コード例 #1
0
 /**
  * Removes the passed figures from the table.
  *
  * @param figures The figures to handle.
  */
 void removeFigures(List<ROIFigure> figures) {
   if (figures == null || figures.size() == 0) return;
   Iterator<ROIFigure> i = figures.iterator();
   while (i.hasNext()) {
     objectsTable.removeROIShape(i.next().getROIShape());
   }
   objectsTable.repaint();
 }
コード例 #2
0
 /** Rebuilds Tree */
 void rebuildTable() {
   TreeMap<Long, ROI> roiList = model.getROI();
   Iterator<ROI> iterator = roiList.values().iterator();
   ROI roi;
   TreeMap<Coord3D, ROIShape> shapeList;
   Iterator<ROIShape> shapeIterator;
   objectsTable.clear();
   while (iterator.hasNext()) {
     roi = iterator.next();
     shapeList = roi.getShapes();
     shapeIterator = shapeList.values().iterator();
     while (shapeIterator.hasNext()) objectsTable.addROIShape(shapeIterator.next());
   }
   objectsTable.collapseAll();
 }
コード例 #3
0
 /**
  * Adds the collection of figures to the display.
  *
  * @param l The collection of objects to add.
  */
 void addFigures(Collection l) {
   Iterator i = l.iterator();
   ROI roi;
   Iterator<ROIShape> j;
   while (i.hasNext()) {
     roi = (ROI) i.next();
     j = roi.getShapes().values().iterator();
     while (j.hasNext()) objectsTable.addROIShape(j.next());
   }
 }
コード例 #4
0
  /** Initializes the components composing the display. */
  private void initComponents() {
    ROINode root = new ROINode("root");
    objectsTable = new ROITable(new ROITableModel(root, COLUMN_NAMES), COLUMN_NAMES, this);
    objectsTable.setRootVisible(false);
    objectsTable.setColumnSelectionAllowed(true);
    objectsTable.setRowSelectionAllowed(true);
    treeSelectionListener =
        new TreeSelectionListener() {

          public void valueChanged(TreeSelectionEvent e) {
            TreeSelectionModel tsm = objectsTable.getTreeSelectionModel();
            if (tsm.isSelectionEmpty()) return;
            int[] index = tsm.getSelectionRows();
            if (index.length == 0) return;
            if (index.length == 1) {
              ROINode node = (ROINode) objectsTable.getNodeAtRow(objectsTable.getSelectedRow());
              if (node == null) return;
              Object nodeValue = node.getUserObject();
              if (nodeValue instanceof ROIShape)
                view.selectFigure(((ROIShape) nodeValue).getFigure());
              int col = objectsTable.getSelectedColumn();
              int row = objectsTable.getSelectedRow();

              if (row < 0 || col < 0) return;
            } else {
              ROIShape shape;
              for (int i = 0; i < index.length; i++) {
                shape = objectsTable.getROIShapeAtRow(index[i]);
                if (shape != null) {
                  view.selectFigure(shape.getFigure());
                  requestFocus();
                }
              }
            }
          }
        };

    objectsTable.addTreeSelectionListener(treeSelectionListener);

    ColumnFactory columnFactory =
        new ColumnFactory() {

          public void configureColumnWidths(JXTable table, TableColumnExt columnExt) {
            columnExt.setPreferredWidth(COLUMN_WIDTHS.get(columnExt.getHeaderValue()));
          }
        };
    objectsTable.setHorizontalScrollEnabled(true);
    objectsTable.setColumnControlVisible(true);
    objectsTable.setColumnFactory(columnFactory);
  }
コード例 #5
0
  /**
   * Selects the collection of figures.
   *
   * @param l The collection of objects to select.
   * @param clear Pass <code>true</code> to clear the selection <code>false</code> otherwise.
   */
  void setSelectedFigures(List<ROIShape> l, boolean clear) {
    Iterator<ROIShape> i = l.iterator();
    TreeSelectionModel tsm = objectsTable.getTreeSelectionModel();
    ROIFigure figure = null;
    ROIShape shape;
    if (clear) tsm.clearSelection();
    objectsTable.removeTreeSelectionListener(treeSelectionListener);

    try {
      while (i.hasNext()) {
        shape = i.next();
        figure = shape.getFigure();
        objectsTable.selectROIShape(figure.getROIShape());
      }
      objectsTable.repaint();
      if (figure != null) objectsTable.scrollToROIShape(figure.getROIShape());
    } catch (Exception e) {
      MeasurementAgent.getRegistry().getLogger().info(this, "Figure selection " + e);
    }

    objectsTable.addTreeSelectionListener(treeSelectionListener);
  }
コード例 #6
0
 /** Invokes when new figures are selected. */
 void onSelectedFigures() {
   objectsTable.onSelectedFigures(model.getSelectedFigures());
 }
コード例 #7
0
 /** Repaints the table. */
 void update() {
   objectsTable.refresh();
   objectsTable.invalidate();
   objectsTable.repaint();
 }
コード例 #8
0
 /**
  * Removes the passed figure from the table.
  *
  * @param figure The figure to remove.
  */
 void removeFigure(ROIFigure figure) {
   if (figure == null) return;
   objectsTable.removeROIShape(figure.getROIShape());
   objectsTable.repaint();
 }
コード例 #9
0
 /**
  * Adds the collection of ROIShapes to the display.
  *
  * @param shapeList The collection of ROIShapes to add.
  */
 void addROIShapes(List<ROIShape> shapeList) {
   objectsTable.addROIShapeList(shapeList);
 }
コード例 #10
0
 /**
  * Displays the menu at the specified location if not already visible.
  *
  * @param x The x-coordinate of the mouse click.
  * @param y The y-coordinate of the mouse click.
  */
 void showROIManagementMenu(int x, int y) {
   objectsTable.showROIManagementMenu(view.getDrawingView(), x, y);
 }