Changeset 8897 in josm


Ignore:
Timestamp:
2015-10-18T18:31:16+02:00 (9 years ago)
Author:
simon04
Message:

fix #10730 - Way splitting: improve dialog layout and hide id of new ways

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r8886 r8897  
    77
    88import java.awt.Component;
    9 import java.awt.GridLayout;
     9import java.awt.GridBagLayout;
    1010import java.awt.event.ActionEvent;
    1111import java.awt.event.KeyEvent;
     
    4646import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4747import org.openstreetmap.josm.tools.CheckParameterUtil;
     48import org.openstreetmap.josm.tools.GBC;
    4849import org.openstreetmap.josm.tools.Shortcut;
    4950import org.openstreetmap.josm.tools.Utils;
     
    231232
    232233            setButtonIcons(new String[]{"ok", "cancel"});
    233             final JPanel pane = new JPanel(new GridLayout(2, 1));
    234             pane.add(new JLabel(getTitle()));
    235             pane.add(list);
     234            final JPanel pane = new JPanel(new GridBagLayout());
     235            pane.add(new JLabel(getTitle()), GBC.eol().fill(GBC.HORIZONTAL));
     236            pane.add(list, GBC.eop().fill(GBC.HORIZONTAL));
    236237            setContent(pane);
    237238        }
     
    258259                public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    259260                    final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    260                     ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, DefaultNameFormatter.getInstance().format((Way) value)));
     261                    final String name = DefaultNameFormatter.getInstance().format((Way) value);
     262                    // get rid of id from DefaultNameFormatter.decorateNameWithId()
     263                    final String nameWithoutId = name.replaceAll(" \\[id: -?\\d+\\]$", "");
     264                    ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, nameWithoutId));
    261265                    return c;
    262266                }
Note: See TracChangeset for help on using the changeset viewer.