Ignore:
Timestamp:
2016-07-02T03:55:03+02:00 (9 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java

    r32462 r32528  
     1// License: WTFPL. For details, see LICENSE file.
    12package iodb;
    23
     
    7273     * @param offsets The list of offset to choose from.
    7374     */
    74     public OffsetDialog( List<ImageryOffsetBase> offsets ) {
     75    public OffsetDialog(List<ImageryOffsetBase> offsets) {
    7576        super(JOptionPane.getFrameForComponent(Main.parent), ImageryOffsetTools.DIALOG_TITLE,
    7677                MODAL ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
     
    9495        calibrationBox.addActionListener(new ActionListener() {
    9596            @Override
    96             public void actionPerformed( ActionEvent e ) {
     97            public void actionPerformed(ActionEvent e) {
    9798                Main.pref.put(PREF_CALIBRATION, calibrationBox.isSelected());
    9899                updateButtonPanel();
     
    103104        deprecatedBox.addActionListener(new ActionListener() {
    104105            @Override
    105             public void actionPerformed( ActionEvent e ) {
     106            public void actionPerformed(ActionEvent e) {
    106107                Main.pref.put(PREF_DEPRECATED, deprecatedBox.isSelected());
    107108                updateButtonPanel();
     
    135136    private void updateButtonPanel() {
    136137        List<ImageryOffsetBase> filteredOffsets = filterOffsets();
    137         if( buttonPanel == null )
     138        if (buttonPanel == null)
    138139            buttonPanel = new JPanel();
    139140        buttonPanel.removeAll();
    140141        buttonPanel.setLayout(new GridLayout(filteredOffsets.size(), 1, 0, 5));
    141         for( ImageryOffsetBase offset : filteredOffsets ) {
     142        for (ImageryOffsetBase offset : filteredOffsets) {
    142143            OffsetDialogButton button = new OffsetDialogButton(offset);
    143144            button.addActionListener(this);
    144145            JPopupMenu popupMenu = new JPopupMenu();
    145146            popupMenu.add(new OffsetInfoAction(offset));
    146             if( !offset.isDeprecated() ) {
     147            if (!offset.isDeprecated()) {
    147148                DeprecateOffsetAction action = new DeprecateOffsetAction(offset);
    148149                action.setListener(new DeprecateOffsetListener(offset));
     
    164165        boolean showDeprecated = Main.pref.getBoolean(PREF_DEPRECATED, false);
    165166        List<ImageryOffsetBase> filteredOffsets = new ArrayList<>();
    166         for( ImageryOffsetBase offset : offsets ) {
    167             if( offset.isDeprecated() && !showDeprecated )
     167        for (ImageryOffsetBase offset : offsets) {
     168            if (offset.isDeprecated() && !showDeprecated)
    168169                continue;
    169             if( offset instanceof CalibrationObject && !showCalibration )
     170            if (offset instanceof CalibrationObject && !showCalibration)
    170171                continue;
    171172            filteredOffsets.add(offset);
    172             if( filteredOffsets.size() >= MAX_OFFSETS )
     173            if (filteredOffsets.size() >= MAX_OFFSETS)
    173174                break;
    174175        }
     
    182183    @Override
    183184    public void zoomChanged() {
    184         for( Component c : buttonPanel.getComponents() ) {
    185             if( c instanceof OffsetDialogButton ) {
    186                 ((OffsetDialogButton)c).updateLocation();
     185        for (Component c : buttonPanel.getComponents()) {
     186            if (c instanceof OffsetDialogButton) {
     187                ((OffsetDialogButton) c).updateLocation();
    187188            }
    188189        }
     
    194195     */
    195196    @Override
    196     public void paint( Graphics2D g, MapView mv, Bounds bbox ) {
    197         if( offsets == null )
     197    public void paint(Graphics2D g, MapView mv, Bounds bbox) {
     198        if (offsets == null)
    198199            return;
    199200
    200         Graphics2D g2 = (Graphics2D)g.create();
     201        Graphics2D g2 = (Graphics2D) g.create();
    201202        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    202203        g2.setStroke(new BasicStroke(2));
    203         for( ImageryOffsetBase offset : filterOffsets() ) {
     204        for (ImageryOffsetBase offset : filterOffsets()) {
    204205            Point p = mv.getPoint(offset.getPosition());
    205206            g2.setColor(Color.BLACK);
     
    221222        prepareDialog();
    222223        MapView.addZoomChangeListener(this);
    223         if( !MODAL ) {
     224        if (!MODAL) {
    224225            Main.map.mapView.addTemporaryLayer(this);
    225226            Main.map.mapView.repaint();
     
    237238     */
    238239    @Override
    239     public void actionPerformed( ActionEvent e ) {
    240         if( e.getSource() instanceof OffsetDialogButton ) {
    241             selectedOffset = ((OffsetDialogButton)e.getSource()).getOffset();
     240    public void actionPerformed(ActionEvent e) {
     241        if (e.getSource() instanceof OffsetDialogButton) {
     242            selectedOffset = ((OffsetDialogButton) e.getSource()).getOffset();
    242243        } else
    243244            selectedOffset = null;
     
    245246                || selectedOffset instanceof CalibrationObject
    246247                || Main.pref.getBoolean("iodb.close.on.select", true);
    247         if( closeDialog ) {
     248        if (closeDialog) {
    248249            MapView.removeZoomChangeListener(this);
    249250            setVisible(false);
    250251        }
    251         if( !MODAL ) {
    252             if( closeDialog ) {
     252        if (!MODAL) {
     253            if (closeDialog) {
    253254                Main.map.mapView.removeTemporaryLayer(this);
    254255                Main.map.mapView.repaint();
    255256            }
    256             if( selectedOffset != null ) {
     257            if (selectedOffset != null) {
    257258                applyOffset();
    258                 if( !closeDialog )
     259                if (!closeDialog)
    259260                    updateButtonPanel();
    260261            }
    261262        }
    262263    }
    263 
    264264
    265265    /**
     
    269269     */
    270270    public void applyOffset() {
    271         if( selectedOffset instanceof ImageryOffset ) {
     271        if (selectedOffset instanceof ImageryOffset) {
    272272            ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
    273             ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset)selectedOffset);
     273            ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset) selectedOffset);
    274274            ImageryOffsetWatcher.getInstance().markGood();
    275275            Main.map.repaint();
    276             if( !Main.pref.getBoolean("iodb.offset.message", false) ) {
     276            if (!Main.pref.getBoolean("iodb.offset.message", false)) {
    277277                JOptionPane.showMessageDialog(Main.parent,
    278278                        tr("The topmost imagery layer has been shifted to presumably match\n"
     
    282282                Main.pref.put("iodb.offset.message", true);
    283283            }
    284         } else if( selectedOffset instanceof CalibrationObject ) {
    285             CalibrationLayer clayer = new CalibrationLayer((CalibrationObject)selectedOffset);
     284        } else if (selectedOffset instanceof CalibrationObject) {
     285            CalibrationLayer clayer = new CalibrationLayer((CalibrationObject) selectedOffset);
    286286            Main.getLayerManager().addLayer(clayer);
    287287            clayer.panToCenter();
    288             if( !Main.pref.getBoolean("iodb.calibration.message", false) ) {
     288            if (!Main.pref.getBoolean("iodb.calibration.message", false)) {
    289289                JOptionPane.showMessageDialog(Main.parent,
    290290                        tr("A layer has been added with a calibration geometry. Hide data layers,\n"
     
    305305         * Initialize the listener with an offset.
    306306         */
    307         public DeprecateOffsetListener( ImageryOffsetBase offset ) {
     307        DeprecateOffsetListener(ImageryOffsetBase offset) {
    308308            this.offset = offset;
    309309        }
     
    324324    class HelpAction extends AbstractAction {
    325325
    326         public HelpAction() {
     326        HelpAction() {
    327327            super(tr("Help"));
    328328            putValue(SMALL_ICON, ImageProvider.get("help"));
     
    330330
    331331        @Override
    332         public void actionPerformed( ActionEvent e ) {
     332        public void actionPerformed(ActionEvent e) {
    333333            String base = Main.pref.get("url.openstreetmap-wiki", "http://wiki.openstreetmap.org/wiki/");
    334334            String lang = LanguageInfo.getWikiLanguagePrefix();
     
    341341                    lang = "";
    342342                }
    343             } catch( IOException ex ) {
     343            } catch (IOException ex) {
    344344                lang = "";
    345345            }
Note: See TracChangeset for help on using the changeset viewer.