コード例 #1
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;
  }