Exemple #1
0
 public void mousePressed(MouseEvent e) {
   if (ctx != null) {
     // save the current selection set operator
     prevSetOp = ctx.getSetOperator(tm).getSetOperator();
     // set the selection set operator
     ctx.getSetOperator(tm).setFromInputEventMask(e.getModifiers());
   }
   start = e.getPoint();
   current = e.getPoint();
   selecting = true;
   repaint();
 }
Exemple #2
0
 public void mouseReleased(MouseEvent e) {
   current = e.getPoint();
   // intersect with graph
   Rectangle selrect =
       new Rectangle(start.x, start.y, current.x - start.x, current.y - start.y);
   int[] gi = gs.getIndicesAt(selrect, graph.getXAxis(), graph.getYAxis());
   DefaultListSelectionModel rsm = new DefaultListSelectionModel();
   if (gi != null) {
     rsm.setValueIsAdjusting(true);
     for (int j = 0; j < gi.length; j++) {
       // find node and select segs for node and all descendents
       int nodeidx = gi[j] / 2;
       TreeNode tn = nodemap[nodeidx];
       selectTraverse(tn, rsm);
     }
     rsm.setValueIsAdjusting(false);
   }
   if (ctx != null) {
     // Merge this selection with the table selection list
     // using the current set selection operator
     ColumnMap cmap = ctx.getColumnMap(tm, 0);
     if (cmap != null) {
       cmap.selectValues(rsm);
     }
   }
   if (ctx != null) {
     // restore the original selection set operator
     ctx.getSetOperator(tm).setSetOperator(prevSetOp);
   }
   repaint();
 }