Changeset 3143 for DataCleaner/trunk
- Timestamp:
- 02/07/12 21:10:16 (4 months ago)
- Location:
- DataCleaner/trunk/core/src/main
- Files:
-
- 1 added
- 2 edited
- 7 moved
-
java/org/eobjects/datacleaner/panels/MaxRowsFilterShortcutPanel.java (modified) (6 diffs)
-
java/org/eobjects/datacleaner/util/IconUtils.java (modified) (9 diffs)
-
resources/org/eobjects/analyzer/beans/filter (added)
-
resources/org/eobjects/analyzer/beans/filter/EqualsFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_equals.png)
-
resources/org/eobjects/analyzer/beans/filter/MaxRowsFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_max_rows.png)
-
resources/org/eobjects/analyzer/beans/filter/NullCheckFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_not_null.png)
-
resources/org/eobjects/analyzer/beans/filter/NumberRangeFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_number_range.png)
-
resources/org/eobjects/analyzer/beans/filter/SingleWordFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_single_word.png)
-
resources/org/eobjects/analyzer/beans/filter/StringLengthRangeFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_string_length_range.png)
-
resources/org/eobjects/analyzer/beans/filter/StringValueRangeFilter.png (moved) (moved from DataCleaner/trunk/core/src/main/resources/images/component-types/type_string_value_range.png)
Legend:
- Unmodified
- Added
- Removed
-
DataCleaner/trunk/core/src/main/java/org/eobjects/datacleaner/panels/MaxRowsFilterShortcutPanel.java
r2616 r3143 52 52 * @author Kasper SÞrensen 53 53 */ 54 public class MaxRowsFilterShortcutPanel extends DCPanel implements FilterJobBuilderPresenter { 54 public class MaxRowsFilterShortcutPanel extends DCPanel implements 55 FilterJobBuilderPresenter { 55 56 56 57 public static final String FILTER_NAME = "Limit analysis (Max rows)"; … … 80 81 } 81 82 82 public MaxRowsFilterShortcutPanel(AnalysisJobBuilder analysisJobBuilder, FilterJobBuilder<?, ?> filterJobBuilder) { 83 public MaxRowsFilterShortcutPanel(AnalysisJobBuilder analysisJobBuilder, 84 FilterJobBuilder<?, ?> filterJobBuilder) { 83 85 super(); 84 86 _analysisJobBuilder = analysisJobBuilder; … … 116 118 if (selected) { 117 119 _analysisJobBuilder.addFilter(maxRowsFilterJobBuilder); 118 _analysisJobBuilder.setDefaultRequirement(maxRowsFilterJobBuilder, ValidationCategory.VALID); 120 _analysisJobBuilder.setDefaultRequirement( 121 maxRowsFilterJobBuilder, ValidationCategory.VALID); 119 122 } else { 120 123 _analysisJobBuilder.removeFilter(maxRowsFilterJobBuilder); … … 135 138 fjb.setConfiguredProperty("Max rows", maxRows); 136 139 } catch (NumberFormatException e) { 137 WidgetUtils.showErrorMessage("Cannot read number", 138 "The entered value could not be read as a number.", e); 140 WidgetUtils 141 .showErrorMessage( 142 "Cannot read number", 143 "The entered value could not be read as a number.", 144 e); 139 145 } 140 146 } … … 144 150 145 151 setLayout(new FlowLayout(FlowLayout.LEFT)); 146 add(new JLabel(ImageManager.getInstance().getImageIcon(IconUtils.MAX_ROWS_IMAGEPATH))); 152 final String imagePath = IconUtils.getImagePathForClass(MaxRowsFilter.class); 153 add(new JLabel(ImageManager.getInstance().getImageIcon( 154 imagePath))); 147 155 add(_checkBox); 148 156 add(_prefixLabel); … … 160 168 // Lazy initializing getter (to postpone the call to 161 169 // DCConfiguration. 162 _maxRowsFilterJobBuilder = new FilterJobBuilder<MaxRowsFilter, ValidationCategory>(_analysisJobBuilder, 163 _analysisJobBuilder.getConfiguration().getDescriptorProvider() 164 .getFilterBeanDescriptorForClass(MaxRowsFilter.class)); 170 _maxRowsFilterJobBuilder = new FilterJobBuilder<MaxRowsFilter, ValidationCategory>( 171 _analysisJobBuilder, _analysisJobBuilder 172 .getConfiguration() 173 .getDescriptorProvider() 174 .getFilterBeanDescriptorForClass( 175 MaxRowsFilter.class)); 165 176 _maxRowsFilterJobBuilder.setName(FILTER_NAME); 166 177 } -
DataCleaner/trunk/core/src/main/java/org/eobjects/datacleaner/util/IconUtils.java
r3033 r3143 101 101 public static final String ANALYZER_IMAGEPATH = "images/component-types/analyzer.png"; 102 102 public static final String FILTER_IMAGEPATH = "images/component-types/filter.png"; 103 public static final String MAX_ROWS_IMAGEPATH = "images/component-types/type_max_rows.png"; 104 105 private static final ImageManager _imageManager = ImageManager.getInstance();103 104 private static final ImageManager _imageManager = ImageManager 105 .getInstance(); 106 106 107 107 private IconUtils() { … … 109 109 } 110 110 111 public static Icon getDescriptorIcon(ComponentDescriptor<?> descriptor, int newWidth) { 112 final ClassLoader classLoader = descriptor.getComponentClass().getClassLoader(); 111 public static Icon getDescriptorIcon(ComponentDescriptor<?> descriptor, 112 int newWidth) { 113 final ClassLoader classLoader = descriptor.getComponentClass() 114 .getClassLoader(); 113 115 String imagePath = getDescriptorImagePath(descriptor, classLoader); 114 116 return _imageManager.getImageIcon(imagePath, newWidth, classLoader); … … 131 133 public static Icon getComponentCategoryIcon(ComponentCategory category) { 132 134 Class<? extends ComponentCategory> categoryClass = category.getClass(); 133 final ClassLoader classLoader = categoryClass.getClassLoader(); 134 final String bundledIconPath = categoryClass.getName().replaceAll("\\.", "/") + ".png"; 135 final URL url = ResourceManager.getInstance().getUrl(bundledIconPath, classLoader); 135 136 final String bundledIconPath = getImagePathForClass(categoryClass); 136 137 137 138 final int totalSize = ICON_SIZE_MEDIUM; 138 139 final Image decoration; 139 140 final int decorationSize = ICON_SIZE_SMALL; 140 if ( url== null) {141 if (bundledIconPath == null) { 141 142 decoration = null; 142 143 } else { 143 decoration = _imageManager.getImage(bundledIconPath, decorationSize, classLoader); 144 } 145 146 final Image folderIcon = _imageManager.getImage("images/filetypes/folder.png", totalSize); 144 final ClassLoader classLoader = categoryClass.getClassLoader(); 145 decoration = _imageManager.getImage(bundledIconPath, 146 decorationSize, classLoader); 147 } 148 149 final Image folderIcon = _imageManager.getImage( 150 "images/filetypes/folder.png", totalSize); 147 151 148 152 if (decoration == null) { … … 150 154 } 151 155 152 final BufferedImage bufferedImage = new BufferedImage(totalSize, totalSize, BufferedImage.TYPE_INT_ARGB); 156 final BufferedImage bufferedImage = new BufferedImage(totalSize, 157 totalSize, BufferedImage.TYPE_INT_ARGB); 153 158 bufferedImage.getGraphics().drawImage(folderIcon, 0, 0, null); 154 bufferedImage.getGraphics().drawImage(decoration, totalSize - decorationSize, totalSize - decorationSize, null); 159 bufferedImage.getGraphics().drawImage(decoration, 160 totalSize - decorationSize, totalSize - decorationSize, null); 155 161 return new ImageIcon(bufferedImage); 156 162 } 157 163 158 protected static String getDescriptorImagePath(ComponentDescriptor<?> descriptor, ClassLoader classLoader) { 164 public static String getImagePathForClass(Class<?> cls) { 165 return getImagePathForClass(cls, cls.getClassLoader()); 166 } 167 168 public static String getImagePathForClass(Class<?> cls, 169 ClassLoader classLoader) { 170 final String iconPath = cls.getName().replaceAll("\\.", "/") + ".png"; 171 final URL url = ResourceManager.getInstance().getUrl(iconPath, 172 classLoader); 173 if (url == null) { 174 return null; 175 } 176 return iconPath; 177 } 178 179 protected static String getDescriptorImagePath( 180 ComponentDescriptor<?> descriptor, ClassLoader classLoader) { 159 181 final Class<?> componentClass = descriptor.getComponentClass(); 160 final String bundledIconPath = componentClass.getName().replaceAll("\\.", "/") + ".png";161 final URL url = ResourceManager.getInstance().getUrl(bundledIconPath,classLoader);162 if ( url!= null) {182 final String bundledIconPath = getImagePathForClass(componentClass, 183 classLoader); 184 if (bundledIconPath != null) { 163 185 return bundledIconPath; 164 186 } 165 187 166 if (!descriptor.getComponentClass().getPackage().getName().startsWith("org.eobjects")) { 188 if (!descriptor.getComponentClass().getPackage().getName() 189 .startsWith("org.eobjects")) { 167 190 // plugins get a special icon 168 191 return "images/component-types/plugin.png"; … … 173 196 if (descriptor instanceof BeanDescriptor) { 174 197 BeanDescriptor<?> beanDescriptor = (BeanDescriptor<?>) descriptor; 175 Set<ComponentCategory> categories = beanDescriptor.getComponentCategories(); 198 Set<ComponentCategory> categories = beanDescriptor 199 .getComponentCategories(); 176 200 displayName = beanDescriptor.getDisplayName().toLowerCase(); 177 201 if (categories.contains(new WriteDataCategory())) { … … 197 221 imagePath = "images/component-types/type_validate.png"; 198 222 } 199 if (displayName.indexOf("internet") != -1 || displayName.indexOf("url") != -1) { 223 if (displayName.indexOf("internet") != -1 224 || displayName.indexOf("url") != -1) { 200 225 imagePath = "images/component-types/type_internet.png"; 201 226 } 202 if (displayName.indexOf("identity") != -1 || displayName.indexOf("name") != -1) { 227 if (displayName.indexOf("identity") != -1 228 || displayName.indexOf("name") != -1) { 203 229 imagePath = "images/component-types/type_identity.png"; 204 230 } 205 if (displayName.indexOf("string") != -1 || displayName.indexOf("word") != -1 || displayName.indexOf("token") != -1 231 if (displayName.indexOf("string") != -1 232 || displayName.indexOf("word") != -1 233 || displayName.indexOf("token") != -1 206 234 || displayName.indexOf("whitespace") != -1) { 207 235 imagePath = "images/component-types/type_string.png"; 208 236 } 209 if (displayName.indexOf("time") != -1 || displayName.indexOf("date") != -1) { 237 if (displayName.indexOf("time") != -1 238 || displayName.indexOf("date") != -1) { 210 239 imagePath = "images/component-types/type_time.png"; 211 240 } … … 225 254 imagePath = "images/component-types/type_compare.png"; 226 255 } 227 if (displayName.indexOf("sound") != -1 || displayName.indexOf("phonetic") != -1) { 256 if (displayName.indexOf("sound") != -1 257 || displayName.indexOf("phonetic") != -1) { 228 258 imagePath = "images/component-types/type_sound.png"; 229 259 } 230 if (displayName.indexOf("pattern") != -1 || displayName.indexOf("expression") != -1 260 if (displayName.indexOf("pattern") != -1 261 || displayName.indexOf("expression") != -1 231 262 || displayName.indexOf("regex") != -1) { 232 263 imagePath = "images/component-types/type_expression.png"; … … 269 300 if (displayName.equals("date gap analyzer")) { 270 301 imagePath = "images/component-types/type_date_gap_analyzer.png"; 271 }272 if (displayName.equals("number range")) {273 imagePath = "images/component-types/type_number_range.png";274 }275 if (displayName.equals("equals")) {276 imagePath = "images/component-types/type_equals.png";277 }278 if (displayName.equals("max rows")) {279 imagePath = MAX_ROWS_IMAGEPATH;280 }281 if (displayName.equals("not null")) {282 imagePath = "images/component-types/type_not_null.png";283 }284 if (displayName.equals("string length range")) {285 imagePath = "images/component-types/type_string_length_range.png";286 }287 if (displayName.equals("string value range")) {288 imagePath = "images/component-types/type_string_value_range.png";289 }290 if (displayName.equals("single word")) {291 imagePath = "images/component-types/type_single_word.png";292 302 } 293 303 if (displayName.equals("pattern finder")) { … … 318 328 } else if (datastore instanceof JdbcDatastore) { 319 329 JdbcDatastore jdbcDatastore = (JdbcDatastore) datastore; 320 if ("jdbc:hsqldb:res:orderdb;readonly=true".equals(jdbcDatastore.getJdbcUrl())) { 330 if ("jdbc:hsqldb:res:orderdb;readonly=true".equals(jdbcDatastore 331 .getJdbcUrl())) { 321 332 imagePath = "images/datastore-types/orderdb.png"; 322 333 } else { 323 334 String driverClass = jdbcDatastore.getDriverClass(); 324 335 if (!StringUtils.isNullOrEmpty(driverClass)) { 325 DatabaseDriverDescriptor driver = DatabaseDriverCatalog.getDatabaseDriverByDriverClassName(driverClass); 336 DatabaseDriverDescriptor driver = DatabaseDriverCatalog 337 .getDatabaseDriverByDriverClassName(driverClass); 326 338 if (driver != null) { 327 339 imagePath = driver.getIconImagePath();
Note: See TracChangeset
for help on using the changeset viewer.
