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

checkstyle: enable relevant whitespace checks and fix them

Location:
trunk/src/org/openstreetmap/josm/gui/history
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r8384 r8510  
    2929
    3030    /** background color used when the coordinates are different */
    31     public static final Color BGCOLOR_DIFFERENCE = new Color(255,197,197);
     31    public static final Color BGCOLOR_DIFFERENCE = new Color(255, 197, 197);
    3232
    3333    /** the model */
     
    5555        gc.weightx = 0.5;
    5656        gc.weighty = 0.0;
    57         gc.insets = new Insets(5,5,5,0);
     57        gc.insets = new Insets(5, 5, 5, 0);
    5858        gc.fill = GridBagConstraints.HORIZONTAL;
    5959        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    6060        referenceInfoPanel = new VersionInfoPanel(model, PointInTimeType.REFERENCE_POINT_IN_TIME);
    61         add(referenceInfoPanel,gc);
     61        add(referenceInfoPanel, gc);
    6262
    6363        gc.gridx = 1;
     
    6868        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    6969        currentInfoPanel = new VersionInfoPanel(model, PointInTimeType.CURRENT_POINT_IN_TIME);
    70         add(currentInfoPanel,gc);
     70        add(currentInfoPanel, gc);
    7171
    7272        // ---------------------------
     
    199199            gc.fill = GridBagConstraints.NONE;
    200200            gc.weightx = 0.0;
    201             gc.insets = new Insets(5,5,5,5);
     201            gc.insets = new Insets(5, 5, 5, 5);
    202202            gc.anchor = GridBagConstraints.NORTHWEST;
    203203            add(new JLabel(tr("Latitude: ")), gc);
     
    211211            lblLat.setBackground(Color.WHITE);
    212212            lblLat.setOpaque(true);
    213             lblLat.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
     213            lblLat.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    214214
    215215            // --------
     
    229229            lblLon.setBackground(Color.WHITE);
    230230            lblLon.setOpaque(true);
    231             lblLon.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
     231            lblLon.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    232232
    233233            // fill the remaining space
     
    257257            if (!(p instanceof HistoryNode)) return false;
    258258            if (!(opposite instanceof HistoryNode)) return false;
    259             HistoryNode node = (HistoryNode)p;
     259            HistoryNode node = (HistoryNode) p;
    260260            HistoryNode oppositeNode = (HistoryNode) opposite;
    261261
     
    312312            gc.fill = GridBagConstraints.NONE;
    313313            gc.weightx = 0.0;
    314             gc.insets = new Insets(5,5,5,5);
     314            gc.insets = new Insets(5, 5, 5, 5);
    315315            gc.anchor = GridBagConstraints.NORTHWEST;
    316316            add(new JLabel(tr("Distance: ")), gc);
     
    324324            lblDistance.setBackground(Color.WHITE);
    325325            lblDistance.setOpaque(true);
    326             lblDistance.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
     326            lblDistance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    327327        }
    328328
  • trunk/src/org/openstreetmap/josm/gui/history/DiffTableModel.java

    r8308 r8510  
    2222        fireTableDataChanged();
    2323    }
     24
    2425    @Override
    2526    public int getRowCount() {
     
    4243
    4344    public int getFirstChange() {
    44         for (int i=0; i<rows.size(); i++) {
     45        for (int i = 0; i < rows.size(); i++) {
    4546            if (rows.get(i).state != DiffItemType.SAME)
    4647                return i;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java

    r8470 r8510  
    153153    }
    154154
    155 
    156155    class CloseAction extends AbstractAction {
    157156        public CloseAction() {
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r8465 r8510  
    154154    @Override
    155155    public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
     156
    156157    @Override
    157158    public void layerAdded(Layer newLayer) {}
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r8509 r8510  
    138138        return false;
    139139    }
     140
    140141    protected boolean canShowAsLatest(OsmPrimitive primitive) {
    141142        if (primitive == null) return false;
     
    224225     */
    225226    protected void initNodeListTableModels() {
    226         if(current.getType() != OsmPrimitiveType.WAY || reference.getType() != OsmPrimitiveType.WAY)
     227        if (current.getType() != OsmPrimitiveType.WAY || reference.getType() != OsmPrimitiveType.WAY)
    227228            return;
    228229        TwoColumnDiff diff = new TwoColumnDiff(
    229                 ((HistoryWay)reference).getNodes().toArray(),
    230                 ((HistoryWay)current).getNodes().toArray());
     230                ((HistoryWay) reference).getNodes().toArray(),
     231                ((HistoryWay) current).getNodes().toArray());
    231232        referenceNodeListTableModel.setRows(diff.referenceDiff, diff.referenceReversed);
    232233        currentNodeListTableModel.setRows(diff.currentDiff, false);
     
    234235
    235236    protected void initMemberListTableModels() {
    236         if(current.getType() != OsmPrimitiveType.RELATION || reference.getType() != OsmPrimitiveType.RELATION)
     237        if (current.getType() != OsmPrimitiveType.RELATION || reference.getType() != OsmPrimitiveType.RELATION)
    237238            return;
    238239        TwoColumnDiff diff = new TwoColumnDiff(
    239                 ((HistoryRelation)reference).getMembers().toArray(),
    240                 ((HistoryRelation)current).getMembers().toArray());
     240                ((HistoryRelation) reference).getMembers().toArray(),
     241                ((HistoryRelation) current).getMembers().toArray());
    241242        referenceRelationMemberTableModel.setRows(diff.referenceDiff, diff.referenceReversed);
    242243        currentRelationMemberTableModel.setRows(diff.currentDiff, false);
     
    735736    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    736737        if (oldLayer instanceof OsmDataLayer) {
    737             OsmDataLayer l = (OsmDataLayer)oldLayer;
     738            OsmDataLayer l = (OsmDataLayer) oldLayer;
    738739            l.data.removeDataSetListener(this);
    739740        }
     
    743744            return;
    744745        }
    745         OsmDataLayer l = (OsmDataLayer)newLayer;
     746        OsmDataLayer l = (OsmDataLayer) newLayer;
    746747        l.data.addDataSetListener(this);
    747748        OsmPrimitive primitive = l.data.getPrimitiveById(history.getId(), history.getType());
     
    758759    @Override
    759760    public void layerAdded(Layer newLayer) {}
     761
    760762    @Override
    761763    public void layerRemoved(Layer oldLayer) {}
     
    778780            clone = new HistoryRelation(r.getId(), r.getVersion(), r.isVisible(), getCurrentUser(), 0, null, false);
    779781            clone.setTags(r.getKeys());
    780             HistoryRelation hr = (HistoryRelation)clone;
     782            HistoryRelation hr = (HistoryRelation) clone;
    781783            for (RelationMember rm : r.getMembers()) {
    782784                hr.addMember(new RelationMemberData(rm.getRole(), rm.getType(), rm.getUniqueId()));
     
    789791            clone.setTags(w.getKeys());
    790792            for (Node n: w.getNodes()) {
    791                 ((HistoryWay)clone).addNode(n.getUniqueId());
     793                ((HistoryWay) clone).addNode(n.getUniqueId());
    792794            }
    793795        }
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

    r8291 r8510  
    190190        try {
    191191            progressMonitor.setTicksCount(toLoad.size());
    192             for(PrimitiveId pid: toLoad) {
     192            for (PrimitiveId pid: toLoad) {
    193193                if (canceled) {
    194194                    break;
     
    212212                        ds.putChangeset(i);
    213213                    }
    214                 } catch(OsmTransferException e) {
     214                } catch (OsmTransferException e) {
    215215                    if (canceled)
    216216                        return;
     
    219219                loadedData.mergeInto(ds);
    220220            }
    221         } catch(OsmTransferException e) {
     221        } catch (OsmTransferException e) {
    222222            lastException = e;
    223223            return;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryViewerPanel.java

    r8308 r8510  
    8282        gc.weightx = 0.5;
    8383        gc.weighty = 0.0;
    84         gc.insets = new Insets(5,5,5,0);
     84        gc.insets = new Insets(5, 5, 5, 0);
    8585        gc.fill = GridBagConstraints.HORIZONTAL;
    8686        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    8787        referenceInfoPanel = new VersionInfoPanel(model, PointInTimeType.REFERENCE_POINT_IN_TIME);
    88         add(referenceInfoPanel,gc);
     88        add(referenceInfoPanel, gc);
    8989
    9090        gc.gridx = 1;
     
    9797        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    9898        currentInfoPanel = new VersionInfoPanel(model, PointInTimeType.CURRENT_POINT_IN_TIME);
    99         add(currentInfoPanel,gc);
     99        add(currentInfoPanel, gc);
    100100
    101101        adjustmentSynchronizer = new AdjustmentSynchronizer();
     
    111111        gc.fill = GridBagConstraints.BOTH;
    112112        gc.anchor = GridBagConstraints.NORTHWEST;
    113         add(embedInScrollPane(buildReferenceTable()),gc);
     113        add(embedInScrollPane(buildReferenceTable()), gc);
    114114
    115115        gc.gridx = 1;
     
    121121        gc.fill = GridBagConstraints.BOTH;
    122122        gc.anchor = GridBagConstraints.NORTHWEST;
    123         add(embedInScrollPane(buildCurrentTable()),gc);
     123        add(embedInScrollPane(buildCurrentTable()), gc);
    124124    }
    125125}
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListTableCellRenderer.java

    r6986 r8510  
    1717public class NodeListTableCellRenderer extends JLabel implements TableCellRenderer {
    1818
    19     public static final Color BGCOLOR_SELECTED = new Color(143,170,255);
     19    public static final Color BGCOLOR_SELECTED = new Color(143, 170, 255);
    2020
    2121    private ImageIcon nodeIcon;
     
    2424     * Constructs a new {@code NodeListTableCellRenderer}.
    2525     */
    26     public NodeListTableCellRenderer(){
     26    public NodeListTableCellRenderer() {
    2727        setOpaque(true);
    2828        nodeIcon = ImageProvider.get("data", "node");
     
    5454            int row, int column) {
    5555
    56         renderNode((TwoColumnDiff.Item)value, isSelected);
     56        renderNode((TwoColumnDiff.Item) value, isSelected);
    5757        return this;
    5858    }
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java

    r8308 r8510  
    118118        gc.weightx = 0.5;
    119119        gc.weighty = 0.0;
    120         gc.insets = new Insets(5,5,5,0);
     120        gc.insets = new Insets(5, 5, 5, 0);
    121121        gc.fill = GridBagConstraints.HORIZONTAL;
    122122        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    123123        referenceInfoPanel = new VersionInfoPanel(model, PointInTimeType.REFERENCE_POINT_IN_TIME);
    124         add(referenceInfoPanel,gc);
     124        add(referenceInfoPanel, gc);
    125125
    126126        gc.gridx = 1;
     
    133133        gc.anchor = GridBagConstraints.FIRST_LINE_START;
    134134        currentInfoPanel = new VersionInfoPanel(model, PointInTimeType.CURRENT_POINT_IN_TIME);
    135         add(currentInfoPanel,gc);
     135        add(currentInfoPanel, gc);
    136136
    137137        adjustmentSynchronizer = new AdjustmentSynchronizer();
     
    149149        gc.fill = GridBagConstraints.BOTH;
    150150        gc.anchor = GridBagConstraints.NORTHWEST;
    151         add(embeddInScrollPane(buildReferenceNodeListTable()),gc);
     151        add(embeddInScrollPane(buildReferenceNodeListTable()), gc);
    152152
    153153        gc.gridx = 1;
     
    159159        gc.fill = GridBagConstraints.BOTH;
    160160        gc.anchor = GridBagConstraints.NORTHWEST;
    161         add(embeddInScrollPane(buildCurrentNodeListTable()),gc);
     161        add(embeddInScrollPane(buildCurrentNodeListTable()), gc);
    162162    }
    163163
     
    175175        }
    176176    }
     177
    177178    protected void registerAsObserver(HistoryBrowserModel model) {
    178179        if (currentInfoPanel != null) {
     
    205206        }
    206207
    207         public void prepare(PrimitiveId pid){
     208        public void prepare(PrimitiveId pid) {
    208209            zoomToNodeAction.setPrimitiveId(pid);
    209210            zoomToNodeAction.updateEnabledState();
     
    310311    private static PrimitiveId primitiveIdAtRow(TableModel model, int row) {
    311312        DiffTableModel castedModel = (DiffTableModel) model;
    312         Long id = (Long)castedModel.getValueAt(row, 0).value;
    313         if(id == null) return null;
     313        Long id = (Long) castedModel.getValueAt(row, 0).value;
     314        if (id == null) return null;
    314315        return new SimplePrimitiveId(id, OsmPrimitiveType.NODE);
    315316    }
     
    340341            if (e.getClickCount() < 2) return;
    341342            int row = table.rowAtPoint(e.getPoint());
    342             if(row <= 0) return;
     343            if (row <= 0) return;
    343344            PrimitiveId pid = primitiveIdAtRow(table.getModel(), row);
    344345            if (pid == null || pid.isNew())
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java

    r8388 r8510  
    2525public class RelationMemberListTableCellRenderer extends JLabel implements TableCellRenderer {
    2626
    27     public static final Color BGCOLOR_EMPTY_ROW = new Color(234,234,234);
    28     public static final Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255,197,197);
    29     public static final Color BGCOLOR_IN_OPPOSITE = new Color(255,234,213);
    30     public static final Color BGCOLOR_SELECTED = new Color(143,170,255);
     27    public static final Color BGCOLOR_EMPTY_ROW = new Color(234, 234, 234);
     28    public static final Color BGCOLOR_NOT_IN_OPPOSITE = new Color(255, 197, 197);
     29    public static final Color BGCOLOR_IN_OPPOSITE = new Color(255, 234, 213);
     30    public static final Color BGCOLOR_SELECTED = new Color(143, 170, 255);
    3131
    3232    private transient Map<OsmPrimitiveType, ImageIcon> icons;
     
    5555        Color bgColor = diffItem.state.getColor();
    5656        RelationMemberData member = (RelationMemberData) diffItem.value;
    57         text = member == null?"":member.getRole();
     57        text = member == null ? "" : member.getRole();
    5858        setText(text);
    5959        setToolTipText(text);
     
    8383            int row, int column) {
    8484
    85         Item member = (TwoColumnDiff.Item)value;
     85        Item member = (TwoColumnDiff.Item) value;
    8686        renderIcon((RelationMemberData) member.value);
    8787        switch(column) {
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java

    r6792 r8510  
    3030        @Override
    3131        public void tableChanged(TableModelEvent e) {
    32             Rectangle rect = table.getCellRect(((DiffTableModel)e.getSource()).getFirstChange(), 0, true);
     32            Rectangle rect = table.getCellRect(((DiffTableModel) e.getSource()).getFirstChange(), 0, true);
    3333            table.scrollRectToVisible(rect);
    3434        }
  • trunk/src/org/openstreetmap/josm/gui/history/SelectionSynchronizer.java

    r8390 r8510  
    3232    @Override
    3333    public void valueChanged(ListSelectionEvent e) {
    34         DefaultListSelectionModel referenceModel = (DefaultListSelectionModel)e.getSource();
     34        DefaultListSelectionModel referenceModel = (DefaultListSelectionModel) e.getSource();
    3535        int i = referenceModel.getMinSelectionIndex();
    3636        for (ListSelectionModel model : participants) {
     
    3838                continue;
    3939            }
    40             model.setSelectionInterval(i,i);
     40            model.setSelectionInterval(i, i);
    4141        }
    4242    }
  • trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java

    r8444 r8510  
    1818 */
    1919public class TagTableCellRenderer extends JLabel implements TableCellRenderer {
    20     public static final Color BGCOLOR_DIFFERENCE = new Color(255,197,197);
     20    public static final Color BGCOLOR_DIFFERENCE = new Color(255, 197, 197);
    2121
    2222    /**
     
    8585            return this;
    8686
    87         String key = (String)value;
     87        String key = (String) value;
    8888        HistoryBrowserModel.TagTableModel model = getTagTableModel(table);
    8989
  • trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java

    r8318 r8510  
    3232
    3333        public enum DiffItemType {
    34             INSERTED(new Color(0xDD, 0xFF, 0xDD)), DELETED(new Color(255,197,197)), CHANGED(new Color(255,234,213)),
    35             SAME(new Color(234,234,234)), EMPTY(new Color(234,234,234));
     34            INSERTED(new Color(0xDD, 0xFF, 0xDD)),
     35            DELETED(new Color(255, 197, 197)),
     36            CHANGED(new Color(255, 234, 213)),
     37            SAME(new Color(234, 234, 234)),
     38            EMPTY(new Color(234, 234, 234));
    3639
    3740            private final Color color;
     
    3942                this.color = color;
    4043            }
     44
    4145            public Color getColor() {
    4246                return color;
     
    9195        int ib = 0;
    9296
    93         while(script != null) {
     97        while (script != null) {
    9498            int deleted = script.deleted;
    9599            int inserted = script.inserted;
    96             while(ia < script.line0 && ib < script.line1){
     100            while (ia < script.line0 && ib < script.line1) {
    97101                Item cell = new Item(DiffItemType.SAME, a[ia]);
    98102                referenceDiff.add(cell);
     
    102106            }
    103107
    104             while(inserted > 0 || deleted > 0) {
    105                 if(inserted > 0 && deleted > 0) {
     108            while (inserted > 0 || deleted > 0) {
     109                if (inserted > 0 && deleted > 0) {
    106110                    referenceDiff.add(new Item(DiffItemType.CHANGED, a[ia++]));
    107111                    currentDiff.add(new Item(DiffItemType.CHANGED, b[ib++]));
    108                 } else if(inserted > 0) {
     112                } else if (inserted > 0) {
    109113                    referenceDiff.add(new Item(DiffItemType.EMPTY, null));
    110114                    currentDiff.add(new Item(DiffItemType.INSERTED, b[ib++]));
     
    118122            script = script.link;
    119123        }
    120         while(ia < a.length && ib < b.length) {
     124        while (ia < a.length && ib < b.length) {
    121125            referenceDiff.add(new Item(DiffItemType.SAME, a[ia++]));
    122126            currentDiff.add(new Item(DiffItemType.SAME, b[ib++]));
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r8426 r8510  
    9292        pnl1.add(lblInfo, BorderLayout.CENTER);
    9393
    94         JPanel pnlUserAndChangeset = new JPanel(new GridLayout(2,2));
     94        JPanel pnlUserAndChangeset = new JPanel(new GridLayout(2, 2));
    9595        lblUser = new UrlLabel("", 2);
    9696        pnlUserAndChangeset.add(new JLabel(tr("User:")));
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java

    r8475 r8510  
    124124            super(popupMenu);
    125125        }
     126
    126127        @Override
    127128        public void mousePressed(MouseEvent e) {
     
    136137            }
    137138        }
     139
    138140        @Override
    139141        protected int checkTableSelection(JTable table, Point p) {
     
    228230        private UserInfoAction userInfoAction;
    229231
     232        /**
     233         * Constructs a new {@code VersionTablePopupMenu}.
     234         */
     235        public VersionTablePopupMenu() {
     236            super();
     237            build();
     238        }
     239
    230240        protected void build() {
    231241            changesetInfoAction = new ChangesetInfoAction();
     
    234244            add(userInfoAction);
    235245        }
    236         public VersionTablePopupMenu() {
    237             super();
    238             build();
    239         }
    240246
    241247        public void prepare(HistoryOsmPrimitive primitive) {
     
    251257        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
    252258                int row, int column) {
    253             setSelected(value != null && (Boolean)value);
     259            setSelected(value != null && (Boolean) value);
    254260            setHorizontalAlignment(SwingConstants.CENTER);
    255261            return this;
     
    314320        int maxwidth = 0;
    315321
    316         for (int row=0; row<tbl.getRowCount(); row++) {
     322        for (int row = 0; row < tbl.getRowCount(); row++) {
    317323            TableCellRenderer tcr = tbl.getCellRenderer(row, col);
    318324            Object val = tbl.getValueAt(row, col);
Note: See TracChangeset for help on using the changeset viewer.