Changeset 22420 in osm for applications/editors/josm/plugins/roadsigns/src
- Timestamp:
- 2010-07-22T14:00:54+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/ParametrizedString.java
r21967 r22420 1 //License: GPL (v2 or later) 1 // License: GPL (v2 or later) 2 2 package org.openstreetmap.josm.plugins.roadsigns; 3 3 -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignInputDialog.java
r21995 r22420 11 11 import java.awt.Rectangle; 12 12 import java.awt.event.ActionEvent; 13 import java.awt.event.ActionListener; 13 14 import java.awt.event.MouseAdapter; 14 15 import java.awt.event.MouseEvent; … … 24 25 25 26 import javax.swing.BorderFactory; 27 import javax.swing.JCheckBox; 26 28 import javax.swing.JComponent; 27 29 import javax.swing.JEditorPane; … … 52 54 import org.openstreetmap.josm.plugins.roadsigns.Sign.SignParameter; 53 55 import org.openstreetmap.josm.plugins.roadsigns.Sign.Tag; 56 import org.openstreetmap.josm.tools.GBC; 54 57 import org.openstreetmap.josm.tools.OpenBrowser; 55 58 import org.openstreetmap.josm.tools.Pair; … … 69 72 */ 70 73 class RoadSignInputDialog extends ExtendedDialog { 71 private final SignSelection sel; 72 private final List<Sign> signs; 73 private JTable previewTable; 74 75 private PreviewTableModel previewModel; 76 private JPanel pnlSignSelection; 77 private JPanel pnlPossibleSigns; 78 private JPanel pnlPossibleSupplements; 79 private JEditorPane info; 80 private JScrollPane scrollInfo; 74 protected final SignSelection sel; 75 protected final List<Sign> signs; 76 protected JTable previewTable; 77 protected JCheckBox addTrafficSignTag; 78 79 protected PreviewTableModel previewModel; 80 protected JPanel pnlSignSelection; 81 protected JPanel pnlPossibleSigns; 82 protected JPanel pnlPossibleSupplements; 83 protected JEditorPane info; 84 protected JScrollPane scrollInfo; 81 85 82 86 public RoadSignInputDialog(List<Sign> signs) { … … 93 97 Collection<OsmPrimitive> selPrim = Main.main.getCurrentDataSet().getSelected(); 94 98 if (selPrim.size() != 0) { 99 Main.pref.put("plugin.roadsigns.addTrafficSignTag", addTrafficSignTag.isSelected()); 100 95 101 Command cmd = createCommand(selPrim); 96 102 if (cmd != null) { … … 464 470 465 471 public JComponent buildPreviewPanel() { 472 JPanel previewPanel = new JPanel(new GridBagLayout()); 473 466 474 String[] columnNames = {tr("Key"), tr("Value")}; 467 475 String[][] data = {{}}; 468 previewTable = new JTable(data, columnNames); 476 previewTable = new JTable(data, columnNames) { 477 public String getToolTipText(MouseEvent e) { 478 int rowIndex = rowAtPoint(e.getPoint()); 479 int colIndex = columnAtPoint(e.getPoint()); 480 if (rowIndex == -1 || colIndex == -1) 481 return null; 482 int realColumnIndex = convertColumnIndexToModel(colIndex); 483 return (String) getValueAt(rowIndex, colIndex); 484 } 485 }; 469 486 previewTable.setFillsViewportHeight(true); 470 487 previewTable.setRowSelectionAllowed(false); … … 475 492 476 493 JScrollPane scroll = new JScrollPane(previewTable); 477 Dimension dim = new Dimension( 236, 10);494 Dimension dim = new Dimension(336, 10); 478 495 scroll.setPreferredSize(dim); 479 496 scroll.setMinimumSize(dim); /* minimum size is relevant for multisplit layout */ 480 return scroll; 497 498 addTrafficSignTag = new JCheckBox(tr("{0} tag", "traffic_sign")); 499 addTrafficSignTag.setSelected(Main.pref.getBoolean("plugin.roadsigns.addTrafficSignTag")); 500 addTrafficSignTag.addActionListener(new ActionListener() { 501 public void actionPerformed(ActionEvent e) { 502 previewModel.update(); 503 } 504 }); 505 506 previewPanel.add(scroll, GBC.eol().fill()); 507 previewPanel.add(addTrafficSignTag, GBC.eol()); 508 return previewPanel; 481 509 } 482 510 … … 515 543 public void update() { 516 544 final TreeMap<String, String> map= new TreeMap<String, String>(); 545 String traffic_sign = ""; 546 517 547 for (SignCombination sc : sel.combos) { 518 548 final Map<String, String> env = new HashMap<String, String>(); 549 String combo_traffic_sign = ""; 519 550 520 551 /** … … 573 604 if (sw.sign.ref != null) { 574 605 sw.signRef = sw.sign.ref.evaluate(env); 606 if (combo_traffic_sign.length() != 0) { 607 combo_traffic_sign += ","; 608 } 609 if (sw.sign.traffic_sign_tag != null) { 610 combo_traffic_sign += sw.sign.traffic_sign_tag.evaluate(env); 611 } else { 612 combo_traffic_sign += sw.signRef; 613 } 575 614 } 576 615 for (Tag t : sw.sign.tags) { … … 615 654 map.putAll(result); 616 655 } 656 657 if (combo_traffic_sign.length() != 0) { 658 if (traffic_sign.length() != 0) { 659 traffic_sign += ";"; 660 } 661 traffic_sign += combo_traffic_sign; 662 } 663 } 664 if (addTrafficSignTag.isSelected()) { 665 map.put("traffic_sign", traffic_sign); 617 666 } 618 667 -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsPlugin.java
r21995 r22420 68 68 presetsLoaded=true; 69 69 List<String> files = new ArrayList<String>( 70 Main.pref.getCollection("plugin.roadsign.sources", 70 Main.pref.getCollection("plugin.roadsigns.sources", 71 71 Collections.<String>singletonList("resource://data/defaultroadsignpreset.xml"))); 72 72 iconDirs = new ArrayList<String>( 73 Main.pref.getCollection("plugin.roadsign.icon.sources", Collections.<String>emptySet())); 73 Main.pref.getCollection("plugin.roadsigns.icon.sources", Collections.<String>emptySet())); 74 74 75 if (Main.pref.getBoolean("plugin.roadsign.use_default_icon_source", true)) { 75 if (Main.pref.getBoolean("plugin.roadsigns.use_default_icon_source", true)) { 76 76 iconDirs.add("resource://images/"); 77 77 } -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/RoadSignsReader.java
r21995 r22420 77 77 try { 78 78 curSign.ref = ParametrizedString.create(atts.getValue("ref")); 79 curSign.traffic_sign_tag = ParametrizedString.create(atts.getValue("traffic_sign_tag")); 79 80 } catch (ParseException ex) { 80 81 throw new SAXException(ex); … … 107 108 curSign.isSupplementing = true; 108 109 } 109 110 110 111 curSign.wiki = atts.getValue("wiki"); 111 112 curSign.loc_wiki = getLocalized(atts, "wiki"); -
applications/editors/josm/plugins/roadsigns/src/org/openstreetmap/josm/plugins/roadsigns/Sign.java
r21995 r22420 21 21 public String id; 22 22 public ParametrizedString ref; 23 public ParametrizedString traffic_sign_tag; 23 24 public String iconURL; 24 25 public ImageIcon icon; … … 99 100 r = r.replaceAll("\\[.*\\]", ""); 100 101 if (r.startsWith("DE:")) { 101 r=r.replace First("DE:", "");102 r=r.replaceAll("DE:", ""); 102 103 /* normal sign: starts with 3 digits, then a non-digit */ 103 104 {
Note:
See TracChangeset
for help on using the changeset viewer.