source: josm/trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitiveTypesComboBox.java@ 13146

Last change on this file since 13146 was 7015, checked in by Don-vip, 10 years ago

see #8465 - fix generics for JComboBox/JList

  • Property svn:eol-style set to native
File size: 900 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.widgets;
3
4import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
5
6/**
7 * A Combo box containing OSM primitive types (Node, Way, Relation).
8 * @author Matthias Julius
9 * @see OsmPrimitiveType#dataValues
10 * @since 2923
11 */
12public class OsmPrimitiveTypesComboBox extends JosmComboBox<Object> {
13
14 /**
15 * Constructs a new {@code OsmPrimitiveTypesComboBox}.
16 */
17 public OsmPrimitiveTypesComboBox() {
18 super(OsmPrimitiveType.dataValues().toArray());
19 }
20
21 /**
22 * Replies the currently selected {@code OsmPrimitiveType}.
23 * @return the currently selected {@code OsmPrimitiveType}.
24 */
25 public OsmPrimitiveType getType() {
26 Object selectedItem = this.getSelectedItem();
27 return selectedItem instanceof OsmPrimitiveType ? (OsmPrimitiveType) selectedItem : null;
28 }
29}
Note: See TracBrowser for help on using the repository browser.