Changeset 7556 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Timestamp:
- 2014-09-18T02:23:15+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r7546 r7556 92 92 /** 93 93 * This dialog is for editing relations. 94 * 94 * @since 343 95 95 */ 96 96 public class GenericRelationEditor extends RelationEditor { … … 172 172 tagEditorPanel.getModel().ensureOneTag(); 173 173 174 JSplitPane pane = buildSplitPane( );174 JSplitPane pane = buildSplitPane(relation); 175 175 pane.setPreferredSize(new Dimension(100, 100)); 176 176 … … 293 293 */ 294 294 protected JPanel buildMemberEditorPanel() { 295 final JPanel pnl = new JPanel(); 296 pnl.setLayout(new GridBagLayout()); 295 final JPanel pnl = new JPanel(new GridBagLayout()); 297 296 // setting up the member table 298 memberTable = new MemberTable(getLayer(), memberTableModel);297 memberTable = new MemberTable(getLayer(), getRelation(), memberTableModel); 299 298 memberTable.addMouseListener(new MemberTableDblClickAdapter()); 300 299 memberTableModel.addMemberModelListener(memberTable); … … 350 349 if (list != null) { 351 350 list.clear(); 352 getLayer().data.getAutoCompletionManager().populateWithMemberRoles(list );351 getLayer().data.getAutoCompletionManager().populateWithMemberRoles(list, getRelation()); 353 352 } 354 353 } … … 454 453 * @return the split panel 455 454 */ 456 protected JSplitPane buildSplitPane( ) {455 protected JSplitPane buildSplitPane(Relation relation) { 457 456 final JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); 458 457 pane.setTopComponent(buildTagEditorPanel()); … … 1603 1602 1604 1603 /** 1605 * Creates a new relation with a copy of the current editor state 1606 * 1604 * Creates a new relation with a copy of the current editor state. 1607 1605 */ 1608 1606 class DuplicateRelationAction extends AbstractAction { … … 1626 1624 1627 1625 /** 1628 * Action for editing the currently selected relation 1629 * 1630 * 1626 * Action for editing the currently selected relation. 1631 1627 */ 1632 1628 class EditAction extends AbstractAction implements ListSelectionListener { … … 1736 1732 } 1737 1733 } 1738 1739 1734 } 1740 1735 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java
r6246 r7556 10 10 11 11 import org.openstreetmap.josm.data.osm.DataSet; 12 import org.openstreetmap.josm.data.osm.Relation; 12 13 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 13 14 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; … … 15 16 public class MemberRoleCellEditor extends AbstractCellEditor implements TableCellEditor { 16 17 private AutoCompletingTextField editor = null; 17 private DataSet ds; 18 private final DataSet ds; 19 private final Relation relation; 18 20 19 21 /** user input is matched against this list of auto completion items */ … … 21 23 22 24 /** 23 * constructor 25 * Constructs a new {@code MemberRoleCellEditor}. 26 * @param ds the data set. Must not be null 27 * @param relation the relation. Can be null 24 28 */ 25 public MemberRoleCellEditor(DataSet ds ) {29 public MemberRoleCellEditor(DataSet ds, Relation relation) { 26 30 this.ds = ds; 31 this.relation = relation; 27 32 editor = new AutoCompletingTextField(); 28 33 editor.setBorder(BorderFactory.createEmptyBorder(1,1,1,1)); … … 31 36 } 32 37 33 /**34 * replies the table cell editor35 */36 38 @Override 37 39 public Component getTableCellEditorComponent(JTable table, … … 41 43 editor.setText(role); 42 44 autoCompletionList.clear(); 43 ds.getAutoCompletionManager().populateWithMemberRoles(autoCompletionList );45 ds.getAutoCompletionManager().populateWithMemberRoles(autoCompletionList, relation); 44 46 return editor; 45 47 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r7005 r7556 29 29 import org.openstreetmap.josm.actions.ZoomToAction; 30 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 31 import org.openstreetmap.josm.data.osm.Relation; 31 32 import org.openstreetmap.josm.data.osm.RelationMember; 32 33 import org.openstreetmap.josm.data.osm.Way; … … 50 51 * constructor for relation member table 51 52 * 52 * @param layer the data layer of the relation 53 * @param layer the data layer of the relation. Must not be null 54 * @param relation the relation. Can be null 53 55 * @param model the table model 54 56 */ 55 public MemberTable(OsmDataLayer layer, MemberTableModel model) {56 super(model, new MemberTableColumnModel(layer.data ), model.getSelectionModel());57 public MemberTable(OsmDataLayer layer, Relation relation, MemberTableModel model) { 58 super(model, new MemberTableColumnModel(layer.data, relation), model.getSelectionModel()); 57 59 setLayer(layer); 58 60 model.addMemberModelListener(this); … … 157 159 * <li>it jumps over cells in the first column</li> <li>it automatically add a new empty row 158 160 * when the user leaves the last cell in the table</li></ul> 159 *160 *161 161 */ 162 162 class SelectNextColumnCellAction extends AbstractAction { … … 191 191 * Action to be run when the user navigates to the previous cell in the table, for instance by 192 192 * pressing Shift-TAB 193 *194 193 */ 195 194 private class SelectPreviousColumnCellAction extends AbstractAction { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableColumnModel.java
r6296 r7556 8 8 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 import org.openstreetmap.josm.data.osm.Relation; 10 11 11 12 public class MemberTableColumnModel extends DefaultTableColumnModel { 12 13 13 public MemberTableColumnModel(DataSet ds) { 14 /** 15 * Constructs a new {@code MemberTableColumnModel}. 16 * @param ds the data set. Must not be null 17 * @param relation the relation. Can be null 18 */ 19 public MemberTableColumnModel(DataSet ds, Relation relation) { 14 20 TableColumn col = null; 15 21 … … 20 26 col.setPreferredWidth(100); 21 27 col.setCellRenderer(new MemberTableRoleCellRenderer()); 22 col.setCellEditor(new MemberRoleCellEditor(ds ));28 col.setCellEditor(new MemberRoleCellEditor(ds, relation)); 23 29 addColumn(col); 24 30
Note:
See TracChangeset
for help on using the changeset viewer.