Changeset 5028 in josm
- Timestamp:
- 2012-02-28T11:29:30+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r5007 r5028 37 37 { 38 38 super(action); 39 if(!usename) 39 if(!usename) { 40 40 setText(null); 41 fixIcon(action); 42 doStyle(); 41 fixIcon(action); 42 doStyle(); 43 } 43 44 } 44 45 … … 80 81 } 81 82 83 // Used constructor with Action 84 @Deprecated 82 85 public SideButton(String imagename, String property, String tooltip, ActionListener actionListener) 83 86 { … … 88 91 setToolTipText(tooltip); 89 92 } 93 94 // Used constructor with Action 95 @Deprecated 90 96 public SideButton(String name, String imagename, String property, String tooltip, Shortcut shortcut, ActionListener actionListener) 91 97 { … … 100 106 setup(name, property, tooltip, actionListener); 101 107 } 108 109 // Used constructor with Action 110 @Deprecated 102 111 public SideButton(String name, String imagename, String property, String tooltip, ActionListener actionListener) 103 112 { -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r5018 r5028 8 8 import java.awt.Graphics2D; 9 9 import java.awt.event.ActionEvent; 10 import java.awt.event.ActionListener;11 10 import java.awt.event.KeyEvent; 12 11 import java.awt.event.MouseEvent; … … 48 47 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 49 48 import org.openstreetmap.josm.gui.SideButton; 49 import org.openstreetmap.josm.tools.ImageProvider; 50 50 import org.openstreetmap.josm.tools.MultikeyActionsHandler; 51 51 import org.openstreetmap.josm.tools.MultikeyShortcutAction; … … 141 141 userTable.setDefaultRenderer(String.class, new StringRenderer()); 142 142 143 addButton = new SideButton(marktr("Add"), "add", "SelectionList", tr("Add filter."), 144 new ActionListener(){ 145 public void actionPerformed(ActionEvent evt){ 143 addButton = new SideButton(new AbstractAction() { 144 { 145 putValue(NAME, marktr("Add")); 146 putValue(SHORT_DESCRIPTION, tr("Add filter.")); 147 putValue(SMALL_ICON, ImageProvider.get("dialogs","add")); 148 } 149 @Override 150 public void actionPerformed(ActionEvent e) { 146 151 Filter filter = (Filter)SearchAction.showSearchDialog(new Filter()); 147 152 if(filter != null){ 148 153 filterModel.addFilter(filter); 149 154 } 150 } 151 }); 152 153 editButton = new SideButton(marktr("Edit"), "edit", "SelectionList", tr("Edit filter."), 154 new ActionListener(){ 155 public void actionPerformed(ActionEvent evt){ 155 }}); 156 editButton = new SideButton(new AbstractAction() { 157 { 158 putValue(NAME, marktr("Edit")); 159 putValue(SHORT_DESCRIPTION, tr("Edit filter.")); 160 putValue(SMALL_ICON, ImageProvider.get("dialogs", "edit")); 161 } 162 @Override 163 public void actionPerformed(ActionEvent e) { 156 164 int index = userTable.getSelectionModel().getMinSelectionIndex(); 157 165 if(index < 0) return; … … 163 171 } 164 172 }); 165 166 deleteButton = new SideButton(marktr("Delete"), "delete", "SelectionList", tr("Delete filter."), 167 new ActionListener(){ 168 public void actionPerformed(ActionEvent evt){ 173 deleteButton = new SideButton(new AbstractAction() { 174 { 175 putValue(NAME, marktr("Delete")); 176 putValue(SHORT_DESCRIPTION, tr("Delete filter.")); 177 putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete")); 178 } 179 @Override 180 public void actionPerformed(ActionEvent e) { 169 181 int index = userTable.getSelectionModel().getMinSelectionIndex(); 170 182 if(index < 0) return; … … 172 184 } 173 185 }); 174 175 upButton = new SideButton(marktr("Up"), "up", "SelectionList", tr("Move filter up."), 176 new ActionListener(){ 177 public void actionPerformed(ActionEvent evt){ 186 upButton = new SideButton(new AbstractAction() { 187 { 188 putValue(NAME, marktr("Up")); 189 putValue(SHORT_DESCRIPTION, tr("Move filter up.")); 190 putValue(SMALL_ICON, ImageProvider.get("dialogs", "up")); 191 } 192 @Override 193 public void actionPerformed(ActionEvent e) { 178 194 int index = userTable.getSelectionModel().getMinSelectionIndex(); 179 195 if(index < 0) return; … … 181 197 userTable.getSelectionModel().setSelectionInterval(index-1, index-1); 182 198 } 199 183 200 }); 184 185 downButton = new SideButton(marktr("Down"), "down", "SelectionList", tr("Move filter down."), 186 new ActionListener(){ 187 public void actionPerformed(ActionEvent evt){ 201 downButton = new SideButton(new AbstractAction() { 202 { 203 putValue(NAME, marktr("Down")); 204 putValue(SHORT_DESCRIPTION, tr("Move filter down.")); 205 putValue(SMALL_ICON, ImageProvider.get("dialogs", "down")); 206 } 207 @Override 208 public void actionPerformed(ActionEvent e) { 188 209 int index = userTable.getSelectionModel().getMinSelectionIndex(); 189 210 if(index < 0) return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r5018 r5028 118 118 ActivateLayerAction activateLayerAction; 119 119 ShowHideLayerAction showHideLayerAction; 120 120 121 121 //TODO This duplicates ShowHide actions functionality 122 122 /** stores which layer index to toggle and executes the ShowHide action if the layer is present */ … … 160 160 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), 161 161 Shortcut.registerShortcut("subwindow:layers", tr("Toggle: {0}", tr("Layers")), KeyEvent.VK_L, 162 Shortcut.ALT_SHIFT), 100, true);162 Shortcut.ALT_SHIFT), 100, true); 163 163 164 164 // create the models … … 240 240 MultikeyActionsHandler.getInstance().addAction(activateLayerAction); 241 241 adaptTo(activateLayerAction, selectionModel); 242 242 243 243 JumpToMarkerActions.initialize(); 244 244 … … 445 445 */ 446 446 public ShowHideLayerAction(boolean init) { 447 putValue(NAME, tr("Show/hide")); 447 448 putValue(SMALL_ICON, ImageProvider.get("dialogs", "showhide")); 448 449 putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the selected layer.")); 449 450 putValue("help", HelpUtil.ht("/Dialog/LayerList#ShowHideLayer")); 450 451 multikeyShortcut = Shortcut.registerShortcut("core_multikey:showHideLayer", tr("Multikey: {0}", 451 tr("Show/hide layer")), KeyEvent.VK_S, Shortcut.SHIFT);452 tr("Show/hide layer")), KeyEvent.VK_S, Shortcut.SHIFT); 452 453 if (init) { 453 454 updateEnabledState(); … … 549 550 */ 550 551 public LayerOpacityAction() { 552 putValue(NAME, tr("Opacity")); 551 553 putValue(SHORT_DESCRIPTION, tr("Adjust opacity of the layer.")); 552 554 putValue(SMALL_ICON, ImageProvider.get("dialogs/layerlist", "transparency")); … … 640 642 641 643 public ActivateLayerAction() { 644 putValue(NAME, tr("Activate")); 642 645 putValue(SMALL_ICON, ImageProvider.get("dialogs", "activate")); 643 646 putValue(SHORT_DESCRIPTION, tr("Activate the selected layer")); 644 647 multikeyShortcut = Shortcut.registerShortcut("core_multikey:activateLayer", tr("Multikey: {0}", 645 tr("Activate layer")), KeyEvent.VK_A, Shortcut.SHIFT);648 tr("Activate layer")), KeyEvent.VK_A, Shortcut.SHIFT); 646 649 putValue("help", HelpUtil.ht("/Dialog/LayerList#ActivateLayer")); 647 650 } … … 737 740 738 741 public MergeAction() { 742 putValue(NAME, tr("Merge")); 739 743 putValue(SMALL_ICON, ImageProvider.get("dialogs", "mergedown")); 740 744 putValue(SHORT_DESCRIPTION, tr("Merge this layer into another layer")); … … 799 803 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 800 804 this.layer = layer; 805 updateEnabledState(); 806 } 807 808 public DuplicateAction() { 801 809 putValue(NAME, tr("Duplicate")); 802 updateEnabledState();803 }804 805 public DuplicateAction() {806 810 putValue(SMALL_ICON, ImageProvider.get("dialogs", "duplicatelayer")); 807 811 putValue(SHORT_DESCRIPTION, tr("Duplicate this layer")); … … 1033 1037 class MoveUpAction extends AbstractAction implements IEnabledStateUpdating{ 1034 1038 public MoveUpAction() { 1039 putValue(NAME, tr("Move up")); 1035 1040 putValue(SMALL_ICON, ImageProvider.get("dialogs", "up")); 1036 1041 putValue(SHORT_DESCRIPTION, tr("Move the selected layer one row up.")); … … 1054 1059 class MoveDownAction extends AbstractAction implements IEnabledStateUpdating { 1055 1060 public MoveDownAction() { 1061 putValue(NAME, tr("Move down")); 1056 1062 putValue(SMALL_ICON, ImageProvider.get("dialogs", "down")); 1057 1063 putValue(SHORT_DESCRIPTION, tr("Move the selected layer one row down.")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r4982 r5028 134 134 135 135 createLayout(displaylist, true, Arrays.asList(new SideButton[] { 136 new SideButton(newAction, false),137 new SideButton(editAction, false),138 new SideButton(duplicateAction, false),139 new SideButton(deleteAction, false),140 new SideButton(selectAction, false)136 new SideButton(newAction, false), 137 new SideButton(editAction, false), 138 new SideButton(duplicateAction, false), 139 new SideButton(deleteAction, false), 140 new SideButton(selectAction, false) 141 141 })); 142 142 … … 282 282 public EditAction() { 283 283 putValue(SHORT_DESCRIPTION,tr( "Open an editor for the selected relation")); 284 //putValue(NAME, tr("Edit"));284 putValue(NAME, tr("Edit")); 285 285 putValue(SMALL_ICON, ImageProvider.get("dialogs", "edit")); 286 286 setEnabled(false); … … 323 323 public DeleteAction() { 324 324 putValue(SHORT_DESCRIPTION,tr("Delete the selected relation")); 325 //putValue(NAME, tr("Delete"));325 putValue(NAME, tr("Delete")); 326 326 putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete")); 327 327 setEnabled(false); … … 334 334 Main.main.getEditLayer(), 335 335 toDelete 336 );336 ); 337 337 } 338 338 339 339 public void actionPerformed(ActionEvent e) { 340 if (!isEnabled()) { 341 return; 342 } 340 if (!isEnabled()) 341 return; 343 342 List<Relation> toDelete = new LinkedList<Relation>(); 344 343 for (int i : displaylist.getSelectedIndices()) { … … 363 362 public NewAction() { 364 363 putValue(SHORT_DESCRIPTION,tr("Create a new relation")); 365 //putValue(NAME, tr("New"));364 putValue(NAME, tr("New")); 366 365 putValue(SMALL_ICON, ImageProvider.get("dialogs", "addrelation")); 367 366 updateEnabledState(); … … 401 400 putValue(SHORT_DESCRIPTION, tr("Create a copy of this relation and open it in another editor window")); 402 401 putValue(SMALL_ICON, ImageProvider.get("duplicate")); 403 //putValue(NAME, tr("Duplicate"));402 putValue(NAME, tr("Duplicate")); 404 403 updateEnabledState(); 405 404 } … … 412 411 copy, 413 412 null /* no selected members */ 414 );413 ); 415 414 editor.setVisible(true); 416 415 } … … 537 536 model.getSelectedNonNewRelations(), 538 537 Main.map.mapView.getEditLayer()) 539 );538 ); 540 539 } 541 540 } … … 570 569 buildSetOfIncompleteMembers(rels), 571 570 Main.map.mapView.getEditLayer() 572 ));571 )); 573 572 } 574 573 … … 603 602 relations, 604 603 DefaultNameFormatter.getInstance().getRelationComparator() 605 );604 ); 606 605 } 607 606 … … 794 793 public RelationDialogPopupMenu(JList list) { 795 794 super(list); 796 795 797 796 // -- download members action 798 797 // … … 832 831 popupMenu.addPopupMenuListener(l); 833 832 } 834 833 835 834 public Collection<Relation> getSelectedRelations() { 836 835 return model.getSelectedRelations(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r4932 r5028 24 24 import java.awt.event.WindowAdapter; 25 25 import java.awt.event.WindowEvent; 26 26 import java.util.ArrayList; 27 27 import java.util.Collection; 28 import java.util.List; 28 29 29 30 import javax.swing.AbstractAction; … … 35 36 import javax.swing.JDialog; 36 37 import javax.swing.JLabel; 38 import javax.swing.JMenu; 37 39 import javax.swing.JOptionPane; 40 import javax.swing.JPanel; 41 import javax.swing.JPopupMenu; 42 import javax.swing.JRadioButtonMenuItem; 38 43 import javax.swing.JScrollPane; 39 import javax.swing.JPanel;40 44 import javax.swing.JToggleButton; 41 45 42 46 import org.openstreetmap.josm.Main; 43 47 import org.openstreetmap.josm.actions.JosmAction; 48 import org.openstreetmap.josm.data.preferences.ParametrizedEnumProperty; 44 49 import org.openstreetmap.josm.gui.MainMenu; 50 import org.openstreetmap.josm.gui.ShowHideButtonListener; 51 import org.openstreetmap.josm.gui.SideButton; 45 52 import org.openstreetmap.josm.gui.dialogs.DialogsPanel.Action; 46 53 import org.openstreetmap.josm.gui.help.HelpUtil; 47 54 import org.openstreetmap.josm.gui.help.Helpful; 48 import org.openstreetmap.josm.gui.ShowHideButtonListener;49 import org.openstreetmap.josm.gui.SideButton;50 55 import org.openstreetmap.josm.tools.GBC; 51 56 import org.openstreetmap.josm.tools.ImageProvider; … … 60 65 public class ToggleDialog extends JPanel implements ShowHideButtonListener, Helpful, AWTEventListener { 61 66 67 public enum ButtonHiddingType { 68 ALWAYS_SHOWN, ALWAYS_HIDDEN, DYNAMIC 69 } 70 71 private final ParametrizedEnumProperty<ButtonHiddingType> PROP_BUTTON_HIDING = new ParametrizedEnumProperty<ToggleDialog.ButtonHiddingType>(ButtonHiddingType.class, ButtonHiddingType.DYNAMIC) { 72 @Override 73 protected String getKey(String... params) { 74 return preferencePrefix + ".buttonhiding"; 75 } 76 @Override 77 protected ButtonHiddingType parse(String s) { 78 try { 79 return super.parse(s); 80 } catch (IllegalArgumentException e) { 81 // Legacy settings 82 return Boolean.parseBoolean(s)?ButtonHiddingType.DYNAMIC:ButtonHiddingType.ALWAYS_HIDDEN; 83 } 84 } 85 }; 86 62 87 /** The action to toggle this dialog */ 63 88 protected ToggleDialogAction toggleAction; … … 87 112 * Indicates whether dynamic button hiding is active or not. 88 113 */ 89 protected boolean isButtonHiding;114 protected ButtonHiddingType buttonHiding; 90 115 91 116 /** the preferred height if the toggle dialog is expanded */ … … 103 128 protected JToggleButton button; 104 129 private JPanel buttonsPanel; 130 private List<javax.swing.Action> buttonActions = new ArrayList<javax.swing.Action>(); 105 131 106 132 /** holds the menu entry in the windows menu. Required to properly … … 143 169 isDocked = Main.pref.getBoolean(preferencePrefix+".docked", true); 144 170 isCollapsed = Main.pref.getBoolean(preferencePrefix+".minimized", false); 145 isButtonHiding = Main.pref.getBoolean(preferencePrefix+".buttonhiding", true);171 buttonHiding = PROP_BUTTON_HIDING.get(); 146 172 147 173 /** show the minimize button */ … … 416 442 } 417 443 } 444 445 private void maybeShowPopup(MouseEvent e) { 446 if (e.isPopupTrigger()) { 447 JPopupMenu menu = new JPopupMenu(); 448 JMenu buttonHidingMenu = new JMenu(tr("Side buttons")); 449 JRadioButtonMenuItem alwaysShown = new JRadioButtonMenuItem(new AbstractAction(tr("Always shown")) { 450 @Override 451 public void actionPerformed(ActionEvent e) { 452 setIsButtonHiding(ButtonHiddingType.ALWAYS_SHOWN); 453 } 454 }); 455 JRadioButtonMenuItem dynamic = new JRadioButtonMenuItem(new AbstractAction(tr("Dynamic")) { 456 @Override 457 public void actionPerformed(ActionEvent e) { 458 setIsButtonHiding(ButtonHiddingType.DYNAMIC); 459 } 460 }); 461 JRadioButtonMenuItem alwaysHidden = new JRadioButtonMenuItem(new AbstractAction(tr("Always hidden")) { 462 @Override 463 public void actionPerformed(ActionEvent e) { 464 setIsButtonHiding(ButtonHiddingType.ALWAYS_HIDDEN); 465 } 466 }); 467 alwaysShown.setSelected(buttonHiding == ButtonHiddingType.ALWAYS_SHOWN); 468 dynamic.setSelected(buttonHiding == ButtonHiddingType.DYNAMIC); 469 alwaysHidden.setSelected(buttonHiding == ButtonHiddingType.ALWAYS_HIDDEN); 470 buttonHidingMenu.add(alwaysShown); 471 buttonHidingMenu.add(dynamic); 472 buttonHidingMenu.add(alwaysHidden); 473 menu.add(buttonHidingMenu); 474 for (javax.swing.Action action: buttonActions) { 475 menu.add(action); 476 } 477 menu.show(TitleBar.this, e.getX(), e.getY()); 478 } 479 } 480 481 @Override 482 public void mousePressed(MouseEvent e) { 483 maybeShowPopup(e); 484 } 485 486 @Override 487 public void mouseReleased(MouseEvent e) { 488 maybeShowPopup(e); 489 } 418 490 } 419 );491 ); 420 492 421 493 if(Main.pref.getBoolean("dialog.dynamic.buttons", true)) { 422 buttonsHide = new JButton(ImageProvider.get("misc", isButtonHiding? "buttonhide" : "buttonshow"));494 buttonsHide = new JButton(ImageProvider.get("misc", buttonHiding != ButtonHiddingType.ALWAYS_SHOWN ? "buttonhide" : "buttonshow")); 423 495 buttonsHide.setToolTipText(tr("Toggle dynamic buttons")); 424 496 buttonsHide.setBorder(BorderFactory.createEmptyBorder()); 425 497 buttonsHide.addActionListener( 426 new ActionListener(){ 427 public void actionPerformed(ActionEvent e) { 428 setIsButtonHiding(!isButtonHiding); 498 new ActionListener(){ 499 public void actionPerformed(ActionEvent e) { 500 setIsButtonHiding(buttonHiding == ButtonHiddingType.ALWAYS_SHOWN?ButtonHiddingType.DYNAMIC:ButtonHiddingType.ALWAYS_SHOWN); 501 } 429 502 } 430 } 431 ); 503 ); 432 504 add(buttonsHide); 433 505 } … … 444 516 } 445 517 } 446 );518 ); 447 519 add(sticky); 448 520 … … 459 531 } 460 532 } 461 );533 ); 462 534 add(close); 463 535 setToolTipText(tr("Click to minimize/maximize the panel content")); … … 578 650 protected void setIsDocked(boolean val) { 579 651 if(buttonsPanel != null && buttonsHide != null) { 580 buttonsPanel.setVisible(val ? !isButtonHiding: true);652 buttonsPanel.setVisible(val ? buttonHiding == ButtonHiddingType.ALWAYS_SHOWN : true); 581 653 } 582 654 isDocked = val; … … 591 663 } 592 664 593 protected void setIsButtonHiding(boolean val) { 594 isButtonHiding = val; 595 Main.pref.put(preferencePrefix+".buttonhiding", val); 596 buttonsHide.setIcon(ImageProvider.get("misc", val ? "buttonhide" : "buttonshow")); 665 protected void setIsButtonHiding(ButtonHiddingType val) { 666 buttonHiding = val; 667 PROP_BUTTON_HIDING.put(val); 668 buttonsHide.setIcon(ImageProvider.get("misc", val != ButtonHiddingType.ALWAYS_SHOWN ? "buttonhide" : "buttonshow")); 669 buttonsPanel.setVisible(val != ButtonHiddingType.ALWAYS_HIDDEN); 597 670 stateChanged(); 598 671 } … … 641 714 return button; 642 715 } 643 716 644 717 /*** 645 718 * The following methods are intended to be overridden, in order to customize … … 679 752 680 753 protected Component createLayout(Component data, boolean scroll, Collection<SideButton> buttons) { 681 if(scroll) 754 if(scroll) { 682 755 data = new JScrollPane(data); 756 } 683 757 add(data, BorderLayout.CENTER); 684 758 if(buttons != null && buttons.size() != 0) { 685 759 buttonsPanel = new JPanel(Main.pref.getBoolean("dialog.align.left", false) 686 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,buttons.size()));687 for(SideButton button : buttons) 760 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,buttons.size())); 761 for(SideButton button : buttons) { 688 762 buttonsPanel.add(button); 763 javax.swing.Action action = button.getAction(); 764 if (action != null) { 765 buttonActions.add(action); 766 } else { 767 System.err.println("Button " + button + " doesn't have action defined"); 768 } 769 } 689 770 add(buttonsPanel, BorderLayout.SOUTH); 690 771 if(Main.pref.getBoolean("dialog.dynamic.buttons", true)) { 691 772 Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_MOTION_EVENT_MASK); 692 buttonsPanel.setVisible( !isButtonHiding|| !isDocked);773 buttonsPanel.setVisible(buttonHiding == ButtonHiddingType.ALWAYS_SHOWN || !isDocked); 693 774 } 694 775 } else if(buttonsHide != null) { … … 700 781 @Override 701 782 public void eventDispatched(AWTEvent event) { 702 if(isShowing() && !isCollapsed && isDocked && isButtonHiding) {783 if(isShowing() && !isCollapsed && isDocked && buttonHiding == ButtonHiddingType.DYNAMIC) { 703 784 Rectangle b = this.getBounds(); 704 785 b.setLocation(getLocationOnScreen()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r4982 r5028 20 20 import java.util.Set; 21 21 22 import javax.swing.AbstractAction; 22 23 import javax.swing.JMenuItem; 23 24 import javax.swing.JOptionPane; … … 51 52 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 52 53 import org.openstreetmap.josm.io.OsmTransferException; 54 import org.openstreetmap.josm.tools.ImageProvider; 53 55 import org.openstreetmap.josm.tools.Shortcut; 54 56 import org.xml.sax.SAXException; … … 61 63 * @author frsantos 62 64 */ 63 public class ValidatorDialog extends ToggleDialog implements ActionListener,SelectionChangedListener, LayerChangeListener {65 public class ValidatorDialog extends ToggleDialog implements SelectionChangedListener, LayerChangeListener { 64 66 /** Serializable ID */ 65 67 private static final long serialVersionUID = 2952292777351992696L; … … 105 107 106 108 List<SideButton> buttons = new LinkedList<SideButton>(); 107 selectButton = new SideButton(marktr("Select"), "select", "Validator", 108 tr("Set the selected elements on the map to the selected items in the list above."), this); 109 110 selectButton = new SideButton(new AbstractAction() { 111 { 112 putValue(NAME, marktr("Select")); 113 putValue(SHORT_DESCRIPTION, tr("Set the selected elements on the map to the selected items in the list above.")); 114 putValue(SMALL_ICON, ImageProvider.get("dialogs","select")); 115 } 116 @Override 117 public void actionPerformed(ActionEvent e) { 118 setSelectedItems(); 119 } 120 }); 109 121 selectButton.setEnabled(false); 110 122 buttons.add(selectButton); … … 112 124 buttons.add(new SideButton(Main.main.validator.validateAction)); 113 125 114 fixButton = new SideButton(marktr("Fix"), "fix", "Validator", tr("Fix the selected issue."), this); 126 fixButton = new SideButton(new AbstractAction() { 127 { 128 putValue(NAME, marktr("Fix")); 129 putValue(SHORT_DESCRIPTION, tr("Fix the selected issue.")); 130 putValue(SMALL_ICON, ImageProvider.get("dialogs","fix")); 131 } 132 @Override 133 public void actionPerformed(ActionEvent e) { 134 fixErrors(e); 135 } 136 }); 115 137 fixButton.setEnabled(false); 116 138 buttons.add(fixButton); 117 139 118 140 if (Main.pref.getBoolean(ValidatorPreference.PREF_USE_IGNORE, true)) { 119 ignoreButton = new SideButton(marktr("Ignore"), "delete", "Validator", 120 tr("Ignore the selected issue next time."), this); 141 ignoreButton = new SideButton(new AbstractAction() { 142 { 143 putValue(NAME, marktr("Ignore")); 144 putValue(SHORT_DESCRIPTION, tr("Ignore the selected issue next time.")); 145 putValue(SMALL_ICON, ImageProvider.get("dialogs","fix")); 146 } 147 @Override 148 public void actionPerformed(ActionEvent e) { 149 ignoreErrors(e); 150 } 151 }); 121 152 ignoreButton.setEnabled(false); 122 153 buttons.add(ignoreButton); … … 332 363 } 333 364 Main.main.getCurrentDataSet().setSelected(sel); 334 }335 336 @Override337 public void actionPerformed(ActionEvent e) {338 String actionCommand = e.getActionCommand();339 if (actionCommand.equals("Select")) {340 setSelectedItems();341 } else if (actionCommand.equals("Fix")) {342 fixErrors(e);343 } else if (actionCommand.equals("Ignore")) {344 ignoreErrors(e);345 }346 365 } 347 366
Note:
See TracChangeset
for help on using the changeset viewer.