Changeset 16042 in josm
- Timestamp:
- 2020-03-06T00:23:31+01:00 (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r15667 r16042 129 129 final Collection<String> s = Config.getPref().getList("taggingpreset.icon.sources", null); 130 130 ImageProvider imgProv = new ImageProvider(iconName).setDirs(s).setId("presets").setArchive(zipIcons).setOptional(true); 131 if (maxSize != null ) {131 if (maxSize != null && maxSize > 0) { 132 132 imgProv.setMaxSize(maxSize); 133 133 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java
r16035 r16042 38 38 public String icon; // NOSONAR 39 39 /** The size of displayed icon. If not set, default is 16px */ 40 public String icon_size; // NOSONAR40 public short icon_size = 16; // NOSONAR 41 41 42 42 private QuadStateCheckBox check; … … 134 134 */ 135 135 public ImageIcon getIcon() { 136 Integer size = parseInteger(icon_size); 137 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), size != null ? size : 16); 136 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), (int) icon_size); 138 137 } 139 138 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroup.java
r15667 r16042 24 24 * Number of columns (positive integer) 25 25 */ 26 public String columns; // NOSONAR26 public short columns = 1; // NOSONAR 27 27 28 28 /** … … 33 33 @Override 34 34 public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) { 35 Integer cols = Integer.valueOf(columns); 36 int rows = (int) Math.ceil(checks.size()/cols.doubleValue()); 37 JPanel panel = new JPanel(new GridLayout(rows, cols)); 35 int rows = (int) Math.ceil(checks.size() / ((double) columns)); 36 JPanel panel = new JPanel(new GridLayout(rows, columns)); 38 37 39 38 for (Check check : checks) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java
r12859 r16042 22 22 public boolean editable = true; // NOSONAR 23 23 /** The length of the combo box (number of characters allowed). */ 24 public Stringlength; // NOSONAR24 public short length; // NOSONAR 25 25 26 26 protected JosmComboBox<PresetListEntry> combobox; … … 59 59 tf.setHint(key); 60 60 } 61 if (length != null && !length.isEmpty()) {62 tf.setMaxChars( Integer.valueOf(length));61 if (length > 0) { 62 tf.setMaxChars((int) length); 63 63 } 64 64 AutoCompletionList acList = tf.getAutoCompletionList(); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r16040 r16042 218 218 public String icon; // NOSONAR 219 219 /** The size of displayed icon. If not set, default is size from icon file */ 220 public Stringicon_size; // NOSONAR220 public short icon_size; // NOSONAR 221 221 /** The localized version of {@link #display_value}. */ 222 222 public String locale_display_value; // NOSONAR … … 273 273 */ 274 274 public ImageIcon getIcon() { 275 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), parseInteger(icon_size));275 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), (int) icon_size); 276 276 } 277 277 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Label.java
r9665 r16042 21 21 public String icon; // NOSONAR 22 22 /** The size of displayed icon. If not set, default is 16px */ 23 public String icon_size; // NOSONAR23 public short icon_size = 16; // NOSONAR 24 24 25 25 @Override … … 45 45 */ 46 46 public ImageIcon getIcon() { 47 Integer size = parseInteger(icon_size); 48 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), size != null ? size : 16); 47 return icon == null ? null : loadImageIcon(icon, TaggingPresetReader.getZipIcons(), (int) icon_size); 49 48 } 50 49 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelect.java
r11017 r16042 20 20 * Number of rows to display (positive integer, optional). 21 21 */ 22 public Stringrows; // NOSONAR22 public short rows; // NOSONAR 23 23 24 24 protected ConcatenatingJList list; … … 48 48 // if a number of rows has been specified in the preset, 49 49 // modify preferred height of scroll pane to match that row count. 50 if (rows != null) {50 if (rows > 0) { 51 51 double height = renderer.getListCellRendererComponent(list, 52 new PresetListEntry("x"), 0, false, false).getPreferredSize().getHeight() * Integer.parseInt(rows);52 new PresetListEntry("x"), 0, false, false).getPreferredSize().getHeight() * rows; 53 53 sp.setPreferredSize(new Dimension((int) sp.getPreferredSize().getWidth(), (int) height)); 54 54 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java
r16041 r16042 56 56 public boolean required; // NOSONAR 57 57 /** How often must the element appear */ 58 private longcount;58 private short count; 59 59 60 60 public void setType(String types) throws SAXException { … … 89 89 90 90 public void setCount(String count) { 91 this.count = Long.parseLong(count);91 this.count = Short.parseShort(count); 92 92 } 93 93 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r16035 r16042 54 54 public String auto_increment; // NOSONAR 55 55 /** The length of the text box (number of characters allowed). */ 56 public Stringlength; // NOSONAR56 public short length; // NOSONAR 57 57 /** A comma separated list of alternative keys to use for autocompletion. */ 58 58 public String alternative_autocomplete_keys; // NOSONAR … … 74 74 textField.setHint(key); 75 75 } 76 if (length != null && !length.isEmpty()) {77 textField.setMaxChars( Integer.valueOf(length));76 if (length > 0) { 77 textField.setMaxChars((int) length); 78 78 } 79 79 if (usage.unused()) { -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java
r9996 r16042 34 34 public void testAddToPanel() { 35 35 CheckGroup cg = new CheckGroup(); 36 cg.columns = "1";37 36 JPanel p = new JPanel(); 38 37 assertEquals(0, p.getComponentCount());
Note:
See TracChangeset
for help on using the changeset viewer.