Changeset 4072 in josm
- Timestamp:
- 2011-05-04T07:09:56+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java
r3083 r4072 164 164 Node node = (Node)value; 165 165 reset(); 166 if (value == null) 167 return this; 166 168 switch(column) { 167 169 case 0: -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
r3844 r4072 8 8 9 9 import javax.swing.BorderFactory; 10 import javax.swing.ImageIcon;11 10 import javax.swing.JLabel; 12 11 import javax.swing.JTable; … … 165 164 RelationMember member = (RelationMember)value; 166 165 reset(); 166 if (value == null) 167 return this; 168 167 169 renderBackground(getModel(table), member, row, column, isSelected); 168 170 renderForeground(getModel(table), member, row, column, isSelected); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeTableCellRenderer.java
r3083 r4072 26 26 27 27 reset(); 28 if (value == null) 29 return this; 30 28 31 TagMergeItem item = (TagMergeItem)value; 29 32 switch(col) { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRenderer.java
r3083 r4072 44 44 } else{ 45 45 switch(decision.getDecisionType()) { 46 47 48 49 50 51 52 53 54 55 56 57 46 case UNDECIDED: 47 setForeground(UIManager.getColor("Table.foreground")); 48 setBackground(BGCOLOR_UNDECIDED); 49 break; 50 case KEEP_NONE: 51 setForeground(UIManager.getColor("Panel.foreground")); 52 setBackground(UIManager.getColor("Panel.background")); 53 break; 54 default: 55 setForeground(UIManager.getColor("Table.foreground")); 56 setBackground(UIManager.getColor("Table.background")); 57 break; 58 58 } 59 59 } … … 63 63 model.removeAllElements(); 64 64 switch(decision.getDecisionType()) { 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 65 case UNDECIDED: 66 model.addElement(tr("Choose a value")); 67 setFont(getFont().deriveFont(Font.ITALIC)); 68 setToolTipText(tr("Please decide which values to keep")); 69 cbDecisionRenderer.setSelectedIndex(0); 70 break; 71 case KEEP_ONE: 72 model.addElement(decision.getChosenValue()); 73 setToolTipText(tr("Value ''{0}'' is going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey())); 74 cbDecisionRenderer.setSelectedIndex(0); 75 break; 76 case KEEP_NONE: 77 model.addElement(tr("deleted")); 78 setFont(getFont().deriveFont(Font.ITALIC)); 79 setToolTipText(tr("The key ''{0}'' and all its values are going to be removed", decision.getKey())); 80 cbDecisionRenderer.setSelectedIndex(0); 81 break; 82 case KEEP_ALL: 83 model.addElement(decision.getChosenValue()); 84 setToolTipText(tr("All values joined as ''{0}'' are going to be applied for key ''{1}''", decision.getChosenValue(), decision.getKey())); 85 cbDecisionRenderer.setSelectedIndex(0); 86 break; 87 87 } 88 88 } … … 98 98 99 99 reset(); 100 if (value == null) 101 return this; 102 100 103 MultiValueResolutionDecision decision = (MultiValueResolutionDecision)value; 101 104 renderColors(decision,isSelected); 102 105 switch(column) { 103 104 105 106 107 108 109 106 case 0: 107 if (decision.isDecided()) { 108 setIcon(iconDecided); 109 } else { 110 setIcon(iconUndecided); 111 } 112 return this; 110 113 111 112 113 114 case 1: 115 setText(decision.getKey()); 116 return this; 114 117 115 116 117 118 case 2: 119 renderValue(decision); 120 return cbDecisionRenderer; 118 121 } 119 122 return this; -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r3501 r4072 478 478 boolean hasFocus, int row, int column) { 479 479 reset(); 480 if (value == null) 481 return this; 482 480 483 if (row == 0) { 481 484 setFont(getFont().deriveFont(Font.BOLD)); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionRenderer.java
r3083 r4072 47 47 int row, int column) { 48 48 resetTableRenderer(); 49 if (value == null) 50 return this; 51 49 52 if (isSelected) { 50 53 setBackground(UIManager.getColor("Table.selectionBackground")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r3375 r4072 38 38 import org.openstreetmap.josm.data.osm.event.DataSetListener; 39 39 import org.openstreetmap.josm.data.osm.event.DatasetEventManager; 40 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; 40 41 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 41 42 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; … … 44 45 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 45 46 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 46 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;47 47 import org.openstreetmap.josm.gui.SideButton; 48 48 import org.openstreetmap.josm.tools.Shortcut; … … 206 206 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row,int column) { 207 207 FilterTableModel model = (FilterTableModel)table.getModel(); 208 setSelected( (Boolean)value);208 setSelected(value != null && (Boolean)value); 209 209 setEnabled(model.isCellEnabled(row, column)); 210 210 setHorizontalAlignment(javax.swing.SwingConstants.CENTER); -
trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r3764 r4072 109 109 @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 110 110 JComponent c = (JComponent)oldRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 111 if (! value.equals(""))111 if (!"".equals(value)) 112 112 return c; 113 113 JLabel l = new JLabel(ImageProvider.get("misc","showhide")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r3941 r4072 60 60 import org.openstreetmap.josm.gui.io.SaveLayersDialog; 61 61 import org.openstreetmap.josm.gui.layer.Layer; 62 import org.openstreetmap.josm.gui.layer.Layer.LayerAction; 62 63 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 63 import org.openstreetmap.josm.gui.layer.Layer.LayerAction;64 64 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 65 65 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 787 787 @Override 788 788 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 789 boolean active = (Boolean) value;789 boolean active = value != null && (Boolean) value; 790 790 cb.setSelected(active); 791 791 cb.setToolTipText(active ? tr("this layer is the active layer") : tr("this layer is not currently active (click to activate)")); … … 802 802 @Override 803 803 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 804 cb.updateStatus((Layer)value); 804 if (value != null) { 805 cb.updateStatus((Layer)value); 806 } 805 807 return cb; 806 808 } … … 831 833 @Override 832 834 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 835 if (value == null) 836 return this; 833 837 Layer layer = (Layer)value; 834 838 JLabel label = (JLabel)super.getTableCellRendererComponent(table, -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r3940 r4072 21 21 import java.io.File; 22 22 import java.io.FileOutputStream; 23 import java.io.IOException; 23 24 import java.io.InputStream; 24 25 import java.io.InputStreamReader; 25 import java.io.IOException;26 26 import java.util.ArrayList; 27 27 import java.util.List; … … 116 116 }); 117 117 cbWireframe.setBorder(new EmptyBorder(new Insets(1,1,1,1))); 118 118 119 119 tblStyles = new StylesTable(model); 120 120 tblStyles.setSelectionModel(selectionModel= new DefaultListSelectionModel()); … … 211 211 return data.size(); 212 212 } 213 213 214 214 @Override 215 215 public Object getValueAt(int row, int column) { … … 280 280 281 281 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row,int column) { 282 if (value == null) 283 return this; 282 284 boolean b = (Boolean) value; 283 285 setSelected(b); … … 290 292 @Override 291 293 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 294 if (value == null) 295 return this; 292 296 StyleSource s = (StyleSource) value; 293 297 JLabel label = (JLabel)super.getTableCellRendererComponent(table, … … 362 366 } 363 367 } 364 368 365 369 /** 366 370 * Opens preferences window and selects the mappaint tab. … … 426 430 } 427 431 } 428 432 429 433 protected class SaveAsAction extends AbstractAction { 430 434 -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r4031 r4072 120 120 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 121 121 final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 122 if (value == null) 123 return this; 122 124 label.setIcon((ImageIcon)value); 123 125 label.setText(""); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java
r3083 r4072 90 90 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 91 91 int row, int column) { 92 if (value == null) 93 return this; 92 94 reset(); 93 95 renderColors(isSelected); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableCellRenderer.java
r3083 r4072 57 57 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 58 58 int row, int column) { 59 if (value == null) 60 return this; 59 61 reset(); 60 62 renderColors(isSelected); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r3970 r4072 563 563 boolean isSelected, boolean hasFocus, int row, int column) { 564 564 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 565 if (value == null) 566 return this; 565 567 if (c instanceof JLabel) { 566 568 String str = null; … … 610 612 boolean isSelected, boolean hasFocus, int row, int column) { 611 613 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 614 if (value == null) 615 return this; 612 616 if (c instanceof JLabel) { 613 617 JLabel label = (JLabel)c; … … 625 629 @Override public Component getTableCellRendererComponent(JTable table, Object value, 626 630 boolean isSelected, boolean hasFocus, int row, int column) { 631 if (value == null) 632 return this; 627 633 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 628 634 boolean isDisabledAndHidden = (((Relation)table.getValueAt(row, 0))).isDisabledAndHidden(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java
r3788 r4072 26 26 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 27 27 int row, int column) { 28 28 29 reset(); 30 if (value == null) 31 return this; 32 29 33 this.value = (WayConnectionType) value; 30 34 renderForeground(isSelected); … … 44 48 int xloop = 10; 45 49 int xowloop = 0; 46 if(value.isOnewayLoopForwardPart) xowloop = -3; 47 if(value.isOnewayLoopBackwardPart) xowloop = 3; 48 50 if(value.isOnewayLoopForwardPart) { 51 xowloop = -3; 52 } 53 if(value.isOnewayLoopBackwardPart) { 54 xowloop = 3; 55 } 56 49 57 int xoff = this.getSize().width / 2; 50 58 if (value.isLoop) { … … 58 66 if (value.linkPrev) { 59 67 g.setColor(Color.black); 60 if(value.isOnewayHead) 68 if(value.isOnewayHead) { 61 69 g.fillRect(xoff - 1, 0, 3, 1); 62 else70 } else { 63 71 g.fillRect(xoff - 1 + xowloop, 0, 3, 1); 72 } 64 73 y1 = 0; 65 74 } else { … … 73 82 else { 74 83 g.setColor(Color.red); 75 if(value.isOnewayHead) 84 if(value.isOnewayHead) { 76 85 g.drawRect(xoff-1, p - 3 - w, w, w); 77 else86 } else { 78 87 g.drawRect(xoff-1 + xowloop, p - 1 - w, w, w); 88 } 79 89 y1 = p; 80 90 } … … 83 93 if (value.linkNext) { 84 94 g.setColor(Color.black); 85 if(value.isOnewayTail) 95 if(value.isOnewayTail) { 86 96 g.fillRect(xoff - 1, ymax, 3, 1); 87 else97 } else { 88 98 g.fillRect(xoff - 1 + xowloop, ymax, 3, 1); 99 } 89 100 y2 = ymax; 90 101 } else { … … 99 110 else { 100 111 g.setColor(Color.red); 101 if(value.isOnewayTail) 112 if(value.isOnewayTail) { 102 113 g.drawRect(xoff-1, ymax - p + 3, w, w); 103 else114 } else { 104 115 g.drawRect(xoff-1 + xowloop, ymax - p + 1, w, w); 116 } 105 117 y2 = ymax - p; 106 118 } … … 144 156 g.drawLine(xoff, y1, xoff, y2); 145 157 } 146 158 147 159 g.drawLine(xoff+xowloop, y1, xoff+xowloop, y2); 148 160 149 161 /* special icons */ 150 162 Image arrow = null; … … 169 181 170 182 if (value.isOnewayLoopBackwardPart && value.isOnewayLoopForwardPart) { 171 if(arrow == arrowDown) 183 if(arrow == arrowDown) { 172 184 arrow = arrowUp; 173 else if (arrow == arrowUp)185 } else if (arrow == arrowUp) { 174 186 arrow = arrowDown; 187 } 175 188 } 176 189 … … 182 195 private void setDotted(Graphics g) { 183 196 ((Graphics2D)g).setStroke(new BasicStroke( 184 1f,185 BasicStroke.CAP_BUTT,186 BasicStroke.CAP_BUTT,187 5f,188 new float[] {1f, 2f},189 0f));197 1f, 198 BasicStroke.CAP_BUTT, 199 BasicStroke.CAP_BUTT, 200 5f, 201 new float[] {1f, 2f}, 202 0f)); 190 203 } 191 204 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableMemberCellRenderer.java
r3083 r4072 27 27 28 28 reset(); 29 if (value == null) 30 return this; 29 31 30 32 renderForeground(isSelected); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableRoleCellRenderer.java
r3083 r4072 12 12 13 13 reset(); 14 if (value == null) 15 return this; 14 16 15 17 renderForeground(isSelected); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableCellRenderer.java
r3083 r4072 68 68 69 69 reset(); 70 if (value == null) 71 return this; 72 70 73 renderBackground((OsmPrimitive)value, isSelected); 71 74 renderPrimitive((OsmPrimitive)value); -
trunk/src/org/openstreetmap/josm/gui/history/NodeListTableCellRenderer.java
r3083 r4072 61 61 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 62 62 int row, int column) { 63 if (value == null) 64 return this; 65 63 66 HistoryBrowserModel.NodeListTableModel model = getNodeListTableModel(table); 64 67 Long nodeId = (Long)value; -
trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java
r3083 r4072 94 94 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 95 95 int row, int column) { 96 if (value == null) 97 return this; 98 96 99 HistoryBrowserModel.RelationMemberTableModel model = gteRelationMemberTableModel(table); 97 100 RelationMember member = (RelationMember)value; -
trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java
r3083 r4072 82 82 int row, int column) { 83 83 84 if (value == null) 85 return this; 86 84 87 String key = (String)value; 85 88 HistoryBrowserModel.TagTableModel model = getTagTableModel(table); -
trunk/src/org/openstreetmap/josm/gui/history/VersionTableCellRenderer.java
r3083 r4072 149 149 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, 150 150 int row, int column) { 151 152 if (value == null) 153 return this; 154 151 155 if (getModel(table).isLatest(row)) { 152 156 renderLatest(getModel(table).getLatest(),table, row, isSelected); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerInfoCellRenderer.java
r3083 r4072 134 134 135 135 resetRenderers(); 136 if (value == null) 137 return null; 138 136 139 SaveLayerInfo info = (SaveLayerInfo)value; 137 140 switch(column) { 138 139 140 141 142 143 141 case 0: return prepareLayerNameRenderer(info); 142 case 1: return prepareUploadRequiredRenderer(info); 143 case 2: return prepareSaveToFileRequired(info); 144 case 3: return prepareFileNameRenderer(info); 145 case 4: return prepareUploadRenderer(info); 146 case 5: return prepareSaveToFileRenderer(info); 144 147 } 145 148 return null; -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r3896 r4072 13 13 import java.util.HashMap; 14 14 import java.util.Map; 15 import java.util.Map.Entry; 15 16 import java.util.TreeMap; 16 17 import java.util.Vector; 17 import java.util.Map.Entry;18 18 import java.util.regex.Matcher; 19 19 import java.util.regex.Pattern; … … 38 38 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 39 39 import org.openstreetmap.josm.gui.layer.GpxLayer; 40 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 40 41 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer;42 42 import org.openstreetmap.josm.tools.ColorHelper; 43 43 import org.openstreetmap.josm.tools.GBC; … … 220 220 colors.setDefaultRenderer(Object.class, new TableCellRenderer(){ 221 221 public Component getTableCellRendererComponent(JTable t, Object o, boolean selected, boolean focus, int row, int column) { 222 if (o == null) 223 return new JLabel(); 222 224 if (column == 1) { 223 225 JLabel l = new JLabel(ColorHelper.color2html((Color)o)); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r4041 r4072 84 84 85 85 final protected boolean isMapPaint; 86 86 87 87 protected JTable tblActiveSources; 88 88 protected ActiveSourcesModel activeSourcesModel; … … 113 113 // some kind of hack to prevent the table from scrolling slightly to the 114 114 // right when clicking on the text 115 @Override 115 116 public void scrollRectToVisible(Rectangle aRect) { 116 117 super.scrollRectToVisible(new Rectangle(0, aRect.y, aRect.width, aRect.height)); … … 142 143 }); 143 144 activeSourcesModel.setActiveSources(getInitialSourcesList()); 144 145 145 146 final EditActiveSourceAction editActiveSourceAction = new EditActiveSourceAction(); 146 147 tblActiveSources.getSelectionModel().addListSelectionListener(editActiveSourceAction); … … 368 369 */ 369 370 protected enum I18nString { AVAILABLE_SOURCES, ACTIVE_SOURCES, NEW_SOURCE_ENTRY_TOOLTIP, NEW_SOURCE_ENTRY, 370 371 372 371 REMOVE_SOURCE_TOOLTIP, EDIT_SOURCE_TOOLTIP, ACTIVATE_TOOLTIP, RELOAD_ALL_AVAILABLE, 372 LOADING_SOURCES_FROM, FAILED_TO_LOAD_SOURCES_FROM, FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC, 373 ILLEGAL_FORMAT_OF_ENTRY } 373 374 374 375 /** … … 378 379 private static void adjustColumnWidth(JTable tbl, int col) { 379 380 int maxwidth = 0; 380 381 for (int row=0; row<tbl.getRowCount(); row++) { 381 382 TableCellRenderer tcr = tbl.getCellRenderer(row, col); 382 383 384 385 386 383 Object val = tbl.getValueAt(row, col); 384 Component comp = tcr.getTableCellRendererComponent(tbl, val, false, false, row, col); 385 maxwidth = Math.max(comp.getPreferredSize().width, maxwidth); 386 } 387 tbl.getColumnModel().getColumn(col).setPreferredWidth(maxwidth); 387 388 } 388 389 … … 587 588 if (sel.length == 0) 588 589 return false; 589 if (i < 0) { // Up590 if (i < 0) 590 591 return sel[0] >= -i; 591 } else if (i > 0) { // Down592 return sel[sel.length-1] <= getRowCount()-1 - i;593 }else594 return true;592 else if (i > 0) 593 return sel[sel.length-1] <= getRowCount()-1 - i; 594 else 595 return true; 595 596 } 596 597 … … 735 736 } 736 737 738 @Override 737 739 public String getTitle() { 738 740 return tfTitle.getText(); … … 1211 1213 } 1212 1214 } 1213 1215 1214 1216 class SourceEntryTableCellRenderer extends DefaultTableCellRenderer { 1215 1217 @Override 1216 1218 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 1219 if (value == null) 1220 return this; 1217 1221 SourceEntry se = (SourceEntry) value; 1218 1222 JLabel label = (JLabel)super.getTableCellRendererComponent(table, … … 1490 1494 public Collection<? extends SourceEntry> readNewFormat() { 1491 1495 List<SourceEntry> entries = readNewFormatImpl(); 1492 if (entries == null) {1496 if (entries == null) 1493 1497 return getDefault(); 1494 }1495 1498 return entries; 1496 1499 } … … 1500 1503 Collection<Collection<String>> mappaintSrc = Main.pref.getArray(pref, null); 1501 1504 if (mappaintSrc == null || mappaintSrc.isEmpty()) { 1502 if (Main.pref.getBoolean(pref + "._empty_", false)) {1505 if (Main.pref.getBoolean(pref + "._empty_", false)) 1503 1506 return Collections.<SourceEntry>emptyList(); 1504 }1505 1507 return null; 1506 1508 } -
trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java
r3083 r4072 89 89 boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) { 90 90 resetRenderer(); 91 if (value == null) 92 return this; 91 93 92 94 // set background color
Note:
See TracChangeset
for help on using the changeset viewer.