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/dialogs/LayerListDialog.java

    r8509 r8510  
    121121    private final class ToggleLayerIndexVisibility extends AbstractAction {
    122122        private int layerIndex = -1;
     123
    123124        public ToggleLayerIndexVisibility(int layerIndex) {
    124125            this.layerIndex = layerIndex;
    125126        }
     127
    126128        @Override
    127129        public void actionPerformed(ActionEvent e) {
     
    145147                KeyEvent.VK_6, KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9, KeyEvent.VK_0};
    146148
    147         for(int i=0; i < 10; i++) {
     149        for (int i = 0; i < 10; i++) {
    148150            visibilityToggleShortcuts[i] = Shortcut.registerShortcut("subwindow:layers:toggleLayer" + (i+1),
    149151                    tr("Toggle visibility of layer: {0}", i+1), k[i], Shortcut.ALT);
     
    223225                        layerList.repaint();
    224226                    }
     227
    225228                    @Override
    226229                    public void refresh() {
     
    233236        MoveUpAction moveUpAction = new MoveUpAction();
    234237        adaptTo(moveUpAction, model);
    235         adaptTo(moveUpAction,selectionModel);
     238        adaptTo(moveUpAction, selectionModel);
    236239
    237240        // -- move down action
    238241        MoveDownAction moveDownAction = new MoveDownAction();
    239242        adaptTo(moveDownAction, model);
    240         adaptTo(moveDownAction,selectionModel);
     243        adaptTo(moveDownAction, selectionModel);
    241244
    242245        // -- activate action
     
    261264        MergeAction mergeLayerAction = new MergeAction();
    262265        adaptTo(mergeLayerAction, model);
    263         adaptTo(mergeLayerAction,selectionModel);
     266        adaptTo(mergeLayerAction, selectionModel);
    264267
    265268        // -- duplicate layer action
     
    273276        adaptTo(deleteLayerAction, selectionModel);
    274277        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
    275                 KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),"delete"
     278                KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"
    276279                );
    277280        getActionMap().put("delete", deleteLayerAction);
     
    369372    @Override
    370373    public void destroy() {
    371         for(int i=0; i < 10; i++) {
     374        for (int i = 0; i < 10; i++) {
    372375            Main.unregisterActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]);
    373376        }
     
    389392         */
    390393        public DeleteLayerAction() {
    391             putValue(SMALL_ICON,ImageProvider.get("dialogs", "delete"));
     394            putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
    392395            putValue(SHORT_DESCRIPTION, tr("Delete the selected layers."));
    393396            putValue(NAME, tr("Delete"));
     
    464467        @Override
    465468        public void actionPerformed(ActionEvent e) {
    466             for(Layer l : model.getSelectedLayers()) {
     469            for (Layer l : model.getSelectedLayers()) {
    467470                l.toggleVisible();
    468471            }
     
    559562                @Override
    560563                public void stateChanged(ChangeEvent e) {
    561                     setOpacity((double)slider.getValue()/100);
     564                    setOpacity((double) slider.getValue()/100);
    562565                }
    563566            });
     
    570573                layer.setOpacity(value);
    571574            } else {
    572                 for(Layer layer: model.getSelectedLayers()) {
     575                for (Layer layer: model.getSelectedLayers()) {
    573576                    layer.setOpacity(value);
    574577                }
     
    582585                double opacity = 0;
    583586                List<Layer> layers = model.getSelectedLayers();
    584                 for(Layer layer: layers) {
     587                for (Layer layer: layers) {
    585588                    opacity += layer.getOpacity();
    586589                }
     
    591594        @Override
    592595        public void actionPerformed(ActionEvent e) {
    593             slider.setValue((int)Math.round(getOpacity()*100));
     596            slider.setValue((int) Math.round(getOpacity()*100));
    594597            if (e.getSource() == opacityButton) {
    595598                popup.show(opacityButton, 0, opacityButton.getHeight());
     
    858861            }
    859862            if (layer instanceof OsmDataLayer) {
    860                 OsmDataLayer oldLayer = (OsmDataLayer)layer;
     863                OsmDataLayer oldLayer = (OsmDataLayer) layer;
    861864                // Translators: "Copy of {layer name}"
    862865                String newName = tr("Copy of {0}", oldLayer.getName());
     
    917920        private final ImageIcon iconEyeTranslucent;
    918921        private boolean isTranslucent;
     922
     923        /**
     924         * Constructs a new {@code LayerVisibleCheckBox}.
     925         */
    919926        public LayerVisibleCheckBox() {
    920927            setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
     
    940947            boolean visible = layer.isVisible();
    941948            setSelected(visible);
    942             setTranslucent(layer.getOpacity()<1.0);
     949            setTranslucent(layer.getOpacity() < 1.0);
    943950            setToolTipText(visible ? tr("layer is currently visible (click to hide layer)") : tr("layer is currently hidden (click to show layer)"));
    944951        }
     
    947954    private static class ActiveLayerCellRenderer implements TableCellRenderer {
    948955        private final JCheckBox cb;
     956
     957        /**
     958         * Constructs a new {@code ActiveLayerCellRenderer}.
     959         */
    949960        public ActiveLayerCellRenderer() {
    950961            cb = new ActiveLayerCheckBox();
     
    962973    private static class LayerVisibleCellRenderer implements TableCellRenderer {
    963974        private final LayerVisibleCheckBox cb;
     975
     976        /**
     977         * Constructs a new {@code LayerVisibleCellRenderer}.
     978         */
    964979        public LayerVisibleCellRenderer() {
    965980            this.cb = new LayerVisibleCheckBox();
     
    969984        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    970985            if (value != null) {
    971                 cb.updateStatus((Layer)value);
     986                cb.updateStatus((Layer) value);
    972987            }
    973988            return cb;
     
    977992    private static class LayerVisibleCellEditor extends DefaultCellEditor {
    978993        private final LayerVisibleCheckBox cb;
     994
    979995        public LayerVisibleCellEditor(LayerVisibleCheckBox cb) {
    980996            super(cb);
     
    9841000        @Override
    9851001        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    986             cb.updateStatus((Layer)value);
     1002            cb.updateStatus((Layer) value);
    9871003            return cb;
    9881004        }
     
    10001016            if (value == null)
    10011017                return this;
    1002             Layer layer = (Layer)value;
    1003             JLabel label = (JLabel)super.getTableCellRendererComponent(table,
     1018            Layer layer = (Layer) value;
     1019            JLabel label = (JLabel) super.getTableCellRendererComponent(table,
    10041020                    layer.getName(), isSelected, hasFocus, row, column);
    10051021            if (isActiveLayer(layer)) {
    10061022                label.setFont(label.getFont().deriveFont(Font.BOLD));
    10071023            }
    1008             if(Main.pref.getBoolean("dialog.layer.colorname", true)) {
     1024            if (Main.pref.getBoolean("dialog.layer.colorname", true)) {
    10091025                Color c = layer.getColor(false);
    1010                 if(c != null) {
     1026                if (c != null) {
    10111027                    Color oc = null;
    1012                     for(Layer l : model.getLayers()) {
     1028                    for (Layer l : model.getLayers()) {
    10131029                        oc = l.getColor(false);
    1014                         if(oc != null) {
    1015                             if(oc.equals(c)) {
     1030                        if (oc != null) {
     1031                            if (oc.equals(c)) {
    10161032                                oc = null;
    10171033                            } else {
     
    10211037                    }
    10221038                    /* not more than one color, don't use coloring */
    1023                     if(oc == null) {
     1039                    if (oc == null) {
    10241040                        c = null;
    10251041                    }
    10261042                }
    1027                 if(c == null) {
     1043                if (c == null) {
    10281044                    c = Main.pref.getUIColor(isSelected ? "Table.selectionForeground" : "Table.foreground");
    10291045                }
     
    12291245            List<Layer> selected = new ArrayList<>();
    12301246            List<Layer> layers = getLayers();
    1231             for (int i=0; i<layers.size(); i++) {
     1247            for (int i = 0; i < layers.size(); i++) {
    12321248                if (selectionModel.isSelectedIndex(i)) {
    12331249                    selected.add(layers.get(i));
     
    12381254
    12391255        /**
    1240          * Replies a the list of indices of the selected rows. Never null,
    1241          * but may be empty.
    1242          *
    1243          * @return  the list of indices of the selected rows. Never null,
    1244          * but may be empty.
     1256         * Replies a the list of indices of the selected rows. Never null, but may be empty.
     1257         *
     1258         * @return  the list of indices of the selected rows. Never null, but may be empty.
    12451259         */
    12461260        public List<Integer> getSelectedRows() {
    12471261            List<Integer> selected = new ArrayList<>();
    1248             for (int i=0; i<getLayers().size();i++) {
     1262            for (int i = 0; i < getLayers().size(); i++) {
    12491263                if (selectionModel.isSelectedIndex(i)) {
    12501264                    selected.add(i);
     
    15321546                        int idx = getLayers().indexOf(oldLayer);
    15331547                        if (idx >= 0) {
    1534                             fireTableRowsUpdated(idx,idx);
     1548                            fireTableRowsUpdated(idx, idx);
    15351549                        }
    15361550                    }
     
    15391553                        int idx = getLayers().indexOf(newLayer);
    15401554                        if (idx >= 0) {
    1541                             fireTableRowsUpdated(idx,idx);
     1555                            fireTableRowsUpdated(idx, idx);
    15421556                        }
    15431557                    }
     
    15631577        public void propertyChange(PropertyChangeEvent evt) {
    15641578            if (evt.getSource() instanceof Layer) {
    1565                 Layer layer = (Layer)evt.getSource();
     1579                Layer layer = (Layer) evt.getSource();
    15661580                final int idx = getLayers().indexOf(layer);
    15671581                if (idx < 0) return;
Note: See TracChangeset for help on using the changeset viewer.