Ignore:
Timestamp:
03.12.2009 19:02:25 (2 years ago)
Author:
Gubaer
Message:

fixed #3400: relation editor: improvement to highlight an element
fixed #3873: Feature request: download selected elements in relation editor
New: Dbl-Click in member table to set the map selection to this member
New: Ctrl-Dbl-Clik in member table to add the member to the the map selection
New: Download selected incomplete members only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r2512 r2563  
    44import static org.openstreetmap.josm.tools.I18n.tr; 
    55 
     6import java.beans.PropertyChangeListener; 
     7import java.beans.PropertyChangeSupport; 
    68import java.lang.reflect.Constructor; 
    79import java.lang.reflect.Method; 
     
    1618 
    1719public abstract class RelationEditor extends ExtendedDialog { 
     20    /** the property name for the current relation. 
     21     * @see #setRelation(Relation) 
     22     * @see #getRelation() 
     23     */ 
     24    static public final String RELATION_PROP = RelationEditor.class.getName() + ".relation"; 
     25 
     26    /** the property name for the current relation snapshot 
     27     * @see #getRelationSnapshot() 
     28     */ 
     29    static public final String RELATION_SNAPSHOT_PROP = RelationEditor.class.getName() + ".relationSnapshot"; 
    1830 
    1931    /** the list of registered relation editor classes */ 
     
    6274     * then an instance of that class will be used. 
    6375     * 
     76     * @param layer the data layer the relation is a member of 
    6477     * @param r the relation to be edited 
     78     * @param selectedMembers a collection of relation members which shall be selected when the 
     79     * editor is first launched 
    6580     * @return an instance of RelationEditor suitable for editing that kind of relation 
    6681     */ 
     
    139154     */ 
    140155    protected void setRelation(Relation relation) { 
    141         this.relationSnapshot = (relation == null) ? null : new Relation(relation); 
     156        setRelationSnapshot((relation == null) ? null : new Relation(relation)); 
     157        Relation oldValue = this.relation; 
    142158        this.relation = relation; 
     159        if (this.relation != oldValue) { 
     160            support.firePropertyChange(RELATION_PROP, oldValue, this.relation); 
     161        } 
    143162        updateTitle(); 
    144163    } 
     
    164183    } 
    165184 
     185    protected void setRelationSnapshot(Relation snapshot) { 
     186        Relation oldValue = relationSnapshot; 
     187        relationSnapshot = snapshot; 
     188        if (relationSnapshot != oldValue) { 
     189            support.firePropertyChange(RELATION_SNAPSHOT_PROP, oldValue, relationSnapshot); 
     190        } 
     191    } 
     192 
    166193    /** 
    167194     * Replies true if the currently edited relation has been changed elsewhere. 
     
    175202        return ! relation.hasEqualSemanticAttributes(relationSnapshot); 
    176203    } 
     204 
     205 
     206    /* ----------------------------------------------------------------------- */ 
     207    /* property change support                                                 */ 
     208    /* ----------------------------------------------------------------------- */ 
     209    final private PropertyChangeSupport support = new PropertyChangeSupport(this); 
     210 
     211    @Override 
     212    public void addPropertyChangeListener(PropertyChangeListener listener) { 
     213        this.support.addPropertyChangeListener(listener); 
     214    } 
     215 
     216    @Override 
     217    public void removePropertyChangeListener(PropertyChangeListener listener) { 
     218        this.support.removePropertyChangeListener(listener); 
     219    } 
    177220} 
Note: See TracChangeset for help on using the changeset viewer.