Changeset 27857 in osm for applications/editors/josm/plugins/utilsplugin2
- Timestamp:
- 2012-02-18T15:10:01+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/customurl/UtilsPluginPreferences.java ¶
r27543 r27857 1 /* 2 * To change this template, choose Tools | Templates 3 * and open the template in the editor. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package utilsplugin2.customurl; 6 3 … … 22 19 import javax.swing.event.TableModelListener; 23 20 import javax.swing.table.DefaultTableModel; 24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 21 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 25 22 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 26 23 import org.openstreetmap.josm.tools.GBC; … … 28 25 import static org.openstreetmap.josm.tools.I18n.*; 29 26 30 public class UtilsPluginPreferences implementsPreferenceSetting {27 public class UtilsPluginPreferences extends DefaultTabPreferenceSetting { 31 28 HistoryComboBox combo1=new HistoryComboBox(); 32 29 JTable table; … … 35 32 JButton saveButton; 36 33 34 public UtilsPluginPreferences() { 35 super("utils", tr("Utilsplugin2 settings [TESTING]"), tr("Here you can change some preferences of Utilsplugin2 functions")); 36 } 37 37 38 @Override 38 39 public void addGui(PreferenceTabbedPane gui) { 39 JPanel pp = gui.createPreferenceTab("utils", tr("Utilsplugin2 settings [TESTING]"), 40 tr("Here you can change some preferences of Utilsplugin2 functions")); 40 JPanel pp = gui.createPreferenceTab(this); 41 41 JPanel all = new JPanel(); 42 42 GridBagLayout layout = new GridBagLayout(); 43 43 all.setLayout(layout); 44 44 45 45 // FIXME: get rid of hardcoded URLS 46 46 47 47 String addr = URLList.getSelectedURL(); 48 48 table=new JTable(new DefaultTableModel(null,new String[]{"Title","URL"})); 49 49 50 50 List<String> items = URLList.getURLList(); 51 //System.out.println("pref:"+addr); 52 51 53 52 resetButton = new JButton(tr("Reset")); 54 53 resetButton.addActionListener(new ActionListener() { … … 57 56 } 58 57 }); 59 58 60 59 saveButton = new JButton(tr("Save to file")); 61 60 saveButton.addActionListener(new ActionListener() { … … 64 63 } 65 64 }); 66 65 67 66 loadButton = new JButton(tr("Load from file")); 68 67 loadButton.addActionListener(new ActionListener() { … … 71 70 } 72 71 }); 73 72 74 73 fillRows(items); 75 74 76 75 HtmlPanel help = new HtmlPanel(tr("Please edit custom URLs and select one row to use with the tool<br/>" 77 76 + " <b>{key}</b> is replaced with the tag value<br/>" … … 80 79 + " <b>{#lat} , {#lon}</b> is replaced with map center latitude/longitude <br/>" 81 80 + " Your can manually load settings from file <b>customurl.txt</b> in JOSM folder")); 82 81 83 82 all.add(new JLabel(tr("Custom URL configuration")),GBC.std().insets(5,10,0,0)); 84 83 all.add(resetButton,GBC.std().insets(25,10,0,0)); … … 86 85 all.add(saveButton,GBC.eol().insets(25,10,0,0)); 87 86 all.add(help,GBC.eop().insets(5,10,0,0)); 88 87 89 88 table.getColumnModel().getColumn(0).setPreferredWidth(150); 90 89 table.getColumnModel().getColumn(0).setMaxWidth(300); … … 99 98 if (row<0 || column<0) return; 100 99 String data = (String)model.getValueAt(row, column); 101 if (data!=null && data.length()>0 && row==model.getRowCount()-1) 100 if (data!=null && data.length()>0 && row==model.getRowCount()-1) 102 101 model.addRow(new String[]{"",""}); 103 102 } 104 103 }); 105 104 all.add(table,GBC.eop().fill()); 106 105 107 106 pp.add(all, GBC.eol().fill(GridBagConstraints.BOTH)); 108 107 } … … 135 134 List<String> lst = readItemsFromTable(); 136 135 URLList.updateURLList(lst); 137 136 138 137 return false; 139 138 } 140 141 142 143 139 144 140 private List<String> readItemsFromTable() {
Note:
See TracChangeset
for help on using the changeset viewer.