Changeset 7090 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2014-05-09T15:47:48+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r7005 r7090 126 126 return group != null ? group.getRawName() + "/" + name : name; 127 127 } 128 128 129 129 /** 130 130 * Returns the preset icon. … … 254 254 link.addToPanel(p, selected, presetInitiallyMatches); 255 255 } 256 256 257 257 // "Add toolbar button" 258 258 JToggleButton tb = new JToggleButton(new ToolbarButtonAction()); … … 320 320 } 321 321 322 public int showDialog(Collection<OsmPrimitive> sel, final boolean showNewRelation) { 322 private static class PresetDialog extends ExtendedDialog { 323 public PresetDialog(Component content, String title, ImageIcon icon, boolean disableApply, boolean showNewRelation) { 324 super(Main.parent, title, 325 showNewRelation? 326 new String[] { tr("Apply Preset"), tr("New relation"), tr("Cancel") }: 327 new String[] { tr("Apply Preset"), tr("Cancel") }, 328 true); 329 if (icon != null) 330 setIconImage(icon.getImage()); 331 contentInsets = new Insets(10,5,0,5); 332 if (showNewRelation) { 333 setButtonIcons(new String[] {"ok.png", "dialogs/addrelation.png", "cancel.png" }); 334 } else { 335 setButtonIcons(new String[] {"ok.png", "cancel.png" }); 336 } 337 setContent(content); 338 setDefaultButton(1); 339 setupDialog(); 340 buttons.get(0).setEnabled(!disableApply); 341 buttons.get(0).setToolTipText(title); 342 // Prevent dialogs of being too narrow (fix #6261) 343 Dimension d = getSize(); 344 if (d.width < 350) { 345 d.width = 350; 346 setSize(d); 347 } 348 showDialog(); 349 } 350 } 351 352 public int showDialog(Collection<OsmPrimitive> sel, boolean showNewRelation) { 323 353 PresetPanel p = createPanel(sel); 324 354 if (p == null) … … 336 366 } 337 367 338 class PresetDialog extends ExtendedDialog { 339 public PresetDialog(Component content, String title, ImageIcon icon, boolean disableApply) { 340 super(Main.parent, 341 title, 342 showNewRelation? 343 new String[] { tr("Apply Preset"), tr("New relation"), tr("Cancel") }: 344 new String[] { tr("Apply Preset"), tr("Cancel") }, 345 true); 346 if (icon != null) 347 setIconImage(icon.getImage()); 348 contentInsets = new Insets(10,5,0,5); 349 if (showNewRelation) { 350 setButtonIcons(new String[] {"ok.png", "dialogs/addrelation.png", "cancel.png" }); 351 } else { 352 setButtonIcons(new String[] {"ok.png", "cancel.png" }); 353 } 354 setContent(content); 355 setDefaultButton(1); 356 setupDialog(); 357 buttons.get(0).setEnabled(!disableApply); 358 buttons.get(0).setToolTipText(title); 359 // Prevent dialogs of being too narrow (fix #6261) 360 Dimension d = getSize(); 361 if (d.width < 350) { 362 d.width = 350; 363 setSize(d); 364 } 365 showDialog(); 366 } 367 } 368 369 answer = new PresetDialog(p, title, (ImageIcon) getValue(Action.SMALL_ICON), sel.isEmpty()).getValue(); 368 answer = new PresetDialog(p, title, (ImageIcon) getValue(Action.SMALL_ICON), 369 sel.isEmpty(), showNewRelation).getValue(); 370 370 } 371 371 if (!showNewRelation && answer == 2) … … 502 502 }); 503 503 } 504 504 505 505 /** 506 506 * Action that adds or removes the button on main toolbar … … 522 522 } 523 523 } 524 524 525 525 public String getToolbarString() { 526 526 ToolbarPreferences.ActionDefinition aDef
Note:
See TracChangeset
for help on using the changeset viewer.