Changeset 27857 in osm for applications/editors/josm/plugins/turnrestrictions/src/org
- Timestamp:
- 2012-02-18T15:10:01+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java
r23192 r27857 19 19 20 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.gui.preferences. PreferenceSetting;21 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 22 22 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 23 23 import org.openstreetmap.josm.gui.widgets.HtmlPanel; … … 30 30 * 31 31 */ 32 public class PreferenceEditor extends JPanel implements PreferenceSetting{33 32 public class PreferenceEditor extends DefaultTabPreferenceSetting { 33 34 34 private PreferencesPanel pnlIconPreferences; 35 private JPanel mainPanel; 36 37 public PreferenceEditor() { 38 super("turnrestrictions", tr("Turn Restrictions"), tr("An OSM plugin for editing turn restrictions.")); 39 build(); 40 } 35 41 36 42 /** 37 * builds the panel with the sponsoring information 38 * 43 * builds the panel with the sponsoring information 44 * 39 45 * @return 40 46 */ … … 50 56 pnl.add(lbl, gc); 51 57 lbl.setIcon(ImageProvider.get("skobbler-logo")); 52 58 53 59 gc.gridx = 1; 54 60 gc.weightx = 1.0; 55 61 HtmlPanel msg =new HtmlPanel(); 56 62 msg.setText("<html><body>" 57 + tr("Development of the turn restriction plugin was sponsored " 63 + tr("Development of the turn restriction plugin was sponsored " 58 64 + "by <a href=\"http://www.skobbler.de\">skobbler GmbH</a>.") 59 65 +"</body></html>"); 60 66 pnl.add(msg, gc); 61 62 // filler - grab remaining space 67 68 // filler - grab remaining space 63 69 gc.gridy = 1; 64 70 gc.gridx = 0; … … 67 73 gc.weighty = 1.0; 68 74 pnl.add(new JPanel(), gc); 69 75 70 76 SkobblerUrlLauncher urlLauncher = new SkobblerUrlLauncher(); 71 77 msg.getEditorPane().addHyperlinkListener(urlLauncher); … … 76 82 protected JPanel buildIconPreferencePanel() { 77 83 JPanel pnl = new JPanel(new BorderLayout()); 78 84 79 85 pnlIconPreferences = new PreferencesPanel(); 80 86 pnlIconPreferences.initFromPreferences(Main.pref); 81 87 82 88 JScrollPane sp = new JScrollPane(pnlIconPreferences); 83 89 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 84 90 sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); 85 91 86 92 pnl.add(sp, BorderLayout.CENTER); 87 93 return pnl; 88 94 } 89 95 90 96 protected void build() { 91 setLayout(new BorderLayout()); 97 mainPanel = new JPanel(); 98 mainPanel.setLayout(new BorderLayout()); 92 99 JTabbedPane tp = new JTabbedPane(); 93 100 tp.add(buildIconPreferencePanel()); 94 tp.add(buildCreditPanel()); 101 tp.add(buildCreditPanel()); 95 102 tp.setTitleAt(0, tr("Preferences")); 96 103 tp.setToolTipTextAt(0,tr("Configure the preferences for the turnrestrictions plugin")); 97 104 tp.setTitleAt(1, tr("Sponsor")); 98 add(tp, BorderLayout.CENTER);105 mainPanel.add(tp, BorderLayout.CENTER); 99 106 } 100 101 public PreferenceEditor() { 102 build(); 103 } 104 107 105 108 public void addGui(PreferenceTabbedPane gui) { 106 String description = tr("An OSM plugin for editing turn restrictions."); 107 JPanel tab = gui.createPreferenceTab("turnrestrictions", tr("Turn Restrictions"), description); 108 tab.add(this, GBC.eol().fill(GBC.BOTH)); 109 JPanel tab = gui.createPreferenceTab(this); 110 tab.add(mainPanel, GBC.eol().fill(GBC.BOTH)); 109 111 } 110 112 … … 113 115 return false; 114 116 } 115 117 116 118 /** 117 * Launches an external browser with the sponsors home page 119 * Launches an external browser with the sponsors home page 118 120 */ 119 121 class SkobblerUrlLauncher extends MouseAdapter implements HyperlinkListener { … … 121 123 OpenBrowser.displayUrl("http://www.skobbler.de"); 122 124 } 123 125 124 126 public void hyperlinkUpdate(HyperlinkEvent e) { 125 127 if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
Note:
See TracChangeset
for help on using the changeset viewer.