Ignore:
Timestamp:
2016-11-25T23:38:21+01:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/imagewaypoint
Files:
1 added
7 edited

Legend:

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

    r32286 r33086  
    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/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/IImageChangeListener.java

    r13497 r33086  
     1// License: GPL. For details, see LICENSE file.
    12package org.insignificant.josm.plugins.imagewaypoint;
    23
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java

    r32915 r33086  
     1// License: GPL. For details, see LICENSE file.
    12package org.insignificant.josm.plugins.imagewaypoint;
    23
     
    1819        private final ImageEntries imageEntries;
    1920
    20         public ImageReadyListener(final ImageEntries imageEntries) {
     21        ImageReadyListener(final ImageEntries imageEntries) {
    2122            this.imageEntries = imageEntries;
    2223        }
    2324
    2425        @Override
    25         public final void onImageReady(final ImageEntry imageEntry,
     26        public void onImageReady(final ImageEntry imageEntry,
    2627            final Image image) {
    2728            this.imageEntries.setCurrentImage(imageEntry, image);
     
    4950    }
    5051
    51     public static final ImageEntries getInstance() {
     52    public static ImageEntries getInstance() {
    5253        return ImageEntries.INSTANCE;
    5354    }
    5455
    55     public final void addListener(final IImageChangeListener listener) {
     56    public void addListener(final IImageChangeListener listener) {
    5657        this.listeners.add(listener);
    5758    }
    5859
    59     public final void removeListener(final IImageChangeListener listener) {
     60    public void removeListener(final IImageChangeListener listener) {
    6061        this.listeners.remove(listener);
    6162    }
    6263
    63     public final void add(final File[] imageFiles) {
     64    public void add(final File[] imageFiles) {
    6465        if (null != imageFiles) {
    6566            for (int index = 0; index < imageFiles.length; index++) {
     
    7071    }
    7172
    72     public final void associateAllLayers() {
     73    public void associateAllLayers() {
    7374        for (int index = 0; index < this.images.size(); index++) {
    7475            this.images.get(index).setWayPoint(null);
     
    9293    }
    9394
    94     private final void doAssociateLayer(final GpxLayer gpxLayer) {
     95    private void doAssociateLayer(final GpxLayer gpxLayer) {
    9596        if (null != gpxLayer && null != gpxLayer.data
    9697        && !gpxLayer.data.fromServer) {
     
    109110    }
    110111
    111     private final List<String> getTextContentsFromWayPoint(
    112     final WayPoint wayPoint) {
    113     final List<String> texts = new ArrayList<>();
    114     for(String s : new String[]{"name", "cmt", "desc"})
    115     {
    116         String t = wayPoint.getString(s);
    117         if(null != t && 0 < t.length())
    118             texts.add(t);
    119     }
    120 
    121     return texts;
     112    private List<String> getTextContentsFromWayPoint(
     113        final WayPoint wayPoint) {
     114        final List<String> texts = new ArrayList<>();
     115        for (String s : new String[]{"name", "cmt", "desc"}) {
     116            String t = wayPoint.getString(s);
     117            if (null != t && 0 < t.length())
     118                texts.add(t);
     119        }
     120
     121        return texts;
    122122    }
    123123
     
    132132    // }
    133133
    134     private final ImageEntry findImageEntryWithFileName(final String fileName) {
     134    private ImageEntry findImageEntryWithFileName(final String fileName) {
    135135        ImageEntry foundimage = null;
    136136
     
    146146    }
    147147
    148     private final void setCurrentImage(final ImageEntry imageEntry,
    149     final Image image) {
     148    private void setCurrentImage(final ImageEntry imageEntry, final Image image) {
    150149        if (imageEntry == this.currentImageEntry) {
    151150            this.currentImage = image;
     
    157156    }
    158157
    159     public final ImageEntry[] getImages() {
     158    public ImageEntry[] getImages() {
    160159        return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);
    161160    }
    162161
    163     public final ImageEntry getCurrentImageEntry() {
     162    public ImageEntry getCurrentImageEntry() {
    164163        return this.currentImageEntry;
    165164    }
    166165
    167     public final Image getCurrentImage() {
     166    public Image getCurrentImage() {
    168167        return this.currentImage;
    169168    }
    170169
    171     public final boolean hasNext() {
     170    public boolean hasNext() {
    172171        return null != this.currentImageEntry
    173172        && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1;
    174173    }
    175174
    176     public final boolean hasPrevious() {
     175    public boolean hasPrevious() {
    177176        return null != this.currentImageEntry
    178177        && this.locatedImages.indexOf(this.currentImageEntry) > 0;
    179178    }
    180179
    181     public final void next() {
     180    public void next() {
    182181        if (null != this.currentImageEntry
    183182        && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1) {
     
    186185    }
    187186
    188     public final void previous() {
     187    public void previous() {
    189188        if (null != this.currentImageEntry
    190189        && this.locatedImages.indexOf(this.currentImageEntry) > 0) {
     
    193192    }
    194193
    195     public final void rotateCurrentImageLeft() {
     194    public void rotateCurrentImageLeft() {
    196195        if (null != this.currentImageEntry) {
    197196            this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
     
    202201    }
    203202
    204     public final void rotateCurrentImageRight() {
     203    public void rotateCurrentImageRight() {
    205204        if (null != this.currentImageEntry) {
    206205            this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
     
    211210    }
    212211
    213     public final void setCurrentImageEntry(final ImageEntry imageEntry) {
     212    public void setCurrentImageEntry(final ImageEntry imageEntry) {
    214213        if (null == imageEntry || this.locatedImages.contains(imageEntry)) {
    215214            if (null != this.currentImageEntry)
     
    219218            this.currentImage = null;
    220219
    221             for (IImageChangeListener listener : this.listeners)
     220            for (IImageChangeListener listener : this.listeners) {
    222221                listener.onSelectedImageEntryChanged(this);
    223 
    224             if(imageEntry != null) // now try to get the image
     222            }
     223
     224            if (imageEntry != null) // now try to get the image
    225225                this.currentImageEntry.requestImage(this.listener);
    226226        }
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntry.java

    r32915 r33086  
    1 /**
    2  *
    3  */
     1// License: GPL. For details, see LICENSE file.
    42package org.insignificant.josm.plugins.imagewaypoint;
    53
     
    2927        private final ImageEntry imageEntry;
    3028
    31         public Observer(final ImageEntry imageEntry) {
     29        Observer(final ImageEntry imageEntry) {
    3230            this.imageEntry = imageEntry;
    3331        }
     
    4038         */
    4139        @Override
    42         public final boolean imageUpdate(final Image image,
     40        public boolean imageUpdate(final Image image,
    4341            final int infoflags, final int x, final int y, final int width,
    4442            final int height) {
     
    7270    }
    7371
    74     public final Orientation rotateRight() {
     72    public Orientation rotateRight() {
    7573        if (this.index < Orientation.orientations.length - 1) {
    7674        return Orientation.orientations[this.index + 1];
     
    8078    }
    8179
    82     public final Orientation rotateLeft() {
     80    public Orientation rotateLeft() {
    8381        if (this.index == 0) {
    8482        return Orientation.orientations[Orientation.orientations.length - 1];
     
    121119
    122120    @Override
    123     public final int compareTo(final ImageEntry image) {
    124     return this.fileName.compareTo(image.fileName);
    125     }
    126 
    127     public final String getFileName() {
    128     return fileName;
    129     }
    130 
    131     public final WayPoint getWayPoint() {
    132     return wayPoint;
    133     }
    134 
    135     public final void setWayPoint(final WayPoint wayPoint) {
    136     this.wayPoint = wayPoint;
    137     }
    138 
    139     public final Orientation getOrientation() {
    140     return orientation;
    141     }
    142 
    143     public final void setOrientation(final Orientation orientation) {
    144     this.orientation = orientation;
    145     this.normalImage = null;
    146     this.rotatedImage = null;
    147     }
    148 
    149     public final Rectangle getBounds(final MapView mapView) {
    150     final Rectangle bounds;
    151 
    152     if (null == this.wayPoint) {
    153         bounds = null;
    154     } else {
    155         final Point point = mapView.getPoint(this.getWayPoint().getCoor());
    156         bounds = new Rectangle(point.x - ImageEntry.ICON_WIDTH,
    157         point.y - ImageEntry.ICON_HEIGHT,
    158         ImageEntry.ICON_WIDTH,
    159         ImageEntry.ICON_WIDTH);
    160     }
    161 
    162     return bounds;
    163     }
    164 
    165     public final void requestImage(final IImageReadyListener imageReadyListener) {
    166     this.listener = imageReadyListener;
    167 
    168     if (null == this.rotatedImage) {
    169         final Image image = Toolkit.getDefaultToolkit()
    170         .getImage(this.filePath);
    171         if (Toolkit.getDefaultToolkit().prepareImage(image,
    172         -1,
    173         -1,
    174         this.observer)) {
    175         this.imageLoaded(image);
    176         }
    177     } else if (null != this.listener) {
    178         this.listener.onImageReady(this, this.rotatedImage);
    179     }
    180     }
    181 
    182     public final void flush() {
    183     if (null != this.normalImage) {
    184         this.normalImage.flush();
     121    public int compareTo(final ImageEntry image) {
     122        return this.fileName.compareTo(image.fileName);
     123    }
     124
     125    public String getFileName() {
     126        return fileName;
     127    }
     128
     129    public WayPoint getWayPoint() {
     130        return wayPoint;
     131    }
     132
     133    public void setWayPoint(final WayPoint wayPoint) {
     134        this.wayPoint = wayPoint;
     135    }
     136
     137    public Orientation getOrientation() {
     138        return orientation;
     139    }
     140
     141    public void setOrientation(final Orientation orientation) {
     142        this.orientation = orientation;
    185143        this.normalImage = null;
    186     }
    187 
    188     if (null != this.rotatedImage) {
    189         this.rotatedImage.flush();
    190144        this.rotatedImage = null;
    191145    }
    192     }
    193 
    194     private final void imageLoaded(final Image image) {
     146
     147    public Rectangle getBounds(final MapView mapView) {
     148        final Rectangle bounds;
     149
     150        if (null == this.wayPoint) {
     151            bounds = null;
     152        } else {
     153            final Point point = mapView.getPoint(this.getWayPoint().getCoor());
     154            bounds = new Rectangle(point.x - ImageEntry.ICON_WIDTH,
     155            point.y - ImageEntry.ICON_HEIGHT,
     156            ImageEntry.ICON_WIDTH,
     157            ImageEntry.ICON_WIDTH);
     158        }
     159
     160        return bounds;
     161    }
     162
     163    public void requestImage(final IImageReadyListener imageReadyListener) {
     164        this.listener = imageReadyListener;
     165
     166        if (null == this.rotatedImage) {
     167            final Image image = Toolkit.getDefaultToolkit()
     168            .getImage(this.filePath);
     169            if (Toolkit.getDefaultToolkit().prepareImage(image,
     170            -1,
     171            -1,
     172            this.observer)) {
     173            this.imageLoaded(image);
     174            }
     175        } else if (null != this.listener) {
     176            this.listener.onImageReady(this, this.rotatedImage);
     177        }
     178    }
     179
     180    public void flush() {
     181        if (null != this.normalImage) {
     182            this.normalImage.flush();
     183            this.normalImage = null;
     184        }
     185
     186        if (null != this.rotatedImage) {
     187            this.rotatedImage.flush();
     188            this.rotatedImage = null;
     189        }
     190    }
     191
     192    private void imageLoaded(final Image image) {
    195193    if (Orientation.NORMAL == this.getOrientation()) {
    196194        this.rotatedImage = image;
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointDialog.java

    r32915 r33086  
     1// License: GPL. For details, see LICENSE file.
    12package org.insignificant.josm.plugins.imagewaypoint;
    23
     
    2627        private Image image;
    2728
    28         public ImageComponent() {
     29        ImageComponent() {
    2930            this.image = null;
    3031        }
    3132
    3233        @Override
    33         public final void paint(final Graphics g) {
     34        public void paint(final Graphics g) {
    3435            if (null == this.image || 0 >= this.image.getWidth(null)
    3536                || 0 >= this.image.getHeight(null)) {
     
    7172        }
    7273
    73         public final void setImage(final Image image) {
     74        public void setImage(final Image image) {
    7475            this.image = image;
    7576            this.repaint();
     
    8182        private final ImageWayPointDialog dialog;
    8283
    83         public ImageChangeListener(final ImageWayPointDialog dialog) {
     84        ImageChangeListener(final ImageWayPointDialog dialog) {
    8485            this.dialog = dialog;
    8586        }
    8687
    8788        @Override
    88         public final void onAvailableImageEntriesChanged(
     89        public void onAvailableImageEntriesChanged(
    8990            final ImageEntries entries) {
    9091            this.dialog.imageDisplay.setImage(entries.getCurrentImage());
     
    9394
    9495        @Override
    95         public final void onSelectedImageEntryChanged(final ImageEntries entries) {
     96        public void onSelectedImageEntryChanged(final ImageEntries entries) {
    9697            this.dialog.imageDisplay.setImage(entries.getCurrentImage());
    9798            this.dialog.updateUI();
     
    101102    private static final class PreviousAction extends JosmAction {
    102103
    103     public PreviousAction() {
    104         super(tr("Previous"),
    105         null,
    106         tr("Previous image"),
    107         null,
    108         false);
    109     }
    110 
    111     @Override
    112     public final void actionPerformed(final ActionEvent actionEvent) {
    113         if (ImageEntries.getInstance().hasPrevious()) {
    114         ImageEntries.getInstance().previous();
    115         }
    116     }
     104        PreviousAction() {
     105            super(tr("Previous"),
     106            null,
     107            tr("Previous image"),
     108            null,
     109            false);
     110        }
     111
     112        @Override
     113        public void actionPerformed(final ActionEvent actionEvent) {
     114            if (ImageEntries.getInstance().hasPrevious()) {
     115                ImageEntries.getInstance().previous();
     116            }
     117        }
    117118    }
    118119
    119120    private static final class NextAction extends JosmAction {
    120121
    121     public NextAction() {
    122         super(tr("Next"), null, tr("Next image"), null, false);
    123     }
    124 
    125     @Override
    126     public final void actionPerformed(final ActionEvent actionEvent) {
    127         if (ImageEntries.getInstance().hasNext()) {
    128         ImageEntries.getInstance().next();
    129         }
    130     }
     122        NextAction() {
     123            super(tr("Next"), null, tr("Next image"), null, false);
     124        }
     125
     126        @Override
     127        public void actionPerformed(final ActionEvent actionEvent) {
     128            if (ImageEntries.getInstance().hasNext()) {
     129                ImageEntries.getInstance().next();
     130            }
     131        }
    131132    }
    132133
    133134    private static final class RotateLeftAction extends JosmAction {
    134135
    135     public RotateLeftAction() {
    136         super(tr("Rotate left"),
    137         null,
    138         tr("Rotate image left"),
    139         null,
    140         false);
    141     }
    142 
    143     @Override
    144     public final void actionPerformed(final ActionEvent actionEvent) {
    145         ImageEntries.getInstance().rotateCurrentImageLeft();
    146     }
     136        RotateLeftAction() {
     137            super(tr("Rotate left"),
     138            null,
     139            tr("Rotate image left"),
     140            null,
     141            false);
     142        }
     143
     144        @Override
     145        public void actionPerformed(final ActionEvent actionEvent) {
     146            ImageEntries.getInstance().rotateCurrentImageLeft();
     147        }
    147148    }
    148149
    149150    private static final class RotateRightAction extends JosmAction {
    150151
    151     public RotateRightAction() {
    152         super(tr("Rotate right"),
    153         null,
    154         tr("Rotate image right"),
    155         null,
    156         false);
    157     }
    158 
    159     @Override
    160     public final void actionPerformed(final ActionEvent actionEvent) {
    161         ImageEntries.getInstance().rotateCurrentImageRight();
    162     }
     152        RotateRightAction() {
     153            super(tr("Rotate right"),
     154            null,
     155            tr("Rotate image right"),
     156            null,
     157            false);
     158        }
     159
     160        @Override
     161        public void actionPerformed(final ActionEvent actionEvent) {
     162            ImageEntries.getInstance().rotateCurrentImageRight();
     163        }
    163164    }
    164165
     
    212213    }
    213214
    214     private final void updateUI() {
    215     this.previousAction.setEnabled(ImageEntries.getInstance().hasPrevious());
    216     this.nextAction.setEnabled(ImageEntries.getInstance().hasNext());
    217     this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance()
    218         .getCurrentImageEntry());
    219     this.rotateRightAction.setEnabled(null != ImageEntries.getInstance()
    220         .getCurrentImageEntry());
    221 
    222     if (null != Main.map) {
    223         Main.map.repaint();
    224     }
     215    private void updateUI() {
     216        this.previousAction.setEnabled(ImageEntries.getInstance().hasPrevious());
     217        this.nextAction.setEnabled(ImageEntries.getInstance().hasNext());
     218        this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance()
     219            .getCurrentImageEntry());
     220        this.rotateRightAction.setEnabled(null != ImageEntries.getInstance()
     221            .getCurrentImageEntry());
     222
     223        if (null != Main.map) {
     224            Main.map.repaint();
     225        }
    225226    }
    226227
    227228    public static ImageWayPointDialog getInstance() {
    228     return ImageWayPointDialog.INSTANCE;
    229     }
    230 
    231     public final ToggleDialog getDisplayComponent() {
    232     return this.dialog;
     229        return ImageWayPointDialog.INSTANCE;
     230    }
     231
     232    public ToggleDialog getDisplayComponent() {
     233        return this.dialog;
    233234    }
    234235}
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java

    r32915 r33086  
     1// License: GPL. For details, see LICENSE file.
    12package org.insignificant.josm.plugins.imagewaypoint;
    23
     
    2324        private final ImageWayPointLayer layer;
    2425
    25         public ImageWayPointMouseListener(final ImageWayPointLayer layer) {
     26        ImageWayPointMouseListener(final ImageWayPointLayer layer) {
    2627            this.layer = layer;
    2728        }
    2829
    2930        @Override
    30         public final void mouseClicked(final MouseEvent event) {
     31        public void mouseClicked(final MouseEvent event) {
    3132            if (MouseEvent.BUTTON1 == event.getButton() && this.layer.isVisible()) {
    3233                final ImageEntry[] images = ImageEntries.getInstance()
     
    5354    private static final class ImageChangeListener implements IImageChangeListener {
    5455        @Override
    55         public final void onAvailableImageEntriesChanged(
    56         final ImageEntries entries) {
     56        public void onAvailableImageEntriesChanged(final ImageEntries entries) {
    5757            Main.map.repaint();
    5858        }
    5959
    6060        @Override
    61         public final void onSelectedImageEntryChanged(final ImageEntries entries) {
     61        public void onSelectedImageEntryChanged(final ImageEntries entries) {
    6262            Main.map.repaint();
    6363        }
     
    8080
    8181    @Override
    82     public final Icon getIcon() {
     82    public Icon getIcon() {
    8383        return ImageProvider.get("dialogs/imagewaypoint");
    8484    }
    8585
    8686    @Override
    87     public final Object getInfoComponent() {
     87    public Object getInfoComponent() {
    8888        return null;
    8989    }
    9090
    9191    @Override
    92     public final Action[] getMenuEntries() {
     92    public Action[] getMenuEntries() {
    9393        return new Action[0];
    9494    }
    9595
    9696    @Override
    97     public final String getToolTipText() {
     97    public String getToolTipText() {
    9898        // TODO
    9999        return "";
     
    101101
    102102    @Override
    103     public final boolean isMergable(final Layer other) {
     103    public boolean isMergable(final Layer other) {
    104104        // TODO
    105105        return false;
     
    107107
    108108    @Override
    109     public final void mergeFrom(final Layer from) {
     109    public void mergeFrom(final Layer from) {
    110110        // TODO not supported yet
    111111    }
    112112
    113113    @Override
    114     public final void paint(final Graphics2D graphics, final MapView mapView, Bounds box) {
     114    public void paint(final Graphics2D graphics, final MapView mapView, Bounds box) {
    115115        final ImageEntry[] images = ImageEntries.getInstance().getImages();
    116116
     
    139139
    140140    @Override
    141     public final void visitBoundingBox(final BoundingXYVisitor visitor) {
     141    public void visitBoundingBox(final BoundingXYVisitor visitor) {
    142142        final ImageEntry[] images = ImageEntries.getInstance().getImages();
    143143
     
    153153
    154154    @Override
    155     public final void destroy() {
     155    public void destroy() {
    156156        super.destroy();
    157157
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java

    r32288 r33086  
     1// License: GPL. For details, see LICENSE file.
    12package org.insignificant.josm.plugins.imagewaypoint;
    23
     
    2122    private final class ImageWaypointImporter extends FileImporter {
    2223
    23         public ImageWaypointImporter() {
     24        ImageWaypointImporter() {
    2425            super(new ExtensionFileFilter("jpg,jpeg,png,gif", "jpg", "Image files [by ImageWayPoint plugin] (*.jpg, *.jpeg, *.png, *.gif)"));
    2526        }
     
    3839        public void importData(List<File> files, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    3940            if (null != files && !files.isEmpty()) {
    40            
     41
    4142                // recursively find all files
    4243                final List<File> allFiles = new ArrayList<>();
     
    7273    public ImageWayPointPlugin(PluginInformation info) {
    7374        super(info);
    74         ExtensionFileFilter.addImporter(new ImageWaypointImporter());
     75        ExtensionFileFilter.addImporter(new ImageWaypointImporter());
    7576    }
    7677
    7778    @Override
    78     public final void mapFrameInitialized(final MapFrame oldFrame,
    79     final MapFrame newFrame) {
     79    public void mapFrameInitialized(final MapFrame oldFrame, final MapFrame newFrame) {
    8080        if (newFrame != null) {
    8181            newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
Note: See TracChangeset for help on using the changeset viewer.