Changeset 1642 in josm for trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagMerger.java
- Timestamp:
- 2009-06-06T16:25:25+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagMerger.java
r1631 r1642 13 13 import java.awt.event.MouseAdapter; 14 14 import java.awt.event.MouseEvent; 15 import java.net.URL;16 15 import java.util.ArrayList; 17 16 … … 27 26 import javax.swing.event.ListSelectionListener; 28 27 28 import org.openstreetmap.josm.tools.ImageProvider; 29 /** 30 * UI component for resolving conflicts in the tag sets of two {@see OsmPrimitive}s. 31 * 32 */ 29 33 public class TagMerger extends JPanel { 30 34 … … 37 41 AdjustmentSynchronizer adjustmentSynchronizer; 38 42 43 /** 44 * embeds table in a new {@see JScrollPane} and returns th scroll pane 45 * 46 * @param table the table 47 * @return the scroll pane embedding the table 48 */ 39 49 protected JScrollPane embeddInScrollPane(JTable table) { 40 50 JScrollPane pane = new JScrollPane(table); … … 46 56 } 47 57 58 /** 59 * builds the table for my tag set (table already embedded in a scroll pane) 60 * 61 * @return the table (embedded in a scroll pane) 62 */ 48 63 protected JScrollPane buildMineTagTable() { 49 64 mineTable = new JTable( … … 57 72 } 58 73 74 /** 75 * builds the table for their tag set (table already embedded in a scroll pane) 76 * 77 * @return the table (embedded in a scroll pane) 78 */ 59 79 protected JScrollPane buildTheirTable() { 60 80 theirTable = new JTable( … … 68 88 } 69 89 70 protected JScrollPane buildUndecidedTable() { 90 /** 91 * builds the table for the merged tag set (table already embedded in a scroll pane) 92 * 93 * @return the table (embedded in a scroll pane) 94 */ 95 96 protected JScrollPane buildMergedTable() { 71 97 mergedTable = new JTable( 72 98 model, 73 99 new TagMergeColumnModel( 74 new UndecidedTableCellRenderer()100 new MergedTableCellRenderer() 75 101 ) 76 102 ); … … 79 105 } 80 106 107 /** 108 * build the user interface 109 */ 81 110 protected void build() { 82 111 GridBagConstraints gc = new GridBagConstraints(); … … 152 181 gc.weightx = 0.3; 153 182 gc.weighty = 1.0; 154 add(build UndecidedTable(), gc);183 add(buildMergedTable(), gc); 155 184 156 185 gc.gridx = 3; … … 205 234 } 206 235 236 /** 237 * replies the model used by this tag merger 238 * 239 * @return the model 240 */ 207 241 public TagMergeModel getModel() { 208 242 return model; 209 243 } 210 244 211 protected ImageIcon loadIcon(String name) { 212 String path = "/images/dialogs/conflict/" + name; 213 URL url = this.getClass().getResource(path); 214 if (url == null) { 215 System.out.println(tr("WARNING: failed to load resource {0}", path)); 216 return null; 217 } 218 return new ImageIcon(url); 219 } 220 245 /** 246 * Keeps the currently selected tags in my table in the list of merged tags. 247 * 248 */ 221 249 class KeepMineAction extends AbstractAction implements ListSelectionListener { 222 223 224 250 public KeepMineAction() { 225 ImageIcon icon = loadIcon("tagkeepmine.png");251 ImageIcon icon = ImageProvider.get("dialogs/conflict", "tagkeepmine.png"); 226 252 if (icon != null) { 227 253 putValue(Action.SMALL_ICON, icon); … … 246 272 } 247 273 274 /** 275 * Keeps the currently selected tags in their table in the list of merged tags. 276 * 277 */ 248 278 class KeepTheirAction extends AbstractAction implements ListSelectionListener { 249 250 279 public KeepTheirAction() { 251 ImageIcon icon = loadIcon("tagkeeptheir.png");280 ImageIcon icon = ImageProvider.get("dialogs/conflict", "tagkeeptheir.png"); 252 281 if (icon != null) { 253 282 putValue(Action.SMALL_ICON, icon); … … 272 301 } 273 302 303 /** 304 * Synchronizes scrollbar adjustments between a set of 305 * {@see Adjustable}s. Whenever the adjustment of one of 306 * the registerd Adjustables is updated the adjustment of 307 * the other registered Adjustables is adjusted too. 308 * 309 */ 274 310 class AdjustmentSynchronizer implements AdjustmentListener { 275 311 private final ArrayList<Adjustable> synchronizedAdjustables; … … 297 333 } 298 334 335 /** 336 * Handler for double clicks on entries in the three tag tables. 337 * 338 */ 299 339 class DoubleClickAdapter extends MouseAdapter { 300 340 … … 324 364 } 325 365 366 /** 367 * Sets the currently selected tags in the table of merged tags to state 368 * {@see MergeDecisionType#UNDECIDED} 369 * 370 */ 326 371 class UndecideAction extends AbstractAction implements ListSelectionListener { 327 372 328 373 public UndecideAction() { 329 ImageIcon icon = loadIcon("tagundecide.png");374 ImageIcon icon = ImageProvider.get("dialogs/conflict", "tagundecide.png"); 330 375 if (icon != null) { 331 376 putValue(Action.SMALL_ICON, icon);
Note:
See TracChangeset
for help on using the changeset viewer.