Changeset 294 in josm for src/org/openstreetmap


Ignore:
Timestamp:
2007-07-20T17:21:38+02:00 (17 years ago)
Author:
imi
Message:
  • renamed annotation presets to tagging presets
Location:
src/org/openstreetmap/josm
Files:
3 added
1 deleted
4 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r293 r294  
    5252import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    5353import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
    54 import org.openstreetmap.josm.gui.preferences.AnnotationPresetPreference;
     54import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
    5555import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
    5656import org.openstreetmap.josm.plugins.PluginException;
     
    192192                contentPane.getActionMap().put("Help", menu.help);
    193193
    194                 AnnotationPresetPreference.initialize();
     194                TaggingPresetPreference.initialize();
    195195
    196196                toolbar.refreshToolbarControl();
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r290 r294  
    4848import org.openstreetmap.josm.data.osm.OsmPrimitive;
    4949import org.openstreetmap.josm.gui.MapFrame;
    50 import org.openstreetmap.josm.gui.annotation.AnnotationCellRenderer;
    51 import org.openstreetmap.josm.gui.annotation.AnnotationPreset;
    52 import org.openstreetmap.josm.gui.annotation.ForwardActionListener;
    53 import org.openstreetmap.josm.gui.preferences.AnnotationPresetPreference;
     50import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
     51import org.openstreetmap.josm.gui.tagging.TaggingCellRenderer;
     52import org.openstreetmap.josm.gui.tagging.ForwardActionListener;
     53import org.openstreetmap.josm.gui.tagging.TaggingPreset;
    5454import org.openstreetmap.josm.tools.AutoCompleteComboBox;
    5555import org.openstreetmap.josm.tools.GBC;
     
    269269         */
    270270        private final JTable propertyTable = new JTable(data);
    271         public JComboBox annotationPresets = new JComboBox();
     271        public JComboBox taggingPresets = new JComboBox();
    272272
    273273
     
    278278                super(tr("Properties"), "propertiesdialog", tr("Properties for selected objects."), KeyEvent.VK_P, 150);
    279279
    280                 if (AnnotationPresetPreference.annotationPresets.size() > 0) {
     280                if (TaggingPresetPreference.taggingPresets.size() > 0) {
    281281                        Vector<ActionListener> allPresets = new Vector<ActionListener>();
    282                         for (final AnnotationPreset p : AnnotationPresetPreference.annotationPresets)
     282                        for (final TaggingPreset p : TaggingPresetPreference.taggingPresets)
    283283                                allPresets.add(new ForwardActionListener(this, p));
    284284
    285                         allPresets.add(0, new ForwardActionListener(this, new AnnotationPreset()));
    286                         annotationPresets.setModel(new DefaultComboBoxModel(allPresets));
     285                        allPresets.add(0, new ForwardActionListener(this, new TaggingPreset()));
     286                        taggingPresets.setModel(new DefaultComboBoxModel(allPresets));
    287287                        JPanel north = new JPanel(new GridBagLayout());
    288288                        north.add(getComponent(0),GBC.eol().fill(GBC.HORIZONTAL));
    289                         north.add(annotationPresets,GBC.eol().fill(GBC.HORIZONTAL));
     289                        north.add(taggingPresets,GBC.eol().fill(GBC.HORIZONTAL));
    290290                        add(north, BorderLayout.NORTH);
    291291                }
    292                 annotationPresets.addActionListener(new ActionListener(){
     292                taggingPresets.addActionListener(new ActionListener(){
    293293                        public void actionPerformed(ActionEvent e) {
    294                                 AnnotationPreset preset = ((ForwardActionListener)annotationPresets.getSelectedItem()).preset;
     294                                TaggingPreset preset = ((ForwardActionListener)taggingPresets.getSelectedItem()).preset;
    295295                                preset.actionPerformed(e);
    296                                 annotationPresets.setSelectedItem(null);
     296                                taggingPresets.setSelectedItem(null);
    297297                        }
    298298                });
    299                 annotationPresets.setRenderer(new AnnotationCellRenderer());
     299                taggingPresets.setRenderer(new TaggingCellRenderer());
    300300
    301301                data.setColumnIdentifiers(new String[]{tr("Key"),tr("Value")});
  • src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

    r287 r294  
    169169                                                proxy.info.name,
    170170                                                proxy.info.description,
    171                                                 PluginInformation.getURLString(proxy.info.file.getPath())));
     171                                                proxy.info.file == null ? null : PluginInformation.getURLString(proxy.info.file.getPath())));
    172172            return availablePlugins.values();
    173173    }
  • src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r283 r294  
    103103                settings.add(new CsvPreference());
    104104                settings.add(new ProjectionPreference());
    105                 settings.add(new AnnotationPresetPreference());
     105                settings.add(new TaggingPresetPreference());
    106106                settings.add(new PluginPreference());
    107107                settings.add(Main.toolbar);
  • src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java

    r291 r294  
    1919
    2020import org.openstreetmap.josm.Main;
    21 import org.openstreetmap.josm.gui.annotation.AnnotationPreset;
     21import org.openstreetmap.josm.gui.tagging.TaggingPreset;
    2222import org.openstreetmap.josm.tools.GBC;
    2323
    24 public class AnnotationPresetPreference implements PreferenceSetting {
     24public class TaggingPresetPreference implements PreferenceSetting {
    2525
    26         public static Collection<AnnotationPreset> annotationPresets;
    27         private JList annotationSources;
     26        public static Collection<TaggingPreset> taggingPresets;
     27        private JList taggingPresetSources;
    2828
    2929        public void addGui(final PreferenceDialog gui) {
    30                 annotationSources = new JList(new DefaultListModel());
    31                 String annos = Main.pref.get("annotation.sources");
     30                taggingPresetSources = new JList(new DefaultListModel());
     31                String annos = Main.pref.get("taggingpreset.sources");
    3232                StringTokenizer st = new StringTokenizer(annos, ";");
    3333                while (st.hasMoreTokens())
    34                         ((DefaultListModel)annotationSources.getModel()).addElement(st.nextToken());
     34                        ((DefaultListModel)taggingPresetSources.getModel()).addElement(st.nextToken());
    3535
    3636                JButton addAnno = new JButton(tr("Add"));
    3737                addAnno.addActionListener(new ActionListener(){
    3838                        public void actionPerformed(ActionEvent e) {
    39                                 String source = JOptionPane.showInputDialog(Main.parent, tr("Annotation preset source"));
     39                                String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"));
    4040                                if (source == null)
    4141                                        return;
    42                                 ((DefaultListModel)annotationSources.getModel()).addElement(source);
     42                                ((DefaultListModel)taggingPresetSources.getModel()).addElement(source);
    4343                                gui.requiresRestart = true;
    4444                        }
     
    4848                editAnno.addActionListener(new ActionListener(){
    4949                        public void actionPerformed(ActionEvent e) {
    50                                 if (annotationSources.getSelectedIndex() == -1)
     50                                if (taggingPresetSources.getSelectedIndex() == -1)
    5151                                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
    5252                                else {
    53                                         String source = JOptionPane.showInputDialog(Main.parent, tr("Annotation preset source"), annotationSources.getSelectedValue());
     53                                        String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"), taggingPresetSources.getSelectedValue());
    5454                                        if (source == null)
    5555                                                return;
    56                                         ((DefaultListModel)annotationSources.getModel()).setElementAt(source, annotationSources.getSelectedIndex());
     56                                        ((DefaultListModel)taggingPresetSources.getModel()).setElementAt(source, taggingPresetSources.getSelectedIndex());
    5757                                        gui.requiresRestart = true;
    5858                                }
     
    6363                deleteAnno.addActionListener(new ActionListener(){
    6464                        public void actionPerformed(ActionEvent e) {
    65                                 if (annotationSources.getSelectedIndex() == -1)
     65                                if (taggingPresetSources.getSelectedIndex() == -1)
    6666                                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
    6767                                else {
    68                                         ((DefaultListModel)annotationSources.getModel()).remove(annotationSources.getSelectedIndex());
     68                                        ((DefaultListModel)taggingPresetSources.getModel()).remove(taggingPresetSources.getSelectedIndex());
    6969                                        gui.requiresRestart = true;
    7070                                }
    7171                        }
    7272                });
    73                 annotationSources.setVisibleRowCount(3);
     73                taggingPresetSources.setVisibleRowCount(3);
    7474
    75                 annotationSources.setToolTipText(tr("The sources (url or filename) of annotation preset definition files. See http://josm.eigenheimstrasse.de/wiki/AnnotationPresets for help."));
    76                 addAnno.setToolTipText(tr("Add a new annotation preset source to the list."));
     75                taggingPresetSources.setToolTipText(tr("The sources (url or filename) of tagging preset definition files. See http://josm.eigenheimstrasse.de/wiki/TaggingPresets for help."));
     76                addAnno.setToolTipText(tr("Add a new tagging preset source to the list."));
    7777                deleteAnno.setToolTipText(tr("Delete the selected source from the list."));
    7878
    79                 gui.map.add(new JLabel(tr("Annotation preset sources")), GBC.eol().insets(0,5,0,0));
    80                 gui.map.add(new JScrollPane(annotationSources), GBC.eol().fill(GBC.BOTH));
     79                gui.map.add(new JLabel(tr("Tagging preset sources")), GBC.eol().insets(0,5,0,0));
     80                gui.map.add(new JScrollPane(taggingPresetSources), GBC.eol().fill(GBC.BOTH));
    8181                JPanel buttonPanel = new JPanel(new GridBagLayout());
    8282                gui.map.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
     
    8888
    8989        public void ok() {
    90                 if (annotationSources.getModel().getSize() > 0) {
     90                if (taggingPresetSources.getModel().getSize() > 0) {
    9191                        StringBuilder sb = new StringBuilder();
    92                         for (int i = 0; i < annotationSources.getModel().getSize(); ++i)
    93                                 sb.append(";"+annotationSources.getModel().getElementAt(i));
    94                         Main.pref.put("annotation.sources", sb.toString().substring(1));
     92                        for (int i = 0; i < taggingPresetSources.getModel().getSize(); ++i)
     93                                sb.append(";"+taggingPresetSources.getModel().getElementAt(i));
     94                        Main.pref.put("taggingpreset.sources", sb.toString().substring(1));
    9595                } else
    96                         Main.pref.put("annotation.sources", null);
     96                        Main.pref.put("taggingpreset.sources", null);
    9797        }
    9898
    9999        /**
    100          * Initialize the annotation presets (load and may display error)
     100         * Initialize the tagging presets (load and may display error)
    101101         */
    102102        public static void initialize() {
    103                 annotationPresets = AnnotationPreset.readFromPreferences();
     103                taggingPresets = TaggingPreset.readFromPreferences();
    104104        }
    105105}
  • src/org/openstreetmap/josm/gui/tagging/ForwardActionListener.java

    r291 r294  
    1 package org.openstreetmap.josm.gui.annotation;
     1package org.openstreetmap.josm.gui.tagging;
    22
    33import java.awt.event.ActionEvent;
     
    1212 */
    1313public final class ForwardActionListener implements ActionListener {
    14         public final AnnotationPreset preset;
     14        public final TaggingPreset preset;
    1515
    1616        private final PropertiesDialog propertiesDialog;
    1717
    18         public ForwardActionListener(PropertiesDialog propertiesDialog, AnnotationPreset preset) {
     18        public ForwardActionListener(PropertiesDialog propertiesDialog, TaggingPreset preset) {
    1919                this.propertiesDialog = propertiesDialog;
    2020                this.preset = preset;
     
    2222
    2323        public void actionPerformed(ActionEvent e) {
    24                 this.propertiesDialog.annotationPresets.setSelectedIndex(0);
     24                this.propertiesDialog.taggingPresets.setSelectedIndex(0);
    2525                e.setSource(this);
    2626                preset.actionPerformed(e);
Note: See TracChangeset for help on using the changeset viewer.