Ignore:
Timestamp:
13.02.2010 17:45:10 (2 years ago)
Author:
Gubaer
Message:

fixed #4506: relation-editor: tag-delete-button does not work
removed duplicated code
fixed selection behaviour for tags tag in RelationEditor and UploadDialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagCellEditor.java

    r2946 r2974  
    1010 
    1111import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionCache; 
    12 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority; 
    1312import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 
    14 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem; 
    1513 
    1614/** 
     
    2624    private AutoCompletingTextField editor = null; 
    2725    private TagModel currentTag = null; 
    28     private TagEditorModel tagEditorModel = null; 
    29     private int currentColumn = 0; 
    3026 
    3127    /** the cache of auto completion items derived from the current JOSM data set */ 
     
    9995        if (column == 0) { 
    10096            editor.setText(currentTag.getName()); 
    101             currentColumn = 0; 
    10297            TagEditorModel model = (TagEditorModel)table.getModel(); 
    10398            initAutoCompletionListForKeys(model, currentTag); 
     
    112107                editor.setText(""); 
    113108            } 
    114             currentColumn = 1; 
    115109            initAutoCompletionListForValues(currentTag.getName()); 
    116110            return editor; 
     
    123117    public Object getCellEditorValue() { 
    124118        return editor.getText(); 
    125     } 
    126  
    127     @Override 
    128     public void cancelCellEditing() { 
    129         super.cancelCellEditing(); 
    130     } 
    131  
    132     @Override 
    133     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(); 
    149119    } 
    150120 
     
    180150        return editor; 
    181151    } 
    182  
    183     /** 
    184      * sets the tag editor model 
    185      * 
    186      * @param tagEditorModel  the tag editor model 
    187      */ 
    188     public void setTagEditorModel(TagEditorModel tagEditorModel) { 
    189         this.tagEditorModel = tagEditorModel; 
    190     } 
    191152} 
Note: See TracChangeset for help on using the changeset viewer.