Changeset 2710 in josm for trunk


Ignore:
Timestamp:
2009-12-30T11:56:09+01:00 (15 years ago)
Author:
stoecker
Message:

close #4222 - unify design of right menus again

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/SideButton.java

    r2586 r2710  
    2020    {
    2121        super(action);
     22        fixIcon();
     23        doStyle();
     24    }
     25
     26    public SideButton(Action action, boolean usename)
     27    {
     28        super(action);
     29        if(!usename)
     30            setText(null);
    2231        fixIcon();
    2332        doStyle();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r2689 r2710  
    4141import org.openstreetmap.josm.gui.MapFrame;
    4242import org.openstreetmap.josm.gui.MapView;
     43import org.openstreetmap.josm.gui.SideButton;
    4344import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager;
    4445import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetHeaderDownloadTask;
     
    184185
    185186    protected JPanel buildButtonPanel() {
    186         JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    187 
    188         JToolBar tp = new JToolBar(JToolBar.HORIZONTAL);
    189         tp.setFloatable(false);
     187        JPanel tp = getButtonPanel(5);
    190188
    191189        // -- select objects action
    192190        selectObjectsAction = new SelectObjectsAction();
    193         tp.add(selectObjectsAction);
     191        tp.add(new SideButton(selectObjectsAction, false));
    194192        cbInSelectionOnly.addItemListener(selectObjectsAction);
    195193        lstInActiveDataLayer.getSelectionModel().addListSelectionListener(selectObjectsAction);
     
    198196        // -- read changesets action
    199197        readChangesetAction = new ReadChangesetsAction();
    200         tp.add(readChangesetAction);
     198        tp.add(new SideButton(readChangesetAction, false));
    201199        cbInSelectionOnly.addItemListener(readChangesetAction);
    202200        lstInActiveDataLayer.getSelectionModel().addListSelectionListener(readChangesetAction);
     
    205203        // -- close changesets action
    206204        closeChangesetAction = new CloseOpenChangesetsAction();
    207         tp.add(closeChangesetAction);
     205        tp.add(new SideButton(closeChangesetAction, false));
    208206        cbInSelectionOnly.addItemListener(closeChangesetAction);
    209207        lstInActiveDataLayer.getSelectionModel().addListSelectionListener(closeChangesetAction);
     
    212210        // -- show info action
    213211        showChangsetInfoAction = new ShowChangesetInfoAction();
    214         tp.add(showChangsetInfoAction);
     212        tp.add(new SideButton(showChangsetInfoAction, false));
    215213        cbInSelectionOnly.addItemListener(showChangsetInfoAction);
    216214        lstInActiveDataLayer.getSelectionModel().addListSelectionListener(showChangsetInfoAction);
     
    219217        // -- launch changeset manager action
    220218        launchChangesetManagerAction = new LaunchChangesetManagerAction();
    221         tp.add(launchChangesetManagerAction);
     219        tp.add(new SideButton(launchChangesetManagerAction, false));
    222220        cbInSelectionOnly.addItemListener(launchChangesetManagerAction);
    223221        lstInActiveDataLayer.getSelectionModel().addListSelectionListener(launchChangesetManagerAction);
    224222        lstInSelection.getSelectionModel().addListSelectionListener(launchChangesetManagerAction);
    225223
    226         pnl.add(tp);
    227         return pnl;
     224        return tp;
    228225    }
    229226
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r2655 r2710  
    88import java.awt.Color;
    99import java.awt.Graphics;
    10 import java.awt.GridLayout;
    1110import java.awt.Point;
    1211import java.awt.event.ActionEvent;
     
    106105        lstConflicts.getSelectionModel().addListSelectionListener(actSelect);
    107106
    108         JPanel buttonPanel = new JPanel(new GridLayout(1,2));
     107        JPanel buttonPanel = getButtonPanel(2);
    109108        buttonPanel.add(btnResolve);
    110109        buttonPanel.add(btnSelect);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r2626 r2710  
    6363
    6464    protected JPanel buildButtonRow() {
    65         JPanel pnl = new JPanel(new GridLayout(1, 4));
     65        JPanel pnl = getButtonPanel(5);
    6666
    6767        addButton = new SideButton(marktr("Add"), "add", "SelectionList", tr("Add filter."),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r2560 r2710  
    66import java.awt.BorderLayout;
    77import java.awt.Component;
    8 import java.awt.GridLayout;
    98import java.awt.event.ActionEvent;
    109import java.awt.event.KeyEvent;
     
    7271     */
    7372    protected JPanel buildButtonRow() {
    74         JPanel buttons = new JPanel(new GridLayout(1,2));
     73        JPanel buttons = getButtonPanel(2);
    7574
    7675        SideButton btn = new SideButton(reloadAction = new ReloadAction());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r2697 r2710  
    55import java.awt.BorderLayout;
    66import java.awt.Component;
    7 import java.awt.FlowLayout;
    87import java.awt.Point;
    98import java.awt.Rectangle;
     
    2928import javax.swing.JPanel;
    3029import javax.swing.JScrollPane;
    31 import javax.swing.JToolBar;
    3230import javax.swing.KeyStroke;
    3331import javax.swing.ListModel;
     
    4341import org.openstreetmap.josm.gui.MapFrame;
    4442import org.openstreetmap.josm.gui.MapView;
     43import org.openstreetmap.josm.gui.SideButton;
    4544import org.openstreetmap.josm.gui.help.HelpUtil;
    4645import org.openstreetmap.josm.gui.io.SaveLayersDialog;
     
    9897
    9998    protected JPanel createButtonPanel() {
    100         JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
    101 
    102         JToolBar tb = new JToolBar(JToolBar.HORIZONTAL);
    103         tb.setFloatable(false);
     99        JPanel buttonPanel = getButtonPanel(5);
    104100
    105101        // -- move up action
     
    107103        adaptTo(moveUpAction, model);
    108104        adaptTo(moveUpAction,selectionModel);
    109         tb.add(moveUpAction);
     105        buttonPanel.add(new SideButton(moveUpAction));
    110106
    111107        // -- move down action
     
    113109        adaptTo(moveDownAction, model);
    114110        adaptTo(moveDownAction,selectionModel);
    115         tb.add(moveDownAction);
     111        buttonPanel.add(new SideButton(moveDownAction));
    116112
    117113        // -- activate action
     
    119115        adaptTo(activateLayerAction, selectionModel);
    120116        MapView.addLayerChangeListener(activateLayerAction);
    121         tb.add(activateLayerAction);
     117        buttonPanel.add(new SideButton(activateLayerAction));
    122118
    123119        // -- show hide action
    124120        ShowHideLayerAction showHideLayerAction = new ShowHideLayerAction();
    125121        adaptTo(showHideLayerAction, selectionModel);
    126         tb.add(showHideLayerAction);
     122        buttonPanel.add(new SideButton(showHideLayerAction));
    127123
    128124        // -- merge layer action
     
    130126        adaptTo(mergeLayerAction, model);
    131127        adaptTo(mergeLayerAction,selectionModel);
    132         tb.add(mergeLayerAction);
     128        buttonPanel.add(new SideButton(mergeLayerAction));
    133129
    134130
     
    140136        layerList.getActionMap().put("deleteLayer", deleteLayerAction);
    141137        adaptTo(deleteLayerAction, selectionModel);
    142         tb.add(deleteLayerAction);
    143 
    144         buttonPanel.add(tb);
     138        buttonPanel.add(new SideButton(deleteLayerAction, false));
     139
    145140        return buttonPanel;
    146141    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r2691 r2710  
    2424import javax.swing.JPopupMenu;
    2525import javax.swing.JScrollPane;
    26 import javax.swing.JToolBar;
     26import javax.swing.JPanel;
    2727import javax.swing.KeyStroke;
    2828import javax.swing.ListSelectionModel;
     
    4949import org.openstreetmap.josm.gui.MapView;
    5050import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     51import org.openstreetmap.josm.gui.SideButton;
    5152import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    5253import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask;
     
    100101        // create the panel with buttons
    101102        //
    102         JToolBar tp = new JToolBar(JToolBar.HORIZONTAL);
    103         tp.setFloatable(false);
     103        JPanel tp = getButtonPanel(5);
    104104        // the new action
    105105        //
    106106        newAction = new NewAction();
    107         tp.add(newAction);
     107        tp.add(new SideButton(newAction, false));
    108108
    109109        // the edit action
     
    111111        editAction = new EditAction();
    112112        displaylist.addListSelectionListener(editAction);
    113         tp.add(editAction);
     113        tp.add(new SideButton(editAction, false));
    114114
    115115        // the duplicate action
     
    117117        DuplicateAction duplicateAction = new DuplicateAction();
    118118        displaylist.addListSelectionListener(duplicateAction);
    119         tp.add(duplicateAction);
     119        tp.add(new SideButton(duplicateAction, false));
    120120
    121121        // the delete action
     
    123123        deleteAction = new DeleteAction();
    124124        displaylist.addListSelectionListener(deleteAction);
    125         tp.add(deleteAction);
     125        tp.add(new SideButton(deleteAction, false));
    126126
    127127        // the select action
     
    129129        SelectAction selectAction = new SelectAction();
    130130        displaylist.addListSelectionListener(selectAction);
    131         tp.add(selectAction);
     131        tp.add(new SideButton(selectAction, false));
    132132
    133133        add(tp, BorderLayout.SOUTH);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r2658 r2710  
    88import java.awt.BorderLayout;
    99import java.awt.Color;
    10 import java.awt.GridLayout;
    1110import java.awt.Rectangle;
    1211import java.awt.event.ActionEvent;
     
    111110        add(new JScrollPane(displaylist), BorderLayout.CENTER);
    112111
    113         JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
     112        JPanel buttonPanel = getButtonPanel(2);
    114113
    115114        selectButton = new SideButton(marktr("Select"), "select", "SelectionList",
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r2613 r2710  
    88import java.awt.Dimension;
    99import java.awt.Graphics;
     10import java.awt.FlowLayout;
     11import java.awt.GridLayout;
    1012import java.awt.GridBagLayout;
    1113import java.awt.Image;
     
    562564     * and the toggle dialogs themself are discared, for instance because no layer is
    563565     * left in JOSM and  the main screen turns from the map editor to the MOTD panel.
    564      * 
     566     *
    565567     * Override in subclasses to unregister as listener. After tearDown() is invoked
    566568     * the dialog should be registered as listener.
    567      * 
     569     *
    568570     * The default implementation is empty.
    569571     */
    570572    public void tearDown() {}
     573
     574    protected JPanel getButtonPanel(int columns) {
     575        JPanel pnl = new JPanel();
     576        pnl.setLayout(Main.pref.getBoolean("dialog.align.left", false)
     577        ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,columns));
     578        return pnl;
     579    }
    571580}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r2626 r2710  
    66
    77import java.awt.BorderLayout;
    8 import java.awt.FlowLayout;
    98import java.awt.event.ActionEvent;
    109import java.awt.event.KeyEvent;
     
    7978
    8079    protected JPanel buildButtonRow() {
    81         JPanel pnl = new JPanel();
    82         pnl.setLayout(new FlowLayout(FlowLayout.LEFT));
     80        JPanel pnl = getButtonPanel(2);
    8381
    8482        // -- select users primitives action
Note: See TracChangeset for help on using the changeset viewer.