Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

File:
1 edited

Legend:

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

    r8509 r8510  
    8787
    8888    // cache the parsing of types using a LRU cache (http://java-planet.blogspot.com/2005/08/how-to-set-up-simple-lru-cache-using.html)
    89     private static final Map<String,Set<TaggingPresetType>> TYPE_CACHE = new LinkedHashMap<>(16, 1.1f, true);
     89    private static final Map<String, Set<TaggingPresetType>> TYPE_CACHE = new LinkedHashMap<>(16, 1.1f, true);
    9090
    9191    /**
    9292     * Last value of each key used in presets, used for prefilling corresponding fields
    9393     */
    94     private static final Map<String,String> LAST_VALUES = new HashMap<>();
     94    private static final Map<String, String> LAST_VALUES = new HashMap<>();
    9595
    9696    public static class PresetListEntry implements Comparable<PresetListEntry> {
     
    196196
    197197        public void setRequisite(String str) throws SAXException {
    198             if("required".equals(str)) {
     198            if ("required".equals(str)) {
    199199                required = true;
    200             } else if(!"optional".equals(str))
     200            } else if (!"optional".equals(str))
    201201                throw new SAXException(tr("Unknown requisite: {0}", str));
    202202        }
     
    232232            if (count > 0 && !required) {
    233233                cstring = "0,"+count;
    234             } else if(count > 0) {
     234            } else if (count > 0) {
    235235                cstring = String.valueOf(count);
    236             } else if(!required) {
     236            } else if (!required) {
    237237                cstring = "0-...";
    238238            } else {
     
    242242                locale_text = getLocaleText(text, text_context, null);
    243243            }
    244             p.add(new JLabel(locale_text+":"), GBC.std().insets(0,0,10,0));
    245             p.add(new JLabel(key), GBC.std().insets(0,0,10,0));
    246             p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0,0,10,0));
     244            p.add(new JLabel(locale_text+":"), GBC.std().insets(0, 0, 10, 0));
     245            p.add(new JLabel(key), GBC.std().insets(0, 0, 10, 0));
     246            p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0, 0, 10, 0));
    247247            if (types != null) {
    248248                JPanel pp = new JPanel();
    249                 for(TaggingPresetType t : types) {
     249                for (TaggingPresetType t : types) {
    250250                    pp.add(new JLabel(ImageProvider.get(t.getIconName())));
    251251                }
     
    553553
    554554        public abstract MatchType getDefaultMatch();
     555
    555556        public abstract Collection<String> getValues();
    556557
     
    650651                textField.setMaxChars(Integer.valueOf(length));
    651652            }
    652             if (usage.unused()){
     653            if (usage.unused()) {
    653654                if (auto_increment_selected != 0  && auto_increment != null) {
    654655                    try {
     
    681682                comboBox.setEditor(textField);
    682683                comboBox.getEditor().setItem(DIFFERENT);
    683                 value=comboBox;
     684                value = comboBox;
    684685                originalValue = DIFFERENT;
    685686            }
     
    702703                    JToggleButton aibutton = new JToggleButton(ai);
    703704                    aibutton.setToolTipText(tr("Select auto-increment of {0} for this field", ai));
    704                     aibutton.setMargin(new java.awt.Insets(0,0,0,0));
     705                    aibutton.setMargin(new java.awt.Insets(0, 0, 0, 0));
    705706                    aibutton.setFocusable(false);
    706707                    saveHorizontalSpace(aibutton);
     
    732733                JButton releasebutton = new JButton("X");
    733734                releasebutton.setToolTipText(tr("Cancel auto-increment for this field"));
    734                 releasebutton.setMargin(new java.awt.Insets(0,0,0,0));
     735                releasebutton.setMargin(new java.awt.Insets(0, 0, 0, 0));
    735736                releasebutton.setFocusable(false);
    736737                releasebutton.addActionListener(new ActionListener() {
     
    745746                value = pnl;
    746747            }
    747             p.add(new JLabel(locale_text+":"), GBC.std().insets(0,0,10,0));
     748            p.add(new JLabel(locale_text+":"), GBC.std().insets(0, 0, 10, 0));
    748749            p.add(value, GBC.eol().fill(GBC.HORIZONTAL));
    749750            return true;
     
    765766                return ((JosmTextField) comp).getText();
    766767            } else if (comp instanceof JPanel) {
    767                 return getValue(((JPanel)comp).getComponent(0));
     768                return getValue(((JPanel) comp).getComponent(0));
    768769            } else {
    769770                return null;
     
    996997
    997998        protected abstract Object getSelectedItem();
     999
    9981000        protected abstract void addToPanelAnchor(JPanel p, String def, boolean presetInitiallyMatches);
    9991001
     
    14141416    private static class ConcatenatingJList extends JList<PresetListEntry> {
    14151417        private String delimiter;
     1418
    14161419        public ConcatenatingJList(String del, PresetListEntry[] o) {
    14171420            super(o);
     
    14311434                    final String value = lm.getElementAt(i).value;
    14321435                    if (parts.contains(value)) {
    1433                         intParts[j++]=i;
     1436                        intParts[j++] = i;
    14341437                        parts.remove(value);
    14351438                    }
     
    14471450            int[] si = getSelectedIndices();
    14481451            StringBuilder builder = new StringBuilder();
    1449             for (int i=0; i<si.length; i++) {
    1450                 if (i>0) {
     1452            for (int i = 0; i < si.length; i++) {
     1453                if (i > 0) {
    14511454                    builder.append(delimiter);
    14521455                }
     
    14741477
    14751478    static String fixPresetString(String s) {
    1476         return s == null ? s : s.replaceAll("'","''");
     1479        return s == null ? s : s.replaceAll("'", "''");
    14771480    }
    14781481
     
    15001503        boolean backslash = false;
    15011504        StringBuilder item = new StringBuilder();
    1502         for (int i=0; i<s.length(); i++) {
     1505        for (int i = 0; i < s.length(); i++) {
    15031506            char ch = s.charAt(i);
    15041507            if (backslash) {
     
    15301533                returnValue.hadEmpty = true;
    15311534            }
    1532             if(s.hasKeys()) {
     1535            if (s.hasKeys()) {
    15331536                returnValue.hadKeys = true;
    15341537            }
Note: See TracChangeset for help on using the changeset viewer.