Changeset 744 in josm for trunk


Ignore:
Timestamp:
2008-08-04T11:49:25+02:00 (16 years ago)
Author:
stoecker
Message:

unified buttons in right side tools, saved some space

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  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import static org.xnap.commons.i18n.I18n.marktr;
    56
    67import java.awt.BorderLayout;
     
    2021
    2122import javax.swing.DefaultListModel;
    22 import javax.swing.JButton;
    2323import javax.swing.JList;
    2424import javax.swing.JOptionPane;
     
    4343import org.openstreetmap.josm.gui.NavigatableComponent;
    4444import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    45 import org.openstreetmap.josm.tools.ImageProvider;
     45import org.openstreetmap.josm.gui.SideButton;
    4646
    4747public final class ConflictDialog extends ToggleDialog {
     
    6464
    6565                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(){
    6968                        public void actionPerformed(ActionEvent e) {
    7069                                resolve();
    7170                        }
    72                 });
    73                 button.putClientProperty("help", "Dialog/Conflict/Resolve");
    74                 buttonPanel.add(button);
     71                }));
    7572
    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(){
    7975                        public void actionPerformed(ActionEvent e) {
    8076                                Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>();
     
    8379                                Main.ds.setSelected(sel);
    8480                        }
    85                 });
    86                 button.putClientProperty("help", "Dialog/Conflict/Select");
    87                 buttonPanel.add(button);
    88 
     81                }));
    8982                add(buttonPanel, BorderLayout.SOUTH);
    9083
  • trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r627 r744  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import static org.xnap.commons.i18n.I18n.marktr;
    56
    67import java.awt.BorderLayout;
     
    2021import java.util.TreeSet;
    2122
    22 import javax.swing.JButton;
    2323import javax.swing.JComponent;
    2424import javax.swing.JLabel;
     
    3535import org.openstreetmap.josm.data.osm.DataSet;
    3636import org.openstreetmap.josm.data.osm.OsmPrimitive;
     37import org.openstreetmap.josm.gui.SideButton;
    3738import org.openstreetmap.josm.tools.GBC;
    3839import org.openstreetmap.josm.tools.ImageProvider;
     
    8485        private Map<OsmPrimitive, List<HistoryItem>> cache = new HashMap<OsmPrimitive, List<HistoryItem>>();
    8586        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"));
    8887
    8988        public HistoryDialog() {
     
    124123
    125124                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(){
    131127                        public void actionPerformed(ActionEvent e) {
    132128                                reload();
    133129                        }
    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(){
    139133                        public void actionPerformed(ActionEvent e) {
    140134                                JOptionPane.showMessageDialog(Main.parent, tr("Not implemented yet."));
    141135                        }
    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
    146139                DataSet.selListeners.add(this);
    147140        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r627 r744  
    2020import javax.swing.DefaultListModel;
    2121import javax.swing.Icon;
    22 import javax.swing.JButton;
    2322import javax.swing.JLabel;
    2423import javax.swing.JList;
     
    3332import org.openstreetmap.josm.gui.MapFrame;
    3433import org.openstreetmap.josm.gui.MapView;
     34import org.openstreetmap.josm.gui.SideButton;
    3535import org.openstreetmap.josm.gui.layer.Layer;
    3636import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    126126         * item below are editable datasets and the merge button is clicked.
    127127         */
    128         private final JButton mergeButton = new JButton(ImageProvider.get("dialogs", "mergedown"));
     128        private final SideButton mergeButton;
    129129        /**
    130130         * Button for moving layer up.
    131131         */
    132         private JButton upButton = new JButton(ImageProvider.get("dialogs", "up"));
     132        private final SideButton upButton;
    133133        /**
    134134         * Button for moving layer down.
    135135         */
    136         private JButton downButton = new JButton(ImageProvider.get("dialogs", "down"));
     136        private final SideButton downButton;
    137137        /**
    138138         * Button for delete layer.
     
    231231                };
    232232
    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);
    237234                buttonPanel.add(upButton);
    238235
    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);
    243237                buttonPanel.add(downButton);
    244238
    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(){
    255244                        public void actionPerformed(ActionEvent e) {
    256245                                Layer lTo = (Layer)instance.getSelectedValue();
     
    262251                        }
    263252                });
    264                 mergeButton.putClientProperty("help", "Dialog/LayerList/Merge");
     253                mergeButton.setText(null);
    265254                buttonPanel.add(mergeButton);
    266255
  • trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r733 r744  
    3131import javax.swing.DefaultComboBoxModel;
    3232import javax.swing.DefaultListCellRenderer;
    33 import javax.swing.JButton;
    3433import javax.swing.JComboBox;
    3534import javax.swing.JDialog;
     
    6160import org.openstreetmap.josm.gui.tagging.TaggingCellRenderer;
    6261import org.openstreetmap.josm.gui.tagging.TaggingPreset;
     62import org.openstreetmap.josm.gui.SideButton;
    6363import org.openstreetmap.josm.tools.AutoCompleteComboBox;
    6464import org.openstreetmap.josm.tools.GBC;
    65 import org.openstreetmap.josm.tools.ImageProvider;
    6665
    6766/**
     
    564563                };
    565564               
    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));
    569568                add(buttonPanel, BorderLayout.SOUTH);
    570569
    571570                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;
    582571        }
    583572
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r684 r744  
    55
    66import java.awt.BorderLayout;
    7 import java.awt.GridBagLayout;
     7import java.awt.GridLayout;
    88import java.awt.event.ActionEvent;
    99import java.awt.event.ActionListener;
     
    1414
    1515import javax.swing.DefaultListModel;
    16 import javax.swing.JButton;
    1716import javax.swing.JList;
    1817import javax.swing.JPanel;
     
    2423import org.openstreetmap.josm.data.osm.Relation;
    2524import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     25import org.openstreetmap.josm.gui.SideButton;
    2626import org.openstreetmap.josm.gui.layer.DataChangeListener;
    2727import org.openstreetmap.josm.gui.layer.Layer;
     
    2929import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    3030import org.openstreetmap.josm.tools.GBC;
    31 import org.openstreetmap.josm.tools.ImageProvider;
    3231
    3332/**
     
    6867                add(new JScrollPane(displaylist), BorderLayout.CENTER);
    6968
    70                 JPanel buttonPanel = new JPanel(new GridBagLayout());
     69                JPanel buttonPanel = new JPanel(new GridLayout(1,4));
    7170               
    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() {
    7372                        public void actionPerformed(ActionEvent e) {
    7473                                // call relation editor with null argument to create new relation
     
    7776                }), GBC.std());
    7877               
    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() {
    8079                        public void actionPerformed(ActionEvent e) {
    8180                                // replace selection with the relation from the list
     
    8483                }), GBC.std());
    8584               
    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() {
    8786                        public void actionPerformed(ActionEvent e) {
    8887                                Relation toEdit = (Relation) displaylist.getSelectedValue();
     
    9291                }), GBC.std());
    9392               
    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() {
    9594                        public void actionPerformed(ActionEvent e) {
    9695                                Relation toDelete = (Relation) displaylist.getSelectedValue();
     
    103102                Layer.listeners.add(this);
    104103                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;
    115104        }
    116105
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r627 r744  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
     5import static org.xnap.commons.i18n.I18n.marktr;
    56
    67import java.awt.BorderLayout;
     
    1617
    1718import javax.swing.DefaultListModel;
    18 import javax.swing.JButton;
    1919import javax.swing.JList;
    2020import javax.swing.JPanel;
     
    2727import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2828import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    29 import org.openstreetmap.josm.tools.ImageProvider;
     29import org.openstreetmap.josm.gui.SideButton;
    3030
    3131/**
     
    6363                JPanel buttonPanel = new JPanel(new GridLayout(1,2));
    6464
    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(){
    6667                        public void actionPerformed(ActionEvent e) {
    6768                                updateMap();
     
    6970                }));
    7071
    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(){
    7273                        public void actionPerformed(ActionEvent e) {
    7374                                selectionChanged(Main.ds.getSelected());
     
    7576                }));
    7677
    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));
    7879
    7980                add(buttonPanel, BorderLayout.SOUTH);
     
    8182
    8283                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;
    9184        }
    9285
Note: See TracChangeset for help on using the changeset viewer.