/**
  * Sets the name.
  *
  * @param name the new name
  */
 @Override
 public void setName(String name) {
   text.setText(name);
   textFigure.setSize(width, 10);
   text.setSize(width, 10);
   text.setLocation(getLocation());
   textFigure.setLocation(getLocation());
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.draw2d.Figure#repaint()
   */
  @Override
  public void repaint() {
    int x = getLocation().x;
    int y = getLocation().y;

    if (collapsing) {
      width = Constants.SIZE_16;
      height = Constants.SIZE_18;
      getBounds().height = height;
      getBounds().width = width;
    } else {

      if (hideButton != null) {

        if (hide) {
          super.setSize(width, 18);
        } else {
          super.setSize(width, height);
        }
        textFigure.setSize(width, 10);
        text.setSize(width, 15);
        text.setLocation(new Point(x, y));

        if (getChildren().size() > 1) {
          if (!textFigure.getChildren().contains(hideButton)) {
            textFigure.add(hideButton);
          }
          hideButton.setLocation(new Point(x + width - 11, y + 1));
        } else {
          if (textFigure.getChildren().contains(hideButton)) {
            textFigure.remove(hideButton);
          }
        }
      }

      for (int i = 0; i < getChildren().size(); i++) {
        IFigure figure = (IFigure) getChildren().get(i);

        if (figure == textFigure || hide) {
          figure.setSize(width, 16);
          figure.setLocation(new Point(x, y));
        } else {
          figure.setSize(width - 5, 15);
          figure.setLocation(new Point(x + 5, y + 16 + 15 * i));
        }
      }
    }

    super.repaint();
  }
Example #3
0
  public int setVerticalLocation(Point parentTopCenter, int currentHeight) {
    Dimension topSize = fTopChannel.getSize();
    Dimension pipelineSize = getSize();
    Dimension headerSize = fHeader.getSize();
    Dimension arrowSize = fArrow.getSize();
    Dimension bottomSize = fBottomChannel.getSize();

    if (fTopChannel.setSelf(parentTopCenter.getTranslated(-topSize.width / 2, currentHeight), true))
      currentHeight += topSize.height;

    setLocation(parentTopCenter.getTranslated(-pipelineSize.width / 2, currentHeight));
    fHeader.setLocation(
        parentTopCenter.getTranslated(
            -pipelineSize.width / 2 + IStreamItGraphConstants.MARGIN / 2,
            IStreamItGraphConstants.MARGIN / 2 + currentHeight));

    if (!isExpanded()) {
      // collapsed location
      fArrow.setLocation(
          parentTopCenter.getTranslated(
              -arrowSize.width / 2,
              IStreamItGraphConstants.MARGIN / 2 + headerSize.height + currentHeight));
      currentHeight += pipelineSize.height;

    } else {
      // expanded location
      fArrow.setLocation(
          parentTopCenter.getTranslated(
              -pipelineSize.width / 2 + IStreamItGraphConstants.MARGIN / 2,
              IStreamItGraphConstants.MARGIN / 2 + headerSize.height + currentHeight));

      int last = fChildren.size() - 1;
      for (int i = 0; i < last + 1; i++)
        currentHeight =
            ((IStreamStructureWidget) fChildren.get(i))
                .setVerticalLocation(parentTopCenter, currentHeight);
    }

    if (fBottomChannel.setSelf(
        parentTopCenter.getTranslated(-bottomSize.width / 2, currentHeight), false))
      currentHeight += bottomSize.height;

    return currentHeight;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.draw2d.Figure#setLocation(org.eclipse.draw2d.geometry.Point)
  */
 @Override
 public void setLocation(Point p) {
   super.setLocation(p);
   textFigure.setLocation(p);
   text.setLocation(p);
 }