- Timestamp:
- 2016-12-03T18:16:10+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/ChangePropertyKeyCommand.java
r10663 r11357 20 20 /** 21 21 * Command that replaces the key of one or several objects 22 * 22 * @since 3669 23 23 */ 24 24 public class ChangePropertyKeyCommand extends Command { 25 final class SinglePrimitivePseudoCommand implements PseudoCommand { 26 private final String name; 27 private final OsmPrimitive osm; 28 private final Icon icon; 29 30 SinglePrimitivePseudoCommand(String name, OsmPrimitive osm, Icon icon) { 31 this.name = name; 32 this.osm = osm; 33 this.icon = icon; 34 } 35 36 @Override 37 public String getDescriptionText() { 38 return name; 39 } 40 41 @Override 42 public Icon getDescriptionIcon() { 43 return icon; 44 } 45 46 @Override 47 public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 48 return Collections.singleton(osm); 49 } 50 } 51 25 52 /** 26 53 * All primitives, that are affected with this command. … … 108 135 for (final OsmPrimitive osm : objects) { 109 136 osm.accept(v); 110 final String name = v.name; 111 final Icon icon = v.icon; 112 children.add(new PseudoCommand() { 113 @Override 114 public String getDescriptionText() { 115 return name; 116 } 117 118 @Override 119 public Icon getDescriptionIcon() { 120 return icon; 121 } 122 123 @Override 124 public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 125 return Collections.singleton(osm); 126 } 127 }); 137 children.add(new SinglePrimitivePseudoCommand(v.name, osm, v.icon)); 128 138 } 129 139 return children; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
r10829 r11357 23 23 /** 24 24 * <p>Abstract common superclass for {@link Rendering} implementations.</p> 25 * 25 * @since 4087 26 26 */ 27 27 public abstract class AbstractMapRenderer implements Rendering { 28 28 29 29 /** the graphics context to which the visitor renders OSM objects */ 30 protected Graphics2D g;30 protected final Graphics2D g; 31 31 /** the map viewport - provides projection and hit detection functionality */ 32 protected NavigatableComponent nc;32 protected final NavigatableComponent nc; 33 33 34 34 /** -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r11348 r11357 524 524 525 525 static final class NoBorderSplitPaneUI extends BasicSplitPaneUI { 526 static final class NoBorderBasicSplitPaneDivider extends BasicSplitPaneDivider { 527 private NoBorderBasicSplitPaneDivider(BasicSplitPaneUI ui) { 528 super(ui); 529 } 530 531 @Override 532 public void setBorder(Border b) { 533 // Do nothing 534 } 535 } 536 526 537 @Override 527 538 public BasicSplitPaneDivider createDefaultDivider() { 528 return new BasicSplitPaneDivider(this) { 529 @Override 530 public void setBorder(Border b) { 531 // Do nothing 532 } 533 }; 539 return new NoBorderBasicSplitPaneDivider(this); 534 540 } 535 541 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/OsmLinkPaster.java
r11279 r11357 28 28 public class OsmLinkPaster extends AbstractOsmDataPaster { 29 29 30 static final class NoWarnOpenLocationAction extends OpenLocationAction { 31 @Override 32 protected void warnNoSuitableTasks(String url) { 33 // ignore this. 34 } 35 } 36 30 37 private static final BooleanProperty PASTE_REFERRERS = new BooleanProperty("paste.url.download-referrers", true); 31 38 private static final String OSM_SERVER = "^https?\\://(\\w+\\.)?(osm|openstreetmap)\\.org/"; … … 46 53 47 54 String transferData = (String) support.getTransferable().getTransferData(df); 48 OpenLocationAction action = new OpenLocationAction() { 49 @Override 50 protected void warnNoSuitableTasks(String url) { 51 // ignore this. 52 } 53 }; 54 if (action.openUrl(transferData)) { 55 if (new NoWarnOpenLocationAction().openUrl(transferData)) { 55 56 return true; 56 57 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r10957 r11357 141 141 popupMenuHandler.addAction(Main.main.menu.autoScaleActions.get("conflict")); 142 142 143 finalResolveToMyVersionAction resolveToMyVersionAction = new ResolveToMyVersionAction();144 finalResolveToTheirVersionAction resolveToTheirVersionAction = new ResolveToTheirVersionAction();143 ResolveToMyVersionAction resolveToMyVersionAction = new ResolveToMyVersionAction(); 144 ResolveToTheirVersionAction resolveToTheirVersionAction = new ResolveToTheirVersionAction(); 145 145 addListSelectionListener(resolveToMyVersionAction); 146 146 addListSelectionListener(resolveToTheirVersionAction); 147 final JMenuItem btnResolveMy = popupMenuHandler.addAction(resolveToMyVersionAction); 148 final JMenuItem btnResolveTheir = popupMenuHandler.addAction(resolveToTheirVersionAction); 149 150 popupMenuHandler.addListener(new PopupMenuListener() { 151 @Override 152 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 153 btnResolveMy.setVisible(ExpertToggleAction.isExpert()); 154 btnResolveTheir.setVisible(ExpertToggleAction.isExpert()); 155 } 156 157 @Override 158 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { 159 // Do nothing 160 } 161 162 @Override 163 public void popupMenuCanceled(PopupMenuEvent e) { 164 // Do nothing 165 } 166 }); 147 JMenuItem btnResolveMy = popupMenuHandler.addAction(resolveToMyVersionAction); 148 JMenuItem btnResolveTheir = popupMenuHandler.addAction(resolveToTheirVersionAction); 149 150 popupMenuHandler.addListener(new ResolveButtonsPopupMenuListener(btnResolveTheir, btnResolveMy)); 167 151 } 168 152 … … 343 327 public String helpTopic() { 344 328 return ht("/Dialog/ConflictList"); 329 } 330 331 static final class ResolveButtonsPopupMenuListener implements PopupMenuListener { 332 private final JMenuItem btnResolveTheir; 333 private final JMenuItem btnResolveMy; 334 335 private ResolveButtonsPopupMenuListener(JMenuItem btnResolveTheir, JMenuItem btnResolveMy) { 336 this.btnResolveTheir = btnResolveTheir; 337 this.btnResolveMy = btnResolveMy; 338 } 339 340 @Override 341 public void popupMenuWillBecomeVisible(PopupMenuEvent e) { 342 btnResolveMy.setVisible(ExpertToggleAction.isExpert()); 343 btnResolveTheir.setVisible(ExpertToggleAction.isExpert()); 344 } 345 346 @Override 347 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { 348 // Do nothing 349 } 350 351 @Override 352 public void popupMenuCanceled(PopupMenuEvent e) { 353 // Do nothing 354 } 345 355 } 346 356 -
trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java
r10779 r11357 185 185 */ 186 186 public static class RelationMemberTableModel extends DefaultTableModel { 187 private static class RelationToChildReferenceComparator implements Comparator<RelationToChildReference> { 188 private NameFormatter nf = DefaultNameFormatter.getInstance(); 189 190 @Override 191 public int compare(RelationToChildReference o1, RelationToChildReference o2) { 192 int cmp = o1.getChild().getDisplayName(nf).compareTo(o2.getChild().getDisplayName(nf)); 193 if (cmp != 0) return cmp; 194 cmp = o1.getParent().getDisplayName(nf).compareTo(o2.getParent().getDisplayName(nf)); 195 if (cmp != 0) return cmp; 196 return Integer.compare(o1.getPosition(), o2.getPosition()); 197 } 198 } 199 187 200 private final transient List<RelationToChildReference> data; 188 201 … … 200 213 } 201 214 202 protected void sort() {203 data.sort(new Comparator<RelationToChildReference>() {204 private NameFormatter nf = DefaultNameFormatter.getInstance();205 @Override206 public int compare(RelationToChildReference o1, RelationToChildReference o2) {207 int cmp = o1.getChild().getDisplayName(nf).compareTo(o2.getChild().getDisplayName(nf));208 if (cmp != 0) return cmp;209 cmp = o1.getParent().getDisplayName(nf).compareTo(o2.getParent().getDisplayName(nf));210 if (cmp != 0) return cmp;211 return Integer.compare(o1.getPosition(), o2.getPosition());212 }213 }214 );215 }216 217 215 public void populate(Collection<RelationToChildReference> references) { 218 216 data.clear(); … … 220 218 data.addAll(references); 221 219 } 222 sort();220 data.sort(new RelationToChildReferenceComparator()); 223 221 fireTableDataChanged(); 224 222 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r10491 r11357 83 83 dlg.setDialogsPanel(this); 84 84 dlg.setVisible(false); 85 final JPanel p = new JPanel() { 86 /** 87 * Honoured by the MultiSplitPaneLayout when the 88 * entire Window is resized. 89 */ 90 @Override 91 public Dimension getMinimumSize() { 92 return new Dimension(0, 40); 93 } 94 }; 85 final JPanel p = new MinSizePanel(); 95 86 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); 96 87 p.setVisible(false); … … 112 103 } else { 113 104 dlg.hideDialog(); 105 } 106 } 107 108 static final class MinSizePanel extends JPanel { 109 @Override 110 public Dimension getMinimumSize() { 111 // Honoured by the MultiSplitPaneLayout when the entire Window is resized 112 return new Dimension(0, 40); 114 113 } 115 114 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r10611 r11357 25 25 import javax.swing.table.JTableHeader; 26 26 import javax.swing.table.TableCellRenderer; 27 import javax.swing.table.TableModel; 27 28 28 29 import org.openstreetmap.josm.Main; … … 107 108 108 109 protected void build() { 109 userTable = new JTable(filterModel) { 110 @Override 111 protected JTableHeader createDefaultTableHeader() { 112 return new JTableHeader(columnModel) { 113 @Override 114 public String getToolTipText(MouseEvent e) { 115 java.awt.Point p = e.getPoint(); 116 int index = columnModel.getColumnIndexAtX(p.x); 117 int realIndex = columnModel.getColumn(index).getModelIndex(); 118 return COLUMN_TOOLTIPS[realIndex]; 119 } 120 }; 121 } 122 }; 110 userTable = new UserTable(filterModel); 123 111 124 112 userTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); … … 252 240 MultikeyActionsHandler.getInstance().removeAction(hidingFilterAction); 253 241 super.destroy(); 242 } 243 244 static final class UserTable extends JTable { 245 UserTable(TableModel dm) { 246 super(dm); 247 } 248 249 @Override 250 protected JTableHeader createDefaultTableHeader() { 251 return new JTableHeader(columnModel) { 252 @Override 253 public String getToolTipText(MouseEvent e) { 254 int index = columnModel.getColumnIndexAtX(e.getPoint().x); 255 int realIndex = columnModel.getColumn(index).getModelIndex(); 256 return COLUMN_TOOLTIPS[realIndex]; 257 } 258 }; 259 } 254 260 } 255 261 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r10910 r11357 139 139 displaylist = new JList<>(model); 140 140 displaylist.setSelectionModel(selectionModel); 141 displaylist.setCellRenderer(new OsmPrimitivRenderer() { 142 /** 143 * Don't show the default tooltip in the relation list. 144 */ 145 @Override 146 protected String getComponentToolTipText(OsmPrimitive value) { 147 return null; 148 } 149 }); 141 displaylist.setCellRenderer(new NoTooltipOsmRenderer()); 150 142 displaylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 151 143 displaylist.addMouseListener(new MouseEventHandler()); … … 307 299 f.addPropertyChangeListener("filter", evt -> model.setFilter(decorator.getMatch())); 308 300 return f; 301 } 302 303 static final class NoTooltipOsmRenderer extends OsmPrimitivRenderer { 304 @Override 305 protected String getComponentToolTipText(OsmPrimitive value) { 306 // Don't show the default tooltip in the relation list 307 return null; 308 } 309 309 } 310 310 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PresetListPanel.java
r9588 r11357 25 25 public class PresetListPanel extends JPanel { 26 26 27 static final class LabelMouseAdapter extends MouseAdapter { 28 private final TaggingPreset t; 29 private final TaggingPresetHandler presetHandler; 30 31 LabelMouseAdapter(TaggingPreset t, TaggingPresetHandler presetHandler) { 32 this.t = t; 33 this.presetHandler = presetHandler; 34 } 35 36 @Override 37 public void mouseClicked(MouseEvent e) { 38 Collection<OsmPrimitive> selection = t.createSelection(presetHandler.getSelection()); 39 if (selection == null || selection.isEmpty()) 40 return; 41 int answer = t.showDialog(selection, false); 42 43 if (answer == TaggingPreset.DIALOG_ANSWER_APPLY) { 44 presetHandler.updateTags(t.getChangedTags()); 45 } 46 } 47 } 48 27 49 /** 28 50 * Constructs a new {@code PresetListPanel}. … … 50 72 for (final TaggingPreset t : TaggingPresets.getMatchingPresets(types, tags, true)) { 51 73 final JLabel lbl = new TaggingPresetLabel(t); 52 lbl.addMouseListener(new MouseAdapter() { 53 @Override 54 public void mouseClicked(MouseEvent e) { 55 Collection<OsmPrimitive> selection = t.createSelection(presetHandler.getSelection()); 56 if (selection == null || selection.isEmpty()) 57 return; 58 int answer = t.showDialog(selection, false); 59 60 if (answer == TaggingPreset.DIALOG_ANSWER_APPLY) { 61 presetHandler.updateTags(t.getChangedTags()); 62 } 63 } 64 }); 74 lbl.addMouseListener(new LabelMouseAdapter(t, presetHandler)); 65 75 add(lbl, GBC.eol().fill(GBC.HORIZONTAL)); 66 76 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r11087 r11357 233 233 }; 234 234 235 private final transient TaggingPresetHandler presetHandler = new TaggingPresetHandler() { 236 @Override 237 public void updateTags(List<Tag> tags) { 238 Command command = TaggingPreset.createCommand(getSelection(), tags); 239 if (command != null) { 240 Main.main.undoRedo.add(command); 241 } 242 } 243 244 @Override 245 public Collection<OsmPrimitive> getSelection() { 246 return Main.main == null ? Collections.<OsmPrimitive>emptyList() : Main.main.getInProgressSelection(); 247 } 248 }; 235 private final transient TaggingPresetHandler presetHandler = new TaggingPresetCommandHandler(); 249 236 250 237 /** … … 831 818 } 832 819 820 static final class TaggingPresetCommandHandler implements TaggingPresetHandler { 821 @Override 822 public void updateTags(List<Tag> tags) { 823 Command command = TaggingPreset.createCommand(getSelection(), tags); 824 if (command != null) { 825 Main.main.undoRedo.add(command); 826 } 827 } 828 829 @Override 830 public Collection<OsmPrimitive> getSelection() { 831 return Main.main == null ? Collections.<OsmPrimitive>emptyList() : Main.main.getInProgressSelection(); 832 } 833 } 834 833 835 /** 834 836 * Class that watches for mouse clicks
Note:
See TracChangeset
for help on using the changeset viewer.