Ignore:
Timestamp:
2015-12-17T16:48:24+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Add some JavaDoc and fix minor issues

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java

    r31840 r31843  
    5656
    5757  @Override
    58   public void actionPerformed(ActionEvent e) {
     58  public void actionPerformed(ActionEvent event) {
    5959    JFileChooser chooser = new JFileChooser();
    6060    File startDirectory = new File(Main.pref.get("mapillary.start-directory",
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java

    r31838 r31843  
    6060  private volatile MapillaryAbstractImage image;
    6161
    62   private final SideButton nextButton = new SideButton(new nextPictureAction());
     62  private final SideButton nextButton = new SideButton(new NextPictureAction());
    6363  private final SideButton previousButton = new SideButton(
    6464      new PreviousPictureAction());
     
    118118    this.nextButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    119119        KeyStroke.getKeyStroke("PAGE_DOWN"), "next");
    120     this.nextButton.getActionMap().put("next", new nextPictureAction());
     120    this.nextButton.getActionMap().put("next", new NextPictureAction());
    121121    this.previousButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
    122122        KeyStroke.getKeyStroke("PAGE_UP"), "previous");
     
    173173   * Destroys the unique instance of the class.
    174174   */
    175   public static void destroyInstance() {
     175  public static synchronized void destroyInstance() {
    176176    instance = null;
    177177  }
     
    340340   *
    341341   */
    342   private class nextPictureAction extends AbstractAction {
     342  private static class NextPictureAction extends AbstractAction {
    343343
    344344    private static final long serialVersionUID = 3023827221453154340L;
    345345
    346     public nextPictureAction() {
     346    /**
     347     * Constructs a normal NextPictureAction
     348     */
     349    public NextPictureAction() {
    347350      putValue(NAME, tr("Next picture"));
    348351      putValue(SHORT_DESCRIPTION, tr("Shows the next picture in the sequence"));
     
    365368    private static final long serialVersionUID = -6420511632957956012L;
    366369
     370    /**
     371     * Constructs a normal PreviousPictureAction
     372     */
    367373    public PreviousPictureAction() {
    368374      putValue(NAME, tr("Previous picture"));
     
    387393    private static final long serialVersionUID = -6480229431481386376L;
    388394
     395    /**
     396     * Constructs a normal RedAction
     397     */
    389398    public RedAction() {
    390399      putValue(NAME, tr("Jump to red"));
     
    412421    private static final long serialVersionUID = 6250690644594703314L;
    413422
     423    /**
     424     * Constructs a normal BlueAction
     425     */
    414426    public BlueAction() {
    415427      putValue(NAME, tr("Jump to blue"));
     
    433445    private WalkThread thread;
    434446
     447    /**
     448     * Constructs a normal StopAction
     449     */
    435450    public StopAction() {
    436451      putValue(NAME, tr("Stop"));
     
    457472    private transient WalkThread thread;
    458473
     474    /**
     475     * Constructs a normal PlayAction
     476     */
    459477    public PlayAction() {
    460478      putValue(NAME, tr("Play"));
     
    483501    private WalkThread thread;
    484502
     503    /**
     504     * Constructs a normal PauseAction
     505     */
    485506    public PauseAction() {
    486507      putValue(NAME, tr("Pause"));
     
    521542          return;
    522543        }
    523         if (this.mapillaryImageDisplay.getImage() == null) {
    524           this.mapillaryImageDisplay.setImage(img);
    525         } else if (img.getHeight() > this.mapillaryImageDisplay.getImage().getHeight()) {
     544        if (
     545            this.mapillaryImageDisplay.getImage() == null
     546            || img.getHeight() > this.mapillaryImageDisplay.getImage().getHeight()
     547        ) {
    526548          this.mapillaryImageDisplay.setImage(img);
    527549        }
     
    568590
    569591  @Override
    570   public void selectedImageChanged(MapillaryAbstractImage oldImage,
    571       MapillaryAbstractImage newImage) {
     592  public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) {
    572593    setImage(newImage);
    573594    updateImage();
     
    576597  @Override
    577598  public void imagesAdded() {
     599    // This method is enforced by MapillaryDataListener, but only selectedImageChanged() is needed
    578600  }
    579601}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryUploadDialog.java

    r31839 r31843  
    3636  public MapillaryUploadDialog() {
    3737    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    38     if (MapillaryUser.getUsername() != null) {
     38    if (MapillaryUser.getUsername() == null) {
     39      this.add(new JLabel(tr("Go to setting and log in to Mapillary before uploading.")));
     40    } else {
    3941      ButtonGroup group = new ButtonGroup();
    4042      this.sequence = new JRadioButton(tr("Upload selected sequence"));
     
    4850      this.delete.setSelected(Main.pref.getBoolean("mapillary.delete-after-upload", true));
    4951      add(this.delete);
    50     } else {
    51       this.add(new JLabel(tr("Go to setting and log in to Mapillary before uploading.")));
    5252    }
    5353  }
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryImageInfoDownloadThread.java

    r31828 r31843  
    3333   * Main constructor.
    3434   *
    35    * @param ex
    36    *          {@link ExecutorService} object that is executing this thread.
    37    * @param queryString
    38    *          A String containing the parameters for the download.
     35   * @param ex {@link ExecutorService} object that is executing this thread.
     36   * @param bounds the bounds inside which the image info should be downloaded
     37   * @param page the pagenumber of the results that should be retrieved
    3938   */
    4039  public MapillaryImageInfoDownloadThread(ExecutorService ex, Bounds bounds, int page) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java

    r31837 r31843  
    3838   * Main constructor.
    3939   *
    40    * @param ex
    41    *          {@link ExecutorService} executing this thread.
    42    * @param queryString
    43    *          String containing the parameters for the download.
     40   * @param ex {@link ExecutorService} executing this thread.
     41   * @param bounds The bounds inside which the sequences should be downloaded
     42   * @param page the pagenumber of the results that should be retrieved
    4443   */
    4544  public MapillarySequenceDownloadThread(ExecutorService ex, Bounds bounds, int page) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java

    r31828 r31843  
    4040   * Main constructor.
    4141   *
    42    * @param queryStringParts
    43    *          The query data.
     42   * @param bounds the bounds of the area that should be downloaded
    4443   *
    4544   */
     
    7170   * Downloads the sequence positions, directions and keys.
    7271   *
    73    * @throws InterruptedException
    74    *           if the thread is interrupted while running this method.
     72   * @throws InterruptedException if the thread is interrupted while running this method.
    7573   */
    7674  private void downloadSequences() throws InterruptedException {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryTrafficSignDownloadThread.java

    r31828 r31843  
    3535   * @param ex {@link ExecutorService} object that is executing this thread.
    3636   * @param bounds the bounds in which the traffic signs should be downloaded
    37    * @page page the pagenumber of the results page that should be retrieved
     37   * @param page the pagenumber of the results page that should be retrieved
    3838   */
    3939  public MapillaryTrafficSignDownloadThread(ExecutorService ex, Bounds bounds, int page) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java

    r31828 r31843  
    3030   * @return The username of the logged in user.
    3131   */
    32   public static String getUsername() {
     32  public static synchronized String getUsername() {
    3333    if (!isTokenValid) {
    3434      return null;
     
    5151   *         strings.
    5252   */
    53   public static Map<String, String> getSecrets() {
     53  public static synchronized Map<String, String> getSecrets() {
    5454    if (!isTokenValid)
    5555      return null;
Note: See TracChangeset for help on using the changeset viewer.