Changeset 10179 in josm
- Timestamp:
- 2016-05-11T02:44:10+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10001 r10179 1665 1665 } 1666 1666 } 1667 return projected = new EastNorth(e0+l*pe, n0+l*pn); 1667 projected = new EastNorth(e0+l*pe, n0+l*pn); 1668 return projected; 1668 1669 } 1669 1670 -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r10043 r10179 725 725 ((MoveCommand) c).applyVectorTo(currentEN); 726 726 } else { 727 Main.main.undoRedo.add(728 c = new MoveCommand(selection, startEN, currentEN));727 c = new MoveCommand(selection, startEN, currentEN); 728 Main.main.undoRedo.add(c); 729 729 } 730 730 for (Node n : affectedNodes) { … … 834 834 limit -= ((Way) osm).getNodes().size(); 835 835 } 836 if ( (limit -= 1)< 0) {836 if (--limit < 0) { 837 837 break; 838 838 } … … 1200 1200 w = ws.way; 1201 1201 1202 Point2D p1 = mv.getPoint2D(wnp.a = w.getNode(ws.lowerIndex)); 1203 Point2D p2 = mv.getPoint2D(wnp.b = w.getNode(ws.lowerIndex + 1)); 1202 wnp.a = w.getNode(ws.lowerIndex); 1203 wnp.b = w.getNode(ws.lowerIndex + 1); 1204 Point2D p1 = mv.getPoint2D(wnp.a); 1205 Point2D p2 = mv.getPoint2D(wnp.b); 1204 1206 if (WireframeMapRenderer.isLargeSegment(p1, p2, virtualSpace)) { 1205 1207 Point2D pc = new Point2D.Double((p1.getX() + p2.getX()) / 2, (p1.getY() + p2.getY()) / 2); -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r9983 r10179 203 203 */ 204 204 public static int askForOption(String text, String opts) { 205 Integer answer;206 205 if (!opts.isEmpty()) { 207 String[] options = opts.split(";"); 208 answer = JOptionPane.showOptionDialog(Main.parent, text, "Question", 209 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, 0); 206 return JOptionPane.showOptionDialog(Main.parent, text, "Question", 207 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, opts.split(";"), 0); 210 208 } else { 211 answer =JOptionPane.showOptionDialog(Main.parent, text, "Question",209 return JOptionPane.showOptionDialog(Main.parent, text, "Question", 212 210 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, 2); 213 211 } 214 if (answer == null) return -1; else return answer;215 212 } 216 213 217 214 public static String askForText(String text) { 218 215 String s = JOptionPane.showInputDialog(Main.parent, text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE); 219 if (s != null && !(s = s.trim()).isEmpty()) { 220 return s; 221 } else { 222 return ""; 223 } 216 return s != null ? s.trim() : null; 224 217 } 225 218 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java
r10000 r10179 84 84 Map<DataSet, Map<Relation, Multipolygon>> map1 = cache.get(nc); 85 85 if (map1 == null) { 86 cache.put(nc, map1 = new ConcurrentHashMap<>()); 86 map1 = new ConcurrentHashMap<>(); 87 cache.put(nc, map1); 87 88 } 88 89 Map<Relation, Multipolygon> map2 = map1.get(r.getDataSet()); 89 90 if (map2 == null) { 90 map1.put(r.getDataSet(), map2 = new ConcurrentHashMap<>()); 91 map2 = new ConcurrentHashMap<>(); 92 map1.put(r.getDataSet(), map2); 91 93 } 92 94 multipolygon = map2.get(r); 93 95 if (multipolygon == null || forceRefresh) { 94 map2.put(r, multipolygon = new Multipolygon(r)); 96 multipolygon = new Multipolygon(r); 97 map2.put(r, multipolygon); 95 98 for (PolyData pd : multipolygon.getCombinedPolygons()) { 96 99 if (pd.selected) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r8510 r10179 158 158 List<OsmPrimitive> list = map.get(number); 159 159 if (list == null) { 160 map.put(number, list = new ArrayList<>()); 160 list = new ArrayList<>(); 161 map.put(number, list); 161 162 } 162 163 list.add(p); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r9381 r10179 128 128 List<Way> list = map.get(value); 129 129 if (list == null) { 130 map.put(value, list = new ArrayList<>()); 130 list = new ArrayList<>(); 131 map.put(value, list); 131 132 } 132 133 list.add(h); -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r10173 r10179 133 133 134 134 /** Conflict dialog */ 135 public ConflictDialog conflictDialog; 135 public final ConflictDialog conflictDialog; 136 136 /** Filter dialog */ 137 public FilterDialog filterDialog; 137 public final FilterDialog filterDialog; 138 138 /** Relation list dialog */ 139 public RelationListDialog relationListDialog; 139 public final RelationListDialog relationListDialog; 140 140 /** Validator dialog */ 141 public ValidatorDialog validatorDialog; 141 public final ValidatorDialog validatorDialog; 142 142 /** Selection list dialog */ 143 public SelectionListDialog selectionListDialog; 143 public final SelectionListDialog selectionListDialog; 144 144 /** Properties dialog */ 145 public PropertiesDialog propertiesDialog; 145 public final PropertiesDialog propertiesDialog; 146 146 /** Map paint dialog */ 147 public MapPaintDialog mapPaintDialog; 147 public final MapPaintDialog mapPaintDialog; 148 148 /** Notes dialog */ 149 public NotesDialog noteDialog; 149 public final NotesDialog noteDialog; 150 150 151 151 // Map modes … … 238 238 239 239 // toolBarActions, map mode buttons 240 addMapMode(new IconToggleButton(mapModeSelect = new SelectAction(this))); 241 addMapMode(new IconToggleButton(mapModeSelectLasso = new LassoModeAction(), true)); 242 addMapMode(new IconToggleButton(mapModeDraw = new DrawAction(this))); 243 addMapMode(new IconToggleButton(mapModeZoom = new ZoomAction(this))); 240 mapModeSelect = new SelectAction(this); 241 mapModeSelectLasso = new LassoModeAction(); 242 mapModeDraw = new DrawAction(this); 243 mapModeZoom = new ZoomAction(this); 244 245 addMapMode(new IconToggleButton(mapModeSelect)); 246 addMapMode(new IconToggleButton(mapModeSelectLasso, true)); 247 addMapMode(new IconToggleButton(mapModeDraw)); 248 addMapMode(new IconToggleButton(mapModeZoom)); 244 249 addMapMode(new IconToggleButton(new DeleteAction(this), true)); 245 250 addMapMode(new IconToggleButton(new ParallelWayAction(this), true)); … … 251 256 // toolBarToggles, toggle dialog buttons 252 257 LayerListDialog.createInstance(this); 258 propertiesDialog = new PropertiesDialog(); 259 selectionListDialog = new SelectionListDialog(); 260 relationListDialog = new RelationListDialog(); 261 conflictDialog = new ConflictDialog(); 262 validatorDialog = new ValidatorDialog(); 263 filterDialog = new FilterDialog(); 264 mapPaintDialog = new MapPaintDialog(); 265 noteDialog = new NotesDialog(); 266 253 267 addToggleDialog(LayerListDialog.getInstance()); 254 addToggleDialog(propertiesDialog = new PropertiesDialog());255 addToggleDialog(selectionListDialog = new SelectionListDialog());256 addToggleDialog(relationListDialog = new RelationListDialog());268 addToggleDialog(propertiesDialog); 269 addToggleDialog(selectionListDialog); 270 addToggleDialog(relationListDialog); 257 271 addToggleDialog(new MinimapDialog()); 258 272 addToggleDialog(new CommandStackDialog()); 259 273 addToggleDialog(new UserListDialog()); 260 addToggleDialog(conflictDialog = new ConflictDialog());261 addToggleDialog(validatorDialog = new ValidatorDialog());262 addToggleDialog(filterDialog = new FilterDialog());274 addToggleDialog(conflictDialog); 275 addToggleDialog(validatorDialog); 276 addToggleDialog(filterDialog); 263 277 addToggleDialog(new ChangesetDialog(), true); 264 addToggleDialog(mapPaintDialog = new MapPaintDialog());265 addToggleDialog(noteDialog = new NotesDialog());278 addToggleDialog(mapPaintDialog); 279 addToggleDialog(noteDialog); 266 280 toolBarToggle.setFloatable(false); 267 281 … … 272 286 boolean unregisterTab = Shortcut.findShortcut(KeyEvent.VK_TAB, 0) != null; 273 287 if (unregisterTab) { 274 for (JComponent c: allDialogButtons) c.setFocusTraversalKeysEnabled(false); 275 for (JComponent c: allMapModeButtons) c.setFocusTraversalKeysEnabled(false); 288 for (JComponent c: allDialogButtons) { 289 c.setFocusTraversalKeysEnabled(false); 290 } 291 for (JComponent c: allMapModeButtons) { 292 c.setFocusTraversalKeysEnabled(false); 293 } 276 294 } 277 295 -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r9978 r10179 91 91 * @author imi 92 92 */ 93 public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener { 93 public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener { 94 94 95 95 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Main.pref.get("statusbar.decimal-format", "0.0")); … … 201 201 private final JProgressBar progressBar = new JProgressBar(); 202 202 public final transient BackgroundProgressMonitor progressMonitor = new BackgroundProgressMonitor(); 203 204 private final transient SoMChangeListener somListener;205 203 206 204 // Distance value displayed in distText, stored if refresh needed after a change of system of measurement … … 924 922 } 925 923 926 SystemOfMeasurement.addSoMChangeListener(somListener = new SoMChangeListener() { 927 @Override 928 public void systemOfMeasurementChanged(String oldSoM, String newSoM) { 929 setDist(distValue); 930 } 931 }); 924 SystemOfMeasurement.addSoMChangeListener(this); 932 925 933 926 latText.addMouseListener(jumpToOnLeftClick); … … 961 954 } 962 955 956 @Override 957 public void systemOfMeasurementChanged(String oldSoM, String newSoM) { 958 setDist(distValue); 959 } 960 963 961 /** 964 962 * Updates the system of measurement and displays a notification. … … 1078 1076 @Override 1079 1077 public void destroy() { 1080 SystemOfMeasurement.removeSoMChangeListener( somListener);1078 SystemOfMeasurement.removeSoMChangeListener(this); 1081 1079 Main.pref.removePreferenceChangeListener(this); 1082 1080 -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r10173 r10179 39 39 /** the text area and the scroll pane for the log */ 40 40 private final JosmTextArea taLog = new JosmTextArea(5, 50); 41 private JScrollPane spLog; 41 private final JScrollPane spLog = new JScrollPane(taLog); 42 42 43 43 private void initDialog() { … … 60 60 gc.weighty = 1.0; 61 61 gc.weightx = 1.0; 62 pane.add(spLog = new JScrollPane(taLog), gc);62 pane.add(spLog, gc); 63 63 spLog.setVisible(false); 64 64 setContentPane(pane); -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r9705 r10179 22 22 23 23 /** 24 * Button that is usually used in toggle dialogs 24 * Button that is usually used in toggle dialogs. 25 * @since 744 25 26 */ 26 27 public class SideButton extends JButton implements Destroyable { … … 29 30 private transient PropertyChangeListener propertyChangeListener; 30 31 32 /** 33 * Constructs a new {@code SideButton}. 34 * @param action action used to specify the new button 35 */ 31 36 public SideButton(Action action) { 32 37 super(action); … … 35 40 } 36 41 42 /** 43 * Constructs a new {@code SideButton}. 44 * @param action action used to specify the new button 45 * @param usename use action name 46 */ 37 47 public SideButton(Action action, boolean usename) { 38 48 super(action); … … 44 54 } 45 55 56 /** 57 * Constructs a new {@code SideButton}. 58 * @param action action used to specify the new button 59 * @param imagename image name in "dialogs" directory 60 */ 46 61 public SideButton(Action action, String imagename) { 47 62 super(action); 48 setIcon( makeIcon(imagename));63 setIcon(getScaledImage(ImageProvider.get("dialogs", imagename).getImage())); 49 64 doStyle(); 50 65 } … … 54 69 // SideButton is constructed get the proper icon size 55 70 if (action != null) { 56 action.addPropertyChangeListener(propertyChangeListener = new PropertyChangeListener() {71 propertyChangeListener = new PropertyChangeListener() { 57 72 @Override 58 73 public void propertyChange(PropertyChangeEvent evt) { … … 61 76 } 62 77 } 63 }); 78 }; 79 action.addPropertyChangeListener(propertyChangeListener); 64 80 } 65 81 Icon i = getIcon(); … … 77 93 int newWidth = im.getWidth(null) * iconHeight / im.getHeight(null); 78 94 return new ImageIcon(im.getScaledInstance(newWidth, iconHeight, Image.SCALE_SMOOTH)); 79 }80 81 public static ImageIcon makeIcon(String imagename) {82 Image im = ImageProvider.get("dialogs", imagename).getImage();83 return getScaledImage(im);84 95 } 85 96 -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r10001 r10179 85 85 private transient Bounds bbox; 86 86 /** the map viewer showing the selected bounding box */ 87 private TileBoundsMapView mapViewer; 87 private final TileBoundsMapView mapViewer = new TileBoundsMapView(); 88 88 /** a panel for entering a bounding box given by a tile grid and a zoom level */ 89 private TileGridInputPanel pnlTileGrid; 90 /** a panel for entering a bounding box given by the address of an individual OSM tile at 91 * a given zoom level 92 */ 93 private TileAddressInputPanel pnlTileAddress; 89 private final TileGridInputPanel pnlTileGrid = new TileGridInputPanel(); 90 /** a panel for entering a bounding box given by the address of an individual OSM tile at a given zoom level */ 91 private final TileAddressInputPanel pnlTileAddress = new TileAddressInputPanel(); 94 92 95 93 /** … … 103 101 gc.fill = GridBagConstraints.HORIZONTAL; 104 102 gc.anchor = GridBagConstraints.NORTHWEST; 105 add(pnlTileGrid = new TileGridInputPanel(), gc);103 add(pnlTileGrid, gc); 106 104 107 105 gc.gridx = 1; 108 add(pnlTileAddress = new TileAddressInputPanel(), gc);106 add(pnlTileAddress, gc); 109 107 110 108 gc.gridx = 0; … … 115 113 gc.fill = GridBagConstraints.BOTH; 116 114 gc.insets = new Insets(2, 2, 2, 2); 117 add(mapViewer = new TileBoundsMapView(), gc);115 add(mapViewer, gc); 118 116 mapViewer.setFocusable(false); 119 117 mapViewer.setZoomContolsVisible(false); … … 217 215 public static final String TILE_BOUNDS_PROP = TileGridInputPanel.class.getName() + ".tileBounds"; 218 216 219 private JosmTextField tfMaxY; 220 private JosmTextField tfMinY; 221 private JosmTextField tfMaxX; 222 private JosmTextField tfMinX; 217 private final JosmTextField tfMaxY = new JosmTextField(); 218 private final JosmTextField tfMinY = new JosmTextField(); 219 private final JosmTextField tfMaxX = new JosmTextField(); 220 private final JosmTextField tfMinX = new JosmTextField(); 223 221 private transient TileCoordinateValidator valMaxY; 224 222 private transient TileCoordinateValidator valMinY; 225 223 private transient TileCoordinateValidator valMaxX; 226 224 private transient TileCoordinateValidator valMinX; 227 private JSpinner spZoomLevel; 225 private final JSpinner spZoomLevel = new JSpinner(new SpinnerNumberModel(0, 0, 18, 1)); 228 226 private final transient TileBoundsBuilder tileBoundsBuilder = new TileBoundsBuilder(); 229 227 private boolean doFireTileBoundChanged = true; … … 240 238 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); 241 239 pnl.add(new JLabel(tr("Zoom level:"))); 242 pnl.add(spZoomLevel = new JSpinner(new SpinnerNumberModel(0, 0, 18, 1)));240 pnl.add(spZoomLevel); 243 241 spZoomLevel.addChangeListener(new ZomeLevelChangeHandler()); 244 242 spZoomLevel.addChangeListener(tileBoundsBuilder); … … 274 272 gc.gridx = 1; 275 273 gc.weightx = 0.5; 276 pnl.add(tfMinX = new JosmTextField(), gc);274 pnl.add(tfMinX, gc); 277 275 valMinX = new TileCoordinateValidator(tfMinX); 278 276 SelectAllOnFocusGainedDecorator.decorate(tfMinX); … … 282 280 gc.gridx = 2; 283 281 gc.weightx = 0.5; 284 pnl.add(tfMaxX = new JosmTextField(), gc);282 pnl.add(tfMaxX, gc); 285 283 valMaxX = new TileCoordinateValidator(tfMaxX); 286 284 SelectAllOnFocusGainedDecorator.decorate(tfMaxX); … … 295 293 gc.gridx = 1; 296 294 gc.weightx = 0.5; 297 pnl.add(tfMinY = new JosmTextField(), gc);295 pnl.add(tfMinY, gc); 298 296 valMinY = new TileCoordinateValidator(tfMinY); 299 297 SelectAllOnFocusGainedDecorator.decorate(tfMinY); … … 303 301 gc.gridx = 2; 304 302 gc.weightx = 0.5; 305 pnl.add(tfMaxY = new JosmTextField(), gc);303 pnl.add(tfMaxY, gc); 306 304 valMaxY = new TileCoordinateValidator(tfMaxY); 307 305 SelectAllOnFocusGainedDecorator.decorate(tfMaxY); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java
r9996 r10179 37 37 private static final DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000"); 38 38 39 private JLabel lblMyCoordinates; 40 private JLabel lblMergedCoordinates; 41 private JLabel lblTheirCoordinates; 42 43 private JLabel lblMyDeletedState; 44 private JLabel lblMergedDeletedState; 45 private JLabel lblTheirDeletedState; 46 47 private JLabel lblMyReferrers; 48 private JLabel lblTheirReferrers; 39 private final JLabel lblMyCoordinates = buildValueLabel("label.mycoordinates"); 40 private final JLabel lblMergedCoordinates = buildValueLabel("label.mergedcoordinates"); 41 private final JLabel lblTheirCoordinates = buildValueLabel("label.theircoordinates"); 42 43 private final JLabel lblMyDeletedState = buildValueLabel("label.mydeletedstate"); 44 private final JLabel lblMergedDeletedState = buildValueLabel("label.mergeddeletedstate"); 45 private final JLabel lblTheirDeletedState = buildValueLabel("label.theirdeletedstate"); 46 47 private final JLabel lblMyReferrers = buildValueLabel("label.myreferrers"); 48 private final JLabel lblTheirReferrers = buildValueLabel("label.theirreferrers"); 49 49 50 50 private final transient PropertiesMergeModel model; … … 61 61 } 62 62 63 protected JLabel buildValueLabel(String name) { 63 protected static JLabel buildValueLabel(String name) { 64 64 JLabel lbl = new JLabel(); 65 65 lbl.setName(name); … … 129 129 gc.weightx = 0.33; 130 130 gc.weighty = 0.0; 131 add(lblMyCoordinates = buildValueLabel("label.mycoordinates"), gc);131 add(lblMyCoordinates, gc); 132 132 133 133 gc.gridx = 2; … … 147 147 gc.weightx = 0.33; 148 148 gc.weighty = 0.0; 149 add(lblMergedCoordinates = buildValueLabel("label.mergedcoordinates"), gc);149 add(lblMergedCoordinates, gc); 150 150 151 151 gc.gridx = 4; … … 164 164 gc.weightx = 0.33; 165 165 gc.weighty = 0.0; 166 add(lblTheirCoordinates = buildValueLabel("label.theircoordinates"), gc);166 add(lblTheirCoordinates, gc); 167 167 168 168 // --------------------------------------------------- … … 198 198 gc.weightx = 0.33; 199 199 gc.weighty = 0.0; 200 add(lblMyDeletedState = buildValueLabel("label.mydeletedstate"), gc);200 add(lblMyDeletedState, gc); 201 201 202 202 gc.gridx = 2; … … 216 216 gc.weightx = 0.33; 217 217 gc.weighty = 0.0; 218 add(lblMergedDeletedState = buildValueLabel("label.mergeddeletedstate"), gc);218 add(lblMergedDeletedState, gc); 219 219 220 220 gc.gridx = 4; … … 234 234 gc.weightx = 0.33; 235 235 gc.weighty = 0.0; 236 add(lblTheirDeletedState = buildValueLabel("label.theirdeletedstate"), gc);236 add(lblTheirDeletedState, gc); 237 237 238 238 // --------------------------------------------------- … … 270 270 gc.weightx = 0.33; 271 271 gc.weighty = 0.0; 272 add(lblMyReferrers = buildValueLabel("label.myreferrers"), gc);272 add(lblMyReferrers, gc); 273 273 274 274 gc.gridx = 5; … … 278 278 gc.weightx = 0.33; 279 279 gc.weighty = 0.0; 280 add(lblTheirReferrers = buildValueLabel("label.theirreferrers"), gc);280 add(lblTheirReferrers, gc); 281 281 } 282 282 … … 289 289 } 290 290 291 p ublic String coordToString(LatLon coord) {291 protected static String coordToString(LatLon coord) { 292 292 if (coord == null) 293 293 return tr("(none)"); … … 301 301 } 302 302 303 p ublic String deletedStateToString(Boolean deleted) {303 protected static String deletedStateToString(Boolean deleted) { 304 304 if (deleted == null) 305 305 return tr("(none)"); … … 310 310 } 311 311 312 p ublic String referrersToString(List<OsmPrimitive> referrers) {312 protected static String referrersToString(List<OsmPrimitive> referrers) { 313 313 if (referrers.isEmpty()) 314 314 return tr("(none)"); … … 390 390 } 391 391 392 /** 393 * Returns properties merge model. 394 * @return properties merge model 395 */ 392 396 public PropertiesMergeModel getModel() { 393 397 return model; -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r10035 r10179 172 172 spTagConflictTypes.setTopComponent(buildTagConflictResolverPanel()); 173 173 spTagConflictTypes.setBottomComponent(buildRelationMemberConflictResolverPanel()); 174 getContentPane().add(pnlButtons = buildButtonPanel(), BorderLayout.SOUTH); 174 pnlButtons = buildButtonPanel(); 175 getContentPane().add(pnlButtons, BorderLayout.SOUTH); 175 176 addWindowListener(new AdjustDividerLocationAction()); 176 177 HelpUtil.setHelpContext(getRootPane(), ht("/")); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r10035 r10179 57 57 } 58 58 59 private TagConflictResolver allPrimitivesResolver; 60 private transient Map<OsmPrimitiveType, TagConflictResolver> resolvers; 61 private JTabbedPane tpResolvers; 59 private final TagConflictResolver allPrimitivesResolver = new TagConflictResolver(); 60 private final transient Map<OsmPrimitiveType, TagConflictResolver> resolvers = new EnumMap<>(OsmPrimitiveType.class); 61 private final JTabbedPane tpResolvers = new JTabbedPane(); 62 62 private Mode mode; 63 63 private boolean canceled; 64 64 65 private final ImageIcon iconResolved; 66 private final ImageIcon iconUnresolved; 67 private StatisticsTableModel statisticsModel; 68 private JPanel pnlTagResolver; 65 private final ImageIcon iconResolved = ImageProvider.get("dialogs/conflict", "tagconflictresolved"); 66 private final ImageIcon iconUnresolved = ImageProvider.get("dialogs/conflict", "tagconflictunresolved"); 67 private final StatisticsTableModel statisticsModel = new StatisticsTableModel(); 68 private final JPanel pnlTagResolver = new JPanel(new BorderLayout()); 69 69 70 70 /** … … 75 75 super(GuiHelper.getFrameForComponent(owner), ModalityType.DOCUMENT_MODAL); 76 76 build(); 77 iconResolved = ImageProvider.get("dialogs/conflict", "tagconflictresolved");78 iconUnresolved = ImageProvider.get("dialogs/conflict", "tagconflictunresolved");79 77 } 80 78 81 79 protected final void build() { 82 80 setTitle(tr("Conflicts in pasted tags")); 83 allPrimitivesResolver = new TagConflictResolver();84 resolvers = new EnumMap<>(OsmPrimitiveType.class);85 81 for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) { 86 82 resolvers.put(type, new TagConflictResolver()); 87 83 resolvers.get(type).getModel().addPropertyChangeListener(this); 88 84 } 89 tpResolvers = new JTabbedPane();90 85 getContentPane().setLayout(new GridBagLayout()); 91 86 mode = null; … … 102 97 gc.weightx = 1.0; 103 98 gc.weighty = 1.0; 104 getContentPane().add(pnlTagResolver = new JPanel(new BorderLayout()), gc);99 getContentPane().add(pnlTagResolver, gc); 105 100 gc.gridx = 0; 106 101 gc.gridy = 2; … … 131 126 protected JPanel buildSourceAndTargetInfoPanel() { 132 127 JPanel pnl = new JPanel(new BorderLayout()); 133 statisticsModel = new StatisticsTableModel();134 128 pnl.add(new StatisticsInfoTable(statisticsModel), BorderLayout.CENTER); 135 129 return pnl; -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
r9548 r10179 40 40 public class RelationMemberConflictResolver extends JPanel { 41 41 42 private AutoCompletingTextField tfRole; 43 private AutoCompletingTextField tfKey; 44 private AutoCompletingTextField tfValue; 42 private final AutoCompletingTextField tfRole = new AutoCompletingTextField(10); 43 private final AutoCompletingTextField tfKey = new AutoCompletingTextField(10); 44 private final AutoCompletingTextField tfValue = new AutoCompletingTextField(10); 45 45 private JCheckBox cbTagRelations; 46 46 private final RelationMemberConflictResolverModel model; 47 private RelationMemberConflictResolverTable tblResolver; 48 private JMultilineLabel lblHeader; 47 private final RelationMemberConflictResolverTable tblResolver; 48 private final JMultilineLabel lblHeader = new JMultilineLabel(""); 49 49 50 50 protected final void build() { 51 51 setLayout(new GridBagLayout()); 52 52 final JPanel pnl = new JPanel(new BorderLayout()); 53 pnl.add(lblHeader = new JMultilineLabel(""));53 pnl.add(lblHeader); 54 54 GridBagConstraints gc = new GridBagConstraints(); 55 55 gc.fill = GridBagConstraints.HORIZONTAL; … … 63 63 gc.fill = GridBagConstraints.BOTH; 64 64 gc.insets = new Insets(0, 0, 0, 0); 65 add(new JScrollPane(tblResolver = new RelationMemberConflictResolverTable(model)), gc);65 add(new JScrollPane(tblResolver), gc); 66 66 67 67 final JPanel pnl2 = new JPanel(); … … 78 78 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); 79 79 pnl.add(new JLabel(tr("Role:"))); 80 pnl.add(tfRole = new AutoCompletingTextField(10));80 pnl.add(tfRole); 81 81 tfRole.setToolTipText(tr("Enter a role for all relation memberships")); 82 82 pnl.add(new JButton(new ApplyRoleAction())); … … 102 102 pnl.add(cbTagRelations); 103 103 pnl.add(new JLabel(trc("tag", "Key:"))); 104 pnl.add(tfKey = new AutoCompletingTextField(10));104 pnl.add(tfKey); 105 105 tfKey.setToolTipText(tr("<html>Enter a tag key, e.g. <strong><tt>fixme</tt></strong></html>")); 106 106 pnl.add(new JLabel(tr("Value:"))); 107 pnl.add(tfValue = new AutoCompletingTextField(10));107 pnl.add(tfValue); 108 108 tfValue.setToolTipText(tr("<html>Enter a tag value, e.g. <strong><tt>check members</tt></strong></html>")); 109 109 cbTagRelations.setSelected(false); … … 120 120 public RelationMemberConflictResolver(RelationMemberConflictResolverModel model) { 121 121 this.model = model; 122 this.tblResolver = new RelationMemberConflictResolverTable(model); 122 123 build(); 123 124 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolver.java
r9543 r10179 21 21 * This is a UI widget for resolving tag conflicts, i.e. differences of the tag values 22 22 * of multiple {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s. 23 * 24 * 23 * @since 2008 25 24 */ 26 25 public class TagConflictResolver extends JPanel { … … 29 28 private final TagConflictResolverModel model; 30 29 /** selects whether only tags with conflicts are displayed */ 31 private JCheckBox cbShowTagsWithConflictsOnly; 32 private JCheckBox cbShowTagsWithMultiValuesOnly; 30 private final JCheckBox cbShowTagsWithConflictsOnly = new JCheckBox(tr("Show tags with conflicts only")); 31 private final JCheckBox cbShowTagsWithMultiValuesOnly = new JCheckBox(tr("Show tags with multiple values only")); 32 33 /** 34 * Constructs a new {@code TagConflictResolver}. 35 */ 36 public TagConflictResolver() { 37 this.model = new TagConflictResolverModel(); 38 build(); 39 } 33 40 34 41 protected JPanel buildInfoPanel() { … … 47 54 gc.fill = GridBagConstraints.HORIZONTAL; 48 55 gc.weighty = 0.0; 49 pnl.add(cbShowTagsWithConflictsOnly = new JCheckBox(tr("Show tags with conflicts only")), gc);50 pnl.add(cbShowTagsWithMultiValuesOnly = new JCheckBox(tr("Show tags with multiple values only")), gc);56 pnl.add(cbShowTagsWithConflictsOnly, gc); 57 pnl.add(cbShowTagsWithMultiValuesOnly, gc); 51 58 cbShowTagsWithConflictsOnly.addChangeListener( 52 59 new ChangeListener() { … … 92 99 93 100 /** 94 * Constructs a new {@code TagConflictResolver}.95 */96 public TagConflictResolver() {97 this.model = new TagConflictResolverModel();98 build();99 }100 101 /**102 101 * Replies the model used by this dialog 103 102 * -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r10124 r10179 72 72 * browser with information about a changeset. Furthermore, it can select all objects in 73 73 * the current data layer being assigned to a specific changeset. 74 * 74 * @since 2613 75 75 */ 76 76 public class ChangesetDialog extends ToggleDialog { … … 162 162 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); 163 163 pnl.setBorder(null); 164 pnl.add(cbInSelectionOnly = new JCheckBox(tr("For selected objects only"))); 164 cbInSelectionOnly = new JCheckBox(tr("For selected objects only")); 165 pnl.add(cbInSelectionOnly); 165 166 cbInSelectionOnly.setToolTipText(tr("<html>Select to show changesets for the currently selected objects only.<br>" 166 167 + "Unselect to show all changesets for objects in the current data layer.</html>")); … … 183 184 JPanel pnl = new JPanel(new BorderLayout()); 184 185 pnl.add(buildFilterPanel(), BorderLayout.NORTH); 185 pnl.add(pnlList = buildListPanel(), BorderLayout.CENTER); 186 pnlList = buildListPanel(); 187 pnl.add(pnlList, BorderLayout.CENTER); 186 188 187 189 cbInSelectionOnly.addItemListener(new FilterChangeHandler()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java
r10035 r10179 69 69 /** the data model */ 70 70 private RelationMemberTableModel model; 71 private HtmlPanel htmlPanel; 71 private final HtmlPanel htmlPanel = new HtmlPanel(); 72 72 private boolean canceled; 73 private SideButton btnOK; 73 private final SideButton btnOK = new SideButton(new OKAction()); 74 74 75 75 protected JPanel buildRelationMemberTablePanel() { … … 82 82 protected JPanel buildButtonPanel() { 83 83 JPanel pnl = new JPanel(new FlowLayout()); 84 pnl.add(btnOK = new SideButton(new OKAction()));84 pnl.add(btnOK); 85 85 btnOK.setFocusable(true); 86 86 pnl.add(new SideButton(new CancelAction())); … … 93 93 model.addTableModelListener(this); 94 94 getContentPane().setLayout(new BorderLayout()); 95 getContentPane().add(htmlPanel = new HtmlPanel(), BorderLayout.NORTH);95 getContentPane().add(htmlPanel, BorderLayout.NORTH); 96 96 getContentPane().add(buildRelationMemberTablePanel(), BorderLayout.CENTER); 97 97 getContentPane().add(buildButtonPanel(), BorderLayout.SOUTH); -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r9996 r10179 89 89 import org.openstreetmap.josm.tools.Utils; 90 90 91 /** 92 * Dialog to configure the map painting style. 93 * @since 3843 94 */ 91 95 public class MapPaintDialog extends ToggleDialog { 92 96 93 97 protected StylesTable tblStyles; 94 98 protected StylesModel model; 95 protected DefaultListSelectionModel selectionModel; 99 protected final DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); 96 100 97 101 protected OnOffAction onoffAction; … … 144 148 145 149 tblStyles = new StylesTable(model); 146 tblStyles.setSelectionModel(selectionModel = new DefaultListSelectionModel());150 tblStyles.setSelectionModel(selectionModel); 147 151 tblStyles.addMouseListener(new PopupMenuHandler()); 148 152 tblStyles.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); … … 272 276 public void ensureSelectedIsVisible() { 273 277 int index = selectionModel.getMinSelectionIndex(); 274 if (index < 0) return; 275 if (index >= getRowCount()) return; 278 if (index < 0) 279 return; 280 if (index >= getRowCount()) 281 return; 276 282 tblStyles.scrollToVisible(index, 0); 277 283 tblStyles.repaint(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/SingleChangesetDownloadPanel.java
r10124 r10179 26 26 * This panel allows to enter the ID of single changeset and to download 27 27 * the respective changeset. 28 * 28 * @since 2689 29 29 */ 30 30 public class SingleChangesetDownloadPanel extends JPanel { 31 31 32 private ChangesetIdTextField tfChangesetId; 32 private final ChangesetIdTextField tfChangesetId = new ChangesetIdTextField(); 33 34 /** 35 * Constructs a new {@link SingleChangesetDownloadPanel} 36 */ 37 public SingleChangesetDownloadPanel() { 38 build(); 39 } 33 40 34 41 protected void build() { … … 42 49 43 50 add(new JLabel(tr("Changeset ID: "))); 44 add(tfChangesetId = new ChangesetIdTextField());51 add(tfChangesetId); 45 52 tfChangesetId.setToolTipText(tr("Enter a changeset id")); 46 53 SelectAllOnFocusGainedDecorator.decorate(tfChangesetId); … … 55 62 tfChangesetId.tryToPasteFromClipboard(); 56 63 } 57 }58 59 /**60 * Constructs a new {@link SingleChangesetDownloadPanel}61 */62 public SingleChangesetDownloadPanel() {63 build();64 64 } 65 65 … … 90 90 return; 91 91 int id = getChangesetId(); 92 if (id == 0) return; 92 if (id == 0) 93 return; 93 94 ChangesetContentDownloadTask task = new ChangesetContentDownloadTask( 94 95 SingleChangesetDownloadPanel.this, -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r10073 r10179 42 42 import org.openstreetmap.josm.tools.CheckParameterUtil; 43 43 44 45 44 /** 46 45 * This panel allows to specify a changeset query 47 * 46 * @since 2689 48 47 */ 49 48 public class AdvancedChangesetQueryPanel extends JPanel { 50 49 51 private JCheckBox cbUserRestriction; 52 private JCheckBox cbOpenAndCloseRestrictions; 53 private JCheckBox cbTimeRestrictions; 54 private JCheckBox cbBoundingBoxRestriction; 55 private UserRestrictionPanel pnlUserRestriction; 56 private OpenAndCloseStateRestrictionPanel pnlOpenAndCloseRestriction; 57 private TimeRestrictionPanel pnlTimeRestriction; 58 private BBoxRestrictionPanel pnlBoundingBoxRestriction; 50 private final JCheckBox cbUserRestriction = new JCheckBox(); 51 private final JCheckBox cbOpenAndCloseRestrictions = new JCheckBox(); 52 private final JCheckBox cbTimeRestrictions = new JCheckBox(); 53 private final JCheckBox cbBoundingBoxRestriction = new JCheckBox(); 54 private final UserRestrictionPanel pnlUserRestriction = new UserRestrictionPanel(); 55 private final OpenAndCloseStateRestrictionPanel pnlOpenAndCloseRestriction = new OpenAndCloseStateRestrictionPanel(); 56 private final TimeRestrictionPanel pnlTimeRestriction = new TimeRestrictionPanel(); 57 private final BBoxRestrictionPanel pnlBoundingBoxRestriction = new BBoxRestrictionPanel(); 58 59 /** 60 * Constructs a new {@code AdvancedChangesetQueryPanel}. 61 */ 62 public AdvancedChangesetQueryPanel() { 63 build(); 64 } 59 65 60 66 protected JPanel buildQueryPanel() { … … 69 75 gc.weightx = 0.0; 70 76 gc.fill = GridBagConstraints.HORIZONTAL; 71 pnl.add(cbUserRestriction = new JCheckBox(), gc);77 pnl.add(cbUserRestriction, gc); 72 78 cbUserRestriction.addItemListener(stateChangeHandler); 73 79 … … 79 85 gc.gridx = 1; 80 86 gc.weightx = 1.0; 81 pnl.add(pnlUserRestriction = new UserRestrictionPanel(), gc);87 pnl.add(pnlUserRestriction, gc); 82 88 83 89 // -- restricting the query to open and closed changesets … … 88 94 gc.weightx = 0.0; 89 95 gc.fill = GridBagConstraints.HORIZONTAL; 90 pnl.add(cbOpenAndCloseRestrictions = new JCheckBox(), gc);96 pnl.add(cbOpenAndCloseRestrictions, gc); 91 97 cbOpenAndCloseRestrictions.addItemListener(stateChangeHandler); 92 98 … … 98 104 gc.gridx = 1; 99 105 gc.weightx = 1.0; 100 pnl.add(pnlOpenAndCloseRestriction = new OpenAndCloseStateRestrictionPanel(), gc);106 pnl.add(pnlOpenAndCloseRestriction, gc); 101 107 102 108 // -- restricting the query to a specific time … … 107 113 gc.weightx = 0.0; 108 114 gc.fill = GridBagConstraints.HORIZONTAL; 109 pnl.add(cbTimeRestrictions = new JCheckBox(), gc);115 pnl.add(cbTimeRestrictions, gc); 110 116 cbTimeRestrictions.addItemListener(stateChangeHandler); 111 117 … … 117 123 gc.gridx = 1; 118 124 gc.weightx = 1.0; 119 pnl.add(pnlTimeRestriction = new TimeRestrictionPanel(), gc);125 pnl.add(pnlTimeRestriction, gc); 120 126 121 127 … … 127 133 gc.weightx = 0.0; 128 134 gc.fill = GridBagConstraints.HORIZONTAL; 129 pnl.add(cbBoundingBoxRestriction = new JCheckBox(), gc);135 pnl.add(cbBoundingBoxRestriction, gc); 130 136 cbBoundingBoxRestriction.addItemListener(stateChangeHandler); 131 137 … … 137 143 gc.gridx = 1; 138 144 gc.weightx = 1.0; 139 pnl.add(pnlBoundingBoxRestriction = new BBoxRestrictionPanel(), gc);145 pnl.add(pnlBoundingBoxRestriction, gc); 140 146 141 147 … … 155 161 JScrollPane spQueryPanel = GuiHelper.embedInVerticalScrollPane(buildQueryPanel()); 156 162 add(spQueryPanel, BorderLayout.CENTER); 157 }158 159 /**160 * Constructs a new {@code AdvancedChangesetQueryPanel}.161 */162 public AdvancedChangesetQueryPanel() {163 build();164 163 } 165 164 … … 241 240 class RestrictionGroupStateChangeHandler implements ItemListener { 242 241 protected void userRestrictionStateChanged() { 243 if (pnlUserRestriction == null) return; 242 if (pnlUserRestriction == null) 243 return; 244 244 pnlUserRestriction.setVisible(cbUserRestriction.isSelected()); 245 245 } 246 246 247 247 protected void openCloseRestrictionStateChanged() { 248 if (pnlOpenAndCloseRestriction == null) return; 248 if (pnlOpenAndCloseRestriction == null) 249 return; 249 250 pnlOpenAndCloseRestriction.setVisible(cbOpenAndCloseRestrictions.isSelected()); 250 251 } 251 252 252 253 protected void timeRestrictionsStateChanged() { 253 if (pnlTimeRestriction == null) return; 254 if (pnlTimeRestriction == null) 255 return; 254 256 pnlTimeRestriction.setVisible(cbTimeRestrictions.isSelected()); 255 257 } 256 258 257 259 protected void boundingBoxRestrictionChanged() { 258 if (pnlBoundingBoxRestriction == null) return; 260 if (pnlBoundingBoxRestriction == null) 261 return; 259 262 pnlBoundingBoxRestriction.setVisible(cbBoundingBoxRestriction.isSelected()); 260 263 } … … 282 285 private static class OpenAndCloseStateRestrictionPanel extends JPanel { 283 286 284 private JRadioButton rbOpenOnly; 285 private JRadioButton rbClosedOnly; 286 private JRadioButton rbBoth; 287 private final JRadioButton rbOpenOnly = new JRadioButton(); 288 private final JRadioButton rbClosedOnly = new JRadioButton(); 289 private final JRadioButton rbBoth = new JRadioButton(); 290 291 OpenAndCloseStateRestrictionPanel() { 292 build(); 293 } 287 294 288 295 protected void build() { … … 299 306 gc.fill = GridBagConstraints.HORIZONTAL; 300 307 gc.weightx = 0.0; 301 add(rbOpenOnly = new JRadioButton(), gc);308 add(rbOpenOnly, gc); 302 309 303 310 gc.gridx = 1; … … 308 315 gc.gridx = 0; 309 316 gc.weightx = 0.0; 310 add(rbClosedOnly = new JRadioButton(), gc);317 add(rbClosedOnly, gc); 311 318 312 319 gc.gridx = 1; … … 317 324 gc.gridx = 0; 318 325 gc.weightx = 0.0; 319 add(rbBoth = new JRadioButton(), gc);326 add(rbBoth, gc); 320 327 321 328 gc.gridx = 1; … … 327 334 bgRestrictions.add(rbClosedOnly); 328 335 bgRestrictions.add(rbOpenOnly); 329 }330 331 OpenAndCloseStateRestrictionPanel() {332 build();333 336 } 334 337 … … 369 372 370 373 /** 371 * This is the panel for selecting whether the query should be restricted to a specific 372 * user 373 * 374 * This is the panel for selecting whether the query should be restricted to a specific user 374 375 */ 375 376 private static class UserRestrictionPanel extends JPanel { 376 private ButtonGroup bgUserRestrictions; 377 private JRadioButton rbRestrictToMyself; 378 private JRadioButton rbRestrictToUid; 379 private JRadioButton rbRestrictToUserName; 380 private JosmTextField tfUid; 377 private final ButtonGroup bgUserRestrictions = new ButtonGroup(); 378 private final JRadioButton rbRestrictToMyself = new JRadioButton(); 379 private final JRadioButton rbRestrictToUid = new JRadioButton(); 380 private final JRadioButton rbRestrictToUserName = new JRadioButton(); 381 private final JosmTextField tfUid = new JosmTextField(10); 381 382 private transient UidInputFieldValidator valUid; 382 private JosmTextField tfUserName; 383 private final JosmTextField tfUserName = new JosmTextField(10); 383 384 private transient UserNameValidator valUserName; 384 private JMultilineLabel lblRestrictedToMyself; 385 private final JMultilineLabel lblRestrictedToMyself = new JMultilineLabel(tr("Only changesets owned by myself")); 386 387 UserRestrictionPanel() { 388 build(); 389 } 385 390 386 391 protected JPanel buildUidInputPanel() { … … 393 398 394 399 gc.gridx = 1; 395 pnl.add(tfUid = new JosmTextField(10), gc);400 pnl.add(tfUid, gc); 396 401 SelectAllOnFocusGainedDecorator.decorate(tfUid); 397 402 valUid = UidInputFieldValidator.decorate(tfUid); … … 413 418 414 419 gc.gridx = 1; 415 pnl.add(tfUserName = new JosmTextField(10), gc);420 pnl.add(tfUserName, gc); 416 421 SelectAllOnFocusGainedDecorator.decorate(tfUserName); 417 422 valUserName = new UserNameValidator(tfUserName); … … 440 445 gc.fill = GridBagConstraints.HORIZONTAL; 441 446 gc.weightx = 0.0; 442 add(rbRestrictToMyself = new JRadioButton(), gc);447 add(rbRestrictToMyself, gc); 443 448 rbRestrictToMyself.addItemListener(userRestrictionChangeHandler); 444 449 … … 446 451 gc.fill = GridBagConstraints.HORIZONTAL; 447 452 gc.weightx = 1.0; 448 add(lblRestrictedToMyself = new JMultilineLabel(tr("Only changesets owned by myself")), gc);453 add(lblRestrictedToMyself, gc); 449 454 450 455 gc.gridx = 0; … … 452 457 gc.fill = GridBagConstraints.HORIZONTAL; 453 458 gc.weightx = 0.0; 454 add(rbRestrictToUid = new JRadioButton(), gc);459 add(rbRestrictToUid, gc); 455 460 rbRestrictToUid.addItemListener(userRestrictionChangeHandler); 456 461 … … 470 475 gc.fill = GridBagConstraints.HORIZONTAL; 471 476 gc.weightx = 0.0; 472 add(rbRestrictToUserName = new JRadioButton(), gc);477 add(rbRestrictToUserName, gc); 473 478 rbRestrictToUserName.addItemListener(userRestrictionChangeHandler); 474 479 … … 484 489 add(buildUserNameInputPanel(), gc); 485 490 486 bgUserRestrictions = new ButtonGroup();487 491 bgUserRestrictions.add(rbRestrictToMyself); 488 492 bgUserRestrictions.add(rbRestrictToUid); 489 493 bgUserRestrictions.add(rbRestrictToUserName); 490 }491 492 UserRestrictionPanel() {493 build();494 494 } 495 495 … … 637 637 private static class TimeRestrictionPanel extends JPanel { 638 638 639 private JRadioButton rbClosedAfter; 640 private JRadioButton rbClosedAfterAndCreatedBefore; 641 private JosmTextField tfClosedAfterDate1; 639 private final JRadioButton rbClosedAfter = new JRadioButton(); 640 private final JRadioButton rbClosedAfterAndCreatedBefore = new JRadioButton(); 641 private final JosmTextField tfClosedAfterDate1 = new JosmTextField(); 642 642 private transient DateValidator valClosedAfterDate1; 643 private JosmTextField tfClosedAfterTime1; 643 private final JosmTextField tfClosedAfterTime1 = new JosmTextField(); 644 644 private transient TimeValidator valClosedAfterTime1; 645 private JosmTextField tfClosedAfterDate2; 645 private final JosmTextField tfClosedAfterDate2 = new JosmTextField(); 646 646 private transient DateValidator valClosedAfterDate2; 647 private JosmTextField tfClosedAfterTime2; 647 private final JosmTextField tfClosedAfterTime2 = new JosmTextField(); 648 648 private transient TimeValidator valClosedAfterTime2; 649 private JosmTextField tfCreatedBeforeDate; 649 private final JosmTextField tfCreatedBeforeDate = new JosmTextField(); 650 650 private transient DateValidator valCreatedBeforeDate; 651 private JosmTextField tfCreatedBeforeTime; 651 private final JosmTextField tfCreatedBeforeTime = new JosmTextField(); 652 652 private transient TimeValidator valCreatedBeforeTime; 653 654 TimeRestrictionPanel() { 655 build(); 656 } 653 657 654 658 protected JPanel buildClosedAfterInputPanel() { … … 662 666 gc.gridx = 1; 663 667 gc.weightx = 0.7; 664 pnl.add(tfClosedAfterDate1 = new JosmTextField(), gc);668 pnl.add(tfClosedAfterDate1, gc); 665 669 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate1); 666 670 valClosedAfterDate1 = DateValidator.decorate(tfClosedAfterDate1); … … 673 677 gc.gridx = 3; 674 678 gc.weightx = 0.3; 675 pnl.add(tfClosedAfterTime1 = new JosmTextField(), gc);679 pnl.add(tfClosedAfterTime1, gc); 676 680 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime1); 677 681 valClosedAfterTime1 = TimeValidator.decorate(tfClosedAfterTime1); … … 696 700 gc.gridx = 2; 697 701 gc.weightx = 0.7; 698 pnl.add(tfClosedAfterDate2 = new JosmTextField(), gc);702 pnl.add(tfClosedAfterDate2, gc); 699 703 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate2); 700 704 valClosedAfterDate2 = DateValidator.decorate(tfClosedAfterDate2); … … 706 710 gc.gridx = 4; 707 711 gc.weightx = 0.3; 708 pnl.add(tfClosedAfterTime2 = new JosmTextField(), gc);712 pnl.add(tfClosedAfterTime2, gc); 709 713 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime2); 710 714 valClosedAfterTime2 = TimeValidator.decorate(tfClosedAfterTime2); … … 726 730 gc.gridx = 2; 727 731 gc.weightx = 0.7; 728 pnl.add(tfCreatedBeforeDate = new JosmTextField(), gc);732 pnl.add(tfCreatedBeforeDate, gc); 729 733 SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeDate); 730 734 valCreatedBeforeDate = DateValidator.decorate(tfCreatedBeforeDate); … … 737 741 gc.gridx = 4; 738 742 gc.weightx = 0.3; 739 pnl.add(tfCreatedBeforeTime = new JosmTextField(), gc);743 pnl.add(tfCreatedBeforeTime, gc); 740 744 SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeTime); 741 745 valCreatedBeforeTime = TimeValidator.decorate(tfCreatedBeforeTime); … … 762 766 gc.fill = GridBagConstraints.HORIZONTAL; 763 767 gc.weightx = 0.0; 764 add(rbClosedAfter = new JRadioButton(), gc);768 add(rbClosedAfter, gc); 765 769 766 770 gc.gridx = 1; … … 783 787 gc.fill = GridBagConstraints.HORIZONTAL; 784 788 gc.weightx = 0.0; 785 add(rbClosedAfterAndCreatedBefore = new JRadioButton(), gc);789 add(rbClosedAfterAndCreatedBefore, gc); 786 790 787 791 gc.gridx = 1; … … 805 809 806 810 rbClosedAfter.setSelected(true); 807 }808 809 TimeRestrictionPanel() {810 build();811 811 } 812 812 … … 864 864 865 865 public void displayMessageIfInvalid() { 866 if (isValidChangesetQuery()) return; 866 if (isValidChangesetQuery()) 867 return; 867 868 HelpAwareOptionPane.showOptionDialog( 868 869 this, … … 949 950 950 951 public void displayMessageIfInvalid() { 951 if (isValidChangesetQuery()) return; 952 if (isValidChangesetQuery()) 953 return; 952 954 HelpAwareOptionPane.showOptionDialog( 953 955 this, … … 968 970 */ 969 971 private static class UidInputFieldValidator extends AbstractTextComponentValidator { 972 UidInputFieldValidator(JTextComponent tc) { 973 super(tc); 974 } 975 970 976 public static UidInputFieldValidator decorate(JTextComponent tc) { 971 977 return new UidInputFieldValidator(tc); 972 }973 974 UidInputFieldValidator(JTextComponent tc) {975 super(tc);976 978 } 977 979 … … 1006 1008 try { 1007 1009 int uid = Integer.parseInt(value.trim()); 1008 if (uid > 0) return uid; 1010 if (uid > 0) 1011 return uid; 1009 1012 return 0; 1010 1013 } catch (NumberFormatException e) { … … 1021 1024 */ 1022 1025 private static class DateValidator extends AbstractTextComponentValidator { 1026 DateValidator(JTextComponent tc) { 1027 super(tc); 1028 } 1029 1023 1030 public static DateValidator decorate(JTextComponent tc) { 1024 1031 return new DateValidator(tc); 1025 }1026 1027 DateValidator(JTextComponent tc) {1028 super(tc);1029 1032 } 1030 1033 … … 1088 1091 */ 1089 1092 private static class TimeValidator extends AbstractTextComponentValidator { 1093 TimeValidator(JTextComponent tc) { 1094 super(tc); 1095 } 1096 1090 1097 public static TimeValidator decorate(JTextComponent tc) { 1091 1098 return new TimeValidator(tc); 1092 1099 } 1093 1100 1094 TimeValidator(JTextComponent tc) {1095 super(tc);1096 }1097 1098 1101 @Override 1099 1102 public boolean isValid() { 1100 if (getComponent().getText().trim().isEmpty()) return true; 1103 if (getComponent().getText().trim().isEmpty()) 1104 return true; 1101 1105 return getDate() != null; 1102 1106 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
r8836 r10179 103 103 gc.fill = GridBagConstraints.HORIZONTAL; 104 104 gc.weightx = 1.0; 105 pnl.add(cbMyChangesetsOnly = new JCheckBox(tr("Download my changesets only")), gc); 105 cbMyChangesetsOnly = new JCheckBox(tr("Download my changesets only")); 106 pnl.add(cbMyChangesetsOnly, gc); 106 107 cbMyChangesetsOnly.setToolTipText( 107 108 tr("<html>Select to restrict the query to your changesets only.<br>Unselect to include all changesets in the query.</html>")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java
r9916 r10179 32 32 /** 33 33 * This is a modal dialog for entering query criteria to search for changesets. 34 * 34 * @since 2689 35 35 */ 36 36 public class ChangesetQueryDialog extends JDialog { 37 37 38 38 private JTabbedPane tpQueryPanels; 39 private BasicChangesetQueryPanel pnlBasicChangesetQueries; 40 private UrlBasedQueryPanel pnlUrlBasedQueries; 41 private AdvancedChangesetQueryPanel pnlAdvancedQueries; 39 private final BasicChangesetQueryPanel pnlBasicChangesetQueries = new BasicChangesetQueryPanel(); 40 private final UrlBasedQueryPanel pnlUrlBasedQueries = new UrlBasedQueryPanel(); 41 private final AdvancedChangesetQueryPanel pnlAdvancedQueries = new AdvancedChangesetQueryPanel(); 42 42 private boolean canceled; 43 44 /** 45 * Constructs a new {@code ChangesetQueryDialog}. 46 * @param parent parent window 47 */ 48 public ChangesetQueryDialog(Window parent) { 49 super(parent, ModalityType.DOCUMENT_MODAL); 50 build(); 51 } 43 52 44 53 protected JPanel buildContentPanel() { 45 54 tpQueryPanels = new JTabbedPane(); 46 tpQueryPanels.add(pnlBasicChangesetQueries = new BasicChangesetQueryPanel());47 tpQueryPanels.add(pnlUrlBasedQueries = new UrlBasedQueryPanel());48 tpQueryPanels.add(pnlAdvancedQueries = new AdvancedChangesetQueryPanel());55 tpQueryPanels.add(pnlBasicChangesetQueries); 56 tpQueryPanels.add(pnlUrlBasedQueries); 57 tpQueryPanels.add(pnlAdvancedQueries); 49 58 50 59 tpQueryPanels.setTitleAt(0, tr("Basic")); … … 92 101 93 102 addWindowListener(new WindowEventHandler()); 94 }95 96 public ChangesetQueryDialog(Window parent) {97 super(parent, ModalityType.DOCUMENT_MODAL);98 build();99 103 } 100 104 … … 184 188 } 185 189 break; 186 187 190 case 2: 188 191 if (getChangesetQuery() == null) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
r9079 r10179 31 31 public class UrlBasedQueryPanel extends JPanel { 32 32 33 private JosmTextField tfUrl; 34 private JLabel lblValid; 33 private final JosmTextField tfUrl = new JosmTextField(); 34 private final JLabel lblValid = new JLabel(); 35 36 /** 37 * Constructs a new {@code UrlBasedQueryPanel}. 38 */ 39 public UrlBasedQueryPanel() { 40 build(); 41 } 35 42 36 43 protected JPanel buildURLPanel() { … … 45 52 gc.weightx = 1.0; 46 53 gc.fill = GridBagConstraints.HORIZONTAL; 47 pnl.add(tfUrl = new JosmTextField(), gc);54 pnl.add(tfUrl, gc); 48 55 tfUrl.getDocument().addDocumentListener(new ChangetQueryUrlValidator()); 49 56 tfUrl.addFocusListener( … … 59 66 gc.weightx = 0.0; 60 67 gc.fill = GridBagConstraints.HORIZONTAL; 61 pnl.add(lblValid = new JLabel(), gc);68 pnl.add(lblValid, gc); 62 69 lblValid.setPreferredSize(new Dimension(20, 20)); 63 70 return pnl; … … 115 122 } 116 123 117 /**118 * Constructs a new {@code UrlBasedQueryPanel}.119 */120 public UrlBasedQueryPanel() {121 build();122 }123 124 124 protected boolean isValidChangesetQueryUrl(String text) { 125 125 return buildChangesetQuery(text) != null; … … 135 135 String path = url.getPath(); 136 136 String query = url.getQuery(); 137 if (path == null || !path.endsWith("/changesets")) return null; 137 if (path == null || !path.endsWith("/changesets")) 138 return null; 138 139 139 140 try { … … 170 171 171 172 protected void feedbackValid() { 172 if ("valid".equals(getCurrentFeedback())) return; 173 if ("valid".equals(getCurrentFeedback())) 174 return; 173 175 lblValid.setIcon(ImageProvider.get("dialogs", "valid")); 174 176 lblValid.setToolTipText(null); … … 177 179 178 180 protected void feedbackInvalid() { 179 if ("invalid".equals(getCurrentFeedback())) return; 181 if ("invalid".equals(getCurrentFeedback())) 182 return; 180 183 lblValid.setIcon(ImageProvider.get("warning-small")); 181 184 lblValid.setToolTipText(tr("This changeset query URL is invalid")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java
r9543 r10179 39 39 private final ReferringRelationsBrowserModel model; 40 40 private final transient OsmDataLayer layer; 41 private JCheckBox cbReadFull; 41 private final JCheckBox cbReadFull = new JCheckBox(tr("including immediate children of parent relations")); 42 42 private EditAction editAction; 43 44 /** 45 * Constructs a new {@code ReferringRelationsBrowser}. 46 * @param layer OSM data layer 47 * @param model referrinf relations browser model 48 */ 49 public ReferringRelationsBrowser(OsmDataLayer layer, ReferringRelationsBrowserModel model) { 50 this.model = model; 51 this.layer = layer; 52 build(); 53 } 43 54 44 55 /** … … 58 69 referrers.getModel().addListDataListener(reloadAction); 59 70 pnl.add(new SideButton(reloadAction)); 60 pnl.add(cbReadFull = new JCheckBox(tr("including immediate children of parent relations")));71 pnl.add(cbReadFull); 61 72 62 73 editAction = new EditAction(); … … 64 75 pnl.add(new SideButton(editAction)); 65 76 add(pnl, BorderLayout.SOUTH); 66 }67 68 public ReferringRelationsBrowser(OsmDataLayer layer, ReferringRelationsBrowserModel model) {69 this.model = model;70 this.layer = layer;71 build();72 77 } 73 78 … … 157 162 public void run() { 158 163 int idx = referrers.getSelectedIndex(); 159 if (idx < 0) return; 164 if (idx < 0) 165 return; 160 166 Relation r = model.getElementAt(idx); 161 if (r == null) return; 167 if (r == null) 168 return; 162 169 RelationEditor editor = RelationEditor.getEditor(getLayer(), r, null); 163 170 editor.setVisible(true); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java
r8998 r10179 154 154 list = customMap.get(sorter); 155 155 if (list == null) { 156 customMap.put(sorter, list = new LinkedList<>()); 156 list = new LinkedList<>(); 157 customMap.put(sorter, list); 157 158 } 158 159 list.add(m); -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r9606 r10179 47 47 48 48 /** displays information about the current download area */ 49 private JMultilineLabel lblCurrentDownloadArea; 49 private final JMultilineLabel lblCurrentDownloadArea = new JMultilineLabel(""); 50 50 private final JosmTextArea bboxDisplay = new JosmTextArea(); 51 51 /** the add action */ 52 private AddAction actAdd; 52 private final AddAction actAdd = new AddAction(); 53 53 54 54 /** … … 84 84 gc.anchor = GridBagConstraints.NORTHWEST; 85 85 gc.insets = new Insets(5, 5, 5, 5); 86 pnl.add(lblCurrentDownloadArea = new JMultilineLabel(""), gc);86 pnl.add(lblCurrentDownloadArea, gc); 87 87 88 88 gc.weightx = 1.0; … … 98 98 gc.weighty = 0.0; 99 99 gc.insets = new Insets(5, 5, 5, 5); 100 pnl.add(new JButton(actAdd = new AddAction()), gc);100 pnl.add(new JButton(actAdd), gc); 101 101 return pnl; 102 102 } … … 163 163 @Override 164 164 public void setDownloadArea(Bounds area) { 165 if (area == null) return; 165 if (area == null) 166 return; 166 167 this.currentArea = area; 167 168 bookmarks.clearSelection(); -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r10173 r10179 83 83 protected JCheckBox cbDownloadNotes; 84 84 /** the download action and button */ 85 private DownloadAction actDownload; 86 protected SideButton btnDownload; 85 private final DownloadAction actDownload = new DownloadAction(); 86 protected final SideButton btnDownload = new SideButton(actDownload); 87 87 88 88 private void makeCheckBoxRespondToEnter(JCheckBox cb) { … … 190 190 191 191 // -- download button 192 pnl.add(btnDownload = new SideButton(actDownload = new DownloadAction()));192 pnl.add(btnDownload); 193 193 InputMapUtils.enableEnter(btnDownload); 194 194 … … 201 201 SideButton btnCancel; 202 202 CancelAction actCancel = new CancelAction(); 203 pnl.add(btnCancel = new SideButton(actCancel)); 203 btnCancel = new SideButton(actCancel); 204 pnl.add(btnCancel); 204 205 InputMapUtils.enableEnter(btnCancel); 205 206 … … 209 210 210 211 // -- help button 211 SideButton btnHelp; 212 pnl.add(btnHelp = new SideButton(new ContextSensitiveHelpAction(getRootPane().getClientProperty("help").toString())));212 SideButton btnHelp = new SideButton(new ContextSensitiveHelpAction(getRootPane().getClientProperty("help").toString())); 213 pnl.add(btnHelp); 213 214 InputMapUtils.enableEnter(btnHelp); 214 215 -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r10055 r10179 83 83 gc.fill = GridBagConstraints.HORIZONTAL; 84 84 gc.anchor = GridBagConstraints.NORTHWEST; 85 add(referenceLatLonViewer = new LatLonViewer(model, PointInTimeType.REFERENCE_POINT_IN_TIME), gc); 85 referenceLatLonViewer = new LatLonViewer(model, PointInTimeType.REFERENCE_POINT_IN_TIME); 86 add(referenceLatLonViewer, gc); 86 87 87 88 gc.gridx = 1; … … 91 92 gc.fill = GridBagConstraints.HORIZONTAL; 92 93 gc.anchor = GridBagConstraints.NORTHWEST; 93 add(currentLatLonViewer = new LatLonViewer(model, PointInTimeType.CURRENT_POINT_IN_TIME), gc); 94 currentLatLonViewer = new LatLonViewer(model, PointInTimeType.CURRENT_POINT_IN_TIME); 95 add(currentLatLonViewer, gc); 94 96 95 97 // -------------------- … … 101 103 gc.weightx = 1.0; 102 104 gc.weighty = 0.0; 103 add(distanceViewer = new DistanceViewer(model), gc); 105 distanceViewer = new DistanceViewer(model); 106 add(distanceViewer, gc); 104 107 105 108 // the map panel … … 110 113 gc.weightx = 1.0; 111 114 gc.weighty = 1.0; 112 add(mapViewer = new MapViewer(model), gc); 115 mapViewer = new MapViewer(model); 116 add(mapViewer, gc); 113 117 mapViewer.setZoomContolsVisible(false); 114 118 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
r9543 r10179 34 34 35 35 /** 36 * Constructs a new {@code HistoryBrowser}. 37 */ 38 public HistoryBrowser() { 39 model = new HistoryBrowserModel(); 40 build(); 41 } 42 43 /** 44 * Constructs a new {@code HistoryBrowser}. 45 * @param history the history of an {@link OsmPrimitive} 46 */ 47 public HistoryBrowser(History history) { 48 this(); 49 populate(history); 50 } 51 52 /** 36 53 * creates the table which shows the list of versions 37 54 * … … 40 57 protected JPanel createVersionTablePanel() { 41 58 JPanel pnl = new JPanel(new BorderLayout()); 42 43 VersionTable versionTable = new VersionTable(model); 44 pnl.add(new JScrollPane(versionTable), BorderLayout.CENTER); 59 pnl.add(new JScrollPane(new VersionTable(model)), BorderLayout.CENTER); 45 60 return pnl; 46 61 } … … 82 97 */ 83 98 protected void build() { 84 JPanel left; 85 JPanel right; 99 JPanel left = createVersionTablePanel(); 100 JPanel right = createVersionComparePanel(); 86 101 setLayout(new BorderLayout()); 87 JSplitPane pane = new JSplitPane( 88 JSplitPane.HORIZONTAL_SPLIT, 89 left = createVersionTablePanel(), 90 right = createVersionComparePanel() 91 ); 102 JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); 92 103 add(pane, BorderLayout.CENTER); 93 104 … … 100 111 } 101 112 102 /**103 * constructor104 */105 public HistoryBrowser() {106 model = new HistoryBrowserModel();107 build();108 }109 110 /**111 * constructor112 * @param history the history of an {@link OsmPrimitive}113 */114 public HistoryBrowser(History history) {115 this();116 populate(history);117 }118 113 119 114 /** -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r10035 r10179 61 61 JPanel pnl = new JPanel(new BorderLayout()); 62 62 model = new DefaultListModel<>(); 63 pnl.add(new JScrollPane(lstOpenChangesets = new JList<>(model)), BorderLayout.CENTER); 63 lstOpenChangesets = new JList<>(model); 64 pnl.add(new JScrollPane(lstOpenChangesets), BorderLayout.CENTER); 64 65 lstOpenChangesets.setCellRenderer(new ChangesetCellRenderer()); 65 66 return pnl; … … 72 73 CloseAction closeAction = new CloseAction(); 73 74 lstOpenChangesets.addListSelectionListener(closeAction); 74 pnl.add(btnCloseChangesets = new SideButton(closeAction)); 75 btnCloseChangesets = new SideButton(closeAction); 76 pnl.add(btnCloseChangesets); 75 77 InputMapUtils.enableEnter(btnCloseChangesets); 76 78 77 79 // -- cancel action 78 SideButton btn; 79 pnl.add(btn = new SideButton(new CancelAction()));80 SideButton btn = new SideButton(new CancelAction()); 81 pnl.add(btn); 80 82 btn.setFocusable(true); 81 83 return pnl; -
trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
r10173 r10179 117 117 public void prepareForOsmApiCredentials(String username, String password) { 118 118 setTitle(tr("Enter credentials for OSM API")); 119 getContentPane().add(pnlCredentials = new OsmApiCredentialsPanel(this), BorderLayout.CENTER); 119 pnlCredentials = new OsmApiCredentialsPanel(this); 120 getContentPane().add(pnlCredentials, BorderLayout.CENTER); 120 121 pnlCredentials.init(username, password); 121 122 validate(); … … 124 125 public void prepareForOtherHostCredentials(String username, String password, String host) { 125 126 setTitle(tr("Enter credentials for host")); 126 getContentPane().add(pnlCredentials = new OtherHostCredentialsPanel(this, host), BorderLayout.CENTER); 127 pnlCredentials = new OtherHostCredentialsPanel(this, host); 128 getContentPane().add(pnlCredentials, BorderLayout.CENTER); 127 129 pnlCredentials.init(username, password); 128 130 validate(); … … 131 133 public void prepareForProxyCredentials(String username, String password) { 132 134 setTitle(tr("Enter credentials for HTTP proxy")); 133 getContentPane().add(pnlCredentials = new HttpProxyCredentialsPanel(this), BorderLayout.CENTER); 135 pnlCredentials = new HttpProxyCredentialsPanel(this); 136 getContentPane().add(pnlCredentials, BorderLayout.CENTER); 134 137 pnlCredentials.init(username, password); 135 138 validate(); … … 137 140 138 141 public String getUsername() { 139 if (pnlCredentials == null) return null; 142 if (pnlCredentials == null) 143 return null; 140 144 return pnlCredentials.getUserName(); 141 145 } 142 146 143 147 public char[] getPassword() { 144 if (pnlCredentials == null) return null; 148 if (pnlCredentials == null) 149 return null; 145 150 return pnlCredentials.getPassword(); 146 151 } 147 152 148 153 public boolean isSaveCredentials() { 149 if (pnlCredentials == null) return false; 154 if (pnlCredentials == null) 155 return false; 150 156 return pnlCredentials.isSaveCredentials(); 151 157 } … … 155 161 protected JosmPasswordField tfPassword; 156 162 protected JCheckBox cbSaveCredentials; 157 protected JMultilineLabel lblHeading; 158 protected JMultilineLabel lblWarning; 163 protected final JMultilineLabel lblHeading = new JMultilineLabel(""); 164 protected final JMultilineLabel lblWarning = new JMultilineLabel(""); 159 165 protected CredentialDialog owner; // owner Dependency Injection to use Key listeners for username and password text fields 160 166 … … 176 182 gc.weighty = 0.0; 177 183 gc.insets = new Insets(0, 0, 10, 0); 178 add(lblHeading = new JMultilineLabel(""), gc);184 add(lblHeading, gc); 179 185 180 186 gc.gridx = 0; … … 208 214 gc.weightx = 1.0; 209 215 gc.weighty = 0.0; 210 lblWarning = new JMultilineLabel("");211 216 lblWarning.setFont(lblWarning.getFont().deriveFont(Font.ITALIC)); 212 217 add(lblWarning, gc); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r10035 r10179 67 67 private SaveLayersModel model; 68 68 private UserAction action = UserAction.CANCEL; 69 private UploadAndSaveProgressRenderer pnlUploadLayers; 70 71 private SaveAndProceedAction saveAndProceedAction; 72 private SaveSessionAction saveSessionAction; 73 private DiscardAndProceedAction discardAndProceedAction; 74 private CancelAction cancelAction; 69 private final UploadAndSaveProgressRenderer pnlUploadLayers = new UploadAndSaveProgressRenderer(); 70 71 private final SaveAndProceedAction saveAndProceedAction = new SaveAndProceedAction(); 72 private final SaveSessionAction saveSessionAction = new SaveSessionAction(); 73 private final DiscardAndProceedAction discardAndProceedAction = new DiscardAndProceedAction(); 74 private final CancelAction cancelAction = new CancelAction(); 75 75 private transient SaveAndUploadTask saveAndUploadTask; 76 77 private final JButton saveAndProceedActionButton = new JButton(saveAndProceedAction); 78 79 /** 80 * Constructs a new {@code SaveLayersDialog}. 81 * @param parent parent component 82 */ 83 public SaveLayersDialog(Component parent) { 84 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 85 build(); 86 } 76 87 77 88 /** … … 96 107 } 97 108 98 private JButton saveAndProceedActionButton;99 100 109 /** 101 110 * builds the button row … … 106 115 JPanel pnl = new JPanel(new GridBagLayout()); 107 116 108 saveAndProceedAction = new SaveAndProceedAction();109 117 model.addPropertyChangeListener(saveAndProceedAction); 110 pnl.add(saveAndProceedActionButton = new JButton(saveAndProceedAction), GBC.std(0, 0).insets(5, 5, 0, 0).fill(GBC.HORIZONTAL)); 111 112 saveSessionAction = new SaveSessionAction(); 118 pnl.add(saveAndProceedActionButton, GBC.std(0, 0).insets(5, 5, 0, 0).fill(GBC.HORIZONTAL)); 119 113 120 pnl.add(new JButton(saveSessionAction), GBC.std(1, 0).insets(5, 5, 5, 0).fill(GBC.HORIZONTAL)); 114 121 115 discardAndProceedAction = new DiscardAndProceedAction();116 122 model.addPropertyChangeListener(discardAndProceedAction); 117 123 pnl.add(new JButton(discardAndProceedAction), GBC.std(0, 1).insets(5, 5, 0, 5).fill(GBC.HORIZONTAL)); 118 124 119 cancelAction = new CancelAction();120 125 pnl.add(new JButton(cancelAction), GBC.std(1, 1).insets(5, 5, 5, 5).fill(GBC.HORIZONTAL)); 121 126 122 127 JPanel pnl2 = new JPanel(new BorderLayout()); 123 pnl2.add(pnlUploadLayers = new UploadAndSaveProgressRenderer(), BorderLayout.CENTER);128 pnl2.add(pnlUploadLayers, BorderLayout.CENTER); 124 129 model.addPropertyChangeListener(pnlUploadLayers); 125 130 pnl2.add(pnl, BorderLayout.SOUTH); … … 137 142 this.saveAndProceedAction.initForSaveAndDelete(); 138 143 this.discardAndProceedAction.initForDiscardAndDelete(); 139 }140 141 public SaveLayersDialog(Component parent) {142 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);143 build();144 144 } 145 145 … … 311 311 public void cancel() { 312 312 switch(model.getMode()) { 313 case EDITING_DATA: cancelWhenInEditingModel(); break; 314 case UPLOADING_AND_SAVING: cancelSafeAndUploadTask(); break; 313 case EDITING_DATA: cancelWhenInEditingModel(); 314 break; 315 case UPLOADING_AND_SAVING: cancelSafeAndUploadTask(); 316 break; 315 317 } 316 318 } … … 350 352 Mode mode = (Mode) evt.getNewValue(); 351 353 switch(mode) { 352 case EDITING_DATA: setEnabled(true); break; 353 case UPLOADING_AND_SAVING: setEnabled(false); break; 354 case EDITING_DATA: setEnabled(true); 355 break; 356 case UPLOADING_AND_SAVING: setEnabled(false); 357 break; 354 358 } 355 359 } … … 433 437 SaveLayersModel.Mode mode = (SaveLayersModel.Mode) evt.getNewValue(); 434 438 switch(mode) { 435 case EDITING_DATA: setEnabled(true); break; 436 case UPLOADING_AND_SAVING: setEnabled(false); break; 439 case EDITING_DATA: setEnabled(true); 440 break; 441 case UPLOADING_AND_SAVING: setEnabled(false); 442 break; 437 443 } 438 444 } … … 560 566 protected void warnBecauseOfUnsavedData() { 561 567 int numProblems = model.getNumCancel() + model.getNumFailed(); 562 if (numProblems == 0) return; 568 if (numProblems == 0) 569 return; 563 570 Main.warn(numProblems + " problems occured during upload/save"); 564 571 String msg = trn( -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r10035 r10179 51 51 public class UploadSelectionDialog extends JDialog { 52 52 53 private OsmPrimitiveList lstSelectedPrimitives; 54 private OsmPrimitiveList lstDeletedPrimitives; 53 private final OsmPrimitiveList lstSelectedPrimitives = new OsmPrimitiveList(); 54 private final OsmPrimitiveList lstDeletedPrimitives = new OsmPrimitiveList(); 55 55 private JSplitPane spLists; 56 56 private boolean canceled; … … 71 71 lbl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 72 72 pnl.add(lbl, BorderLayout.NORTH); 73 pnl.add(new JScrollPane(lstSelectedPrimitives = new OsmPrimitiveList()), BorderLayout.CENTER);73 pnl.add(new JScrollPane(lstSelectedPrimitives), BorderLayout.CENTER); 74 74 lbl.setLabelFor(lstSelectedPrimitives); 75 75 return pnl; … … 81 81 lbl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 82 82 pnl.add(lbl, BorderLayout.NORTH); 83 pnl.add(new JScrollPane(lstDeletedPrimitives = new OsmPrimitiveList()), BorderLayout.CENTER);83 pnl.add(new JScrollPane(lstDeletedPrimitives), BorderLayout.CENTER); 84 84 lbl.setLabelFor(lstDeletedPrimitives); 85 85 return pnl; … … 89 89 JPanel pnl = new JPanel(new FlowLayout()); 90 90 ContinueAction continueAction = new ContinueAction(); 91 pnl.add(btnContinue = new SideButton(continueAction)); 91 btnContinue = new SideButton(continueAction); 92 pnl.add(btnContinue); 92 93 btnContinue.setFocusable(true); 93 94 lstDeletedPrimitives.getSelectionModel().addListSelectionListener(continueAction); … … 176 177 177 178 static class OsmPrimitiveList extends JList<OsmPrimitive> { 179 OsmPrimitiveList() { 180 this(new OsmPrimitiveListModel()); 181 } 182 183 OsmPrimitiveList(OsmPrimitiveListModel model) { 184 super(model); 185 init(); 186 } 187 178 188 protected void init() { 179 189 setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 180 190 setCellRenderer(new OsmPrimitivRenderer()); 181 }182 183 OsmPrimitiveList() {184 this(new OsmPrimitiveListModel());185 }186 187 OsmPrimitiveList(OsmPrimitiveListModel model) {188 super(model);189 init();190 191 } 191 192 … … 208 209 public int compare(OsmPrimitive o1, OsmPrimitive o2) { 209 210 int ret = OsmPrimitiveType.from(o1).compareTo(OsmPrimitiveType.from(o2)); 210 if (ret != 0) return ret; 211 if (ret != 0) 212 return ret; 211 213 return o1.getDisplayName(formatter).compareTo(o1.getDisplayName(formatter)); 212 214 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r10173 r10179 56 56 private transient Map<UploadStrategy, JLabel> lblNumRequests; 57 57 private transient Map<UploadStrategy, JMultilineLabel> lblStrategies; 58 private JosmTextField tfChunkSize; 59 private JPanel pnlMultiChangesetPolicyPanel; 60 private JRadioButton rbFillOneChangeset; 61 private JRadioButton rbUseMultipleChangesets; 58 private final JosmTextField tfChunkSize = new JosmTextField(4); 59 private final JPanel pnlMultiChangesetPolicyPanel = new JPanel(new GridBagLayout()); 60 private final JRadioButton rbFillOneChangeset = new JRadioButton( 61 tr("Fill up one changeset and return to the Upload Dialog")); 62 private final JRadioButton rbUseMultipleChangesets = new JRadioButton( 63 tr("Open and use as many new changesets as necessary")); 62 64 private JMultilineLabel lblMultiChangesetPoliciesHeader; 63 65 … … 138 140 gc.weighty = 0.0; 139 141 gc.gridwidth = 1; 140 pnl.add(tfChunkSize = new JosmTextField(4), gc);142 pnl.add(tfChunkSize, gc); 141 143 gc.gridx = 3; 142 144 gc.gridy = 2; … … 181 183 182 184 protected JPanel buildMultiChangesetPolicyPanel() { 183 pnlMultiChangesetPolicyPanel = new JPanel(new GridBagLayout());184 185 GridBagConstraints gc = new GridBagConstraints(); 185 186 gc.gridx = 0; … … 188 189 gc.anchor = GridBagConstraints.FIRST_LINE_START; 189 190 gc.weightx = 1.0; 190 pnlMultiChangesetPolicyPanel.add(lblMultiChangesetPoliciesHeader = new JMultilineLabel(191 lblMultiChangesetPoliciesHeader = new JMultilineLabel( 191 192 tr("<html>There are <strong>multiple changesets</strong> necessary in order to upload {0} objects. " + 192 193 "Which strategy do you want to use?</html>", 193 numUploadedObjects)), gc); 194 numUploadedObjects)); 195 pnlMultiChangesetPolicyPanel.add(lblMultiChangesetPoliciesHeader, gc); 194 196 gc.gridy = 1; 195 pnlMultiChangesetPolicyPanel.add(rbFillOneChangeset = new JRadioButton( 196 tr("Fill up one changeset and return to the Upload Dialog")), gc); 197 gc.gridy = 2; 198 pnlMultiChangesetPolicyPanel.add(rbUseMultipleChangesets = new JRadioButton( 199 tr("Open and use as many new changesets as necessary")), gc); 197 pnlMultiChangesetPolicyPanel.add(rbFillOneChangeset, gc); 198 gc.gridy = 2; 199 pnlMultiChangesetPolicyPanel.add(rbUseMultipleChangesets, gc); 200 200 201 201 ButtonGroup bgMultiChangesetPolicies = new ButtonGroup(); … … 473 473 public void itemStateChanged(ItemEvent e) { 474 474 UploadStrategy strategy = getUploadStrategy(); 475 if (strategy == null) return; 475 if (strategy == null) 476 return; 476 477 switch(strategy) { 477 478 case CHUNKED_DATASET_STRATEGY: -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r10168 r10179 1580 1580 int offset = 200; 1581 1581 for (String part: cachedTileLoader.getStats().split("\n")) { 1582 myDrawString(g, tr("Cache stats: {0}", part), 50,offset += 15);1583 }1584 1582 offset += 15; 1583 myDrawString(g, tr("Cache stats: {0}", part), 50, offset); 1584 } 1585 1585 } 1586 1586 } -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r10173 r10179 103 103 104 104 public double getPPD() { 105 if (!Main.isDisplayingMapView()) return Main.getProjection().getDefaultZoomInPPD(); 105 if (!Main.isDisplayingMapView()) 106 return Main.getProjection().getDefaultZoomInPPD(); 106 107 ProjectionBounds bounds = Main.map.mapView.getProjectionBounds(); 107 108 return Main.map.mapView.getWidth() / (bounds.maxEast - bounds.minEast); … … 122 123 123 124 public void displace(double dx, double dy) { 124 setOffset(this.dx += dx, this.dy += dy); 125 } 126 125 this.dx += dx; 126 this.dy += dy; 127 setOffset(this.dx, this.dy); 128 } 129 130 /** 131 * Returns imagery info. 132 * @return imagery info 133 */ 127 134 public ImageryInfo getInfo() { 128 135 return info; -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
r9078 r10179 98 98 MapPaintAction a = actions.get(k); 99 99 if (a == null) { 100 actions.put(k, a = new MapPaintAction(style)); 100 a = new MapPaintAction(style); 101 actions.put(k, a); 101 102 add(a.getButton()); 102 103 } else { -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r10035 r10179 37 37 public class PreferenceDialog extends JDialog { 38 38 39 private PreferenceTabbedPane tpPreferences; 39 private final PreferenceTabbedPane tpPreferences = new PreferenceTabbedPane(); 40 40 private boolean canceled; 41 42 /** 43 * Constructs a new {@code PreferenceDialog}. 44 * @param parent parent component 45 */ 46 public PreferenceDialog(Component parent) { 47 super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL); 48 build(); 49 this.setMinimumSize(new Dimension(600, 350)); 50 // set the maximum width to the current screen. If the dialog is opened on a 51 // smaller screen than before, this will reset the stored preference. 52 this.setMaximumSize(GuiHelper.getScreenSize()); 53 } 41 54 42 55 protected JPanel buildActionPanel() { … … 65 78 Container c = getContentPane(); 66 79 c.setLayout(new BorderLayout()); 67 c.add(tpPreferences = new PreferenceTabbedPane(), BorderLayout.CENTER);80 c.add(tpPreferences, BorderLayout.CENTER); 68 81 tpPreferences.buildGui(); 69 82 tpPreferences.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); … … 75 88 getRootPane().getActionMap().put("cancel", new CancelAction()); 76 89 HelpUtil.setHelpContext(getRootPane(), HelpUtil.ht("/Action/Preferences")); 77 }78 79 public PreferenceDialog(Component parent) {80 super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL);81 build();82 this.setMinimumSize(new Dimension(600, 350));83 // set the maximum width to the current screen. If the dialog is opened on a84 // smaller screen than before, this will reset the stored preference.85 this.setMaximumSize(GuiHelper.getScreenSize());86 90 } 87 91 … … 126 130 } 127 131 132 /** 133 * Select preferences tab by name. 134 * @param name preferences tab name (icon) 135 */ 128 136 public void selectPreferencesTabByName(String name) { 129 137 tpPreferences.selectTabByName(name); 130 138 } 131 139 140 /** 141 * Select preferences tab by class. 142 * @param clazz preferences tab class 143 */ 132 144 public void selectPreferencesTabByClass(Class<? extends TabPreferenceSetting> clazz) { 133 145 tpPreferences.selectTabByPref(clazz); 134 146 } 135 147 148 /** 149 * Select preferences sub-tab by class. 150 * @param clazz preferences sub-tab class 151 */ 136 152 public void selectSubPreferencesTabByClass(Class<? extends SubPreferenceSetting> clazz) { 137 153 tpPreferences.selectSubTabByPref(clazz); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r10114 r10179 1486 1486 Matcher m = Pattern.compile("^(.+);(.+)$").matcher(line); 1487 1487 if (m.matches()) { 1488 sources.add(last = new ExtendedSourceEntry(m.group(1), m.group(2))); 1488 last = new ExtendedSourceEntry(m.group(1), m.group(2)); 1489 sources.add(last); 1489 1490 } else { 1490 1491 Main.error(tr(getStr(I18nString.ILLEGAL_FORMAT_OF_ENTRY), url, line)); … … 1528 1529 1529 1530 class FileOrUrlCellEditor extends JPanel implements TableCellEditor { 1530 private JosmTextField tfFileName; 1531 private final JosmTextField tfFileName = new JosmTextField(); 1531 1532 private final CopyOnWriteArrayList<CellEditorListener> listeners; 1532 1533 private String value; … … 1544 1545 gc.weightx = 1.0; 1545 1546 gc.weighty = 1.0; 1546 add(tfFileName = new JosmTextField(), gc);1547 add(tfFileName, gc); 1547 1548 1548 1549 gc.gridx = 1; -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r10173 r10179 682 682 private JPanel actionParametersPanel; 683 683 684 private JButton upButton; 685 private JButton downButton; 686 private JButton removeButton; 687 private JButton addButton; 684 private final JButton upButton = createButton("up"); 685 private final JButton downButton = createButton("down"); 686 private final JButton removeButton = createButton(">"); 687 private final JButton addButton = createButton("<"); 688 688 689 689 private String movingComponent; 690 690 691 /** 692 * Constructs a new {@code Settings}. 693 * @param rootActionsNode root actions node 694 */ 691 695 public Settings(DefaultMutableTreeNode rootActionsNode) { 692 696 super(/* ICON(preferences/) */ "toolbar", tr("Toolbar customization"), tr("Customize the elements on the toolbar.")); … … 815 819 816 820 final JPanel buttons = new JPanel(new GridLayout(6, 1)); 817 buttons.add(upButton = createButton("up"));818 buttons.add(addButton = createButton("<"));819 buttons.add(removeButton = createButton(">"));820 buttons.add(downButton = createButton("down"));821 buttons.add(upButton); 822 buttons.add(addButton); 823 buttons.add(removeButton); 824 buttons.add(downButton); 821 825 updateEnabledState(); 822 826 -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
r9778 r10179 66 66 add(formats, GBC.eol().fill()); 67 67 68 add(wmsInstruction = new JLabel(tr("4. Verify generated WMS URL")), GBC.eol()); 68 wmsInstruction = new JLabel(tr("4. Verify generated WMS URL")); 69 add(wmsInstruction, GBC.eol()); 69 70 wmsInstruction.setLabelFor(wmsUrl); 70 71 add(wmsUrl, GBC.eop().fill()); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r10134 r10179 79 79 private ImageryLayerInfo layerInfo; 80 80 81 private CommonSettingsPanel commonSettings; 82 private WMSSettingsPanel wmsSettings; 83 private TMSSettingsPanel tmsSettings; 81 private final CommonSettingsPanel commonSettings = new CommonSettingsPanel(); 82 private final WMSSettingsPanel wmsSettings = new WMSSettingsPanel(); 83 private final TMSSettingsPanel tmsSettings = new TMSSettingsPanel(); 84 84 85 85 /** … … 115 115 p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 116 116 117 addSettingsSection(p, tr("Common Settings"), commonSettings = new CommonSettingsPanel());118 addSettingsSection(p, tr("WMS Settings"), wmsSettings = new WMSSettingsPanel(),117 addSettingsSection(p, tr("Common Settings"), commonSettings); 118 addSettingsSection(p, tr("WMS Settings"), wmsSettings, 119 119 GBC.eol().fill(GBC.HORIZONTAL)); 120 addSettingsSection(p, tr("TMS Settings"), tmsSettings = new TMSSettingsPanel(),120 addSettingsSection(p, tr("TMS Settings"), tmsSettings, 121 121 GBC.eol().fill(GBC.HORIZONTAL)); 122 122 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
r9212 r10179 46 46 47 47 static Policy fromPreferenceValue(String preferenceValue) { 48 if (preferenceValue == null) return null; 49 preferenceValue = preferenceValue.trim().toLowerCase(Locale.ENGLISH); 48 if (preferenceValue == null) 49 return null; 50 String prefValue = preferenceValue.trim().toLowerCase(Locale.ENGLISH); 50 51 for (Policy p: Policy.values()) { 51 if (p.getPreferencesValue().equals(pref erenceValue))52 if (p.getPreferencesValue().equals(prefValue)) 52 53 return p; 53 54 } … … 58 59 private transient Map<Policy, JRadioButton> rbVersionBasedUpatePolicy; 59 60 private transient Map<Policy, JRadioButton> rbTimeBasedUpatePolicy; 60 private JosmTextField tfUpdateInterval; 61 private JLabel lblUpdateInterval; 61 private final JosmTextField tfUpdateInterval = new JosmTextField(5); 62 private final JLabel lblUpdateInterval = new JLabel(tr("Update interval (in days):")); 63 64 /** 65 * Constructs a new {@code PluginUpdatePolicyPanel}. 66 */ 67 public PluginUpdatePolicyPanel() { 68 build(); 69 initFromPreferences(); 70 } 62 71 63 72 protected JPanel buildVersionBasedUpdatePolicyPanel() { … … 95 104 protected JPanel buildUpdateIntervalPanel() { 96 105 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); 97 pnl.add(lblUpdateInterval = new JLabel(tr("Update interval (in days):")));98 pnl.add(tfUpdateInterval = new JosmTextField(5));106 pnl.add(lblUpdateInterval); 107 pnl.add(tfUpdateInterval); 99 108 lblUpdateInterval.setLabelFor(tfUpdateInterval); 100 109 SelectAllOnFocusGainedDecorator.decorate(tfUpdateInterval); … … 160 169 161 170 /** 162 * Constructs a new {@code PluginUpdatePolicyPanel}.163 */164 public PluginUpdatePolicyPanel() {165 build();166 initFromPreferences();167 }168 169 /**170 171 * Loads the relevant preference values from the JOSM preferences 171 *172 172 */ 173 173 public final void initFromPreferences() { -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r9609 r10179 47 47 private static class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener { 48 48 49 public JosmTextField filter; 50 private ProjectionCodeListModel model; 49 public final JosmTextField filter = new JosmTextField(30); 50 private final ProjectionCodeListModel model = new ProjectionCodeListModel(); 51 51 public JList<String> selectionList; 52 52 private final List<String> data; … … 89 89 90 90 private void build() { 91 filter = new JosmTextField(30);92 91 filter.setColumns(10); 93 92 filter.getDocument().addDocumentListener(this); 94 93 95 94 selectionList = new JList<>(data.toArray(new String[0])); 96 selectionList.setModel(model = new ProjectionCodeListModel());95 selectionList.setModel(model); 97 96 JScrollPane scroll = new JScrollPane(selectionList); 98 97 scroll.setPreferredSize(new Dimension(200, 214)); … … 105 104 public String getCode() { 106 105 int idx = selectionList.getSelectedIndex(); 107 if (idx == -1) return lastCode; 106 if (idx == -1) 107 return lastCode; 108 108 return filteredData.get(selectionList.getSelectedIndex()); 109 109 } … … 174 174 if (matcher2.matches()) { 175 175 int cmp1 = matcher1.group(1).compareTo(matcher2.group(1)); 176 if (cmp1 != 0) return cmp1; 176 if (cmp1 != 0) 177 return cmp1; 177 178 int num1 = Integer.parseInt(matcher1.group(2)); 178 179 int num2 = Integer.parseInt(matcher2.group(2)); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r9783 r10179 69 69 private static Map<String, ProjectionChoice> projectionChoicesById = new HashMap<>(); 70 70 71 // some ProjectionChoices that are referenced from other parts of the code 72 public static final ProjectionChoice wgs84, mercator, lambert, utm_france_dom, lambert_cc9; 71 /** 72 * WGS84: Directly use latitude / longitude values as x/y. 73 */ 74 public static final ProjectionChoice wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326, "epsg4326"); 75 76 /** 77 * Mercator Projection. 78 * 79 * The center of the mercator projection is always the 0 grad coordinate. 80 * 81 * See also USGS Bulletin 1532 (http://pubs.usgs.gov/bul/1532/report.pdf) 82 * initially EPSG used 3785 but that has been superseded by 3857, see https://www.epsg-registry.org/ 83 */ 84 public static final ProjectionChoice mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 3857); 85 86 /** 87 * Lambert conic conform 4 zones using the French geodetic system NTF. 88 * 89 * This newer version uses the grid translation NTF<->RGF93 provided by IGN for a submillimetric accuracy. 90 * (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal) 91 * 92 * Source: http://geodesie.ign.fr/contenu/fichiers/Changement_systeme_geodesique.pdf 93 */ 94 public static final ProjectionChoice lambert = new LambertProjectionChoice(); 95 96 /** 97 * French departements in the Caribbean Sea and Indian Ocean. 98 * 99 * Using the UTM transvers Mercator projection and specific geodesic settings. 100 */ 101 public static final ProjectionChoice utm_france_dom = new UTMFranceDOMProjectionChoice(); 102 103 /** 104 * Lambert Conic Conform 9 Zones projection. 105 * 106 * As specified by the IGN in this document 107 * http://geodesie.ign.fr/contenu/fichiers/documentation/rgf93/cc9zones.pdf 108 */ 109 public static final ProjectionChoice lambert_cc9 = new LambertCC9ZonesProjectionChoice(); 73 110 74 111 static { … … 77 114 * Global projections. 78 115 */ 79 80 /**81 * WGS84: Directly use latitude / longitude values as x/y.82 */83 wgs84 = registerProjectionChoice(tr("WGS84 Geographic"), "core:wgs84", 4326, "epsg4326");84 85 /**86 * Mercator Projection.87 *88 * The center of the mercator projection is always the 0 grad89 * coordinate.90 *91 * See also USGS Bulletin 153292 * (http://pubs.usgs.gov/bul/1532/report.pdf)93 * initially EPSG used 3785 but that has been superseded by 3857,94 * see https://www.epsg-registry.org/95 */96 mercator = registerProjectionChoice(tr("Mercator"), "core:mercator", 3857);97 116 98 117 /** … … 156 175 * @author Pieren 157 176 */ 158 registerProjectionChoice(lambert = new LambertProjectionChoice());// FR177 registerProjectionChoice(lambert); // FR 159 178 160 179 /** … … 174 193 * @author Pieren 175 194 */ 176 registerProjectionChoice(lambert_cc9 = new LambertCC9ZonesProjectionChoice());// FR195 registerProjectionChoice(lambert_cc9); // FR 177 196 178 197 /** … … 181 200 * Using the UTM transvers Mercator projection and specific geodesic settings. 182 201 */ 183 registerProjectionChoice(utm_france_dom = new UTMFranceDOMProjectionChoice());// FR202 registerProjectionChoice(utm_france_dom); // FR 184 203 185 204 /** … … 281 300 private final JPanel projSubPrefPanelWrapper = new JPanel(new GridBagLayout()); 282 301 283 private JLabel projectionCodeLabel; 284 private Component projectionCodeGlue; 302 private JLabel projectionCodeLabel = new JLabel(tr("Projection code")); 303 private Component projectionCodeGlue = GBC.glue(5, 0); 285 304 private final JLabel projectionCode = new JLabel(); 286 private JLabel projectionNameLabel; 287 private Component projectionNameGlue; 305 private final JLabel projectionNameLabel = new JLabel(tr("Projection name")); 306 private final Component projectionNameGlue = GBC.glue(5, 0); 288 307 private final JLabel projectionName = new JLabel(); 289 308 private final JLabel bounds = new JLabel(); … … 323 342 projPanel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL)); 324 343 projPanel.add(projectionCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5)); 325 projPanel.add(projectionCodeLabel = new JLabel(tr("Projection code")), GBC.std().insets(25, 5, 0, 5));326 projPanel.add(projectionCodeGlue = GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));344 projPanel.add(projectionCodeLabel, GBC.std().insets(25, 5, 0, 5)); 345 projPanel.add(projectionCodeGlue, GBC.std().fill(GBC.HORIZONTAL)); 327 346 projPanel.add(projectionCode, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5)); 328 projPanel.add(projectionNameLabel = new JLabel(tr("Projection name")), GBC.std().insets(25, 5, 0, 5));329 projPanel.add(projectionNameGlue = GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));347 projPanel.add(projectionNameLabel, GBC.std().insets(25, 5, 0, 5)); 348 projPanel.add(projectionNameGlue, GBC.std().fill(GBC.HORIZONTAL)); 330 349 projPanel.add(projectionName, GBC.eop().fill(GBC.HORIZONTAL).insets(0, 5, 5, 5)); 331 350 projPanel.add(new JLabel(tr("Bounds")), GBC.std().insets(25, 5, 0, 5)); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java
r9543 r10179 25 25 26 26 /** 27 * This is the preference panel for the authentication method and the authentication 28 * parameters. 29 * 27 * This is the preference panel for the authentication method and the authentication parameters. 28 * @since 2745 30 29 */ 31 30 public class AuthenticationPreferencesPanel extends VerticallyScrollablePanel implements PropertyChangeListener { 32 31 33 32 /** indicates whether we use basic authentication */ 34 private JRadioButton rbBasicAuthentication; 33 private final JRadioButton rbBasicAuthentication = new JRadioButton(); 35 34 /** indicates whether we use OAuth as authentication scheme */ 36 private JRadioButton rbOAuth; 37 /** the panel which contains the authentication parameters for the respective 38 * authentication scheme 39 */ 40 private JPanel pnlAuthenticationParameteters; 35 private final JRadioButton rbOAuth = new JRadioButton(); 36 /** the panel which contains the authentication parameters for the respective authentication scheme */ 37 private final JPanel pnlAuthenticationParameteters = new JPanel(new BorderLayout()); 41 38 /** the panel for the basic authentication parameters */ 42 39 private BasicAuthenticationPreferencesPanel pnlBasicAuthPreferences; … … 45 42 /** the panel for messages notifier preferences */ 46 43 private FeaturesPanel pnlFeaturesPreferences; 44 45 /** 46 * Constructs a new {@code AuthenticationPreferencesPanel}. 47 */ 48 public AuthenticationPreferencesPanel() { 49 build(); 50 initFromPreferences(); 51 HelpUtil.setHelpContext(this, HelpUtil.ht("/Preferences/Connection#AuthenticationSettings")); 52 } 47 53 48 54 /** … … 61 67 gc.weightx = 1.0; 62 68 gc.insets = new Insets(0, 0, 0, 3); 63 add(rbBasicAuthentication = new JRadioButton(), gc);69 add(rbBasicAuthentication, gc); 64 70 rbBasicAuthentication.setText(tr("Use Basic Authentication")); 65 71 rbBasicAuthentication.setToolTipText(tr("Select to use HTTP basic authentication with your OSM username and password")); … … 69 75 gc.gridx = 0; 70 76 gc.weightx = 0.0; 71 add(rbOAuth = new JRadioButton(), gc);77 add(rbOAuth, gc); 72 78 rbOAuth.setText(tr("Use OAuth")); 73 79 rbOAuth.setToolTipText(tr("Select to use OAuth as authentication mechanism")); … … 86 92 gc.weightx = 1.0; 87 93 gc.weighty = 1.0; 88 pnlAuthenticationParameteters = new JPanel(new BorderLayout());89 94 add(pnlAuthenticationParameteters, gc); 90 95 … … 104 109 pnlFeaturesPreferences = new FeaturesPanel(); 105 110 add(pnlFeaturesPreferences, gc); 106 }107 108 /**109 * Constructs a new {@code AuthenticationPreferencesPanel}.110 */111 public AuthenticationPreferencesPanel() {112 build();113 initFromPreferences();114 HelpUtil.setHelpContext(this, HelpUtil.ht("/Preferences/Connection#AuthenticationSettings"));115 111 } 116 112 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java
r8510 r10179 25 25 26 26 /** 27 * The preferences panel for parameters necessary for the Basic Authentication 28 * Scheme. 29 * 27 * The preferences panel for parameters necessary for the Basic Authentication Scheme. 28 * @since 2745 30 29 */ 31 30 public class BasicAuthenticationPreferencesPanel extends JPanel { 32 31 33 32 /** the OSM user name */ 34 private JosmTextField tfOsmUserName; 33 private final JosmTextField tfOsmUserName = new JosmTextField(); 35 34 /** the OSM password */ 36 private JosmPasswordField tfOsmPassword; 35 private final JosmPasswordField tfOsmPassword = new JosmPasswordField(); 37 36 /** a panel with further information, e.g. some warnings */ 38 37 private JPanel decorationPanel; 38 39 /** 40 * Constructs a new {@code BasicAuthenticationPreferencesPanel}. 41 */ 42 public BasicAuthenticationPreferencesPanel() { 43 build(); 44 } 39 45 40 46 /** … … 55 61 gc.gridx = 1; 56 62 gc.weightx = 1.0; 57 add(tfOsmUserName = new JosmTextField(), gc);63 add(tfOsmUserName, gc); 58 64 SelectAllOnFocusGainedDecorator.decorate(tfOsmUserName); 59 65 UserNameValidator valUserName = new UserNameValidator(tfOsmUserName); … … 68 74 gc.gridx = 1; 69 75 gc.weightx = 1.0; 70 add(tfOsmPassword = new JosmPasswordField(), gc);76 add(tfOsmPassword, gc); 71 77 SelectAllOnFocusGainedDecorator.decorate(tfOsmPassword); 72 78 tfOsmPassword.setToolTipText(tr("Please enter your OSM password")); … … 82 88 decorationPanel = new JPanel(new BorderLayout()); 83 89 add(decorationPanel, gc); 84 }85 86 /**87 * Constructs a new {@code BasicAuthenticationPreferencesPanel}.88 */89 public BasicAuthenticationPreferencesPanel() {90 build();91 90 } 92 91 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r10137 r10179 46 46 */ 47 47 public class OAuthAuthenticationPreferencesPanel extends JPanel implements PropertyChangeListener { 48 private JPanel pnlAuthorisationMessage; 49 private NotYetAuthorisedPanel pnlNotYetAuthorised; 50 private AlreadyAuthorisedPanel pnlAlreadyAuthorised; 51 private AdvancedOAuthPropertiesPanel pnlAdvancedProperties; 48 private final JPanel pnlAuthorisationMessage = new JPanel(new BorderLayout()); 49 private final NotYetAuthorisedPanel pnlNotYetAuthorised = new NotYetAuthorisedPanel(); 50 private final AlreadyAuthorisedPanel pnlAlreadyAuthorised = new AlreadyAuthorisedPanel(); 51 private final AdvancedOAuthPropertiesPanel pnlAdvancedProperties = new AdvancedOAuthPropertiesPanel(); 52 52 private String apiUrl; 53 private JCheckBox cbShowAdvancedParameters; 54 private JCheckBox cbSaveToPreferences; 53 private final JCheckBox cbShowAdvancedParameters = new JCheckBox(); 54 private final JCheckBox cbSaveToPreferences = new JCheckBox(tr("Save to preferences")); 55 55 56 56 /** … … 75 75 gc.weightx = 0.0; 76 76 gc.insets = new Insets(0, 0, 0, 3); 77 pnl.add(cbShowAdvancedParameters = new JCheckBox(), gc);77 pnl.add(cbShowAdvancedParameters, gc); 78 78 cbShowAdvancedParameters.setSelected(false); 79 79 cbShowAdvancedParameters.addItemListener( … … 98 98 gc.weightx = 1.0; 99 99 gc.weighty = 1.0; 100 pnl.add(pnlAdvancedProperties = new AdvancedOAuthPropertiesPanel(), gc);100 pnl.add(pnlAdvancedProperties, gc); 101 101 pnlAdvancedProperties.initFromPreferences(Main.pref); 102 102 pnlAdvancedProperties.setBorder( … … 126 126 gc.weightx = 1.0; 127 127 gc.insets = new Insets(10, 0, 0, 0); 128 add(pnlAuthorisationMessage = new JPanel(new BorderLayout()), gc); 129 130 // create these two panels, they are going to be used later in refreshView 131 // 132 pnlAlreadyAuthorised = new AlreadyAuthorisedPanel(); 133 pnlNotYetAuthorised = new NotYetAuthorisedPanel(); 128 add(pnlAuthorisationMessage, gc); 134 129 } 135 130 … … 196 191 gc.fill = GridBagConstraints.HORIZONTAL; 197 192 gc.weightx = 1.0; 198 JMultilineLabel lbl ;199 add(lbl = new JMultilineLabel(200 tr("You do not have an Access Token yet to access the OSM server using OAuth. Please authorize first.")), gc);193 JMultilineLabel lbl = new JMultilineLabel( 194 tr("You do not have an Access Token yet to access the OSM server using OAuth. Please authorize first.")); 195 add(lbl, gc); 201 196 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); 202 197 … … 221 216 */ 222 217 private class AlreadyAuthorisedPanel extends JPanel { 223 private JosmTextField tfAccessTokenKey; 224 private JosmTextField tfAccessTokenSecret; 218 private final JosmTextField tfAccessTokenKey = new JosmTextField(); 219 private final JosmTextField tfAccessTokenSecret = new JosmTextField(); 225 220 226 221 /** … … 240 235 gc.weightx = 1.0; 241 236 gc.gridwidth = 2; 242 JMultilineLabel lbl; 243 add(lbl = new JMultilineLabel(tr("You already have an Access Token to access the OSM server using OAuth.")), gc);237 JMultilineLabel lbl = new JMultilineLabel(tr("You already have an Access Token to access the OSM server using OAuth.")); 238 add(lbl, gc); 244 239 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); 245 240 … … 253 248 gc.gridx = 1; 254 249 gc.weightx = 1.0; 255 add(tfAccessTokenKey = new JosmTextField(), gc);250 add(tfAccessTokenKey, gc); 256 251 tfAccessTokenKey.setEditable(false); 257 252 … … 265 260 gc.gridx = 1; 266 261 gc.weightx = 1.0; 267 add(tfAccessTokenSecret = new JosmTextField(), gc);262 add(tfAccessTokenSecret, gc); 268 263 tfAccessTokenSecret.setEditable(false); 269 264 … … 273 268 gc.gridwidth = 2; 274 269 gc.weightx = 1.0; 275 add(cbSaveToPreferences = new JCheckBox(tr("Save to preferences")), gc);270 add(cbSaveToPreferences, gc); 276 271 cbSaveToPreferences.setSelected(OAuthAccessTokenHolder.getInstance().isSaveToPreferences()); 277 272 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r10137 r10179 49 49 public static final String API_URL_PROP = OsmApiUrlInputPanel.class.getName() + ".apiUrl"; 50 50 51 private JLabel lblValid; 52 private JLabel lblApiUrl; 53 private HistoryComboBox tfOsmServerUrl; 51 private final JLabel lblValid = new JLabel(); 52 private final JLabel lblApiUrl = new JLabel(tr("OSM Server URL:")); 53 private final HistoryComboBox tfOsmServerUrl = new HistoryComboBox(); 54 54 private transient ApiUrlValidator valOsmServerUrl; 55 55 private SideButton btnTest; … … 95 95 gc.weightx = 0.0; 96 96 gc.insets = new Insets(0, 0, 0, 3); 97 add(lblApiUrl = new JLabel(tr("OSM Server URL:")), gc);97 add(lblApiUrl, gc); 98 98 99 99 gc.gridx = 1; 100 100 gc.weightx = 1.0; 101 add(tfOsmServerUrl = new HistoryComboBox(), gc);101 add(tfOsmServerUrl, gc); 102 102 lblApiUrl.setLabelFor(tfOsmServerUrl); 103 103 SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl.getEditorComponent()); … … 110 110 gc.gridx = 2; 111 111 gc.weightx = 0.0; 112 add(lblValid = new JLabel(), gc);112 add(lblValid, gc); 113 113 114 114 gc.gridx = 3; … … 116 116 ValidateApiUrlAction actTest = new ValidateApiUrlAction(); 117 117 tfOsmServerUrl.getEditorComponent().getDocument().addDocumentListener(actTest); 118 add(btnTest = new SideButton(actTest), gc); 118 btnTest = new SideButton(actTest); 119 add(btnTest, gc); 119 120 } 120 121 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java
r8510 r10179 102 102 103 103 private transient Map<ProxyPolicy, JRadioButton> rbProxyPolicy; 104 private JosmTextField tfProxyHttpHost; 105 private JosmTextField tfProxyHttpPort; 106 private JosmTextField tfProxySocksHost; 107 private JosmTextField tfProxySocksPort; 108 private JosmTextField tfProxyHttpUser; 109 private JosmPasswordField tfProxyHttpPassword; 104 private final JosmTextField tfProxyHttpHost = new JosmTextField(); 105 private final JosmTextField tfProxyHttpPort = new JosmTextField(5); 106 private final JosmTextField tfProxySocksHost = new JosmTextField(20); 107 private final JosmTextField tfProxySocksPort = new JosmTextField(5); 108 private final JosmTextField tfProxyHttpUser = new JosmTextField(20); 109 private final JosmPasswordField tfProxyHttpPassword = new JosmPasswordField(20); 110 110 111 111 private JPanel pnlHttpProxyConfigurationPanel; … … 134 134 gc.gridx = 1; 135 135 gc.weightx = 1.0; 136 pnl.add(tfProxyHttpHost = new JosmTextField(), gc);136 pnl.add(tfProxyHttpHost, gc); 137 137 138 138 gc.gridy = 1; … … 144 144 gc.gridx = 1; 145 145 gc.weightx = 1.0; 146 pnl.add(tfProxyHttpPort = new JosmTextField(5), gc);146 pnl.add(tfProxyHttpPort, gc); 147 147 tfProxyHttpPort.setMinimumSize(tfProxyHttpPort.getPreferredSize()); 148 148 … … 164 164 gc.gridx = 1; 165 165 gc.weightx = 1.0; 166 pnl.add(tfProxyHttpUser = new JosmTextField(20), gc);166 pnl.add(tfProxyHttpUser, gc); 167 167 tfProxyHttpUser.setMinimumSize(tfProxyHttpUser.getPreferredSize()); 168 168 … … 174 174 gc.gridx = 1; 175 175 gc.weightx = 1.0; 176 pnl.add(tfProxyHttpPassword = new JosmPasswordField(20), gc);176 pnl.add(tfProxyHttpPassword, gc); 177 177 tfProxyHttpPassword.setMinimumSize(tfProxyHttpPassword.getPreferredSize()); 178 178 … … 209 209 gc.gridx = 1; 210 210 gc.weightx = 1.0; 211 pnl.add(tfProxySocksHost = new JosmTextField(20), gc);211 pnl.add(tfProxySocksHost, gc); 212 212 213 213 gc.gridy = 1; … … 219 219 gc.gridx = 1; 220 220 gc.weightx = 1.0; 221 pnl.add(tfProxySocksPort = new JosmTextField(5), gc);221 pnl.add(tfProxySocksPort, gc); 222 222 tfProxySocksPort.setMinimumSize(tfProxySocksPort.getPreferredSize()); 223 223 … … 290 290 gc.weightx = 1.0; 291 291 gc.weighty = 0.0; 292 pnl.add(pnlHttpProxyConfigurationPanel = buildHttpProxyConfigurationPanel(), gc); 292 pnlHttpProxyConfigurationPanel = buildHttpProxyConfigurationPanel(); 293 pnl.add(pnlHttpProxyConfigurationPanel, gc); 293 294 294 295 // radio button SOCKS proxy … … 309 310 gc.weightx = 1.0; 310 311 gc.weighty = 0.0; 311 pnl.add(pnlSocksProxyConfigurationPanel = buildSocksProxyConfigurationPanel(), gc); 312 pnlSocksProxyConfigurationPanel = buildSocksProxyConfigurationPanel(); 313 pnl.add(pnlSocksProxyConfigurationPanel, gc); 312 314 313 315 return pnl; -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
r9588 r10179 75 75 pnl.setLayout(new BoxLayout(pnl, BoxLayout.Y_AXIS)); 76 76 77 // add action 78 // 79 JButton btn; 80 pnl.add(btn = new JButton(tagTable.getAddAction())); 77 buildButton(pnl, tagTable.getAddAction()); 78 buildButton(pnl, tagTable.getDeleteAction()); 79 buildButton(pnl, tagTable.getPasteAction()); 80 81 return pnl; 82 } 83 84 private void buildButton(JPanel pnl, AbstractAction action) { 85 JButton btn = new JButton(action); 86 pnl.add(btn); 81 87 btn.setMargin(new Insets(0, 0, 0, 0)); 82 88 tagTable.addComponentNotStoppingCellEditing(btn); 83 84 // delete action85 pnl.add(btn = new JButton(tagTable.getDeleteAction()));86 btn.setMargin(new Insets(0, 0, 0, 0));87 tagTable.addComponentNotStoppingCellEditing(btn);88 89 // paste action90 pnl.add(btn = new JButton(tagTable.getPasteAction()));91 btn.setMargin(new Insets(0, 0, 0, 0));92 tagTable.addComponentNotStoppingCellEditing(btn);93 return pnl;94 89 } 95 90 -
trunk/src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java
r9484 r10179 22 22 public HistoryComboBox() { 23 23 int maxsize = Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 24 setModel(model = new ComboBoxHistory(maxsize)); 24 model = new ComboBoxHistory(maxsize); 25 setModel(model); 25 26 setEditable(true); 26 27 } -
trunk/src/org/openstreetmap/josm/gui/widgets/ImageLabel.java
r9372 r10179 18 18 */ 19 19 public class ImageLabel extends JPanel { 20 private final JLabel imgLabel; 21 private final JLabel tf; 20 private final JLabel imgLabel = new JLabel(); 21 private final JLabel tf = new JLabel(); 22 22 private final int charCount; 23 23 … … 32 32 setLayout(new GridBagLayout()); 33 33 setBackground(background); 34 add(imgLabel = new JLabel(), GBC.std().anchor(GBC.WEST).insets(0, 1, 1, 0));34 add(imgLabel, GBC.std().anchor(GBC.WEST).insets(0, 1, 1, 0)); 35 35 setIcon(img); 36 add(tf = new JLabel(), GBC.std().fill(GBC.BOTH).anchor(GBC.WEST).insets(2, 1, 1, 0));36 add(tf, GBC.std().fill(GBC.BOTH).anchor(GBC.WEST).insets(2, 1, 1, 0)); 37 37 setToolTipText(tooltip); 38 38 this.charCount = charCount; -
trunk/src/org/openstreetmap/josm/io/OsmChangeBuilder.java
r8840 r10179 13 13 /** 14 14 * Creates an OsmChange document from JOSM edits. 15 * See http://wiki.openstreetmap.org/index.php/OsmChange for a documentation of the 16 * OsmChange format. 17 * 15 * See http://wiki.openstreetmap.org/index.php/OsmChange for a documentation of the OsmChange format. 16 * @since 1071 18 17 */ 19 18 public class OsmChangeBuilder { 19 /** Default OSM API version */ 20 20 public static final String DEFAULT_API_VERSION = "0.6"; 21 21 22 22 private String currentMode; 23 private PrintWriter writer; 24 private StringWriter swriter; 25 private OsmWriter osmwriter; 23 private final PrintWriter writer; 24 private final StringWriter swriter; 25 private final OsmWriter osmwriter; 26 26 private String apiVersion = DEFAULT_API_VERSION; 27 27 private boolean prologWritten; 28 28 29 /** 30 * Constructs a new {@code OsmChangeBuilder}. 31 * @param changeset changeset 32 */ 29 33 public OsmChangeBuilder(Changeset changeset) { 30 34 this(changeset, null /* default api version */); 31 35 } 32 36 37 /** 38 * Constructs a new {@code OsmChangeBuilder}. 39 * @param changeset changeset 40 * @param apiVersion OSM API version 41 */ 33 42 public OsmChangeBuilder(Changeset changeset, String apiVersion) { 34 43 this.apiVersion = apiVersion == null ? DEFAULT_API_VERSION : apiVersion; 35 writer = new PrintWriter(swriter = new StringWriter()); 44 swriter = new StringWriter(); 45 writer = new PrintWriter(swriter); 36 46 osmwriter = OsmWriterFactory.createOsmWriter(writer, false, apiVersion); 37 47 osmwriter.setChangeset(changeset); … … 90 100 */ 91 101 public void append(Collection<? extends IPrimitive> primitives) { 92 if (primitives == null) return;93 if (!prologWritten)94 throw new IllegalStateException(tr("Prolog of OsmChange document not written yet. Please write first."));102 if (primitives == null) 103 return; 104 checkProlog(); 95 105 for (IPrimitive p : primitives) { 96 106 write(p); 97 107 } 108 } 109 110 private void checkProlog() { 111 if (!prologWritten) 112 throw new IllegalStateException(tr("Prolog of OsmChange document not written yet. Please write first.")); 98 113 } 99 114 … … 107 122 */ 108 123 public void append(IPrimitive p) { 109 if (p == null) return;110 if (!prologWritten)111 throw new IllegalStateException(tr("Prolog of OsmChange document not written yet. Please write first."));124 if (p == null) 125 return; 126 checkProlog(); 112 127 write(p); 113 128 } … … 119 134 */ 120 135 public void finish() { 121 if (!prologWritten) 122 throw new IllegalStateException(tr("Prolog of OsmChange document not written yet. Please write first.")); 136 checkProlog(); 123 137 if (currentMode != null) { 124 138 writer.print("</"); … … 129 143 } 130 144 145 /** 146 * Returns XML document. 147 * @return XML document 148 */ 131 149 public String getDocument() { 132 150 return swriter.toString(); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r10143 r10179 1493 1493 1494 1494 private static class UpdatePluginsMessagePanel extends JPanel { 1495 private JMultilineLabel lblMessage; 1496 private JCheckBox cbDontShowAgain; 1495 private final JMultilineLabel lblMessage = new JMultilineLabel(""); 1496 private final JCheckBox cbDontShowAgain = new JCheckBox( 1497 tr("Do not ask again and remember my decision (go to Preferences->Plugins to change it later)")); 1498 1499 UpdatePluginsMessagePanel() { 1500 build(); 1501 } 1497 1502 1498 1503 protected final void build() { … … 1504 1509 gc.weighty = 1.0; 1505 1510 gc.insets = new Insets(5, 5, 5, 5); 1506 add(lblMessage = new JMultilineLabel(""), gc);1511 add(lblMessage, gc); 1507 1512 lblMessage.setFont(lblMessage.getFont().deriveFont(Font.PLAIN)); 1508 1513 … … 1510 1515 gc.fill = GridBagConstraints.HORIZONTAL; 1511 1516 gc.weighty = 0.0; 1512 add(cbDontShowAgain = new JCheckBox( 1513 tr("Do not ask again and remember my decision (go to Preferences->Plugins to change it later)")), gc); 1517 add(cbDontShowAgain, gc); 1514 1518 cbDontShowAgain.setFont(cbDontShowAgain.getFont().deriveFont(Font.PLAIN)); 1515 }1516 1517 UpdatePluginsMessagePanel() {1518 build();1519 1519 } 1520 1520 -
trunk/src/org/openstreetmap/josm/tools/Diff.java
r10001 r10179 597 597 public String toString() { 598 598 String s = String.format("%d -%d +%d %d", line0, deleted, inserted, line1); 599 return (link != null) ? s = s+ '\n' + link : s;599 return (link != null) ? s + '\n' + link : s; 600 600 } 601 601 } … … 832 832 Integer ir = h.get(data[i]); 833 833 if (ir == null) { 834 h.put(data[i], equivs[i] = equivMax++); 834 equivs[i] = equivMax++; 835 h.put(data[i], equivs[i]); 835 836 } else { 836 837 equivs[i] = ir.intValue(); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r10140 r10179 58 58 59 59 import org.openstreetmap.josm.Main; 60 import org.openstreetmap.josm.data.osm.DataSet; 60 61 import org.openstreetmap.josm.data.osm.OsmPrimitive; 61 62 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 83 84 import com.kitfox.svg.SVGDiagram; 84 85 import com.kitfox.svg.SVGUniverse; 85 import org.openstreetmap.josm.data.osm.DataSet;86 86 87 87 /** … … 1229 1229 Map<Long, ImageResource> cacheByAngle = ROTATE_CACHE.get(img); 1230 1230 if (cacheByAngle == null) { 1231 ROTATE_CACHE.put(img, cacheByAngle = new HashMap<>()); 1231 cacheByAngle = new HashMap<>(); 1232 ROTATE_CACHE.put(img, cacheByAngle); 1232 1233 } 1233 1234 … … 1257 1258 } 1258 1259 Image image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); 1259 cacheByAngle.put(originalAngle, imageResource = new ImageResource(image)); 1260 imageResource = new ImageResource(image); 1261 cacheByAngle.put(originalAngle, imageResource); 1260 1262 Graphics g = image.getGraphics(); 1261 1263 Graphics2D g2d = (Graphics2D) g.create();
Note:
See TracChangeset
for help on using the changeset viewer.