Changeset 2974 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java
- Timestamp:
- 13.02.2010 17:45:10 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java
r2946 r2974 10 10 11 11 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionCache; 12 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority;13 12 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 14 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;15 13 16 14 /** … … 26 24 private AutoCompletingTextField editor = null; 27 25 private TagModel currentTag = null; 28 private TagEditorModel tagEditorModel = null;29 private int currentColumn = 0;30 26 31 27 /** the cache of auto completion items derived from the current JOSM data set */ … … 99 95 if (column == 0) { 100 96 editor.setText(currentTag.getName()); 101 currentColumn = 0;102 97 TagEditorModel model = (TagEditorModel)table.getModel(); 103 98 initAutoCompletionListForKeys(model, currentTag); … … 112 107 editor.setText(""); 113 108 } 114 currentColumn = 1;115 109 initAutoCompletionListForValues(currentTag.getName()); 116 110 return editor; … … 123 117 public Object getCellEditorValue() { 124 118 return editor.getText(); 125 }126 127 @Override128 public void cancelCellEditing() {129 super.cancelCellEditing();130 }131 132 @Override133 public boolean stopCellEditing() {134 if (tagEditorModel == null) {135 logger.warning("no tag editor model set. Can't update edited values. Please set tag editor model first");136 return super.stopCellEditing();137 }138 139 if (currentColumn == 0) {140 tagEditorModel.updateTagName(currentTag, editor.getText());141 } else if (currentColumn == 1){142 if (currentTag.getValueCount() > 1 && ! editor.getText().equals("")) {143 tagEditorModel.updateTagValue(currentTag, editor.getText());144 } else if (currentTag.getValueCount() <= 1) {145 tagEditorModel.updateTagValue(currentTag, editor.getText());146 }147 }148 return super.stopCellEditing();149 119 } 150 120 … … 180 150 return editor; 181 151 } 182 183 /**184 * sets the tag editor model185 *186 * @param tagEditorModel the tag editor model187 */188 public void setTagEditorModel(TagEditorModel tagEditorModel) {189 this.tagEditorModel = tagEditorModel;190 }191 152 }
Note: See TracChangeset
for help on using the changeset viewer.
