Changeset 27857 in osm


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

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

Location:
applications/editors/josm/plugins
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/osmarender/build.xml

    r27243 r27857  
    3434    <property name="xslt" location="./xslt"/>
    3535    <property name="commit.message" value="Fixed #4360 - osmarender plugin does not load"/>
    36     <property name="plugin.main.version" value="4645"/>
     36    <property name="plugin.main.version" value="4968"/>
    3737    <target name="init">
    3838        <mkdir dir="${plugin.build.dir}"/>
  • applications/editors/josm/plugins/osmarender/src/org/openstreetmap/josm/plugins/osmarender/OsmarenderPlugin.java

    r27243 r27857  
    3434import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    3535import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
     36import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting;
     37import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting;
    3638import org.openstreetmap.josm.io.OsmWriter;
    3739import org.openstreetmap.josm.io.OsmWriterFactory;
     
    142144
    143145    @Override public PreferenceSetting getPreferenceSetting() {
    144         return new PreferenceSetting(){
    145             private JTextField firefox = new JTextField(10);
    146             public void addGui(PreferenceTabbedPane gui) {
    147                 final JPanel panel = new JPanel(new GridBagLayout());
    148                 panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
    149 
    150                 panel.add(new JLabel(tr("Firefox executable")), GBC.std().insets(10,5,5,0));
    151                 panel.add(firefox, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
    152                 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
    153                 firefox.setText(Main.pref.get("osmarender.firefox"));
    154                 gui.mapcontent.addTab(tr("Osmarender"), panel);
    155             }
    156             public boolean ok() {
    157                 Main.pref.put("osmarender.firefox", firefox.getText());
    158                 return false;
    159             }
    160         };
     146        return new OsmarenderPreferenceSetting();
     147    }
     148
     149    private class OsmarenderPreferenceSetting implements SubPreferenceSetting {
     150
     151        private JTextField firefox = new JTextField(10);
     152
     153        @Override
     154        public void addGui(PreferenceTabbedPane gui) {
     155            final JPanel panel = new JPanel(new GridBagLayout());
     156            panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
     157
     158            panel.add(new JLabel(tr("Firefox executable")), GBC.std().insets(10,5,5,0));
     159            panel.add(firefox, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
     160            panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
     161            firefox.setText(Main.pref.get("osmarender.firefox"));
     162            gui.getMapPreference().mapcontent.addTab(tr("Osmarender"), panel);
     163        }
     164
     165        @Override
     166        public boolean ok() {
     167            Main.pref.put("osmarender.firefox", firefox.getText());
     168            return false;
     169        }
     170
     171        @Override
     172        public boolean isExpert() {
     173            return false;
     174        }
     175
     176        @Override
     177        public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) {
     178            return gui.getMapPreference();
     179        }
     180
    161181    }
    162182
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java

    r23561 r27857  
    5555import org.apache.log4j.Logger;
    5656import org.openstreetmap.josm.Main;
    57 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     57import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    5858import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    5959import org.openstreetmap.josm.tools.GBC;
     
    6161import com.innovant.josm.jrt.osm.OsmWayTypes;
    6262
    63 public class RoutingPreferenceDialog implements PreferenceSetting {
     63public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting {
    6464
    6565    /**
     
    7575     */
    7676    public RoutingPreferenceDialog() {
    77         super();
     77        super("routing", tr("Routing Plugin Preferences"), tr("Configure routing preferences."));
    7878        readPreferences();
    7979    }
     
    8181    public void addGui(final PreferenceTabbedPane gui) {
    8282
    83         JPanel principal = gui.createPreferenceTab("routing",
    84                 tr("Routing Plugin Preferences"), tr("Configure routing preferences."));
     83        JPanel principal = gui.createPreferenceTab(this);
    8584
    8685        JPanel p = new JPanel();
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java

    r25883 r27857  
    99
    1010import org.openstreetmap.josm.Main;
    11 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     11import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    1212import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    1313import org.openstreetmap.josm.tools.GBC;
    1414
    15 public class SimplifyAreaPreferenceSetting implements PreferenceSetting {
     15public class SimplifyAreaPreferenceSetting extends DefaultTabPreferenceSetting {
    1616
    1717    static final String DIST_FACTOR = "simplify-area.dist.factor";
     
    3131    private final JTextField distanceFactor = new JTextField(8);
    3232
     33    public SimplifyAreaPreferenceSetting() {
     34        super("simplifyArea", "Simplify Area", "Node of the way (area) is removed if all of <u>Angle Weight</u>, <u>Area Weight</u> and <u>Distance Weight</u> are greater than 1. " +
     35                "<u>Weight</u> is computed as <u>Value</u> / <u>Threshold</u>, where <u>Value</u> is one of <u>Angle</u>, <u>Area</u> and <u>Distance</u> " +
     36                "computed from every three adjanced points of the way." +
     37                "<ul><li><u>Value</u> of <u>Angle</u> is angle in degrees on the second node</li>" +
     38                "<li><u>Value</u> of <u>Area</u> is area formed by triangle</li>" +
     39                "<li><u>Value</u> of the <u>Distance</u> is Cross Track Error Distance</li></ul>" +
     40                "All three <u>Weight</u>s multiplied by its <u>Factor</u>s are summed and node of the lowest sum is removed first. " +
     41                "Removal continues until there is no node to remove." +
     42                "Merge Nearby Nodes is another step of the simplification that merges adjanced nodes that are closer than <u>Threshold</u> meters.");
     43    }
    3344
    3445    @Override
    3546    public void addGui(final PreferenceTabbedPane gui) {
    36         final JPanel tab = gui.createPreferenceTab("simplifyArea", "Simplify Area", "Node of the way (area) is removed if all of <u>Angle Weight</u>, <u>Area Weight</u> and <u>Distance Weight</u> are greater than 1. " +
    37                         "<u>Weight</u> is computed as <u>Value</u> / <u>Threshold</u>, where <u>Value</u> is one of <u>Angle</u>, <u>Area</u> and <u>Distance</u> " +
    38                         "computed from every three adjanced points of the way." +
    39                         "<ul><li><u>Value</u> of <u>Angle</u> is angle in degrees on the second node</li>" +
    40                         "<li><u>Value</u> of <u>Area</u> is area formed by triangle</li>" +
    41                         "<li><u>Value</u> of the <u>Distance</u> is Cross Track Error Distance</li></ul>" +
    42                         "All three <u>Weight</u>s multiplied by its <u>Factor</u>s are summed and node of the lowest sum is removed first. " +
    43                         "Removal continues until there is no node to remove." +
    44                         "Merge Nearby Nodes is another step of the simplification that merges adjanced nodes that are closer than <u>Threshold</u> meters.");
     47        final JPanel tab = gui.createPreferenceTab(this);
    4548
    4649        angleThreshold.setText(Main.pref.get(ANGLE_THRESHOLD, "10"));
  • applications/editors/josm/plugins/tag2link/build.xml

    r26990 r27857  
    3232    <property name="commit.message" value="Commit message"/>
    3333    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    34     <property name="plugin.main.version" value="4549"/>
     34    <property name="plugin.main.version" value="4968"/>
    3535    <!-- should not be necessary to change the following properties -->
    3636    <property name="josm" location="../../core/dist/josm-custom.jar"/>
     
    149149    </target>
    150150    <!--
    151     ************************** Publishing the plugin *********************************** 
    152     -->
    153     <!--
    154     ** extracts the JOSM release for the JOSM version in ../core and saves it in the 
     151    ************************** Publishing the plugin ***********************************
     152    -->
     153    <!--
     154    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    155155    ** property ${coreversion.info.entry.revision}
    156156    -->
     
    196196        <echo>
    197197    ***** Properties of published ${plugin.jar} *****
    198     Commit message    : '${commit.message}'                   
     198    Commit message    : '${commit.message}'
    199199    Plugin-Mainversion: ${plugin.main.version}
    200200    JOSM build version: ${coreversion.info.entry.revision}
    201201    Plugin-Version    : ${version.entry.commit.revision}
    202     ***** / Properties of published ${plugin.jar} *****                   
    203                        
     202    ***** / Properties of published ${plugin.jar} *****
     203
    204204    Now commiting ${plugin.jar} ...
    205205    </echo>
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java

    r27305 r27857  
    4242public class Tag2LinkPlugin extends Plugin {
    4343
    44     private Tag2LinkPreferenceSetting preferenceSetting;
    45    
     44    // private Tag2LinkPreferenceSetting preferenceSetting; TODO
     45
    4646        /**
    4747         * Initializes the plugin.
     
    5050        public Tag2LinkPlugin(PluginInformation info) {
    5151                super(info);
    52                 this.preferenceSetting = new Tag2LinkPreferenceSetting();
     52                // this.preferenceSetting = new Tag2LinkPreferenceSetting();
    5353                Tag2LinkRuleChecker.init();
    5454        }
     
    5757     * @see org.openstreetmap.josm.plugins.Plugin#getPreferenceSetting()
    5858     */
    59     @Override
    60     public PreferenceSetting getPreferenceSetting() {
    61         return this.preferenceSetting;
    62     }
    63    
     59//    @Override
     60//    public PreferenceSetting getPreferenceSetting() {
     61//        return this.preferenceSetting;
     62//    }
     63
    6464    /* (non-Javadoc)
    6565     * @see org.openstreetmap.josm.plugins.Plugin#mapFrameInitialized(org.openstreetmap.josm.gui.MapFrame, org.openstreetmap.josm.gui.MapFrame)
     
    6868    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    6969        if (newFrame != null) {
    70             // Initialize dialogs listeners only after the main frame is created 
     70            // Initialize dialogs listeners only after the main frame is created
    7171            newFrame.selectionListDialog.addPopupMenuListener(new SelectionPopupListener(newFrame));
    7272            newFrame.propertiesDialog.addMembershipPopupMenuListener(new MembershipPopupListener(newFrame));
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPreferenceSetting.java

    r26922 r27857  
    1616package org.openstreetmap.josm.plugins.tag2link;
    1717
    18 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     18import static org.openstreetmap.josm.tools.I18n.tr;
     19
     20import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    1921import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    2022
    21 public class Tag2LinkPreferenceSetting implements PreferenceSetting, Tag2LinkConstants {
     23public class Tag2LinkPreferenceSetting extends DefaultTabPreferenceSetting implements Tag2LinkConstants {
     24
     25    public Tag2LinkPreferenceSetting() {
     26        super(ICON_48, tr("Tag2Link Preferences"), tr("Tag2Link Preferences"));
     27    }
    2228
    2329    @Override
  • applications/editors/josm/plugins/turnrestrictions/build.xml

    r27352 r27857  
    3232    <property name="commit.message" value="Adapt to JOSM core change (DefaultNameFormatter)"/>
    3333    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    34     <property name="plugin.main.version" value="4549"/>
     34    <property name="plugin.main.version" value="4968"/>
    3535    <!--
    3636      ************************************************
  • 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)) {
  • 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.
    52package utilsplugin2.customurl;
    63
     
    2219import javax.swing.event.TableModelListener;
    2320import javax.swing.table.DefaultTableModel;
    24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     21import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
    2522import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    2623import org.openstreetmap.josm.tools.GBC;
     
    2825import static org.openstreetmap.josm.tools.I18n.*;
    2926
    30 public class UtilsPluginPreferences  implements PreferenceSetting {
     27public class UtilsPluginPreferences extends DefaultTabPreferenceSetting {
    3128    HistoryComboBox combo1=new HistoryComboBox();
    3229    JTable table;
     
    3532    JButton saveButton;
    3633
     34    public UtilsPluginPreferences() {
     35        super("utils", tr("Utilsplugin2 settings [TESTING]"), tr("Here you can change some preferences of Utilsplugin2 functions"));
     36    }
     37
    3738    @Override
    3839    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);
    4141        JPanel all = new JPanel();
    4242        GridBagLayout layout = new GridBagLayout();
    4343        all.setLayout(layout);
    44        
     44
    4545        // FIXME: get rid of hardcoded URLS
    46        
     46
    4747        String addr =  URLList.getSelectedURL();
    4848        table=new JTable(new DefaultTableModel(null,new String[]{"Title","URL"}));
    49        
     49
    5050        List<String> items = URLList.getURLList();
    51         //System.out.println("pref:"+addr);
    52        
     51
    5352        resetButton = new JButton(tr("Reset"));
    5453        resetButton.addActionListener(new ActionListener() {
     
    5756            }
    5857        });
    59        
     58
    6059        saveButton = new JButton(tr("Save to file"));
    6160        saveButton.addActionListener(new ActionListener() {
     
    6463            }
    6564        });
    66        
     65
    6766        loadButton = new JButton(tr("Load from file"));
    6867        loadButton.addActionListener(new ActionListener() {
     
    7170            }
    7271        });
    73        
     72
    7473        fillRows(items);
    75        
     74
    7675        HtmlPanel help = new HtmlPanel(tr("Please edit custom URLs and select one row to use with the tool<br/>"
    7776                + " <b>&#123;key&#125;</b> is replaced with the tag value<br/>"
     
    8079                + " <b>&#123;#lat&#125; , &#123;#lon&#125;</b> is replaced with map center latitude/longitude <br/>"
    8180                + " Your can manually load settings from file <b>customurl.txt</b> in JOSM folder"));
    82        
     81
    8382        all.add(new JLabel(tr("Custom URL configuration")),GBC.std().insets(5,10,0,0));
    8483        all.add(resetButton,GBC.std().insets(25,10,0,0));
     
    8685        all.add(saveButton,GBC.eol().insets(25,10,0,0));
    8786        all.add(help,GBC.eop().insets(5,10,0,0));
    88        
     87
    8988        table.getColumnModel().getColumn(0).setPreferredWidth(150);
    9089        table.getColumnModel().getColumn(0).setMaxWidth(300);
     
    9998                if (row<0  || column<0) return;
    10099                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)
    102101                    model.addRow(new String[]{"",""});
    103102            }
    104103        });
    105104        all.add(table,GBC.eop().fill());
    106        
     105
    107106        pp.add(all, GBC.eol().fill(GridBagConstraints.BOTH));
    108107    }
     
    135134        List<String> lst = readItemsFromTable();
    136135        URLList.updateURLList(lst);
    137        
     136
    138137        return false;
    139138    }
    140 
    141    
    142    
    143139
    144140    private List<String> readItemsFromTable() {
Note: See TracChangeset for help on using the changeset viewer.