- Timestamp:
- 2008-08-04T11:49:25+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r627 r744 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.xnap.commons.i18n.I18n.marktr; 5 6 6 7 import java.awt.BorderLayout; … … 20 21 21 22 import javax.swing.DefaultListModel; 22 import javax.swing.JButton;23 23 import javax.swing.JList; 24 24 import javax.swing.JOptionPane; … … 43 43 import org.openstreetmap.josm.gui.NavigatableComponent; 44 44 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 45 import org.openstreetmap.josm. tools.ImageProvider;45 import org.openstreetmap.josm.gui.SideButton; 46 46 47 47 public final class ConflictDialog extends ToggleDialog { … … 64 64 65 65 JPanel buttonPanel = new JPanel(new GridLayout(1,2)); 66 JButton button = new JButton(tr("Resolve"), ImageProvider.get("dialogs", "conflict")); 67 button.setToolTipText(tr("Open a merge dialog of all selected items in the list above.")); 68 button.addActionListener(new ActionListener(){ 66 buttonPanel.add(new SideButton(marktr("Resolve"), "conflict", "Conflict", 67 tr("Open a merge dialog of all selected items in the list above."), new ActionListener(){ 69 68 public void actionPerformed(ActionEvent e) { 70 69 resolve(); 71 70 } 72 }); 73 button.putClientProperty("help", "Dialog/Conflict/Resolve"); 74 buttonPanel.add(button); 71 })); 75 72 76 button = new JButton(tr("Select"), ImageProvider.get("mapmode/selection/select")); 77 button.setToolTipText(tr("Set the selected elements on the map to the selected items in the list above.")); 78 button.addActionListener(new ActionListener(){ 73 buttonPanel.add(new SideButton(marktr("Select"), "select", "Conflict", 74 tr("Set the selected elements on the map to the selected items in the list above."), new ActionListener(){ 79 75 public void actionPerformed(ActionEvent e) { 80 76 Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>(); … … 83 79 Main.ds.setSelected(sel); 84 80 } 85 }); 86 button.putClientProperty("help", "Dialog/Conflict/Select"); 87 buttonPanel.add(button); 88 81 })); 89 82 add(buttonPanel, BorderLayout.SOUTH); 90 83 -
trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r627 r744 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.xnap.commons.i18n.I18n.marktr; 5 6 6 7 import java.awt.BorderLayout; … … 20 21 import java.util.TreeSet; 21 22 22 import javax.swing.JButton;23 23 import javax.swing.JComponent; 24 24 import javax.swing.JLabel; … … 35 35 import org.openstreetmap.josm.data.osm.DataSet; 36 36 import org.openstreetmap.josm.data.osm.OsmPrimitive; 37 import org.openstreetmap.josm.gui.SideButton; 37 38 import org.openstreetmap.josm.tools.GBC; 38 39 import org.openstreetmap.josm.tools.ImageProvider; … … 84 85 private Map<OsmPrimitive, List<HistoryItem>> cache = new HashMap<OsmPrimitive, List<HistoryItem>>(); 85 86 private JLabel notLoaded = new JLabel("<html><i>"+tr("Click Reload to refresh list")+"</i></html>"); 86 private JButton reloadButton = new JButton(tr("Reload"), ImageProvider.get("dialogs/refresh"));87 private JButton revertButton = new JButton(tr("Revert"), ImageProvider.get("dialogs/revert"));88 87 89 88 public HistoryDialog() { … … 124 123 125 124 JPanel buttons = new JPanel(new GridLayout(1,2)); 126 buttons.add(reloadButton); 127 buttons.add(revertButton); 128 add(buttons, BorderLayout.SOUTH); 129 130 reloadButton.addActionListener(new ActionListener(){ 125 buttons.add(new SideButton(marktr("Reload"), "refresh", "History", tr("Reload all currently selected objects and refresh the list."), 126 new ActionListener(){ 131 127 public void actionPerformed(ActionEvent e) { 132 128 reload(); 133 129 } 134 }); 135 reloadButton.setToolTipText(tr("Reload all currently selected objects and refresh the list.")); 136 reloadButton.putClientProperty("help", "Dialog/History/Reload"); 137 138 revertButton.addActionListener(new ActionListener(){ 130 })); 131 buttons.add(new SideButton(marktr("Revert"), "revert", "History", 132 tr("Revert the state of all currently selected objects to the version selected in the history list."), new ActionListener(){ 139 133 public void actionPerformed(ActionEvent e) { 140 134 JOptionPane.showMessageDialog(Main.parent, tr("Not implemented yet.")); 141 135 } 142 }); 143 revertButton.setToolTipText(tr("Revert the state of all currently selected objects to the version selected in the history list.")); 144 revertButton.putClientProperty("help", "Dialog/History/Revert"); 145 136 })); 137 add(buttons, BorderLayout.SOUTH); 138 146 139 DataSet.selListeners.add(this); 147 140 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r627 r744 20 20 import javax.swing.DefaultListModel; 21 21 import javax.swing.Icon; 22 import javax.swing.JButton;23 22 import javax.swing.JLabel; 24 23 import javax.swing.JList; … … 33 32 import org.openstreetmap.josm.gui.MapFrame; 34 33 import org.openstreetmap.josm.gui.MapView; 34 import org.openstreetmap.josm.gui.SideButton; 35 35 import org.openstreetmap.josm.gui.layer.Layer; 36 36 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 126 126 * item below are editable datasets and the merge button is clicked. 127 127 */ 128 private final JButton mergeButton = new JButton(ImageProvider.get("dialogs", "mergedown"));128 private final SideButton mergeButton; 129 129 /** 130 130 * Button for moving layer up. 131 131 */ 132 private JButton upButton = new JButton(ImageProvider.get("dialogs", "up"));132 private final SideButton upButton; 133 133 /** 134 134 * Button for moving layer down. 135 135 */ 136 private JButton downButton = new JButton(ImageProvider.get("dialogs", "down"));136 private final SideButton downButton; 137 137 /** 138 138 * Button for delete layer. … … 231 231 }; 232 232 233 upButton.setToolTipText(tr("Move the selected layer one row up.")); 234 upButton.addActionListener(upDown); 235 upButton.setActionCommand("up"); 236 upButton.putClientProperty("help", "Dialog/LayerList/Up"); 233 upButton = new SideButton("up", "LayerList", tr("Move the selected layer one row up."), upDown); 237 234 buttonPanel.add(upButton); 238 235 239 downButton.setToolTipText(tr("Move the selected layer one row down.")); 240 downButton.addActionListener(upDown); 241 downButton.setActionCommand("down"); 242 downButton.putClientProperty("help", "Dialog/LayerList/Down"); 236 downButton = new SideButton("down", "LayerList", tr("Move the selected layer one row down."), upDown); 243 237 buttonPanel.add(downButton); 244 238 245 JButton showHideButton = new JButton(new ShowHideLayerAction(null)); 246 showHideButton.setText(""); 247 buttonPanel.add(showHideButton); 248 249 JButton deleteButton = new JButton(deleteAction); 250 deleteButton.setText(""); 251 buttonPanel.add(deleteButton); 252 253 mergeButton.setToolTipText(tr("Merge the layer directly below into the selected layer.")); 254 mergeButton.addActionListener(new ActionListener(){ 239 buttonPanel.add(new SideButton(new ShowHideLayerAction(null))); 240 buttonPanel.add(new SideButton(deleteAction)); 241 242 mergeButton = new SideButton("Merge", "mergedown", "LayerList", tr("Merge the layer directly below into the selected layer."), 243 new ActionListener(){ 255 244 public void actionPerformed(ActionEvent e) { 256 245 Layer lTo = (Layer)instance.getSelectedValue(); … … 262 251 } 263 252 }); 264 mergeButton. putClientProperty("help", "Dialog/LayerList/Merge");253 mergeButton.setText(null); 265 254 buttonPanel.add(mergeButton); 266 255 -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r733 r744 31 31 import javax.swing.DefaultComboBoxModel; 32 32 import javax.swing.DefaultListCellRenderer; 33 import javax.swing.JButton;34 33 import javax.swing.JComboBox; 35 34 import javax.swing.JDialog; … … 61 60 import org.openstreetmap.josm.gui.tagging.TaggingCellRenderer; 62 61 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 62 import org.openstreetmap.josm.gui.SideButton; 63 63 import org.openstreetmap.josm.tools.AutoCompleteComboBox; 64 64 import org.openstreetmap.josm.tools.GBC; 65 import org.openstreetmap.josm.tools.ImageProvider;66 65 67 66 /** … … 564 563 }; 565 564 566 buttonPanel.add( createButton(marktr("Add"),tr("Add a new key/value pair to all objects"), KeyEvent.VK_A, buttonAction));567 buttonPanel.add( createButton(marktr("Edit"),tr("Edit the value of the selected key for all objects"), KeyEvent.VK_E, buttonAction));568 buttonPanel.add( createButton(marktr("Delete"),tr("Delete the selected key in all objects"), KeyEvent.VK_D, buttonAction));565 buttonPanel.add(new SideButton(marktr("Add"),"add","Properties",tr("Add a new key/value pair to all objects"), KeyEvent.VK_A, buttonAction)); 566 buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties",tr("Edit the value of the selected key for all objects"), KeyEvent.VK_E, buttonAction)); 567 buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties",tr("Delete the selected key in all objects"), KeyEvent.VK_D, buttonAction)); 569 568 add(buttonPanel, BorderLayout.SOUTH); 570 569 571 570 DataSet.selListeners.add(this); 572 }573 574 private JButton createButton(String name, String tooltip, int mnemonic, ActionListener actionListener) {575 JButton b = new JButton(tr(name), ImageProvider.get("dialogs", name.toLowerCase()));576 b.setActionCommand(name);577 b.addActionListener(actionListener);578 b.setToolTipText(tooltip);579 b.setMnemonic(mnemonic);580 b.putClientProperty("help", "Dialog/Properties/"+name);581 return b;582 571 } 583 572 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r684 r744 5 5 6 6 import java.awt.BorderLayout; 7 import java.awt.Grid BagLayout;7 import java.awt.GridLayout; 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.ActionListener; … … 14 14 15 15 import javax.swing.DefaultListModel; 16 import javax.swing.JButton;17 16 import javax.swing.JList; 18 17 import javax.swing.JPanel; … … 24 23 import org.openstreetmap.josm.data.osm.Relation; 25 24 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 25 import org.openstreetmap.josm.gui.SideButton; 26 26 import org.openstreetmap.josm.gui.layer.DataChangeListener; 27 27 import org.openstreetmap.josm.gui.layer.Layer; … … 29 29 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 30 30 import org.openstreetmap.josm.tools.GBC; 31 import org.openstreetmap.josm.tools.ImageProvider;32 31 33 32 /** … … 68 67 add(new JScrollPane(displaylist), BorderLayout.CENTER); 69 68 70 JPanel buttonPanel = new JPanel(new Grid BagLayout());69 JPanel buttonPanel = new JPanel(new GridLayout(1,4)); 71 70 72 buttonPanel.add( createButton(marktr("New"), "addrelation", tr("Create a new relation"), -1, new ActionListener() {71 buttonPanel.add(new SideButton(marktr("New"), "addrelation", "Selection", tr("Create a new relation"), new ActionListener() { 73 72 public void actionPerformed(ActionEvent e) { 74 73 // call relation editor with null argument to create new relation … … 77 76 }), GBC.std()); 78 77 79 buttonPanel.add( createButton(marktr("Select"), "select", tr("Select this relation"), -1, new ActionListener() {78 buttonPanel.add(new SideButton(marktr("Select"), "select", "Selection", tr("Select this relation"), new ActionListener() { 80 79 public void actionPerformed(ActionEvent e) { 81 80 // replace selection with the relation from the list … … 84 83 }), GBC.std()); 85 84 86 buttonPanel.add( createButton(marktr("Edit"), "edit", tr( "Open an editor for the selected relation"), -1, new ActionListener() {85 buttonPanel.add(new SideButton(marktr("Edit"), "edit", "Selection", tr( "Open an editor for the selected relation"), new ActionListener() { 87 86 public void actionPerformed(ActionEvent e) { 88 87 Relation toEdit = (Relation) displaylist.getSelectedValue(); … … 92 91 }), GBC.std()); 93 92 94 buttonPanel.add( createButton(" ", "delete", tr("Delete the selected relation"), -1, new ActionListener() {93 buttonPanel.add(new SideButton(marktr("Delete"), "delete", "Selection", tr("Delete the selected relation"), new ActionListener() { 95 94 public void actionPerformed(ActionEvent e) { 96 95 Relation toDelete = (Relation) displaylist.getSelectedValue(); … … 103 102 Layer.listeners.add(this); 104 103 add(buttonPanel, BorderLayout.SOUTH); 105 }106 107 private JButton createButton(String name, String imagename, String tooltip, int mnemonic, ActionListener actionListener) {108 JButton b = new JButton(tr(name), ImageProvider.get("dialogs", imagename));109 b.setActionCommand(name);110 b.addActionListener(actionListener);111 b.setToolTipText(tooltip);112 if (mnemonic >= 0) b.setMnemonic(mnemonic);113 b.putClientProperty("help", "Dialog/Properties/"+name);114 return b;115 104 } 116 105 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r627 r744 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.xnap.commons.i18n.I18n.marktr; 5 6 6 7 import java.awt.BorderLayout; … … 16 17 17 18 import javax.swing.DefaultListModel; 18 import javax.swing.JButton;19 19 import javax.swing.JList; 20 20 import javax.swing.JPanel; … … 27 27 import org.openstreetmap.josm.data.osm.OsmPrimitive; 28 28 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 29 import org.openstreetmap.josm. tools.ImageProvider;29 import org.openstreetmap.josm.gui.SideButton; 30 30 31 31 /** … … 63 63 JPanel buttonPanel = new JPanel(new GridLayout(1,2)); 64 64 65 buttonPanel.add(createButton("Select", "mapmode/selection/select", "Set the selected elements on the map to the selected items in the list above.", new ActionListener(){ 65 buttonPanel.add(new SideButton(marktr("Select"), "select", "SelectionList", 66 tr("Set the selected elements on the map to the selected items in the list above."), new ActionListener(){ 66 67 public void actionPerformed(ActionEvent e) { 67 68 updateMap(); … … 69 70 })); 70 71 71 buttonPanel.add( createButton("Reload", "dialogs/refresh", "Refresh the selection list.", new ActionListener(){72 buttonPanel.add(new SideButton(marktr("Reload"), "refresh", "SelectionList", tr("Refresh the selection list."), new ActionListener(){ 72 73 public void actionPerformed(ActionEvent e) { 73 74 selectionChanged(Main.ds.getSelected()); … … 75 76 })); 76 77 77 buttonPanel.add( createButton("Search", "dialogs/search", "Search for objects.", Main.main.menu.search));78 buttonPanel.add(new SideButton(marktr("Search"), "search", "SelectionList", tr("Search for objects."), Main.main.menu.search)); 78 79 79 80 add(buttonPanel, BorderLayout.SOUTH); … … 81 82 82 83 DataSet.selListeners.add(this); 83 }84 85 private JButton createButton(String name, String icon, String tooltip, ActionListener action) {86 JButton button = new JButton(tr(name), ImageProvider.get(icon));87 button.setToolTipText(tr(tooltip));88 button.addActionListener(action);89 button.putClientProperty("help", "Dialog/SelectionList/"+name);90 return button;91 84 } 92 85
Note:
See TracChangeset
for help on using the changeset viewer.