Changeset 6074 in josm


Ignore:
Timestamp:
2013-07-19T02:08:27+02:00 (11 years ago)
Author:
Don-vip
Message:

code cleanup in TaggingPreset* classes

Location:
trunk/src/org/openstreetmap/josm/gui/tagging
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r6070 r6074  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging;
    33
     
    5656import org.xml.sax.SAXException;
    5757
    58 
    5958/**
    6059 * This class read encapsulate one tagging preset. A class method can
     
    6362 *
    6463 * It is also able to construct dialogs out of preset definitions.
     64 * @since 294
    6565 */
    6666public class TaggingPreset extends AbstractAction implements MapView.LayerChangeListener {
     
    7474    public String name_context;
    7575    public String locale_name;
    76    public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text";
     76    public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text";
    7777
    7878    /**
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java

    r6072 r6074  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging;
    33
     
    1414
    1515/**
    16  * This calss reperesentse single part of a preset - one field or text label that
    17  * is shown to user
     16 * Class that represents single part of a preset - one field or text label that is shown to user
     17 * @since 6068
    1818 */
    1919public abstract class TaggingPresetItem {
     
    4747        return null;
    4848    }
    49 
    5049}
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6068 r6074  
    5757import static org.openstreetmap.josm.tools.I18n.trc;
    5858
    59 
    6059/**
    61  * Class that constains all subtypes of TaggingPresetItem,
    62  * static supplementary data, types and methods
     60 * Class that contains all subtypes of TaggingPresetItem, static supplementary data, types and methods
     61 * @since 6068
    6362 */
    6463public final class TaggingPresetItems {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java

    r6068 r6074  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging;
    33
     
    2222public class TaggingPresetMenu extends TaggingPreset {
    2323    public JMenu menu = null; // set by TaggingPresetPreferences
     24   
    2425    @Override
    2526    public void setDisplayName() {
     
    3132        putValue("toolbar", "tagginggroup_" + getRawName());
    3233    }
     34   
    3335    @Override
    3436    public void setIcon(String iconName) {
     
    6062    public void actionPerformed(ActionEvent e) {
    6163        Object s = e.getSource();
    62         if(menu != null && s instanceof Component)
    63         {
    64             Component co = (Component)s;
    65 
     64        if (menu != null && s instanceof Component) {
    6665            JPopupMenu pm = new JPopupMenu(getName());
    6766            for (Component c : menu.getMenuComponents()) {
     
    7271        }
    7372    }
     73   
    7474    /**
    7575     * Sorts the menu items using the translated item text
     
    9999                    for (JMenuItem menuItem : sortarray) {
    100100                        int oldPos;
    101                         if(lastSeparator == 0){
     101                        if (lastSeparator == 0){
    102102                            oldPos=pos;
    103                         }else {
     103                        } else {
    104104                            oldPos = pos+lastSeparator+1;
    105105                        }
     
    110110                    lastSeparator = 0;
    111111                }
    112             }else if (item instanceof JSeparator){
     112            } else if (item instanceof JSeparator){
    113113                Collections.sort(sortarray, comp);
    114114                int pos = 0;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetReader.java

    r6068 r6074  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.gui.tagging;
    23
     
    2324import static org.openstreetmap.josm.tools.I18n.tr;
    2425
    25 
     26/**
     27 * The tagging presets reader.
     28 * @since 6068
     29 */
    2630public final class TaggingPresetReader {
    2731
     32    /**
     33     * Constructs a new {@code TaggingPresetReader}.
     34     */
    2835    public TaggingPresetReader() {
    2936    }
     
    4047        return sources;
    4148    }
    42 
    4349   
    4450    public static List<TaggingPreset> readAll(Reader in, boolean validate) throws SAXException {
     
    7076            parser.start(in);
    7177        }
    72         while(parser.hasNext()) {
     78        while (parser.hasNext()) {
    7379            Object o = parser.next();
    7480            if (o instanceof TaggingPresetMenu) {
    7581                TaggingPresetMenu tp = (TaggingPresetMenu) o;
    76                 if(tp == lastmenu) {
     82                if (tp == lastmenu) {
    7783                    lastmenu = tp.group;
    78                 } else
    79                 {
     84                } else {
    8085                    tp.group = lastmenu;
    8186                    tp.setDisplayName();
    8287                    lastmenu = tp;
    8388                    all.add(tp);
    84 
    8589                }
    8690                lastrole = null;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchAction.java

    r5170 r6074  
    1111import org.openstreetmap.josm.tools.Shortcut;
    1212
     13/**
     14 * The tagging presets search action (F3).
     15 * @since 3388
     16 */
    1317public class TaggingPresetSearchAction extends JosmAction {
    1418
     19    /**
     20     * Constructs a new {@code TaggingPresetSearchAction}.
     21     */
    1522    public TaggingPresetSearchAction() {
    1623        super(tr("Search preset"), "dialogs/search", tr("Show preset search dialog"),
     
    2633            return;
    2734
    28         TaggingPresetSearchDialog dialog = TaggingPresetSearchDialog.getInstance();
    29         dialog.showDialog();
     35        TaggingPresetSearchDialog.getInstance().showDialog();
    3036    }
    31 
    3237}
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchDialog.java

    r6068 r6074  
    1111import org.openstreetmap.josm.gui.ExtendedDialog;
    1212
    13 
     13/**
     14 * The tagging presets search dialog (F3).
     15 * @since 3388
     16 */
    1417public class TaggingPresetSearchDialog extends ExtendedDialog {
    1518
     
    1720
    1821    private static TaggingPresetSearchDialog instance;
     22   
     23    /**
     24     * Returns the unique instance of {@code TaggingPresetSearchDialog}.
     25     * @return the unique instance of {@code TaggingPresetSearchDialog}.
     26     */
    1927    public static TaggingPresetSearchDialog getInstance() {
    2028        if (instance == null) {
     
    2331        return instance;
    2432    }
     33   
    2534    private TaggingPresetSearchDialog() {
    2635        super(Main.parent, tr("Presets"), new String[] {tr("Select"), tr("Cancel")});
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSelector.java

    r6072 r6074  
    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 org.openstreetmap.josm.gui.tagging;
    63
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSeparator.java

    r6068 r6074  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging;
    33
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetType.java

    r6070 r6074  
    77/**
    88 * Enumeration of OSM primitive types associated with names and icons
     9 * @since 6068
    910 */
    1011public enum TaggingPresetType {
Note: See TracChangeset for help on using the changeset viewer.