Пример #1
0
 /**
  * Checks if the Rotate, Add and Remove Buttons should be activated or not. Add and Remove only if
  * Arrow, Rotate only if Shape
  */
 public void checkDefaultButtonVisibility() {
   if (board.getSelectionCount() == 1 && board.getSelectionCell() instanceof ArrowItem) {
     this.activatePoints(true);
   } else {
     this.activatePoints(false);
   }
   if (board.getSelectionCount() == 1 && board.getSelectionCell() instanceof ShapeItem) {
     this.activateRotation(true);
   } else {
     this.activateRotation(false);
   }
 }
Пример #2
0
 /**
  * Add/Remove a Point to/from an Arrow
  *
  * @param b boolean, true = add, false = remove
  */
 public void addRemovePoint(boolean b) {
   if (board.getSelectionCount() == 1 && board.getSelectionCell() instanceof ArrowItem) {
     MoveCommand mc = new MoveCommand(board.getSelectedItems());
     ArrowItem a = (ArrowItem) board.getSelectionCell();
     if (b) {
       a.addPoint();
     } else {
       a.removePoint();
     }
     WorkingView.this.refresh();
     board.setSelectionCell(a);
     setTool(cursorTool, cursorButton);
     board.addItem(a);
     mc.setMoveEnd(board.getSelectedItems());
     ArrayList<Command> actCommands = new ArrayList<Command>();
     actCommands.add(mc);
     tbe.addCommands(actCommands);
   }
 }