Changeset 1942 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-08-10T05:10:14+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/ConflictResolver.java
r1904 r1942 7 7 import java.beans.PropertyChangeEvent; 8 8 import java.beans.PropertyChangeListener; 9 import java.beans.PropertyChangeSupport;10 9 import java.util.ArrayList; 11 10 import java.util.logging.Logger; … … 48 47 */ 49 48 public class ConflictResolver extends JPanel implements PropertyChangeListener { 49 50 /* -------------------------------------------------------------------------------------- */ 51 /* Property names */ 52 /* -------------------------------------------------------------------------------------- */ 53 /** name of the property indicating whether all conflicts are resolved, 54 * {@see #isResolvedCompletely()} 55 */ 50 56 static public final String RESOLVED_COMPLETELY_PROP = ConflictResolver.class.getName() + ".resolvedCompletely"; 57 /** 58 * name of the property for the {@see OsmPrimitive} in the role "my" 59 */ 51 60 static public final String MY_PRIMITIVE_PROP = ConflictResolver.class.getName() + ".myPrimitive"; 61 62 /** 63 * name of the property for the {@see OsmPrimitive} in the role "my" 64 */ 52 65 static public final String THEIR_PRIMITIVE_PROP = ConflictResolver.class.getName() + ".theirPrimitive"; 53 66 … … 66 79 private ImageIcon mergeIncomplete; 67 80 68 /** the property change listeners */69 private PropertyChangeSupport listeners;70 71 81 /** indicates whether the current conflict is resolved completely */ 72 82 private boolean resolvedCompletely; 73 83 84 /** 85 * loads the required icons 86 */ 74 87 protected void loadIcons() { 75 88 mergeComplete = ImageProvider.get("dialogs/conflict","mergecomplete.png" ); … … 77 90 } 78 91 92 /** 93 * builds the UI 94 */ 79 95 protected void build() { 80 96 tabbedPane = new JTabbedPane(); … … 104 120 } 105 121 106 122 /** 123 * constructor 124 */ 107 125 public ConflictResolver() { 108 listeners = new PropertyChangeSupport(this);109 126 resolvedCompletely = false; 110 127 build(); … … 112 129 } 113 130 114 131 /** 132 * Sets the {@see OsmPrimitive} in the role "my" 133 * 134 * @param my the primitive in the role "my" 135 */ 115 136 protected void setMy(OsmPrimitive my) { 116 137 OsmPrimitive old = this.my; 117 138 this.my = my; 118 139 if (old != this.my) { 119 fireMyPrimitive(old, this.my); 120 } 121 } 122 140 firePropertyChange(MY_PRIMITIVE_PROP, old, this.my); 141 } 142 } 143 144 /** 145 * Sets the {@see OsmPrimitive} in the role "their". 146 * 147 * @param their the primitive in the role "their" 148 */ 123 149 protected void setTheir(OsmPrimitive their) { 124 150 OsmPrimitive old = this.their; 125 151 this.their = their; 126 152 if (old != this.their) { 127 fireTheirPrimitive(old, this.their); 128 } 129 } 130 131 protected void fireResolvedCompletely(boolean oldValue,boolean newValue) { 132 if (listeners == null) return; 133 listeners.firePropertyChange(RESOLVED_COMPLETELY_PROP, oldValue, newValue); 134 } 135 136 protected void fireMyPrimitive(OsmPrimitive oldValue,OsmPrimitive newValue) { 137 if (listeners == null) return; 138 listeners.firePropertyChange(MY_PRIMITIVE_PROP, oldValue, newValue); 139 } 140 141 protected void fireTheirPrimitive(OsmPrimitive oldValue,OsmPrimitive newValue) { 142 if (listeners == null) return; 143 listeners.firePropertyChange(THEIR_PRIMITIVE_PROP, oldValue, newValue); 144 } 145 146 /** 147 * Adds a property change listener 148 * 149 * @param listener the listener 150 */ 151 @Override 152 public void addPropertyChangeListener(PropertyChangeListener listener) { 153 listeners.addPropertyChangeListener(listener); 154 } 155 156 /** 157 * Removes a property change listener 158 * 159 * @param listener the listener 160 */ 161 162 @Override 163 public void removePropertyChangeListener(PropertyChangeListener listener) { 164 listeners.removePropertyChangeListener(listener); 165 } 166 153 firePropertyChange(THEIR_PRIMITIVE_PROP, old, this.their); 154 } 155 } 156 157 /** 158 * handles property change events 159 */ 167 160 public void propertyChange(PropertyChangeEvent evt) { 168 161 if (evt.getPropertyName().equals(TagMergeModel.PROP_NUM_UNDECIDED_TAGS)) { … … 213 206 } 214 207 } 215 216 208 217 209 /** … … 288 280 } 289 281 282 /** 283 * Updates the state of the property {@see #RESOLVED_COMPLETELY_PROP} 284 * 285 */ 290 286 protected void updateResolvedCompletely() { 291 287 boolean oldValueResolvedCompletely = resolvedCompletely; … … 317 313 } 318 314 if (this.resolvedCompletely != oldValueResolvedCompletely) { 319 fire ResolvedCompletely(oldValueResolvedCompletely, this.resolvedCompletely);315 firePropertyChange(RESOLVED_COMPLETELY_PROP, oldValueResolvedCompletely, this.resolvedCompletely); 320 316 } 321 317 }
Note:
See TracChangeset
for help on using the changeset viewer.