Changeset 9847 in josm
- Timestamp:
- 2016-02-21T14:03:08+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r9440 r9847 31 31 import org.openstreetmap.josm.gui.conflict.pair.IConflictResolver; 32 32 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 33 import org.openstreetmap.josm.gui.tagging.TagTableColumnModelBuilder; 33 34 import org.openstreetmap.josm.tools.ImageProvider; 34 35 … … 43 44 private JTable theirTable; 44 45 private final TagMergeModel model; 46 private final String[] keyvalue; 45 47 private transient AdjustmentSynchronizer adjustmentSynchronizer; 46 48 … … 50 52 public TagMerger() { 51 53 model = new TagMergeModel(); 54 keyvalue = new String[]{tr("Key"), tr("Value")}; 52 55 build(); 53 56 } … … 71 74 */ 72 75 protected JScrollPane buildMineTagTable() { 73 mineTable = new JTable( 74 model, 75 new TagMergeColumnModel( 76 new MineTableCellRenderer() 77 ) 78 ); 76 mineTable = new JTable(model, new TagTableColumnModelBuilder(new MineTableCellRenderer(), keyvalue).build()); 79 77 mineTable.setName("table.my"); 80 78 return embeddInScrollPane(mineTable); … … 87 85 */ 88 86 protected JScrollPane buildTheirTable() { 89 theirTable = new JTable( 90 model, 91 new TagMergeColumnModel( 92 new TheirTableCellRenderer() 93 ) 94 ); 87 theirTable = new JTable(model, new TagTableColumnModelBuilder(new TheirTableCellRenderer(), keyvalue).build()); 95 88 theirTable.setName("table.their"); 96 89 return embeddInScrollPane(theirTable); … … 104 97 105 98 protected JScrollPane buildMergedTable() { 106 mergedTable = new JTable( 107 model, 108 new TagMergeColumnModel( 109 new MergedTableCellRenderer() 110 ) 111 ); 99 mergedTable = new JTable(model, new TagTableColumnModelBuilder(new MergedTableCellRenderer(), keyvalue).build()); 112 100 mergedTable.setName("table.merged"); 113 101 return embeddInScrollPane(mergedTable); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r9543 r9847 33 33 import javax.swing.JTable; 34 34 import javax.swing.UIManager; 35 import javax.swing.table.DefaultTableColumnModel;36 35 import javax.swing.table.DefaultTableModel; 37 36 import javax.swing.table.TableCellRenderer; 38 import javax.swing.table.TableColumn;39 37 40 38 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 41 39 import org.openstreetmap.josm.data.osm.TagCollection; 42 40 import org.openstreetmap.josm.gui.SideButton; 41 import org.openstreetmap.josm.gui.tagging.TagTableColumnModelBuilder; 43 42 import org.openstreetmap.josm.tools.ImageProvider; 44 43 import org.openstreetmap.josm.tools.WindowGeometry; … … 368 367 } 369 368 370 private static final class StatisticsTableColumnModel extends DefaultTableColumnModel {371 private StatisticsTableColumnModel() {372 TableCellRenderer renderer = new StatisticsInfoRenderer();373 TableColumn col = null;374 375 // column 0 - Paste376 col = new TableColumn(0);377 col.setHeaderValue(tr("Paste ..."));378 col.setResizable(true);379 col.setCellRenderer(renderer);380 addColumn(col);381 382 // column 1 - From383 col = new TableColumn(1);384 col.setHeaderValue(tr("From ..."));385 col.setResizable(true);386 col.setCellRenderer(renderer);387 addColumn(col);388 389 // column 2 - To390 col = new TableColumn(2);391 col.setHeaderValue(tr("To ..."));392 col.setResizable(true);393 col.setCellRenderer(renderer);394 addColumn(col);395 }396 }397 398 369 private static final class StatisticsTableModel extends DefaultTableModel { 399 370 private static final String[] HEADERS = new String[] {tr("Paste ..."), tr("From ..."), tr("To ...") }; … … 510 481 511 482 private StatisticsInfoTable(StatisticsTableModel model) { 512 JTable infoTable = new JTable(model, new StatisticsTableColumnModel()); 483 JTable infoTable = new JTable(model, 484 new TagTableColumnModelBuilder(new StatisticsInfoRenderer(), tr("Paste ..."), tr("From ..."), tr("To ...")).build()); 513 485 infoTable.setShowHorizontalLines(true); 514 486 infoTable.setShowVerticalLines(false); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverTable.java
r9497 r9847 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import javax.swing.JTable; 5 7 import javax.swing.ListSelectionModel; 6 8 9 import org.openstreetmap.josm.gui.tagging.TagTableColumnModelBuilder; 7 10 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 8 11 import org.openstreetmap.josm.gui.widgets.JosmTable; … … 15 18 */ 16 19 public TagConflictResolverTable(TagConflictResolverModel model) { 17 super(model, new TagConflictResolverColumnModel()); 20 super(model, new TagTableColumnModelBuilder(new MultiValueCellRenderer(), "", tr("Key"), tr("Value")) 21 .setWidth(20, 0).setPreferredWidth(20, 0).setMaxWidth(30, 0) 22 .setCellEditor(new MultiValueCellEditor(), 2).build()); 18 23 19 24 setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r9319 r9847 24 24 import javax.swing.AbstractAction; 25 25 import javax.swing.CellEditor; 26 import javax.swing.DefaultListSelectionModel;27 26 import javax.swing.JComponent; 28 27 import javax.swing.JTable; … … 33 32 import javax.swing.event.ListSelectionEvent; 34 33 import javax.swing.event.ListSelectionListener; 35 import javax.swing.table.DefaultTableColumnModel;36 import javax.swing.table.TableColumn;37 34 import javax.swing.text.JTextComponent; 38 35 … … 53 50 /** 54 51 * This is the tabular editor component for OSM tags. 55 * 52 * @since 1762 56 53 */ 57 54 public class TagTable extends JTable { … … 66 63 private final CopyOnWriteArrayList<Component> doNotStopCellEditingWhenFocused = new CopyOnWriteArrayList<>(); 67 64 private transient CellEditorRemover editorRemover; 68 69 /**70 * The table has two columns. The first column is used for editing rendering and71 * editing tag keys, the second for rendering and editing tag values.72 *73 */74 static class TagTableColumnModel extends DefaultTableColumnModel {75 TagTableColumnModel(DefaultListSelectionModel selectionModel) {76 setSelectionModel(selectionModel);77 TableColumn col = null;78 TagCellRenderer renderer = new TagCellRenderer();79 80 // column 0 - tag key81 col = new TableColumn(0);82 col.setHeaderValue(tr("Key"));83 col.setResizable(true);84 col.setCellRenderer(renderer);85 addColumn(col);86 87 // column 1 - tag value88 col = new TableColumn(1);89 col.setHeaderValue(tr("Value"));90 col.setResizable(true);91 col.setCellRenderer(renderer);92 addColumn(col);93 }94 }95 65 96 66 /** … … 437 407 */ 438 408 public TagTable(TagEditorModel model, final int maxCharacters) { 439 super(model, new TagTableColumnModel(model.getColumnSelectionModel()), model.getRowSelectionModel()); 409 super(model, new TagTableColumnModelBuilder(new TagCellRenderer(), tr("Key"), tr("Value")) 410 .setSelectionModel(model.getColumnSelectionModel()).build(), 411 model.getRowSelectionModel()); 440 412 this.model = model; 441 413 init(maxCharacters);
Note:
See TracChangeset
for help on using the changeset viewer.