Changeset 20735 in osm for applications/editors/josm/plugins/turnrestrictions/src/org
- Timestamp:
- 2010-03-29T19:14:54+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java
r20586 r20735 12 12 import javax.swing.JTable; 13 13 14 import org.openstreetmap.josm.gui.help.HelpUtil; 14 15 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 15 16 import org.openstreetmap.josm.gui.widgets.HtmlPanel; … … 104 105 this.model = model; 105 106 build(); 107 HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#AdvancedEditor")); 106 108 } 107 109 -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java
r20675 r20735 13 13 import org.openstreetmap.josm.Main; 14 14 import org.openstreetmap.josm.data.Preferences; 15 import org.openstreetmap.josm.gui.help.HelpUtil; 15 16 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 16 17 import org.openstreetmap.josm.plugins.turnrestrictions.editor.NavigationControler.BasicEditorFokusTargets; … … 123 124 this.model = model; 124 125 build(); 126 HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#BasicEditor")); 125 127 } 126 128 -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java
r20586 r20735 122 122 } 123 123 this.selection.addAll(selection); 124 sort();125 124 fireContentsChanged(this, 0, getSize()); 126 125 setSelected(sel); 127 }128 129 /**130 * Sorts the primitives in the list131 */132 public void sort() {133 Collections.sort(this.selection,new OsmPrimitiveComparator());134 126 } 135 127 … … 234 226 return ret; 235 227 } 236 237 /**238 * The comparator used when sorting the elements in this model239 *240 */241 static private class OsmPrimitiveComparator implements Comparator<OsmPrimitive> {242 final private HashMap<Object, String> cache= new HashMap<Object, String>();243 final private DefaultNameFormatter df = DefaultNameFormatter.getInstance();244 245 private String cachedName(OsmPrimitive p) {246 String name = cache.get(p);247 if (name == null) {248 name = p.getDisplayName(df);249 cache.put(p, name);250 }251 return name;252 }253 254 private int compareName(OsmPrimitive a, OsmPrimitive b) {255 String an = cachedName(a);256 String bn = cachedName(b);257 // make sure display names starting with digits are the end of the258 // list259 if (Character.isDigit(an.charAt(0)) && Character.isDigit(bn.charAt(0)))260 return an.compareTo(bn);261 else if (Character.isDigit(an.charAt(0)) && !Character.isDigit(bn.charAt(0)))262 return 1;263 else if (!Character.isDigit(an.charAt(0)) && Character.isDigit(bn.charAt(0)))264 return -1;265 return an.compareTo(bn);266 }267 268 private int compareType(OsmPrimitive a, OsmPrimitive b) {269 // show ways before relations, then nodes270 //271 if (a.getType().equals(b.getType())) return 0;272 if (a.getType().equals(OsmPrimitiveType.WAY)) return -1;273 if (a.getType().equals(OsmPrimitiveType.NODE)) return 1;274 // a is a relation275 if (b.getType().equals(OsmPrimitiveType.WAY)) return 1;276 // b is a node277 return -1;278 }279 public int compare(OsmPrimitive a, OsmPrimitive b) {280 if (a.getType().equals(b.getType()))281 return compareName(a, b);282 return compareType(a, b);283 }284 }285 228 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java
r20675 r20735 105 105 pnl.add(new SideButton(new CancelAction())); 106 106 107 pnl.add(new SideButton(new ContextSensitiveHelpAction(ht("/Plugins/turnrestrictions "))));107 pnl.add(new SideButton(new ContextSensitiveHelpAction(ht("/Plugins/turnrestrictions#TurnRestrictionEditor")))); 108 108 return pnl; 109 109 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModel.java
r20724 r20735 209 209 */ 210 210 public void apply(Relation turnRestriction) { 211 CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction"); 212 211 CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction"); 213 212 TagCollection tags = tagEditorModel.getTagCollection(); 213 turnRestriction.removeAll(); 214 214 tags.applyTo(turnRestriction); 215 215 memberModel.applyTo(turnRestriction); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java
r20711 r20735 33 33 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener; 34 34 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 35 import org.openstreetmap.josm.gui.help.HelpUtil; 35 36 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 36 37 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; … … 166 167 ); 167 168 build(); 169 HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#TurnRestrictionToggleDialog")); 168 170 } 169 171 -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesView.java
r20586 r20735 9 9 import javax.swing.JPanel; 10 10 11 import org.openstreetmap.josm.gui.help.HelpUtil; 11 12 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 12 13 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 36 37 model.addObserver(this); 37 38 build(); 39 HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#ErrorsAndWarnings")); 38 40 } 39 41
Note:
See TracChangeset
for help on using the changeset viewer.