Changeset 32580 in osm for applications


Ignore:
Timestamp:
2016-07-05T14:49:06+02:00 (8 years ago)
Author:
floscher
Message:

[mapillary] Use common TreeCellRenderer for ChangesetDialog and HistoryDialog

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryChangesetDialog.java

    r32577 r32580  
    2020import javax.swing.SwingUtilities;
    2121import javax.swing.tree.DefaultMutableTreeNode;
    22 import javax.swing.tree.DefaultTreeCellRenderer;
    2322import javax.swing.tree.DefaultTreeModel;
    2423import javax.swing.tree.TreeSelectionModel;
     
    7069  private MapillaryChangesetDialog() {
    7170    super(
    72       tr("Current Mapillary changeset"), "mapillaryhistory.png", tr("Open Mapillary changeset dialog"),
     71      tr("Current Mapillary changeset"),
     72      "mapillaryhistory.png",
     73      tr("Open Mapillary changeset dialog"),
    7374      Shortcut.registerShortcut(
    7475        tr("Mapillary changeset"), tr("Open Mapillary changeset dialog"), KeyEvent.VK_9, Shortcut.NONE
    75       ), 200
     76      ),
     77      200
    7678    );
    7779
     
    8284    this.changesetTree.setShowsRootHandles(true);
    8385    this.changesetTree.setRootVisible(false);
    84     this.changesetTree.setCellRenderer(new MapillaryCellRenderer());
     86    this.changesetTree.setCellRenderer(new MapillaryImageTreeCellRenderer());
    8587    this.changesetTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    8688
     
    105107   */
    106108  public static synchronized MapillaryChangesetDialog getInstance() {
    107     if (instance == null)
     109    if (instance == null) {
    108110      instance = new MapillaryChangesetDialog();
     111    }
    109112    return instance;
    110113  }
     
    148151      buildTree();
    149152    }
    150 
    151153  }
    152154
     
    166168    }
    167169  }
    168 
    169   private static class MapillaryCellRenderer extends DefaultTreeCellRenderer {
    170 
    171     private static final long serialVersionUID = -3129520241562296901L;
    172 
    173     @Override
    174     public Component getTreeCellRendererComponent(
    175       JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus
    176     ) {
    177       super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    178       setIcon(ImageProvider.get("data/node.png"));
    179       return this;
    180     }
    181   }
    182 
    183170}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java

    r32396 r32580  
    2626import javax.swing.event.TreeSelectionListener;
    2727import javax.swing.tree.DefaultMutableTreeNode;
    28 import javax.swing.tree.DefaultTreeCellRenderer;
    2928import javax.swing.tree.DefaultTreeModel;
    3029import javax.swing.tree.TreeSelectionModel;
     
    8887    this.undoTree.setShowsRootHandles(true);
    8988    this.undoTree.setRootVisible(false);
    90     this.undoTree.setCellRenderer(new MapillaryCellRenderer());
     89    this.undoTree.setCellRenderer(new MapillaryImageTreeCellRenderer());
    9190    this.undoTree.getSelectionModel().setSelectionMode(
    9291        TreeSelectionModel.SINGLE_TREE_SELECTION);
     
    9796
    9897    this.redoTree.expandRow(0);
    99     this.redoTree.setCellRenderer(new MapillaryCellRenderer());
     98    this.redoTree.setCellRenderer(new MapillaryImageTreeCellRenderer());
    10099    this.redoTree.setShowsRootHandles(true);
    101100    this.redoTree.setRootVisible(false);
     
    227226  }
    228227
    229   private static class MapillaryCellRenderer extends DefaultTreeCellRenderer {
    230 
    231     private static final long serialVersionUID = -3129520241562296901L;
    232 
    233     @Override
    234     public Component getTreeCellRendererComponent(
    235         JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus
    236     ) {
    237       super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    238       setIcon(ImageProvider.get("data/node.png"));
    239       return this;
    240     }
    241   }
    242 
    243228  /**
    244229   * Destroys the unique instance of the class.
Note: See TracChangeset for help on using the changeset viewer.