コード例 #1
0
  protected void paintConnections(Graphics graphics) {
    // paint composite connections
    graphics.setForegroundColor(FigurePrefs.relationsColor);
    IFigure compositeFigure = getContentPane(0);
    if (compositeFigure.isVisible()) {
      int compositeChildrenNumber = compositeFigure.getChildren().size();
      if (compositeChildrenNumber == 0) return;
      Point mainToggleLocation =
          isRightToLeft() ? mainToggle.getBounds().getLeft() : mainToggle.getBounds().getRight();
      //			translateToRelative(mainToggleLocation);
      Point[] childs = new Point[compositeChildrenNumber];
      for (int i = 0; i < compositeChildrenNumber; i++) {
        IFigure compositeChild = (IFigure) compositeFigure.getChildren().get(i);

        // calculate target point position
        Point targetLocation;
        if (compositeChild instanceof INodeFigure)
          targetLocation = ((INodeFigure) compositeChild).getTargetAnchor(0).getLocation(null);
        else {
          Rectangle compositeChildBounds = compositeChild.getBounds();
          targetLocation =
              isRightToLeft() ? compositeChildBounds.getRight() : compositeChildBounds.getLeft();
          compositeChild.translateToAbsolute(targetLocation);
        }
        translateToRelative(targetLocation);
        childs[i] = targetLocation;
      }
      DrawUtils.drawHorizontalTree(graphics, mainToggleLocation, DrawUtils.SPACING / 2, childs);
    }
  }
コード例 #2
0
ファイル: CheckBoxFigure.java プロジェクト: Crisam/cs-studio
 @Override
 public void setEnabled(boolean value) {
   super.setEnabled(value);
   repaint();
 }