Changeset 30532 in osm for applications/editors/josm/plugins/reltoolbox/src
- Timestamp:
- 2014-07-14T04:18:06+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/reltoolbox/src/relcontext
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
r30145 r30532 137 137 138 138 final MouseListener relationMouseAdapter = new ChosenRelationMouseAdapter(); 139 final JComboBox roleBox = new JComboBox(); 139 final JComboBox<String> roleBox = new JComboBox<>(); 140 140 roleBoxModel = new RoleComboBoxModel(roleBox); 141 141 roleBox.setModel(roleBoxModel); … … 620 620 setEnabled(newRelation != null); 621 621 } 622 622 } 623 623 624 private class RoleComboBoxModel extends AbstractListModel implements ComboBoxModel { 624 private class RoleComboBoxModel extends AbstractListModel<String> implements ComboBoxModel<String> { 625 625 private List<String> roles = new ArrayList<String>(); 626 626 private int selectedIndex = -1; 627 private JComboBox combobox; 627 private JComboBox<String> combobox; 628 628 private String membersRole; 629 629 private final String EMPTY_ROLE = tr("<empty>"); 630 630 private final String ANOTHER_ROLE = tr("another..."); 631 631 632 public RoleComboBoxModel( JComboBox combobox ) { 632 public RoleComboBoxModel( JComboBox<String> combobox ) { 633 633 super(); 634 634 this.combobox = combobox; … … 708 708 } 709 709 710 public ObjectgetElementAt( int index ) {710 public String getElementAt( int index ) { 711 711 return getRole(index); 712 712 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java
r28857 r30532 37 37 panel.add(searchField, BorderLayout.NORTH); 38 38 final FindRelationListModel relationsData = new FindRelationListModel(); 39 final JList relationsList = new JList(relationsData); 39 final JList<Relation> relationsList = new JList<>(relationsData); 40 40 relationsList.setSelectionModel(relationsData.getSelectionModel()); 41 41 relationsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); … … 167 167 * I admit, some of it was copypasted from {@link org.openstreetmap.josm.gui.dialogs.RelationListDialog.RelationListModel}. 168 168 */ 169 protected class FindRelationListModel extends AbstractListModel { 169 protected class FindRelationListModel extends AbstractListModel<Relation> { 170 170 private final ArrayList<Relation> relations = new ArrayList<Relation>(); 171 171 private DefaultListSelectionModel selectionModel; … … 184 184 } 185 185 186 public Relation getRelation( int idx ) { 187 return relations.get(idx); 188 } 189 186 @Override 190 187 public int getSize() { 191 188 return relations.size(); 192 189 } 193 190 194 public Object getElementAt( int index ) { 195 return getRelation(index); 191 @Override 192 public Relation getElementAt( int index ) { 193 return relations.get(index); 196 194 } 197 195 198 196 public void setRelations(Collection<Relation> relations) { 199 197 int selectedIndex = selectionModel.getMinSelectionIndex(); 200 Relation sel = selectedIndex < 0 ? null : get Relation(selectedIndex);198 Relation sel = selectedIndex < 0 ? null : getElementAt(selectedIndex); 201 199 202 200 this.relations.clear();
Note:
See TracChangeset
for help on using the changeset viewer.