Changeset 5481 in josm
- Timestamp:
- 2012-08-28T00:16:35+02:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r5392 r5481 140 140 windowtitle="JOSM" 141 141 use="true" 142 private="true" 142 143 linksource="true" 143 144 author="false"> -
trunk/src/org/openstreetmap/josm/Main.java
r5460 r5481 16 16 import java.net.URI; 17 17 import java.net.URISyntaxException; 18 import java.text.MessageFormat; 18 19 import java.util.ArrayList; 19 20 import java.util.Collection; … … 151 152 public MainMenu menu; 152 153 154 /** 155 * The data validation handler. 156 */ 153 157 public OsmValidator validator; 154 158 /** … … 158 162 159 163 /** 160 * Print a message if logging is on.164 * Logging level (3 = debug, 2 = info, 1 = warn, 0 = none). 161 165 */ 162 166 static public int log_level = 2; 167 /** 168 * Print a warning message if logging is on. 169 * @param msg The message to print. 170 */ 163 171 static public void warn(String msg) { 164 172 if (log_level < 1) … … 166 174 System.out.println(msg); 167 175 } 176 /** 177 * Print an informational message if logging is on. 178 * @param msg The message to print. 179 */ 168 180 static public void info(String msg) { 169 181 if (log_level < 2) … … 171 183 System.out.println(msg); 172 184 } 185 /** 186 * Print an debug message if logging is on. 187 * @param msg The message to print. 188 */ 173 189 static public void debug(String msg) { 174 190 if (log_level < 3) 175 191 return; 176 192 System.out.println(msg); 193 } 194 /** 195 * Print a formated warning message if logging is on. Calls {@link MessageFormat#format} 196 * function to format text. 197 * @param msg The formated message to print. 198 * @param objects The objects to insert into format string. 199 */ 200 static public void warn(String msg, Object... objects) { 201 warn(MessageFormat.format(msg, objects)); 202 } 203 /** 204 * Print a formated informational message if logging is on. Calls {@link MessageFormat#format} 205 * function to format text. 206 * @param msg The formated message to print. 207 * @param objects The objects to insert into format string. 208 */ 209 static public void info(String msg, Object... objects) { 210 info(MessageFormat.format(msg, objects)); 211 } 212 /** 213 * Print a formated debug message if logging is on. Calls {@link MessageFormat#format} 214 * function to format text. 215 * @param msg The formated message to print. 216 * @param objects The objects to insert into format string. 217 */ 218 static public void debug(String msg, Object... objects) { 219 debug(MessageFormat.format(msg, objects)); 177 220 } 178 221 -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r5266 r5481 26 26 * the deleted or visible state of {@link OsmPrimitive}s. 27 27 * 28 * This model is an {@link Observable}. It notifies registered {@link Observer}s whenever the28 * This model is an {@link Observable}. It notifies registered {@link java.util.Observer}s whenever the 29 29 * internal state changes. 30 30 * … … 33 33 * 34 34 * @see Node#getCoor() 35 * @see OsmPrimitive# deleted36 * @see OsmPrimitive# visible35 * @see OsmPrimitive#isDeleted 36 * @see OsmPrimitive#isVisible 37 37 * 38 38 */ … … 120 120 121 121 /** 122 * populates the model with the differences between my and their version 123 * 124 * @param my my version of the primitive 125 * @param their their version of the primitive 122 * Populates the model with the differences between local and server version 123 * 124 * @param conflict The conflict information 126 125 */ 127 126 public void populate(Conflict<? extends OsmPrimitive> conflict) { … … 151 150 /** 152 151 * replies the coordinates of my {@link OsmPrimitive}. null, if my primitive hasn't 153 * coordinates (i.e. because it is a {@link Way}).152 * coordinates (i.e. because it is a {@link org.openstreetmap.josm.data.osm.Way}). 154 153 * 155 154 * @return the coordinates of my {@link OsmPrimitive}. null, if my primitive hasn't 156 * coordinates (i.e. because it is a {@link Way}).155 * coordinates (i.e. because it is a {@link org.openstreetmap.josm.data.osm.Way}). 157 156 */ 158 157 public LatLon getMyCoords() { … … 162 161 /** 163 162 * replies the coordinates of their {@link OsmPrimitive}. null, if their primitive hasn't 164 * coordinates (i.e. because it is a {@link Way}).163 * coordinates (i.e. because it is a {@link org.openstreetmap.josm.data.osm.Way}). 165 164 * 166 165 * @return the coordinates of my {@link OsmPrimitive}. null, if my primitive hasn't 167 * coordinates (i.e. because it is a {@link Way}).166 * coordinates (i.e. because it is a {@link org.openstreetmap.josm.data.osm.Way}). 168 167 */ 169 168 public LatLon getTheirCoords() { … … 189 188 190 189 /** 191 * decides a conflict between my and their coordinates190 * Decides a conflict between local and server coordinates 192 191 * 193 192 * @param decision the decision … … 201 200 202 201 /** 203 * replies my deleted state,204 * @return 202 * Replies deleted state of local dataset 203 * @return The state of deleted flag 205 204 */ 206 205 public Boolean getMyDeletedState() { … … 208 207 } 209 208 209 /** 210 * Replies deleted state of Server dataset 211 * @return The state of deleted flag 212 */ 210 213 public Boolean getTheirDeletedState() { 211 214 return theirDeletedState; 212 215 } 213 216 217 /** 218 * Replies deleted state of combined dataset 219 * @return The state of deleted flag 220 */ 214 221 public Boolean getMergedDeletedState() { 215 222 switch(deletedMergeDecision) { … … 223 230 224 231 /** 225 * returns my referrers,226 * @return myreferrers232 * Returns local referrers 233 * @return The referrers 227 234 */ 228 235 public List<OsmPrimitive> getMyReferrers() { … … 231 238 232 239 /** 233 * returns their referrers,234 * @return theirreferrers240 * Returns server referrers 241 * @return The referrers 235 242 */ 236 243 public List<OsmPrimitive> getTheirReferrers() { … … 289 296 * their deleted states 290 297 * 291 * @return trueif my and their primitive have a conflict between298 * @return <code>true</code> if my and their primitive have a conflict between 292 299 * their deleted states 293 300 */ … … 299 306 * replies true if all conflict in this model are resolved 300 307 * 301 * @return true if all conflict in this model are resolved; falseotherwise308 * @return <code>true</code> if all conflict in this model are resolved; <code>false</code> otherwise 302 309 */ 303 310 public boolean isResolvedCompletely() { … … 313 320 314 321 /** 315 * builds the command(s) to apply the conflict resolutions to my primitive 316 * 317 * @param my my primitive 318 * @param their their primitive 319 * @return the list of commands 322 * Builds the command(s) to apply the conflict resolutions to my primitive 323 * 324 * @param conflict The conflict information 325 * @return The list of commands 320 326 */ 321 327 public List<Command> buildResolveCommand(Conflict<? extends OsmPrimitive> conflict) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r5472 r5481 317 317 p.add(Box.createHorizontalStrut(10), GBC.std()); 318 318 p.add(values, GBC.eol().fill(GBC.HORIZONTAL)); 319 addFocusAdapter( row,keys, values, autocomplete, usedValuesAwareComparator);319 addFocusAdapter(keys, values, autocomplete, usedValuesAwareComparator); 320 320 321 321 final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) { … … 447 447 448 448 /** 449 * This simply fires up an relation editorfor the relation shown; everything else449 * This simply fires up an {@link RelationEditor} for the relation shown; everything else 450 450 * is the editor's business. 451 451 * … … 535 535 } 536 536 537 FocusAdapter focus = addFocusAdapter( -1,keys, values, autocomplete, defaultACItemComparator);537 FocusAdapter focus = addFocusAdapter(keys, values, autocomplete, defaultACItemComparator); 538 538 // fire focus event in advance or otherwise the popup list will be too small at first 539 539 focus.focusGained(null); … … 617 617 // performing this action leads to autocomplete to the next key (see #7671 comments) 618 618 for (int j = 0; j < propertyData.getRowCount(); ++j) { 619 System.out.println(propertyData.getValueAt(j, 0));620 619 if (t.getKey().equals(propertyData.getValueAt(j, 0))) { 621 620 action.setEnabled(false); … … 655 654 656 655 /** 657 * @param allData 658 * @param keys 659 * @param values 660 */ 661 private FocusAdapter addFocusAdapter(final int row, 662 final AutoCompletingComboBox keys, final AutoCompletingComboBox values, 656 * Create a focus handling adapter and apply in to the editor component of value 657 * autocompletion box. 658 * @param keys Box for keys entering and autocompletion 659 * @param values Box for values entering and autocompletion 660 * @param autocomplete Manager handling the autocompletion 661 * @param comparator Class to decide what values are offered on autocompletion 662 * @return The created adapter 663 */ 664 private FocusAdapter addFocusAdapter(final AutoCompletingComboBox keys, final AutoCompletingComboBox values, 663 665 final AutoCompletionManager autocomplete, final Comparator<AutoCompletionListItem> comparator) { 664 666 // get the combo box' editor component … … 683 685 684 686 /** 685 * The property data .687 * The property data of selected objects. 686 688 */ 687 689 private final DefaultTableModel propertyData = new DefaultTableModel() { … … 695 697 696 698 /** 697 * The membership data .699 * The membership data of selected objects. 698 700 */ 699 701 private final DefaultTableModel membershipData = new DefaultTableModel() { … … 707 709 708 710 /** 709 * The properties list.711 * The properties table. 710 712 */ 711 713 private final JTable propertyTable = new JTable(propertyData); 714 /** 715 * The membership table. 716 */ 712 717 private final JTable membershipTable = new JTable(membershipData); 713 718 714 719 /** 715 * The Add /Edit/Delete buttons (needed to be able to disable them)720 * The Add button (needed to be able to disable it) 716 721 */ 717 722 private final SideButton btnAdd; 723 /** 724 * The Edit button (needed to be able to disable it) 725 */ 718 726 private final SideButton btnEdit; 727 /** 728 * The Delete button (needed to be able to disable it) 729 */ 719 730 private final SideButton btnDel; 731 /** 732 * Matching preset display class 733 */ 720 734 private final PresetListPanel presets = new PresetListPanel(); 721 735 736 /** 737 * Text to display when nothing selected. 738 */ 722 739 private final JLabel selectSth = new JLabel("<html><p>" 723 740 + tr("Select objects for which to change properties.") + "</p></html>"); … … 996 1013 } 997 1014 998 @Override public void setVisible(boolean b) { 1015 @Override 1016 public void setVisible(boolean b) { 999 1017 super.setVisible(b); 1000 1018 if (b && Main.main.getCurrentDataSet() != null) { … … 1030 1048 }; 1031 1049 1050 @Override 1032 1051 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 1033 1052 if (!isVisible()) … … 1156 1175 } 1157 1176 1177 /** 1178 * Update selection status, call @{link #selectionChanged} function. 1179 */ 1158 1180 private void updateSelection() { 1159 1181 if (Main.main.getCurrentDataSet() == null) { … … 1165 1187 1166 1188 /* ---------------------------------------------------------------------------------- */ 1167 /* EditLayerChangeListener 1189 /* EditLayerChangeListener */ 1168 1190 /* ---------------------------------------------------------------------------------- */ 1191 @Override 1169 1192 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 1170 1193 updateSelection(); 1171 1194 } 1172 1195 1196 @Override 1173 1197 public void processDatasetEvent(AbstractDatasetChangedEvent event) { 1174 1198 updateSelection(); 1175 1199 } 1176 1200 1201 /** 1202 * Action handling delete button press in properties dialog. 1203 */ 1177 1204 class DeleteAction extends JosmAction implements ListSelectionListener { 1178 1205 … … 1277 1304 } 1278 1305 1306 /** 1307 * Action handling add button press in properties dialog. 1308 */ 1279 1309 class AddAction extends JosmAction { 1280 1310 public AddAction() { … … 1290 1320 } 1291 1321 1322 /** 1323 * Action handling edit button press in properties dialog. 1324 */ 1292 1325 class EditAction extends JosmAction implements ListSelectionListener { 1293 1326 public EditAction() { … … 1381 1414 1382 1415 if (conn.getResponseCode() != 200) { 1383 System.out.println("INFO: " + u + " does not exist");1416 Main.info("INFO: {0} does not exist", u); 1384 1417 conn.disconnect(); 1385 1418 } else { … … 1398 1431 */ 1399 1432 if (Math.abs(conn.getContentLength() - osize) > 200) { 1400 System.out.println("INFO: " + u + " is a mediawiki redirect");1433 Main.info("INFO: {0} is a mediawiki redirect", u); 1401 1434 conn.disconnect(); 1402 1435 } else { 1403 System.out.println("INFO: browsing to " +u);1436 Main.info("INFO: browsing to {0}", u); 1404 1437 conn.disconnect(); 1405 1438 -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r5478 r5481 17 17 import javax.swing.Icon; 18 18 19 import org.openstreetmap.josm.Main; 19 20 import org.openstreetmap.josm.actions.search.SearchCompiler.Match; 20 21 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; … … 108 109 cache.put(key, result); 109 110 } catch (ParseError e) { 110 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key));111 Main.warn("Unable to parse template engine pattern ''{0}'' for property {1}", defaultValue, key); 111 112 } 112 113 } … … 127 128 cache.put(key, result); 128 129 } catch (ParseError e) { 129 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key));130 Main.warn("Unable to parse template engine pattern ''{0}'' for property {1}", defaultValue, key); 130 131 } 131 132 } … … 147 148 return new TemplateParser(s).parse(); 148 149 } catch (ParseError e) { 149 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s. Using default ('%s') instead",150 s, getKey(), super.getDefaultValueAsString()) );150 Main.warn("Unable to parse template engine pattern ''{0}'' for property {1}. Using default (''{2}'') instead", 151 s, getKey(), super.getDefaultValueAsString()); 151 152 return getDefaultValue(); 152 153 } … … 177 178 public static final List<MarkerProducers> markerProducers = new LinkedList<MarkerProducers>(); 178 179 179 // Add one Ma ker specifying the default behaviour.180 // Add one Marker specifying the default behaviour. 180 181 static { 181 182 Marker.markerProducers.add(new MarkerProducers() { … … 203 204 url = new File(relativePath.getParentFile(), uri).toURI().toURL(); 204 205 } catch (MalformedURLException e1) { 205 System.err.println("Unable to convert uri " + uri + " to URL: " +e1.getMessage());206 Main.warn("Unable to convert uri {0} to URL: {1}", uri, e1.getMessage()); 206 207 } 207 208 } … … 217 218 return new Marker(wpt.getCoor(), wpt, symbolName, parentLayer, time, offset); 218 219 } 219 else if (url.toString().endsWith(".wav")) 220 else if (url.toString().endsWith(".wav")) { 220 221 return new AudioMarker(wpt.getCoor(), wpt, url, parentLayer, time, offset); 221 else if (url.toString().endsWith(".png") || url.toString().endsWith(".jpg") || url.toString().endsWith(".jpeg") || url.toString().endsWith(".gif"))222 } else if (url.toString().endsWith(".png") || url.toString().endsWith(".jpg") || url.toString().endsWith(".jpeg") || url.toString().endsWith(".gif")) { 222 223 return new ImageMarker(wpt.getCoor(), url, parentLayer, time, offset); 223 else224 } else { 224 225 return new WebMarker(wpt.getCoor(), url, parentLayer, time, offset); 226 } 225 227 } 226 228 }); … … 366 368 /** 367 369 * Returns the Text which should be displayed, depending on chosen preference 368 * @return Text 370 * @return Text of the label 369 371 */ 370 372 public String getText() { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r4831 r5481 424 424 } 425 425 426 /** 427 * Get state of text display. 428 * @return <code>true</code> if text should be shown, <code>false</code> otherwise. 429 */ 426 430 private boolean isTextOrIconShown() { 427 431 String current = Main.pref.get("marker.show "+getName(),"show");
Note:
See TracChangeset
for help on using the changeset viewer.