Changeset 2632 in josm for trunk/src


Ignore:
Timestamp:
2009-12-14T12:57:16+01:00 (12 years ago)
Author:
Gubaer
Message:

fixed: Action New Relation initially disabled
update: now uses a JToolBar for action panel

File:
1 edited

Legend:

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

    r2626 r2632  
    55
    66import java.awt.BorderLayout;
    7 import java.awt.GridLayout;
    87import java.awt.Point;
    98import java.awt.event.ActionEvent;
     
    2322import javax.swing.DefaultListSelectionModel;
    2423import javax.swing.JList;
    25 import javax.swing.JPanel;
    2624import javax.swing.JPopupMenu;
    2725import javax.swing.JScrollPane;
     26import javax.swing.JToolBar;
    2827import javax.swing.KeyStroke;
    2928import javax.swing.ListSelectionModel;
     
    4948import org.openstreetmap.josm.gui.MapView;
    5049import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    51 import org.openstreetmap.josm.gui.SideButton;
     50import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    5251import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask;
    5352import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    5453import org.openstreetmap.josm.gui.layer.Layer;
    5554import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    56 import org.openstreetmap.josm.tools.GBC;
    5755import org.openstreetmap.josm.tools.ImageProvider;
    5856import org.openstreetmap.josm.tools.Shortcut;
     
    10199        // create the panel with buttons
    102100        //
    103         JPanel buttonPanel = new JPanel(new GridLayout(1,3));
    104 
     101        JToolBar tp = new JToolBar(JToolBar.HORIZONTAL);
     102        tp.setFloatable(false);
    105103        // the new action
    106104        //
    107105        newAction = new NewAction();
    108         buttonPanel.add(new SideButton(newAction), GBC.std());
     106        tp.add(newAction);
    109107
    110108        // the edit action
     
    112110        editAction = new EditAction();
    113111        displaylist.addListSelectionListener(editAction);
    114         buttonPanel.add(new SideButton(editAction), GBC.std());
     112        tp.add(editAction);
    115113
    116114        // the duplicate action
     
    118116        DuplicateAction duplicateAction = new DuplicateAction();
    119117        displaylist.addListSelectionListener(duplicateAction);
    120         buttonPanel.add(new SideButton(duplicateAction), GBC.std());
     118        tp.add(duplicateAction);
    121119
    122120        // the delete action
     
    124122        deleteAction = new DeleteAction();
    125123        displaylist.addListSelectionListener(deleteAction);
    126         buttonPanel.add(new SideButton(deleteAction), GBC.eol());
     124        tp.add(deleteAction);
    127125
    128126        // the select action
     
    130128        SelectAction selectAction = new SelectAction();
    131129        displaylist.addListSelectionListener(selectAction);
    132         buttonPanel.add(new SideButton(selectAction), GBC.eol());
    133 
    134         add(buttonPanel, BorderLayout.SOUTH);
     130        tp.add(selectAction);
     131
     132        add(tp, BorderLayout.SOUTH);
    135133
    136134        // activate DEL in the list of relations
     
    339337     *
    340338     */
    341     static class NewAction extends AbstractAction implements MapView.LayerChangeListener{
     339    static class NewAction extends AbstractAction implements LayerChangeListener{
    342340        public NewAction() {
    343341            putValue(SHORT_DESCRIPTION,tr("Create a new relation"));
    344342            //putValue(NAME, tr("New"));
    345343            putValue(SMALL_ICON, ImageProvider.get("dialogs", "addrelation"));
    346             setEnabled(false);
     344            updateEnabledState();
    347345        }
    348346
Note: See TracChangeset for help on using the changeset viewer.