Changeset 12321 in osm
- Timestamp:
- 2008-12-13T18:11:39+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r12187 r12321 10 10 import java.util.Map; 11 11 import java.util.TreeSet; 12 import java.util.TreeMap; 12 13 import java.io.*; 13 14 … … 40 41 41 42 static ArrayList<WMSInfo> wmsList = new ArrayList<WMSInfo>(); 43 static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>(); 42 44 43 45 // remember state of menu item to restore on changed preferences … … 102 104 wmsList.add(new WMSInfo(name, url, prefid)); 103 105 } 104 setDefault(tr ("Landsat"), "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&"+106 setDefault(true, tr("Landsat"), "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&"+ 105 107 "layers=global_mosaic&styles=&srs=EPSG:4326&format=image/jpeg"); 106 setDefault(tr("NPE Maps"), "http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe&"); 107 setDefault(tr("YAHOO (GNOME)"), "yahoo://gnome-web-photo --mode=photo --format=png {0} /dev/stdout"); 108 setDefault(tr("YAHOO (GNOME Fix)"), "yahoo://gnome-web-photo-fixed {0}"); 109 setDefault(tr("YAHOO (WebKit)"), "yahoo://webkit-image {0}"); 108 setDefault(true, tr("NPE Maps"), "http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe&"); 109 setDefault(false, tr("YAHOO (GNOME)"), "yahoo://gnome-web-photo --mode=photo --format=png {0} /dev/stdout"); 110 setDefault(false, tr("YAHOO (GNOME Fix)"), "yahoo://gnome-web-photo-fixed {0}"); 111 setDefault(true, tr("YAHOO (WebKit)"), "yahoo://webkit-image {0}"); 112 setDefault(false, tr("YAHOO (WebKit GTK)"), "yahoo://webkit-image-gtk {0}"); 110 113 111 114 Collections.sort(wmsList); … … 140 143 141 144 /* add a default entry in case the URL does not yet exist */ 142 private static void setDefault( String name, String url)145 private static void setDefault(Boolean force, String name, String url) 143 146 { 144 147 String testurl = url.replaceAll("=", "_"); 145 if(!Main.pref.getBoolean("wmsplugin.default."+testurl)) 148 wmsListDefault.put(name, url); 149 150 if(force && !Main.pref.getBoolean("wmsplugin.default."+testurl)) 146 151 { 147 152 Main.pref.put("wmsplugin.default."+testurl, true); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r10767 r12321 31 31 private DefaultTableModel model; 32 32 private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>(); 33 33 34 34 public void addGui(final PreferenceDialog gui) { 35 35 JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu")); … … 39 39 JScrollPane scroll = new JScrollPane(list); 40 40 p.add(scroll, GBC.eol().fill(GBC.BOTH)); 41 scroll.setPreferredSize(new Dimension( 400,200));41 scroll.setPreferredSize(new Dimension(200,200)); 42 42 43 43 for (WMSInfo i : WMSPlugin.wmsList) { … … 45 45 model.addRow(new String[]{i.name, i.url}); 46 46 } 47 47 48 final DefaultTableModel modeldef = new DefaultTableModel( 49 new String[]{tr("Menu Name (Default)"), tr("WMS URL (Default)")}, 0); 50 final JTable listdef = new JTable(modeldef){ 51 public boolean isCellEditable(int row,int column){return false;} 52 };; 53 JScrollPane scrolldef = new JScrollPane(listdef); 54 p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(GBC.BOTH)); 55 scrolldef.setPreferredSize(new Dimension(200,200)); 56 57 for (Map.Entry<String,String> i : WMSPlugin.wmsListDefault.entrySet()) { 58 modeldef.addRow(new String[]{i.getKey(), i.getValue()}); 59 } 60 48 61 JButton add = new JButton(tr("Add")); 49 62 p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); … … 76 89 while ((i = list.getSelectedRow()) != -1) 77 90 model.removeRow(i); 91 } 92 } 93 }); 94 95 JButton copy = new JButton(tr("Copy Default")); 96 p.add(copy, GBC.std().insets(0,5,0,0)); 97 copy.addActionListener(new ActionListener(){ 98 public void actionPerformed(ActionEvent e) { 99 Integer line = listdef.getSelectedRow(); 100 if (line == -1) 101 JOptionPane.showMessageDialog(gui, tr("Please select the row to copy.")); 102 else 103 { 104 model.addRow(new String[]{modeldef.getValueAt(line, 0).toString(), 105 modeldef.getValueAt(line, 1).toString()}); 78 106 } 79 107 }
Note:
See TracChangeset
for help on using the changeset viewer.