Ignore:
Timestamp:
2012-02-18T15:10:01+01:00 (13 years ago)
Author:
bastik
Message:

update because of core api change (preferences - rev. 4968)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java

    r23192 r27857  
    1919
    2020import org.openstreetmap.josm.Main;
    21 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     21import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    2222import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    2323import org.openstreetmap.josm.gui.widgets.HtmlPanel;
     
    3030 *
    3131 */
    32 public class PreferenceEditor extends JPanel implements PreferenceSetting{
    33    
     32public class PreferenceEditor extends DefaultTabPreferenceSetting {
     33
    3434    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    }
    3541
    3642    /**
    37      * builds the panel with the sponsoring information 
    38      * 
     43     * builds the panel with the sponsoring information
     44     *
    3945     * @return
    4046     */
     
    5056        pnl.add(lbl, gc);
    5157        lbl.setIcon(ImageProvider.get("skobbler-logo"));
    52        
     58
    5359        gc.gridx = 1;
    5460        gc.weightx = 1.0;
    5561        HtmlPanel msg  =new HtmlPanel();
    5662        msg.setText("<html><body>"
    57                 + tr("Development of the turn restriction plugin was sponsored " 
     63                + tr("Development of the turn restriction plugin was sponsored "
    5864                + "by <a href=\"http://www.skobbler.de\">skobbler GmbH</a>.")
    5965                +"</body></html>");
    6066        pnl.add(msg, gc);
    61        
    62         // filler - grab remaining space 
     67
     68        // filler - grab remaining space
    6369        gc.gridy = 1;
    6470        gc.gridx = 0;
     
    6773        gc.weighty = 1.0;
    6874        pnl.add(new JPanel(), gc);
    69        
     75
    7076        SkobblerUrlLauncher urlLauncher = new SkobblerUrlLauncher();
    7177        msg.getEditorPane().addHyperlinkListener(urlLauncher);
     
    7682    protected JPanel buildIconPreferencePanel() {
    7783        JPanel pnl = new JPanel(new BorderLayout());
    78        
     84
    7985        pnlIconPreferences = new PreferencesPanel();
    8086        pnlIconPreferences.initFromPreferences(Main.pref);
    81        
     87
    8288        JScrollPane sp = new JScrollPane(pnlIconPreferences);
    8389        sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    8490        sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    85        
     91
    8692        pnl.add(sp, BorderLayout.CENTER);
    8793        return pnl;
    8894    }
    89    
     95
    9096    protected void build() {
    91         setLayout(new BorderLayout());
     97        mainPanel = new JPanel();
     98        mainPanel.setLayout(new BorderLayout());
    9299        JTabbedPane tp = new JTabbedPane();
    93100        tp.add(buildIconPreferencePanel());
    94         tp.add(buildCreditPanel());     
     101        tp.add(buildCreditPanel());
    95102        tp.setTitleAt(0, tr("Preferences"));
    96103        tp.setToolTipTextAt(0,tr("Configure the preferences for the turnrestrictions plugin"));
    97104        tp.setTitleAt(1, tr("Sponsor"));
    98         add(tp, BorderLayout.CENTER);
     105        mainPanel.add(tp, BorderLayout.CENTER);
    99106    }
    100    
    101     public PreferenceEditor() {
    102         build();
    103     }
    104    
     107
    105108    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));
    109111    }
    110112
     
    113115        return false;
    114116    }
    115    
     117
    116118    /**
    117      * Launches an external browser with the sponsors home page 
     119     * Launches an external browser with the sponsors home page
    118120     */
    119121    class SkobblerUrlLauncher extends MouseAdapter implements HyperlinkListener {
     
    121123            OpenBrowser.displayUrl("http://www.skobbler.de");
    122124        }
    123        
     125
    124126        public void hyperlinkUpdate(HyperlinkEvent e) {
    125127            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
Note: See TracChangeset for help on using the changeset viewer.