Ignore:
Timestamp:
2016-09-08T23:59:12+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/tageditor
Files:
1 added
25 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tageditor/.project

    r32286 r32959  
    1616                        </arguments>
    1717                </buildCommand>
     18                <buildCommand>
     19                        <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
     20                        <arguments>
     21                        </arguments>
     22                </buildCommand>
    1823        </buildSpec>
    1924        <natures>
    2025                <nature>org.eclipse.jdt.core.javanature</nature>
     26                <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
    2127        </natures>
    2228</projectDescription>
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/LaunchAction.java

    r30488 r32959  
    1616public class LaunchAction extends JosmAction implements SelectionChangedListener {
    1717
    18     public LaunchAction()  {
     18    public LaunchAction() {
    1919        super(
    2020                tr("Edit tags"),
    21                 (String)null, //TODO: set "tag-editor" and add /images/tag-editor.png to distrib
     21                (String) null, //TODO: set "tag-editor" and add /images/tag-editor.png to distrib
    2222                tr("Launches the tag editor dialog"),
    2323                Shortcut.registerShortcut("edit:launchtageditor", tr("Launches the tag editor dialog"),
    24                         KeyEvent.VK_1,Shortcut.ALT_SHIFT)
    25                 , true, "tageditor/launch", true);
     24                        KeyEvent.VK_1, Shortcut.ALT_SHIFT),
     25                true, "tageditor/launch", true);
    2626
    2727        DataSet.addSelectionListener(this);
     
    4747    @Override
    4848    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    49         setEnabled(newSelection != null && newSelection.size() >0);
     49        setEnabled(newSelection != null && newSelection.size() > 0);
    5050    }
    5151}
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/TagEditorDialog.java

    r32913 r32959  
    5353
    5454    /** the unique instance */
    55     static private TagEditorDialog instance = null;
     55    private static TagEditorDialog instance = null;
    5656
    5757    /**
     
    6060     * @return the singleton instance of the dialog
    6161     */
    62     static public TagEditorDialog getInstance() {
     62    public static TagEditorDialog getInstance() {
    6363        if (instance == null) {
    6464            instance = new TagEditorDialog();
     
    6868
    6969    /** default preferred size */
    70     static public final Dimension PREFERRED_SIZE = new Dimension(700, 500);
     70    public static final Dimension PREFERRED_SIZE = new Dimension(700, 500);
    7171
    7272    /** the properties table */
     
    9999        // the cancel button
    100100        //
    101         pnl.add(new JButton(cancelAction  = new CancelAction()));
     101        pnl.add(new JButton(cancelAction = new CancelAction()));
    102102        return pnl;
    103103    }
     
    124124        pnlTagGrid.add(tagEditor, BorderLayout.CENTER);
    125125        pnlTagGrid.add(aclViewer, BorderLayout.EAST);
    126         pnlTagGrid.setBorder(BorderFactory.createEmptyBorder(5, 0,0,0));
     126        pnlTagGrid.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    127127
    128128        JSplitPane splitPane = new JSplitPane(
     
    167167        JPanel pnlPresetSelector = new JPanel();
    168168        pnlPresetSelector.setLayout(new BorderLayout());
    169         pnlPresetSelector.add(presetSelector,BorderLayout.CENTER);
    170         pnlPresetSelector.setBorder(BorderFactory.createEmptyBorder(0,0,5,0 ));
     169        pnlPresetSelector.add(presetSelector, BorderLayout.CENTER);
     170        pnlPresetSelector.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
    171171
    172172        // create the tag selector
     
    185185        JPanel pnlTagSelector = new JPanel();
    186186        pnlTagSelector.setLayout(new BorderLayout());
    187         pnlTagSelector.add(tagSelector,BorderLayout.CENTER);
    188         pnlTagSelector.setBorder(BorderFactory.createEmptyBorder(0,0,5,0    ));
     187        pnlTagSelector.add(tagSelector, BorderLayout.CENTER);
     188        pnlTagSelector.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
    189189
    190190        // create the tabbed pane
     
    209209        pnlTagGrid.setMinimumSize(minimumSize);
    210210
    211         getContentPane().add(splitPane,BorderLayout.CENTER);
     211        getContentPane().add(splitPane, BorderLayout.CENTER);
    212212
    213213        getContentPane().add(buildButtonRow(), BorderLayout.SOUTH);
     
    217217                new WindowAdapter() {
    218218                    @Override public void windowActivated(WindowEvent e) {
    219                         SwingUtilities.invokeLater(new Runnable(){
     219                        SwingUtilities.invokeLater(new Runnable() {
    220220                            @Override
    221                             public void run()
    222                             {
     221                            public void run() {
    223222                                getModel().ensureOneTag();
    224223                                tagEditor.clearSelection();
     
    233232        // and in the aclViewer is handled by okAction
    234233        //
    235         getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke)cancelAction.getValue(Action.ACCELERATOR_KEY), okAction.getValue(AbstractAction.NAME));
     234        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     235                (KeyStroke) cancelAction.getValue(Action.ACCELERATOR_KEY), okAction.getValue(AbstractAction.NAME));
    236236        getRootPane().getActionMap().put(cancelAction.getValue(Action.NAME), cancelAction);
    237237
    238         getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke)okAction.getValue(Action.ACCELERATOR_KEY), okAction.getValue(AbstractAction.NAME));
     238        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     239                (KeyStroke) okAction.getValue(Action.ACCELERATOR_KEY), okAction.getValue(AbstractAction.NAME));
    239240        getRootPane().getActionMap().put(okAction.getValue(Action.NAME), okAction);
    240241
     
    287288
    288289    class CancelAction extends AbstractAction {
    289         public CancelAction() {
     290        CancelAction() {
    290291            putValue(NAME, tr("Cancel"));
    291292            putValue(SMALL_ICON, ImageProvider.get("cancel"));
    292             putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0));
     293            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    293294            putValue(SHORT_DESCRIPTION, tr("Abort tag editing and close dialog"));
    294295        }
     
    302303    class OKAction extends AbstractAction implements PropertyChangeListener {
    303304
    304         public OKAction() {
     305        OKAction() {
    305306            putValue(NAME, tr("OK"));
    306307            putValue(SMALL_ICON, ImageProvider.get("ok"));
     
    325326        @Override
    326327        public void propertyChange(PropertyChangeEvent evt) {
    327             if (! evt.getPropertyName().equals(TagEditorModel.PROP_DIRTY))
     328            if (!evt.getPropertyName().equals(TagEditorModel.PROP_DIRTY))
    328329                return;
    329             if (! evt.getNewValue().getClass().equals(Boolean.class))
     330            if (!evt.getNewValue().getClass().equals(Boolean.class))
    330331                return;
    331             boolean dirty = (Boolean)evt.getNewValue();
     332            boolean dirty = (Boolean) evt.getNewValue();
    332333            setEnabled(dirty);
    333334        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/ac/AutoCompletionListRenderer.java

    r32913 r32959  
    2424public class AutoCompletionListRenderer extends JLabel implements TableCellRenderer {
    2525
    26     static public final String RES_OSM_ICON = "/resources/osm.png";
    27     static public final String RES_SELECTION_ICON = "/resources/selection.png";
     26    public static final String RES_OSM_ICON = "/resources/osm.png";
     27    public static final String RES_SELECTION_ICON = "/resources/selection.png";
    2828
    2929    /** the icon used to decorate items of priority
     
    111111        //
    112112        if (value instanceof AutoCompletionListItem) {
    113             AutoCompletionListItem item = (AutoCompletionListItem)value;
     113            AutoCompletionListItem item = (AutoCompletionListItem) value;
    114114            prepareRendererIcon(item);
    115115            setText(item.getValue());
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/ac/AutoCompletionListViewer.java

    r30737 r32959  
    2222
    2323public class AutoCompletionListViewer extends JPanel {
    24    
     24
    2525    //static private Logger logger = Logger.getLogger(AutoCompletionListViewer.class.getName());
    2626
    2727    /** the table showing the auto completion list entries */
    2828    private JTable table = null;
    29    
     29
    3030    /** the auto completion list to be displayed */
    3131    private AutoCompletionList autoCompletionList = null;
    32    
     32
    3333    /** the listeners */
    3434    private ArrayList<IAutoCompletionListListener> listener = null;
    35    
     35
    3636    /**
    37      * creates the GUI 
     37     * creates the GUI
    3838     */
    3939    protected void createGUI() {
    4040        setBackground(Color.WHITE);
    4141        setLayout(new BorderLayout());
    42    
     42
    4343        table = new JTable();
    44        
     44
    4545        // the table model
    4646        //
     
    5252            table.setModel(autoCompletionList);
    5353        }
    54        
    55         // no table header required 
     54
     55        // no table header required
    5656        table.setTableHeader(null);
    57        
    58         // set cell renderer 
     57
     58        // set cell renderer
    5959        //
    6060        table.setDefaultRenderer(Object.class, new AutoCompletionListRenderer());
    61        
    62         // embed in a scroll pane 
    63         JScrollPane p  = new JScrollPane(table);
     61
     62        // embed in a scroll pane
     63        JScrollPane p = new JScrollPane(table);
    6464        p.setBackground(Color.WHITE);
    6565        add(p, BorderLayout.CENTER);
    66        
     66
    6767        // only single selection allowed
    6868        //
    6969        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    70        
     70
    7171        // fire item change event on double click
    7272        //
     
    8080                            fireAutoCompletionListItemSelected(item);
    8181                        }
    82                     }                   
     82                    }
    8383                }
    8484        );
    8585    }
    86    
     86
    8787    /**
    88      * constructor 
    89      * 
     88     * constructor
     89     *
    9090     * @param list the auto completion list to be rendered. If null, the list is empty.
    91      * 
     91     *
    9292     */
    93     public AutoCompletionListViewer(AutoCompletionList list) {     
     93    public AutoCompletionListViewer(AutoCompletionList list) {
    9494        this.autoCompletionList = list;
    9595        createGUI();
    9696        listener = new ArrayList<>();
    9797    }
    98    
     98
    9999    /**
    100      * constructor 
     100     * constructor
    101101     */
    102102    public AutoCompletionListViewer() {
     
    107107
    108108    /**
    109      * 
     109     *
    110110     */
    111     @Override public Dimension getMaximumSize() {       
     111    @Override public Dimension getMaximumSize() {
    112112        Dimension d = super.getMaximumSize();
    113113        d.width = 100;
    114114        return d;
    115115    }
    116    
     116
    117117    /**
    118      * 
     118     *
    119119     */
    120     @Override public Dimension getPreferredSize() {     
     120    @Override public Dimension getPreferredSize() {
    121121        Dimension d = super.getMaximumSize();
    122122        d.width = 150;
     
    127127    /**
    128128     * replies the auto completion list this viewer renders
    129      * 
    130      * @return the auto completion list; may be null 
     129     *
     130     * @return the auto completion list; may be null
    131131     */
    132132    public AutoCompletionList getAutoCompletionList() {
     
    136136
    137137    /**
    138      * sets the auto completion list this viewer renders 
    139      * 
     138     * sets the auto completion list this viewer renders
     139     *
    140140     * @param autoCompletionList  the auto completion list; may be null
    141141     */
     
    148148        }
    149149    }
    150    
     150
    151151    /**
    152152     * add an {@link IAutoCompletionListListener}
    153      * 
    154      * @param listener  the listener 
     153     *
     154     * @param listener  the listener
    155155     */
    156156    public void addAutoCompletionListListener(IAutoCompletionListListener listener) {
    157157        if (listener != null && !this.listener.contains(listener)) {
    158             synchronized(this.listener) {
     158            synchronized (this.listener) {
    159159                this.listener.add(listener);
    160160            }
    161161        }
    162162    }
    163    
     163
    164164    /**
    165      * removes a {@link IAutoCompletionListListener} 
    166      * 
    167      * @param listener the listener 
     165     * removes a {@link IAutoCompletionListListener}
     166     *
     167     * @param listener the listener
    168168     */
    169169    public void removeAutoCompletionListListener(IAutoCompletionListListener listener) {
    170170        if (listener != null && this.listener.contains(listener)) {
    171             synchronized(this.listener) {
     171            synchronized (this.listener) {
    172172                this.listener.remove(listener);
    173173            }
    174174        }
    175175    }
    176    
     176
    177177    /**
    178      * notifies listeners about a selected item in the auto completion list 
     178     * notifies listeners about a selected item in the auto completion list
    179179     */
    180180    protected void fireAutoCompletionListItemSelected(String item) {
    181         synchronized(this.listener) {
     181        synchronized (this.listener) {
    182182            for (IAutoCompletionListListener target: listener) {
    183183                target.autoCompletionItemSelected(item);
    184             }           
     184            }
    185185        }
    186     }   
    187    
     186    }
     187
    188188    public void installKeyAction(Action a) {
    189         getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke)a.getValue(AbstractAction.ACCELERATOR_KEY), a.getValue(AbstractAction.NAME));
     189        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     190                (KeyStroke) a.getValue(AbstractAction.ACCELERATOR_KEY), a.getValue(AbstractAction.NAME));
    190191        getActionMap().put(a.getValue(AbstractAction.NAME), a);
    191192
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/ac/IAutoCompletionListListener.java

    r30488 r32959  
    33
    44public interface IAutoCompletionListListener {
    5     public void autoCompletionItemSelected(String item);
     5    void autoCompletionItemSelected(String item);
    66}
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/PresetManager.java

    r32913 r32959  
    6666        btnRemove = new JButton(tr("Remove"));
    6767        btnRemove.addActionListener(
    68                 new ActionListener()  {
     68                new ActionListener() {
    6969                    @Override
    7070                    public void actionPerformed(ActionEvent arg0) {
     
    8484
    8585    protected void removeCurrentPreset() {
    86         TaggingPreset item= (TaggingPreset)presets.getSelectedItem();
    87         if (item != null && model !=null) {
     86        TaggingPreset item = (TaggingPreset) presets.getSelectedItem();
     87        if (item != null && model != null) {
    8888            model.removeAppliedPreset(item);
    8989        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagEditor.java

    r32913 r32959  
    7474        JButton btn;
    7575        pnl.add(btn = new JButton(tblTagEditor.getAddAction()));
    76         btn.setMargin(new Insets(0,0,0,0));
     76        btn.setMargin(new Insets(0, 0, 0, 0));
    7777        tblTagEditor.addComponentNotStoppingCellEditing(btn);
    7878
    7979        // delete action
    8080        pnl.add(btn = new JButton(tblTagEditor.getDeleteAction()));
    81         btn.setMargin(new Insets(0,0,0,0));
     81        btn.setMargin(new Insets(0, 0, 0, 0));
    8282        tblTagEditor.addComponentNotStoppingCellEditing(btn);
    8383        return pnl;
     
    9797        DefaultListSelectionModel colSelectionModel = new DefaultListSelectionModel();
    9898
    99         tagEditorModel = new TagEditorModel(rowSelectionModel,colSelectionModel);
     99        tagEditorModel = new TagEditorModel(rowSelectionModel, colSelectionModel);
    100100
    101101        // build the scrollable table for editing tag names and tag values
     
    119119        gc.weighty = 1.0;
    120120        gc.anchor = GridBagConstraints.NORTHWEST;
    121         pnl.add(buildButtonsPanel(),gc);
     121        pnl.add(buildButtonsPanel(), gc);
    122122
    123123        // -- the panel with the editor table
     
    128128        gc.weighty = 1.0;
    129129        gc.anchor = GridBagConstraints.CENTER;
    130         pnl.add(pnlTagTable,gc);
     130        pnl.add(pnlTagTable, gc);
    131131
    132132        return pnl;
     
    186186    public void autoCompletionItemSelected(String item) {
    187187        logger.info("autocompletion item selected ...");
    188         TagSpecificationAwareTagCellEditor editor = (TagSpecificationAwareTagCellEditor)tblTagEditor.getCellEditor();
     188        TagSpecificationAwareTagCellEditor editor = (TagSpecificationAwareTagCellEditor) tblTagEditor.getCellEditor();
    189189        if (editor != null) {
    190190            editor.autoCompletionItemSelected(item);
     
    193193
    194194    public void requestFocusInTopLeftCell() {
    195         tblTagEditor.requestFocusInCell(0,0);
     195        tblTagEditor.requestFocusInCell(0, 0);
    196196    }
    197197
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagEditorModel.java

    r32508 r32959  
    2020
    2121@SuppressWarnings("serial")
    22 public class TagEditorModel extends org.openstreetmap.josm.gui.tagging.TagEditorModel  {
     22public class TagEditorModel extends org.openstreetmap.josm.gui.tagging.TagEditorModel {
    2323    //static private final Logger logger = Logger.getLogger(TagEditorModel.class.getName());
    24    
     24
    2525    private DefaultComboBoxModel<TaggingPreset> appliedPresets = null;
    2626
     
    2828     * constructor
    2929     */
    30     public TagEditorModel(DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel){
     30    public TagEditorModel(DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel) {
    3131        super(rowSelectionModel, colSelectionModel);
    3232        appliedPresets = new DefaultComboBoxModel<>();
     
    3535    /**
    3636     * applies the tags defined for a preset item to the tag model.
    37      * 
     37     *
    3838     * Mandatory tags are added to the list of currently edited tags.
    3939     * Optional tags are not added.
    4040     * The model remembers the currently applied presets.
    41      * 
     41     *
    4242     * @param item  the preset item. Must not be null.
    4343     * @exception IllegalArgumentException thrown, if item is null
    44      * 
     44     *
    4545     */
    4646    public void applyPreset(TaggingPreset item) {
     
    4949        // check whether item is already applied
    5050        //
    51         for(int i=0; i < appliedPresets.getSize(); i++) {
     51        for (int i = 0; i < appliedPresets.getSize(); i++) {
    5252            if (appliedPresets.getElementAt(i).equals(item))
    5353                // abort - preset already applied
     
    5757        // apply the tags proposed by the preset
    5858        //
    59         for(AdvancedTag tag : AdvancedTag.forTaggingPreset(item)) {
     59        for (AdvancedTag tag : AdvancedTag.forTaggingPreset(item)) {
    6060            if (!tag.isOptional()) {
    6161                if (!includesTag(tag.getKey())) {
    62                     TagModel tagModel = new TagModel(tag.getKey(),tag.getValue());
     62                    TagModel tagModel = new TagModel(tag.getKey(), tag.getValue());
    6363                    prepend(tagModel);
    6464                } else {
     
    8585    /**
    8686     * applies a tag given by a {@see KeyValuePair} to the model
    87      * 
     87     *
    8888     * @param pair the key value pair
    8989     */
     
    9898        fireTableDataChanged();
    9999    }
    100 
    101100
    102101    public DefaultComboBoxModel<TaggingPreset> getAppliedPresetsModel() {
     
    140139        fireTableDataChanged();
    141140    }
    142    
     141
    143142    /**
    144143     * updates the tags of the primitives in the current selection with the
    145144     * values in the current tag model
    146      * 
     145     *
    147146     */
    148147    public void updateJOSMSelection() {
     
    152151            return;
    153152        for (TagModel tag : tags) {
    154             Command command = createUpdateTagCommand(selection,tag);
     153            Command command = createUpdateTagCommand(selection, tag);
    155154            if (command != null) {
    156155                commands.add(command);
     
    170169        Main.main.undoRedo.add(command);
    171170    }
    172    
     171
    173172    /**
    174173     * initializes the model with the tags in the current JOSM selection
     
    180179            for (String key : element.keySet()) {
    181180                String value = element.get(key);
    182                 add(key,value);
     181                add(key, value);
    183182            }
    184183        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagSpecificationAwareTagCellEditor.java

    r32913 r32959  
    22package org.openstreetmap.josm.plugins.tageditor.editor;
    33
    4 import java.util.logging.Level;
    54import java.util.logging.Logger;
    65
     
    1615
    1716    public TagSpecificationAwareTagCellEditor() {
    18                 super(0);
    19         }
     17        super(0);
     18    }
    2019
    21         /**
     20    /**
    2221     * initializes  the auto completion list when the table cell editor starts
    2322     * to edit the key of a tag. In this case the auto completion list is
     
    3938        // add the list of standard keys
    4039        //
    41         try {
    42             //autoCompletionList.add(TagSpecifications.getInstance().getKeysForAutoCompletion(context));
    43         } catch(Exception e) {
     40        /*try {
     41            autoCompletionList.add(TagSpecifications.getInstance().getKeysForAutoCompletion(context));
     42        } catch (Exception e) {
    4443            logger.log(Level.WARNING, "failed to initialize auto completion list with standard keys.", e);
    45         }
     44        }*/
    4645
    4746        // add the list of keys in the current data set
     
    5251            context.initFromJOSMSelection();
    5352            autoCompletionList.add(TagSpecifications.getInstance().getKeysForAutoCompletion(context));
    54         } catch(Exception e) {
     53        } catch (Exception e) {
    5554            System.out.println("Warning: failed to initialize auto completion list with tag specification keys. Exception was: " + e.toString());
    5655            e.printStackTrace();
     
    6059        //
    6160        for (String key : model.getKeys()) {
    62             if (! key.equals(currentTag.getName())) {
     61            if (!key.equals(currentTag.getName())) {
    6362                autoCompletionList.remove(key);
    6463            }
     
    8988            context.initFromJOSMSelection();
    9089            autoCompletionList.add(TagSpecifications.getInstance().getLabelsForAutoCompletion(forKey, context));
    91         } catch(Exception e) {
    92             System.out.println("Warning: failed to initialize auto completion list with tag specification values. Exception was: " + e.toString());
     90        } catch (Exception e) {
     91            System.out.println(
     92                    "Warning: failed to initialize auto completion list with tag specification values. Exception was: " + e.toString());
    9393            e.printStackTrace();
    9494        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagTableCellRenderer.java

    r32913 r32959  
    2222 * in the tag editor dialog.
    2323 */
    24 public class TagTableCellRenderer extends JLabel implements TableCellRenderer  {
     24public class TagTableCellRenderer extends JLabel implements TableCellRenderer {
    2525
    2626    //private static Logger logger = Logger.getLogger(TagTableCellRenderer.class.getName());
    27     public static final Color BG_COLOR_HIGHLIGHTED = new Color(255,255,204);
     27    public static final Color BG_COLOR_HIGHLIGHTED = new Color(255, 255, 204);
    2828
    2929    private Font fontStandard = null;
     
    3434        fontItalic = fontStandard.deriveFont(Font.ITALIC);
    3535        setOpaque(true);
    36         setBorder(new EmptyBorder(5,5,5,5));
     36        setBorder(new EmptyBorder(5, 5, 5, 5));
    3737    }
    3838
     
    5858        } else if (tag.getValueCount() == 1) {
    5959            setText(tag.getValues().get(0));
    60         } else if (tag.getValueCount() >  1) {
     60        } else if (tag.getValueCount() > 1) {
    6161            setText(tr("multiple"));
    6262            setFont(fontItalic);
     
    7474
    7575    protected TagEditorModel getModel(JTable table) {
    76         return (TagEditorModel)table.getModel();
     76        return (TagEditorModel) table.getModel();
    7777    }
    7878
     
    8888        // no current preset selected?
    8989        //
    90         TaggingPreset item = (TaggingPreset)model.getAppliedPresetsModel().getSelectedItem();
     90        TaggingPreset item = (TaggingPreset) model.getAppliedPresetsModel().getSelectedItem();
    9191        if (item == null) {
    9292            return false;
    9393        }
    9494
    95         for(AdvancedTag tag: AdvancedTag.forTaggingPreset(item)) {
     95        for (AdvancedTag tag: AdvancedTag.forTaggingPreset(item)) {
    9696            if (tag.getValue() == null) {
    9797                if (tagModel.getName().equals(tag.getKey())) {
     
    118118     */
    119119    protected void renderColor(TagModel tagModel, TagEditorModel model, boolean isSelected) {
    120         if (isSelected){
     120        if (isSelected) {
    121121            setBackground(UIManager.getColor("Table.selectionBackground"));
    122122            setForeground(UIManager.getColor("Table.selectionForeground"));
     
    147147
    148148        resetRenderer();
    149         TagModel tagModel  = (TagModel)value;
     149        TagModel tagModel = (TagModel) value;
    150150        switch(vColIndex) {
    151151            case 0: renderTagName(tagModel); break;
    152152            case 1: renderTagValue(tagModel); break;
    153153        }
    154         renderColor(tagModel, (TagEditorModel)table.getModel(),isSelected);
     154        renderColor(tagModel, (TagEditorModel) table.getModel(), isSelected);
    155155        if (hasFocus && isSelected) {
    156156            if (table.getSelectedColumnCount() == 1 && table.getSelectedRowCount() == 1) {
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/AdvancedTag.java

    r31615 r32959  
    4848        this.optional = optional;
    4949    }
    50    
     50
    5151    public static Collection<AdvancedTag> forTaggingPreset(TaggingPreset preset) {
    5252        Collection<AdvancedTag> result = new ArrayList<>();
     
    5454        for (TaggingPresetItem item : preset.data) {
    5555            if (item instanceof KeyedItem) {
    56                 KeyedItem ki = (KeyedItem)item;
     56                KeyedItem ki = (KeyedItem) item;
    5757                for (String value : ki.getValues()) {
    5858                    AdvancedTag tag = new AdvancedTag(ki.key, value);
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/ui/IPresetSelectorListener.java

    r31615 r32959  
    66public interface IPresetSelectorListener {
    77
    8     public void itemSelected(TaggingPreset item);
     8    void itemSelected(TaggingPreset item);
    99}
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/ui/NameIconCellRenderer.java

    r32913 r32959  
    1414public class NameIconCellRenderer extends JLabel implements TableCellRenderer {
    1515
    16     public static final Color BG_COLOR_SELECTED = new Color(143,170,255);
     16    public static final Color BG_COLOR_SELECTED = new Color(143, 170, 255);
    1717
    1818    protected void init() {
    1919        setOpaque(true);
    20         setFont(new Font("SansSerif",Font.PLAIN,10));
     20        setFont(new Font("SansSerif", Font.PLAIN, 10));
    2121    }
    2222
     
    3131        if (isSelected) {
    3232            setBackground(BG_COLOR_SELECTED);
    33         } else  {
     33        } else {
    3434            setBackground(Color.WHITE);
    3535        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/ui/PresetsTable.java

    r30488 r32959  
    1010
    1111    /**
    12      * initialize the table 
     12     * initialize the table
    1313     */
    14     protected void init() {             
    15         setAutoResizeMode(JTable.AUTO_RESIZE_OFF);     
     14    protected void init() {
     15        setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    1616        setRowSelectionAllowed(true);
    1717        setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    1818        setRowHeight(18); // icon height (=16) + minimal border
    1919    }
    20    
     20
    2121    public PresetsTable(TableModel model, TableColumnModel columnModel) {
    22         super(model,columnModel);
     22        super(model, columnModel);
    2323        init();
    2424    }
    25    
     25
    2626    /**
    2727     * adjusts the width of the columns for the tag name and the tag value
    2828     * to the width of the scroll panes viewport.
    29      * 
     29     *
    3030     * Note: {@see #getPreferredScrollableViewportSize()} did not work as expected
    31      * 
     31     *
    3232     * @param scrollPaneWidth the width of the scroll panes viewport
    3333     */
     
    4040            tcm.getColumn(0).setMaxWidth(width);
    4141            tcm.getColumn(1).setMinWidth(width);
    42             tcm.getColumn(1).setMaxWidth(width);           
     42            tcm.getColumn(1).setMaxWidth(width);
    4343        }
    4444    }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/ui/PresetsTableModel.java

    r32913 r32959  
    1010import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
    1111
    12 public class PresetsTableModel extends AbstractTableModel  {
     12public class PresetsTableModel extends AbstractTableModel {
    1313
    1414    //private static final Logger logger = Logger.getLogger(PresetsTableModel.class.getName());
     
    3939    @Override
    4040    public void addTableModelListener(TableModelListener l) {
    41         synchronized(listeners) {
     41        synchronized (listeners) {
    4242            if (l == null)
    4343                return;
     
    9999
    100100    public void filter(String filter) {
    101         synchronized(this) {
     101        synchronized (this) {
    102102            if (filter == null || filter.trim().equals("")) {
    103103                visibleItems.clear();
    104                 for(TaggingPreset item: items) {
     104                for (TaggingPreset item: items) {
    105105                    visibleItems.add(item);
    106106                }
     
    108108                visibleItems.clear();
    109109                filter = filter.toLowerCase();
    110                 for(TaggingPreset item: items) {
     110                for (TaggingPreset item: items) {
    111111                    if ((item.getName() != null && item.getName().toLowerCase().trim().contains(filter))
    112                             || (item.group != null && item.group.getName() != null && item.group.getName().toLowerCase().trim().contains(filter))) {
     112                     || (item.group != null && item.group.getName() != null && item.group.getName().toLowerCase().trim().contains(filter))) {
    113113                        visibleItems.add(item);
    114114                    }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/preset/ui/TabularPresetSelector.java

    r32913 r32959  
    3939
    4040    private PresetsTable presetsTable = null;
    41     private JTextField   tfFilter = null;
     41    private JTextField tfFilter = null;
    4242    private final ArrayList<IPresetSelectorListener> listeners = new ArrayList<>();
    4343    private JScrollPane scrollPane;
     
    5050        tfFilter = new JTextField(20);
    5151        pnl.add(lbl);
    52         pnl.add(tfFilter,BorderLayout.CENTER);
     52        pnl.add(tfFilter, BorderLayout.CENTER);
    5353        JButton btn = new JButton(tr("Clear"));
    5454        pnl.add(btn);
     
    6767    protected JScrollPane buildPresetGrid() {
    6868
    69         presetsTable = new PresetsTable(new PresetsTableModel(),new PresetsTableColumnModel());
     69        presetsTable = new PresetsTable(new PresetsTableModel(), new PresetsTableColumnModel());
    7070
    7171        scrollPane = new JScrollPane(presetsTable);
     
    9494        // replace Enter action. apply the current preset on enter
    9595        //
    96         presetsTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0));
     96        presetsTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    9797        ActionListener enterAction = new ActionListener() {
    9898            @Override
     
    108108                enterAction,
    109109                "Enter",
    110                 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),
     110                KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    111111                JComponent.WHEN_FOCUSED
    112112        );
     
    125125                    public void actionPerformed(ActionEvent arg0) {
    126126                        int row = presetsTable.getSelectedRow();
    127                         if (row >=0) {
     127                        if (row >= 0) {
    128128                            fireItemSelected(getModel().getVisibleItem(row));
    129129                        }
     
    193193
    194194    public void bindTo(Collection<TaggingPreset> presets) {
    195         PresetsTableModel model = (PresetsTableModel)presetsTable.getModel();
     195        PresetsTableModel model = (PresetsTableModel) presetsTable.getModel();
    196196        model.setPresets(presets);
    197197    }
     
    202202
    203203    public void addPresetSelectorListener(IPresetSelectorListener listener) {
    204         synchronized(this.listeners) {
    205             if (listener != null && ! listeners.contains(listener)) {
     204        synchronized (this.listeners) {
     205            if (listener != null && !listeners.contains(listener)) {
    206206                listeners.add(listener);
    207207            }
     
    210210
    211211    public void removePresetSelectorListener(IPresetSelectorListener listener) {
    212         synchronized(this.listeners) {
     212        synchronized (this.listeners) {
    213213            if (listener != null) {
    214214                listeners.remove(listener);
     
    218218
    219219    protected void fireItemSelected(TaggingPreset item) {
    220         synchronized(this.listeners) {
    221             for(IPresetSelectorListener listener: listeners) {
     220        synchronized (this.listeners) {
     221            for (IPresetSelectorListener listener: listeners) {
    222222                listener.itemSelected(item);
    223223            }
     
    249249        //
    250250        Component c = presetsTable;
    251         while(c != null) {
     251        while (c != null) {
    252252            c.doLayout();
    253253            c.repaint();
     
    257257
    258258    protected PresetsTableModel getModel() {
    259         return (PresetsTableModel)presetsTable.getModel();
     259        return (PresetsTableModel) presetsTable.getModel();
    260260    }
    261261
    262262    public void installKeyAction(Action a) {
    263         getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put((KeyStroke)a.getValue(AbstractAction.ACCELERATOR_KEY), a.getValue(AbstractAction.NAME));
     263        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
     264                (KeyStroke) a.getValue(AbstractAction.ACCELERATOR_KEY), a.getValue(AbstractAction.NAME));
    264265        getActionMap().put(a.getValue(AbstractAction.NAME), a);
    265266    }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/KeyValuePair.java

    r30488 r32959  
    55    private String key = new String("");
    66    private String value = new String("");
    7    
     7
    88    public KeyValuePair() {}
    9    
     9
    1010    public KeyValuePair(String key, String value) {
    1111        setKey(key);
     
    1313    }
    1414
    15    
    1615    public String getKey() {
    1716        return key;
     
    1918
    2019    public void setKey(String key) {
    21         this.key = key == null? ""  :key;
     20        this.key = key == null ? "" : key;
    2221    }
    2322
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/TagSpecification.java

    r30737 r32959  
    6565    /**
    6666     * sets the list of lables for this tag specification
    67      * 
     67     *
    6868     * @param lables  the list of lables; must not be null
    6969     * @exception IllegalArgumentException thrown, if lables is null
     
    8181     * Adds a label to the list of label for this tag specification. The label
    8282     * is only added if i
    83      * 
     83     *
    8484     * @param lable the lalbe to add; must not be null
    8585     * @exception IllegalArgumentException thrown, if lable is null
    8686     */
    87     public void addLable(LabelSpecification lable) throws IllegalArgumentException  {
     87    public void addLable(LabelSpecification lable) throws IllegalArgumentException {
    8888        if (lable == null)
    8989            throw new IllegalArgumentException("argument 'lable' must not be null");
     
    111111        return key;
    112112    }
     113
    113114    public void setKey(String key) {
    114115        this.key = key;
    115116    }
     117
    116118    public String getType() {
    117119        return type;
    118120    }
     121
    119122    public void setType(String type) {
    120123        this.type = type;
    121124    }
     125
    122126    public boolean isApplicableToNode() {
    123127        return applicableToNode;
    124128    }
     129
    125130    public void setApplicableToNode(boolean applicableToNode) {
    126131        this.applicableToNode = applicableToNode;
    127132    }
     133
    128134    public boolean isApplicableToWay() {
    129135        return applicableToWay;
    130136    }
     137
    131138    public void setApplicableToWay(boolean applicableToWay) {
    132139        this.applicableToWay = applicableToWay;
    133140    }
     141
    134142    public boolean isApplicableToRelation() {
    135143        return applicableToRelation;
    136144    }
     145
    137146    public void setApplicableToRelation(boolean applicableToRelation) {
    138147        this.applicableToRelation = applicableToRelation;
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/TagSpecifications.java

    r32913 r32959  
    3535public class TagSpecifications {
    3636
    37     final static public String ATTR_KEY = "key";
    38     final static public String ATTR_TYPE = "type";
    39     final static public String ATTR_FOR_NODE = "for-node";
    40     final static public String ATTR_FOR_WAY = "for-way";
    41     final static public String ATTR_FOR_RELATION = "for-relation";
    42     final static public String ATTR_VALUE = "value";
    43 
    44     final static public String ELEM_ROOT = "osm-tag-definitions";
    45     final static public String ELEM_TAG = "tag";
    46     final static public String ELEM_LABEL = "label";
    47 
    48     final static public String DTD = "osm-tag-definitions.dtd";
     37    public static final String ATTR_KEY = "key";
     38    public static final String ATTR_TYPE = "type";
     39    public static final String ATTR_FOR_NODE = "for-node";
     40    public static final String ATTR_FOR_WAY = "for-way";
     41    public static final String ATTR_FOR_RELATION = "for-relation";
     42    public static final String ATTR_VALUE = "value";
     43
     44    public static final String ELEM_ROOT = "osm-tag-definitions";
     45    public static final String ELEM_TAG = "tag";
     46    public static final String ELEM_LABEL = "label";
     47
     48    public static final String DTD = "osm-tag-definitions.dtd";
    4949
    5050
    5151    /** the default name of the resource file with the  tag specifications */
    52     static public final String RES_NAME_TAG_SPECIFICATIONS = "/resources/osm-tag-definitions.xml";
     52    public static final String RES_NAME_TAG_SPECIFICATIONS = "/resources/osm-tag-definitions.xml";
    5353
    5454    /** the logger object */
     
    6767     * @throws Exception thrown, if an exception occurs
    6868     */
    69     static public void loadFromResources() throws Exception {
     69    public static void loadFromResources() throws Exception {
    7070        InputStream in = TagSpecifications.class.getResourceAsStream(RES_NAME_TAG_SPECIFICATIONS);
    7171        if (in == null) {
     
    8080    }
    8181
    82     static public TagSpecifications getInstance() throws Exception {
     82    public static TagSpecifications getInstance() throws Exception {
    8383        if (instance == null) {
    8484            loadFromResources();
     
    187187         * between &lt;tag&gt; ... &lt;/tag&gt;
    188188         */
    189         private TagSpecification currentTagSpecification  = null;
     189        private TagSpecification currentTagSpecification = null;
    190190
    191191        @Override
    192192        public void endDocument() throws SAXException {
    193             logger.log(Level.FINE,"END");
     193            logger.log(Level.FINE, "END");
    194194        }
    195195
     
    206206        @Override
    207207        public void startDocument() throws SAXException {
    208             logger.log(Level.FINE,"START");
     208            logger.log(Level.FINE, "START");
    209209        }
    210210
     
    230230         *
    231231         * @param atts  the XML attributes
    232          * @throws SAXException
     232         * @throws SAXException if any SAX error occurs
    233233         */
    234234        protected void startElementOsmTagDefinitions(Attributes atts) throws SAXException {
     
    239239         * handles an end element with name <code>osm-tag-specifications</code>
    240240         *
    241          * @throws SAXException
     241         * @throws SAXException if any SAX error occurs
    242242         */
    243243        protected void endElementOsmTagDefinitions() throws SAXException {
     
    249249         *
    250250         * @param atts the XML attributes of the element
    251          * @throws SAXException
     251         * @throws SAXException if any SAX error occurs
    252252         */
    253253        protected void startElementTag(Attributes atts) throws SAXException {
    254254            currentTagSpecification = new TagSpecification();
    255             for (int i=0; i< atts.getLength(); i++) {
     255            for (int i = 0; i < atts.getLength(); i++) {
    256256                String name = atts.getQName(i);
    257257                String value = atts.getValue(i);
     
    272272        }
    273273
    274 
    275274        /**
    276275         * handles an end element with name <code>tag</code>
    277          * @throws SAXException
     276         * @throws SAXException if any SAX error occurs
    278277         */
    279278        protected void endElementTag() throws SAXException {
    280279            tagSpecifications.add(currentTagSpecification);
    281280            currentTagSpecification = null;
    282 
    283281        }
    284282
     
    287285         *
    288286         * @param atts the XML attributes
    289          * @throws SAXException
     287         * @throws SAXException if any SAX error occurs
    290288         */
    291289        protected void startElementLabel(Attributes atts) throws SAXException {
    292290            LabelSpecification ls = new LabelSpecification();
    293             for (int i=0; i< atts.getLength(); i++) {
     291            for (int i = 0; i < atts.getLength(); i++) {
    294292                String name = atts.getQName(i);
    295293                String value = atts.getValue(i);
     
    312310         * handles an end element with name <code>label</code>
    313311         *
    314          * @throws SAXException
     312         * @throws SAXException if any SAX error occurs
    315313         */
    316314        protected void endElementLabel() throws SAXException {
     
    353351
    354352        @Override
    355                 public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
     353        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
    356354            if (systemId != null && systemId.endsWith(DTD)) {
    357355                InputStream stream = TagSpecifications.class.getResourceAsStream("/resources/"+DTD);
     
    366364    }
    367365
    368     public static void main(String args[]) throws Exception{
     366    public static void main(String[] args) throws Exception {
    369367        TagSpecifications.loadFromResources();
    370368    }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/ui/ITagSelectorListener.java

    r30488 r32959  
    55
    66public interface ITagSelectorListener {
    7     public void itemSelected(KeyValuePair pair);
     7    void itemSelected(KeyValuePair pair);
    88}
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/ui/KeyValueCellRenderer.java

    r32913 r32959  
    1010import javax.swing.table.TableCellRenderer;
    1111
    12 public class KeyValueCellRenderer extends JLabel implements TableCellRenderer  {
     12public class KeyValueCellRenderer extends JLabel implements TableCellRenderer {
    1313
    1414    protected void init() {
    15         setFont(new Font("Courier",Font.PLAIN,getFont().getSize()));
     15        setFont(new Font("Courier", Font.PLAIN, getFont().getSize()));
    1616        setOpaque(true);
    1717    }
     
    2828            setBackground(UIManager.getColor("Table.selectionBackground"));
    2929            setForeground(UIManager.getColor("Table.selectionForeground"));
    30         } else  {
     30        } else {
    3131            setBackground(UIManager.getColor("Table.background"));
    3232            setForeground(UIManager.getColor("Table.foreground"));
    3333        }
    34         setText((String)value);
     34        setText((String) value);
    3535        setIcon(null);
    3636        return this;
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/ui/TabularTagSelector.java

    r32913 r32959  
    4646        tfFilter = new JTextField(20);
    4747        pnl.add(lbl);
    48         pnl.add(tfFilter,BorderLayout.CENTER);
     48        pnl.add(tfFilter, BorderLayout.CENTER);
    4949        JButton btn = new JButton(tr("Clear"));
    5050        pnl.add(btn);
     
    6363    protected JScrollPane buildPresetGrid() {
    6464
    65         tagsTable = new TagsTable(new TagsTableModel(),new TagsTableColumnModel());
     65        tagsTable = new TagsTable(new TagsTableModel(), new TagsTableColumnModel());
    6666        getModel().initFromTagSpecifications();
    6767
     
    9191        // replace Enter action. apply the current preset on enter
    9292        //
    93         tagsTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0));
     93        tagsTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    9494        ActionListener enterAction = new ActionListener() {
    9595            @Override
     
    106106                enterAction,
    107107                "Enter",
    108                 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),
     108                KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    109109                JComponent.WHEN_FOCUSED
    110110        );
     
    123123                    public void actionPerformed(ActionEvent arg0) {
    124124                        int row = tagsTable.getSelectedRow();
    125                         if (row >=0) {
     125                        if (row >= 0) {
    126126                            KeyValuePair item = getModel().getVisibleItem(row);
    127127                            fireItemSelected(item);
     
    209209        //
    210210        Component c = tagsTable;
    211         while(c != null) {
     211        while (c != null) {
    212212            c.doLayout();
    213213            c.repaint();
     
    217217
    218218    protected TagsTableModel getModel() {
    219         return (TagsTableModel)tagsTable.getModel();
    220     }
    221 
     219        return (TagsTableModel) tagsTable.getModel();
     220    }
    222221
    223222    public void addTagSelectorListener(ITagSelectorListener listener) {
    224         synchronized(this.listeners) {
    225             if (listener != null && ! listeners.contains(listener)) {
     223        synchronized (this.listeners) {
     224            if (listener != null && !listeners.contains(listener)) {
    226225                listeners.add(listener);
    227226            }
     
    230229
    231230    public void removeTagSelectorListener(ITagSelectorListener listener) {
    232         synchronized(this.listeners) {
     231        synchronized (this.listeners) {
    233232            if (listener != null) {
    234233                listeners.remove(listener);
     
    238237
    239238    protected void fireItemSelected(KeyValuePair pair) {
    240         synchronized(this.listeners) {
    241             for(ITagSelectorListener listener: listeners) {
     239        synchronized (this.listeners) {
     240            for (ITagSelectorListener listener: listeners) {
    242241                listener.itemSelected(pair);
    243242            }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/ui/TagsTable.java

    r30488 r32959  
    99public class TagsTable extends JTable {
    1010    /**
    11      * initialize the table 
     11     * initialize the table
    1212     */
    13     protected void init() {             
    14         setAutoResizeMode(JTable.AUTO_RESIZE_OFF);     
     13    protected void init() {
     14        setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    1515        setRowSelectionAllowed(true);
    1616        setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    1717    }
    18    
     18
    1919    public TagsTable(TableModel model, TableColumnModel columnModel) {
    20         super(model,columnModel);
     20        super(model, columnModel);
    2121        init();
    2222    }
    23    
     23
    2424    /**
    2525     * adjusts the width of the columns for the tag name and the tag value
    2626     * to the width of the scroll panes viewport.
    27      * 
     27     *
    2828     * Note: {@see #getPreferredScrollableViewportSize()} did not work as expected
    29      * 
     29     *
    3030     * @param scrollPaneWidth the width of the scroll panes viewport
    3131     */
     
    3838            tcm.getColumn(0).setMaxWidth(width);
    3939            tcm.getColumn(1).setMinWidth(width);
    40             tcm.getColumn(1).setMaxWidth(width);           
     40            tcm.getColumn(1).setMaxWidth(width);
    4141        }
    4242    }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/ui/TagsTableModel.java

    r32913 r32959  
    1717public class TagsTableModel extends AbstractTableModel {
    1818
    19     static private Logger logger = Logger.getLogger(TagsTableModel.class.getName());
     19    private static Logger logger = Logger.getLogger(TagsTableModel.class.getName());
    2020
    2121    private ArrayList<KeyValuePair> items = null;
     
    3434                    public int compare(KeyValuePair self,
    3535                            KeyValuePair other) {
    36                         int ret =self.getKey().compareToIgnoreCase(other.getKey());
     36                        int ret = self.getKey().compareToIgnoreCase(other.getKey());
    3737
    3838                        if (ret == 0)
     
    5656        try {
    5757            spec = TagSpecifications.getInstance();
    58         } catch(Exception e) {
     58        } catch (Exception e) {
    5959            logger.log(Level.SEVERE, "failed to init TagTableModel. Exception:" + e);
    6060            return;
     
    6363        items = spec.asList();
    6464        sort();
    65         for(KeyValuePair item : items) {
     65        for (KeyValuePair item : items) {
    6666            visibleItems.add(item);
    6767        }
     
    8686        default:
    8787            /* should not happen */
    88             throw new IllegalArgumentException(tr("unexpected column number {0}",col));
     88            throw new IllegalArgumentException(tr("unexpected column number {0}", col));
    8989        }
    9090    }
    9191
    9292    public void filter(String filter) {
    93         synchronized(this) {
     93        synchronized (this) {
    9494            if (filter == null || filter.trim().equals("")) {
    9595                visibleItems.clear();
    96                 for(KeyValuePair pair: items) {
     96                for (KeyValuePair pair: items) {
    9797                    visibleItems.add(pair);
    9898                }
     
    100100                visibleItems.clear();
    101101                filter = filter.toLowerCase();
    102                 for(KeyValuePair pair: items) {
     102                for (KeyValuePair pair: items) {
    103103                    if (pair.getKey().toLowerCase().trim().startsWith(filter)
    104                             ||  pair.getValue().toLowerCase().trim().startsWith(filter)) {
     104                            || pair.getValue().toLowerCase().trim().startsWith(filter)) {
    105105                        visibleItems.add(pair);
    106106                    }
Note: See TracChangeset for help on using the changeset viewer.