Changeset 33628 in osm for applications/editors/josm/plugins
- Timestamp:
- 2017-09-18T07:11:12+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/gui/WikosmDownloadSource.java
r33626 r33628 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.BorderLayout; 7 import java.awt.Dimension; 8 import java.awt.GridBagLayout; 6 import java.awt.*; 9 7 import java.awt.event.ActionEvent; 10 8 import java.awt.event.FocusEvent; … … 36 34 import org.openstreetmap.josm.tools.GBC; 37 35 import org.openstreetmap.josm.tools.ImageProvider; 36 import org.openstreetmap.josm.tools.OpenBrowser; 38 37 import org.wikipedia.io.WikosmDownloadReader; 39 38 … … 76 75 public static class WikosmDownloadSourcePanel extends AbstractDownloadSourcePanel<WikosmDownloadData> { 77 76 77 private static final String HELP_PAGE = "https://wiki.openstreetmap.org/wiki/Wikidata%2BOSM_SPARQL_query_service"; 78 78 private static final String SIMPLE_NAME = "wikosmdownloadpanel"; 79 79 private static final AbstractProperty<Integer> PANEL_SIZE_PROPERTY = … … 96 96 setLayout(new BorderLayout()); 97 97 98 // CHECKSTYLE.OFF: LineLength 99 this.wikosmQuery = new JosmTextArea( 100 "# " + tr("Enter your Wikosm SPARQL query below") + "\n" 101 + "SELECT ?osmId ?loc WHERE { BIND(osmnode:2681940767 as ?osmId). ?osmId osmm:loc ?loc . }", 102 8, 80); 103 // CHECKSTYLE.ON: LineLength 98 String queryText = "# " + 99 tr("Find places of education at least 2km, and at most 3km from the center of the selection") + 100 "\n" + 101 "SELECT ?osmid WHERE {\n" + 102 " VALUES ?amenity { \"kindergarten\" \"school\" \"university\" \"college\" }\n" + 103 " ?osmid osmt:amenity ?amenity ;\n" + 104 " osmm:loc ?location .\n" + 105 " BIND(geof:distance({{center}}, ?location) as ?distance)\n" + 106 " FILTER(?distance > 2 && ?distance < 3)\n" + 107 "}"; 108 109 this.wikosmQuery = new JosmTextArea(queryText, 8, 80); 110 104 111 this.wikosmQuery.setFont(GuiHelper.getMonospacedFont(wikosmQuery)); 105 112 this.wikosmQuery.addFocusListener(new FocusListener() { … … 149 156 }); 150 157 158 // TODO: Once new core is widely avialable, replace: 159 // Main.pref.getBoolean --> Config.getPref().getBoolean 160 // Main.pref.put --> Config.getPref().putBoolean 151 161 152 162 referrers = new JCheckBox(tr("Download referrers (parent relations)")); 153 163 referrers.setToolTipText(tr("Select if the referrers of the object should be downloaded as well, i.e.," 154 164 + "parent relations and for nodes, additionally, parent ways")); 155 156 // TODO: Once new core is widely avialable, replace:157 // Main.pref.getBoolean --> Config.getPref().getBoolean158 // Main.pref.put --> Config.getPref().putBoolean159 160 165 referrers.setSelected(Main.pref.getBoolean("wikosm.downloadprimitive.referrers", true)); 161 166 referrers.addActionListener(e -> Main.pref.put("wikosm.downloadprimitive.referrers", referrers.isSelected())); … … 166 171 fullRel.addActionListener(e -> Main.pref.put("wikosm.downloadprimitive.full", fullRel.isSelected())); 167 172 173 // https://stackoverflow.com/questions/527719/how-to-add-hyperlink-in-jlabel 174 JButton helpLink = new JButton(); 175 helpLink.setText("<HTML><FONT color=\"#000099\"><U>"+tr("help")+"</U></FONT></HTML>"); 176 helpLink.setToolTipText(HELP_PAGE); 177 helpLink.setHorizontalAlignment(SwingConstants.LEFT); 178 helpLink.setBorderPainted(false); 179 helpLink.setOpaque(false); 180 helpLink.setBackground(Color.WHITE); 181 helpLink.addActionListener(e -> OpenBrowser.displayUrl(HELP_PAGE)); 182 168 183 JPanel centerPanel = new JPanel(new GridBagLayout()); 169 184 centerPanel.add(scrollPane, GBC.eol().fill(GBC.BOTH)); 170 185 centerPanel.add(referrers, GBC.std().anchor(GBC.WEST).insets(5, 5, 5, 5)); 171 186 centerPanel.add(fullRel, GBC.std().anchor(GBC.WEST).insets(15, 5, 5, 5)); 187 centerPanel.add(helpLink, GBC.std().anchor(GBC.WEST).insets(10, 5, 5, 5)); 172 188 173 189
Note:
See TracChangeset
for help on using the changeset viewer.