Beispiel #1
0
  @Override
  protected IFigure createFigure() {
    final IFigure figure = createBaseFigure();
    ComponentInterface ci =
        ((WorkflowNode) getModel())
            .getComponentDescription()
            .getComponentInstallation()
            .getComponentRevision()
            .getComponentInterface();

    if (ci.getShape() == ComponentShape.CIRCLE) {
      final int size = 16;
      final int newOffset = 3;
      errorFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      warningFigure.setBounds(new Rectangle(newOffset, newOffset, size, size));
      final int localX = 22;
      final int localY = 20;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    } else if (ci.getSize() == ComponentSize.SMALL) {
      final int size = 16;
      final int newOffsetX = 22;
      final int newOffsetY = 1;
      warningFigure.setBounds(new Rectangle(newOffsetX, newOffsetY, size, size));
      final int localX = 22;
      final int localY = 22;
      localFigure.setBounds(new Rectangle(localX, localY, size, size));
    }
    figure.add(errorFigure);
    figure.add(warningFigure);
    figure.add(localFigure);
    figure.add(deprecatedFigure);
    return figure;
  }
 /** @generated */
 protected void refreshSelectionFeedback() {
   if (selectionFeedbackFigure != null) {
     if (selectionFeedbackFigure instanceof Label) {
       updateLabel((Label) selectionFeedbackFigure);
       selectionFeedbackFigure.setBounds(getFeedbackBounds());
     } else {
       selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
     }
   }
 }
 @Override
 public void relocate(IFigure target) {
   if (constraint.y == 0) {
     if (durationConstraintEditPart.getCurrentSideOfParent() == PositionConstants.WEST) {
       Point r = parentFigure.getBounds().getLeft().translate(-20, -5);
       target.setBounds(new Rectangle(r, target.getPreferredSize()));
     } else {
       Point r = parentFigure.getBounds().getRight().translate(5, -5);
       target.setBounds(new Rectangle(r, target.getPreferredSize()));
     }
   } else super.relocate(target);
 }
Beispiel #4
0
 {
   final int offsetX = 62;
   final int offsetY = 2;
   final int size = 16;
   warningFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   warningFigure.setVisible(false);
 }
  protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
    IFigure feedback = getDragSourceFeedbackFigure();

    PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
    getHostFigure().translateToAbsolute(rect);
    rect.translate(request.getMoveDelta());
    rect.resize(request.getSizeDelta());

    IFigure f = getHostFigure();
    Dimension min = f.getMinimumSize().getCopy();
    Dimension max = f.getMaximumSize().getCopy();
    IMapMode mmode = MapModeUtil.getMapMode(f);
    min.height = mmode.LPtoDP(min.height);
    min.width = mmode.LPtoDP(min.width);
    max.height = mmode.LPtoDP(max.height);
    max.width = mmode.LPtoDP(max.width);

    if (min.width > rect.width) rect.width = min.width;
    else if (max.width < rect.width) rect.width = max.width;

    if (min.height > rect.height) rect.height = min.height;
    else if (max.height < rect.height) rect.height = max.height;

    feedback.translateToRelative(rect);
    feedback.setBounds(rect);
  }
 @Override
 public void relocate(IFigure target) {
   Rectangle bounds = target.getBounds().getCopy();
   Point location = null;
   if (parent instanceof ConnectorEditPart) {
     ConnectorEditPart connectorPart = (ConnectorEditPart) parent;
     PointList points = getPoints(connectorPart.getConnectionFigure());
     location = getPointForEnd(points);
   } else {
     // if the parent is any other edit part
     // use the bounds center
     location = parent.getFigure().getBounds().getCenter();
   }
   if (lastLocation == null) {
     lastLocation = location;
   }
   Dimension delta = location.getDifference(lastLocation);
   bounds.translate(delta.width, delta.height);
   lastLocation = location.getCopy();
   // if the current width is 0 then the
   // user has never set the width, calculate it
   // here using a maximum number of 400
   boolean cropWidth = false;
   if (bounds.width == 0) {
     Dimension preferred = target.getPreferredSize();
     bounds.width = preferred.width;
     bounds.width = Math.min(400, bounds.width);
     cropWidth = true;
   }
   if (bounds.width < target.getBorder().getInsets(target).getWidth()) {
     // do not allow resizing to zero
     bounds.width = target.getBorder().getInsets(target).getWidth();
   }
   // we must set the bounds to allow recalculation
   // of text height (wrapping)
   target.setBounds(bounds);
   target.validate();
   // adjust height to account for word wrapping
   bounds.height = getMinimumHeight(target);
   if (cropWidth) {
     // crop the width here, as this is not a user set
     // width and otherwise if near 400 may leave extra
     // slack
     bounds.width = getMinimumWidth(target);
   }
   target.setBounds(bounds);
 }
Beispiel #7
0
 {
   final int offsetX = 62;
   final int offsetY = 62;
   final int size = 16;
   localFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   localFigure.setToolTip(new Label(Messages.localExecutionOnly));
   localFigure.setVisible(false);
 }
Beispiel #8
0
 {
   final int offsetX = 23;
   final int offsetY = 17;
   final int size = 32;
   deprecatedFigure.setBounds(new Rectangle(offsetX, offsetY, size, size));
   deprecatedFigure.setToolTip(new Label(Messages.deprecated));
   deprecatedFigure.setVisible(false);
 }
 @Override
 public void showSizeOnDropFeedback(CreateRequest request, IFigure feedback, Insets insets) {
   Point p = new Point(request.getLocation().getCopy());
   feedback.translateToRelative(p);
   Dimension size = request.getSize().getCopy();
   feedback.translateToRelative(size);
   feedback.setBounds(new Rectangle(p, size).expand(insets));
 }
  @Override
  public void showChangeBoundsFeedback(
      AbstractWidgetModel widgetModel,
      PrecisionRectangle bounds,
      IFigure feedbackFigure,
      ChangeBoundsRequest request) {

    feedbackFigure.translateToRelative(bounds);
    feedbackFigure.setBounds(bounds);
  }
Beispiel #11
0
 protected void layoutFigures(FigureCanvas fc) {
   Rectangle r = new Rectangle(fc.getViewport().getClientArea());
   if (vertical) r.transpose();
   Dimension size = blockFigure.getPreferredSize();
   Rectangle b =
       new Rectangle(
           r.x + size.width / 2,
           r.y + (r.height - SLOT_HEIGHT) / 2,
           r.width - size.width,
           SLOT_HEIGHT);
   int x = (int) (b.x + b.width * selectionRatio);
   int y = b.y + b.height - b.height / 2;
   Rectangle b2 = new Rectangle(x - size.width / 2, y - size.height / 2, size.width, size.height);
   if (vertical) {
     b.transpose();
     b2.transpose();
   }
   slotFigure.setBounds(b);
   blockFigure.setBounds(b2);
 }
Beispiel #12
0
  private void computeHandlerIconPositions(boolean horizontal) {
    org.eclipse.draw2d.geometry.Rectangle bounds = getFigure().getBounds();
    if (horizontal) {
      rectFault =
          new Rectangle(
              bounds.x,
              bounds.y + bounds.height - faultImageHeight,
              faultImageWidth,
              faultImageHeight);
      rectEvent =
          new Rectangle(
              bounds.x + faultImageWidth,
              bounds.y + bounds.height - eventImageHeight,
              eventImageWidth,
              eventImageHeight);

    } else {
      rectFault =
          new Rectangle(
              bounds.x + bounds.width - faultImageWidth - BORDER_WIDTH,
              bounds.y - 1,
              faultImageWidth,
              faultImageHeight);
      rectEvent =
          new Rectangle(
              bounds.x + bounds.width - eventImageWidth - BORDER_WIDTH,
              bounds.y + bounds.height - eventImageHeight + 1,
              eventImageWidth,
              eventImageHeight);
    }

    // Apply the bounds to the figures
    faultImageFigure.setBounds(
        new org.eclipse.draw2d.geometry.Rectangle(
            rectFault.x, rectFault.y, rectFault.width, rectFault.height));
    eventImageFigure.setBounds(
        new org.eclipse.draw2d.geometry.Rectangle(
            rectEvent.x, rectEvent.y, rectEvent.width, rectEvent.height));
  }
  /** Shows a nice guideline to show the move */
  protected void showSourceFeedback() {
    if (_container == null) {
      return;
    }
    if (guideline.getParent() == null) {
      addFeedback(guideline);
    }
    Rectangle bounds = Rectangle.SINGLETON.getCopy();
    bounds.y = getCurrentPositionZoomed();

    Rectangle containerBounds = _container.getFigure().getBounds().getCopy();

    _container.getFigure().translateToAbsolute(containerBounds);

    ((DiagramEditPart) getCurrentViewer().getContents())
        .getFigure()
        .translateToRelative(containerBounds);

    bounds.x = containerBounds.x;
    bounds.height = 1;
    bounds.width = containerBounds.width;

    ZoomManager zoomManager =
        ((DiagramRootEditPart) getCurrentViewer().getRootEditPart()).getZoomManager();
    bounds.performScale(zoomManager.getZoom());

    guideline.setBounds(bounds);
    guideline.setVisible(getState() == STATE_DRAG_IN_PROGRESS);

    ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
    request.setMoveDelta(((ChangeBoundsRequest) getSourceRequest()).getMoveDelta());
    request.setSizeDelta(new Dimension(0, 0));
    request.setEditParts(_movingShapes);

    for (IGraphicalEditPart part : _movingShapes) {
      part.showSourceFeedback(request);
    }

    ChangeBoundsRequest spRequest = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
    Point moveDelta = ((ChangeBoundsRequest) getSourceRequest()).getMoveDelta().getCopy();
    Dimension spSizeDelta = new Dimension(moveDelta.x, moveDelta.y);
    spRequest.setSizeDelta(spSizeDelta);
    spRequest.setMoveDelta(new Point(0, 0));
    spRequest.setEditParts(_subProcesses);

    for (IGraphicalEditPart sp : _subProcesses) {
      sp.showSourceFeedback(spRequest);
    }
    ((DiagramEditPart) getCurrentViewer().getContents()).getRoot().refresh();
  }
    /*
     * (non-Javadoc)
     *
     * @see org.eclipse.draw2d.ToolbarLayout#layout(org.eclipse.draw2d.IFigure)
     */
    @Override
    public void layout(IFigure parent) {
      final Rectangle clientArea = parent.getClientArea();
      int x = clientArea.x;
      int y = clientArea.y;
      final List children = parent.getChildren();
      int numChildren = children.size();

      int maxHeight = 0;
      for (int i = 0; i < numChildren; i++) {
        IFigure child = (IFigure) children.get(i);
        Dimension prefSize = getChildPreferredSize(child, clientArea.width, -1);
        maxHeight = Math.max(maxHeight, prefSize.height);
      }
      maxHeight = Math.max(maxHeight, clientArea.height);

      if (numChildren == 1) {
        IFigure child = (IFigure) children.get(0);
        Dimension prefSize = child.getPreferredSize(clientArea.width, -1);
        prefSize.width = Math.max(prefSize.width, clientArea.width);
        Rectangle newBounds = new Rectangle(x, y, prefSize.width, maxHeight);
        child.setBounds(newBounds);
      } else if (numChildren == 2) {
        int initExpressionWidth =
            (xmlTreePart.getViewer().getControl().getSize().x / 3 - 80 - 10) / 2;
        IFigure child = (IFigure) children.get(0);
        Rectangle newBounds = new Rectangle(x, y, initExpressionWidth, maxHeight);
        child.setBounds(newBounds);

        child = (IFigure) children.get(1);
        Dimension prefSize = child.getPreferredSize(clientArea.width, -1);
        prefSize.width = Math.max(prefSize.width, clientArea.width - initExpressionWidth);
        newBounds = new Rectangle(x + initExpressionWidth, y, prefSize.width, maxHeight);
        child.setBounds(newBounds);
      }
    }
    public void relocate(IFigure target) {
      Rectangle parentRect = getParentBorder();
      float xRatio = parentRect.width / (float) initDim.width;
      float yRatio = parentRect.height / (float) initDim.height;

      Rectangle targetRect = target.getBounds();
      Point ptLoc = this.getAbsoluteToBorder(getConstraint().getLocation());
      ptLoc = ptLoc.getTranslated(-parentRect.x, -parentRect.y);
      ptLoc.scale(xRatio, yRatio);
      ptLoc = ptLoc.getTranslated(parentRect.x, parentRect.y);

      target.setBounds(
          new Rectangle(
              ptLoc.x - targetRect.width / 2,
              ptLoc.y - targetRect.height / 2,
              targetRect.width,
              targetRect.height));
    }
 /** @see org.eclipse.draw2d.LayoutManager#layout(org.eclipse.draw2d.IFigure) */
 public void layout(IFigure container) {
   List children = container.getChildren();
   Rectangle rulerSize = container.getClientArea();
   for (int i = 0; i < children.size(); i++) {
     IFigure child = (IFigure) children.get(i);
     Dimension childSize = child.getPreferredSize();
     int position = ((Integer) getConstraint(child)).intValue();
     if (((RulerFigure) container).isHorizontal()) {
       childSize.height = rulerSize.height - 1;
       Rectangle.getSINGLETON().setLocation(position - (childSize.width / 2), rulerSize.y);
     } else {
       childSize.width = rulerSize.width - 1;
       Rectangle.getSINGLETON().setLocation(rulerSize.x, position - (childSize.height / 2));
     }
     Rectangle.getSINGLETON().setSize(childSize);
     child.setBounds(Rectangle.getSINGLETON());
   }
 }
  public void layout(IFigure parent) {
    Rectangle bounds = parent.getClientArea();

    for (Iterator i = parent.getChildren().iterator(); i.hasNext(); ) {
      IFigure child = (IFigure) i.next();

      Dimension r = null;
      if (!(child instanceof FreeformFigure)) {
        r = child.getPreferredSize();

        bounds.width = r.width;

        child.setBounds(bounds);

        bounds.x += r.width + getMinorSpacing();
      }
    }
  }
 @Override
 public void relocate(final IFigure targetFigure) {
   final Rectangle referenceBox = getReferenceBox().getCopy();
   getReferenceFigure().translateToAbsolute(referenceBox);
   targetFigure.translateToRelative(referenceBox);
   final Rectangle targetFigureBounds =
       new Rectangle(
           referenceBox
               .getBottomLeft()
               .getTranslated(
                   new Dimension(
                       (int) (relativeX * referenceBox.width)
                           + absoluteX
                           + referenceBox.width
                           - targetFigure.getBounds().width,
                       (int) (relativeY * referenceBox.height)
                           + absoluteY
                           - targetFigure.getPreferredSize().height)),
           targetFigure.getPreferredSize());
   targetFigure.setBounds(targetFigureBounds);
 }
 /*
  * public void addChild() {
  * List<EditPart> listchildren = this.getChildren();
  * if(!listchildren.isEmpty()) {
  * int size = listchildren.size();
  * EditPart childEditPart = listchildren.get(0);
  * this.addChild(childEditPart, size);
  * listchildren = this.getChildren();
  * size = listchildren.size();
  * System.out.printf("Size of ListChildren %d\n", size);
  *
  * }
  * }
  */
 @Override
 protected boolean removeFixedChild(EditPart childEditPart) {
   if (childEditPart instanceof MessageNameEditPart) {
     if (childEditPart instanceof MessageNameEditPart) {
       IFigure childFigureBefore = ((GraphicalEditPart) childEditPart).getFigure();
       getPrimaryShape().remove(((MessageNameEditPart) childEditPart).getFigure());
       IFigure childFigure = ((GraphicalEditPart) childEditPart).getFigure();
       if (childFigure.getParent() == null) {
         childFigure.setParent(this.getPrimaryShape());
       }
       if (childFigure.getBounds() == new Rectangle(0, 0, 0, 0)) {
         // System.out.println("The bound have changed!!!! ");
         childFigure.setBounds(childFigureBefore.getBounds());
       }
     }
     return true;
   }
   if (childEditPart instanceof AppliedStereotypeMessageEditPart) {
     return true;
   }
   return false;
 }
  protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
    IFigure feedback = getDragSourceFeedbackFigure();

    PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
    getHostFigure().translateToAbsolute(rect);

    // Only enable horizontal dragging on lifelines(except lifelines that are result of a create
    // message).
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=364688
    if (this.getHost() instanceof LifelineEditPart) {
      LifelineEditPart lifelineEP = (LifelineEditPart) this.getHost();
      if (!SequenceUtil.isCreateMessageEndLifeline(lifelineEP)) {
        request.getMoveDelta().y = 0;
      }
    }

    rect.translate(request.getMoveDelta());
    rect.resize(request.getSizeDelta());

    IFigure f = getHostFigure();
    Dimension min = f.getMinimumSize().getCopy();
    Dimension max = f.getMaximumSize().getCopy();
    IMapMode mmode = MapModeUtil.getMapMode(f);
    min.height = mmode.LPtoDP(min.height);
    min.width = mmode.LPtoDP(min.width);
    max.height = mmode.LPtoDP(max.height);
    max.width = mmode.LPtoDP(max.width);

    if (min.width > rect.width) rect.width = min.width;
    else if (max.width < rect.width) rect.width = max.width;

    if (min.height > rect.height) rect.height = min.height;
    else if (max.height < rect.height) rect.height = max.height;

    feedback.translateToRelative(rect);
    feedback.setBounds(rect);
  }
Beispiel #21
0
  /** Applies a hexagon-based layout to the container. */
  @Override
  public void layout(IFigure container) {

    // Get the maximum bounding box we can use for layout out sub-figures.
    Rectangle limit = container.getClientArea();

    // Math.cos() may vary across platforms, so pre-compute it.
    double cosPiDivSix = Math.sqrt(3) / 2.0;

    if (!rotated) {

      // Get the hexagon side lengths supported by the current
      // width/height of
      // the client area.
      double lx =
          2.0
              * (double) (limit.width - horizontalSpacing * (columns - 1))
              / (double) (3 * columns + 1);
      double ly =
          (double) (limit.height - verticalSpacing * (rows - 1))
              / (cosPiDivSix * (double) (rows * 2 + 1));

      // Determine which length to use and flag the direction that needs
      // to be
      // padded (x or y).
      double l;
      int paddingX = 0, paddingY = 0;
      if (ly >= lx) { // Size restricted by width.
        l = lx;
      } else { // Size restricted by height.
        l = ly;
        paddingX++;
      }

      // Compute the half-height and half-width of each hexagon.
      lx = l / 2; // shortcut: sin(PI/6) = 1/2!
      ly = l * cosPiDivSix;

      // Compute the necessary padding for whichever dimension needs it.
      if (paddingX != 0) { // Size restricted by height.
        paddingX =
            (int)
                (((double) limit.width
                        - horizontalSpacing * (rows - 1)
                        - (lx * (double) (3 * columns + 1)))
                    / 2.0);
      } else { // Size restricted by width.
        paddingY =
            (int)
                (((double) limit.height
                        - verticalSpacing * (rows - 1)
                        - (ly * (double) (2 * rows + 1)))
                    / 2.0);
      }

      // Update the PointList used by each hexagon.
      // Note: The hexagons store references to the PointList, so we do
      // not need to call hexagon.setPoints(), which, in fact,
      // refreshes/repaints the Shape, in the quadratic loop below.
      points.setPoint(new Point((int) (lx), 0), 0);
      points.setPoint(new Point((int) (lx + l), 0), 1);
      points.setPoint(new Point((int) (l + l), (int) ly), 2);
      points.setPoint(new Point((int) (lx + l), (int) (ly + ly)), 3);
      points.setPoint(new Point((int) (lx), (int) (ly + ly)), 4);
      points.setPoint(new Point(0, (int) ly), 5);

      // We want to limit math ops, so compute the factors used in the
      // loop.
      double xFactor = l + lx + (double) horizontalSpacing;
      double yFactor = 2 * ly + (double) verticalSpacing;

      // Compute the width and height of each hexagon.
      int width = (int) Math.ceil(2 * l);
      int height = (int) Math.ceil(2 * ly);

      // Variables used throughout the below loop.
      int i, row, column, x, y, w, h;

      // Loop over the IFigures in the container with this layout.
      for (Object childObject : container.getChildren()) {
        IFigure child = (IFigure) childObject;

        // Get the constraints (and the x, y, w, h offsets from it).
        GridData constraint = getConstraint(child);
        Rectangle offsets = constraint.getOffsets();

        // Get the index and compute the row and column for the index.
        i = constraint.getIndex();
        row = i / columns;
        column = i % columns;

        // Compute the bounds of the cell in the row, column position.
        x = paddingX + (int) (column * xFactor) + offsets.x;
        y = paddingY + (int) (row * yFactor + ly * (double) (column % 2)) + offsets.y;
        w = width + offsets.width;
        h = height + offsets.height;

        // Set the bounds for the child IFigure.
        child.setBounds(new Rectangle(x, y, w, h));
      }
    } else { // All hexagons are rotated 90 degrees.

      // Get the hexagon side lengths supported by the current
      // width/height of
      // the client area.
      double lx =
          (double) (limit.width - horizontalSpacing * (columns - 1))
              / (cosPiDivSix * (double) (columns * 2 + 1));
      double ly =
          2.0 * (double) (limit.height - verticalSpacing * (rows - 1)) / (double) (3 * rows + 1);

      // Determine which length to use and flag the direction that needs
      // to be
      // padded (x or y).
      double l;
      int paddingX = 0, paddingY = 0;
      if (ly >= lx) { // Size restricted by width.
        l = lx;
      } else { // Size restricted by height.
        l = ly;
        paddingX++;
      }

      // Compute the half-height and half-width of each hexagon.
      lx = l * cosPiDivSix;
      ly = l / 2; // shortcut: sin(PI/6) = 1/2!

      // Compute the necessary padding for whichever dimension needs it.
      if (paddingX != 0) { // Size restricted by height.
        paddingX =
            (int)
                (((double) limit.width
                        - horizontalSpacing * (columns - 1)
                        - (lx * (double) (2 * columns + 1)))
                    / 2.0);
      } else { // Size restricted by width.
        paddingY =
            (int)
                (((double) limit.height
                        - verticalSpacing * (rows - 1)
                        - (ly * (double) (3 * rows + 1)))
                    / 2.0);
      }

      // Update the PointList used by each hexagon.
      // Note: The hexagons store references to the PointList, so we do
      // not need to call hexagon.setPoints(), which, in fact,
      // refreshes/repaints the Shape, in the quadratic loop below.
      points.setPoint(new Point((int) lx, 0), 0);
      points.setPoint(new Point((int) (lx + lx), (int) ly), 1);
      points.setPoint(new Point((int) (lx + lx), (int) (ly + l)), 2);
      points.setPoint(new Point((int) lx, (int) (l + l)), 3);
      points.setPoint(new Point(0, (int) (ly + l)), 4);
      points.setPoint(new Point(0, (int) ly), 5);

      // We want to limit math ops, so compute the factors used in the
      // loop.
      double xFactor = lx + lx + (double) horizontalSpacing;
      double yFactor = l + ly + (double) verticalSpacing;

      // Compute the width and height of each hexagon.
      int width = (int) Math.ceil(lx + lx);
      int height = (int) Math.ceil(l + l);

      // Variables used throughout the below loop.
      int i, row, column, x, y, w, h;

      // Loop over the IFigures in the container with this layout.
      for (Object childObject : container.getChildren()) {
        IFigure child = (IFigure) childObject;

        // Get the constraints (and the x, y, w, h offsets from it).
        GridData constraint = getConstraint(child);
        Rectangle offsets = constraint.getOffsets();

        // Get the index and compute the row and column for the index.
        i = constraint.getIndex();
        row = i / columns;
        column = i % columns;

        // Compute the bounds of the cell in the row, column position.
        x = paddingX + (int) (column * xFactor + lx * (double) (row % 2)) + offsets.x;
        y = paddingY + (int) (row * yFactor) + offsets.y;
        w = width + offsets.width;
        h = height + offsets.height;

        // Set the bounds for the child IFigure.
        child.setBounds(new Rectangle(x, y, w, h));
      }
    }

    return;
  }
 /** @generated */
 protected void refreshFocusFeedback() {
   if (focusFeedbackFigure != null) {
     focusFeedbackFigure.setBounds(getFeedbackBounds());
   }
 }
  @Override
  public void layout(IFigure parent) {
    List children = parent.getChildren();
    int numChildren = children.size();
    Rectangle clientArea = transposer.t(parent.getClientArea());
    int x = clientArea.x;
    int y = clientArea.y;
    int availableHeight = clientArea.height;

    Dimension prefSizes[] = new Dimension[numChildren];
    Dimension minSizes[] = new Dimension[numChildren];

    int wHint = -1;
    int hHint = -1;
    if (isHorizontal()) {
      hHint = parent.getClientArea(Rectangle.SINGLETON).height;
    } else {
      wHint = parent.getClientArea(Rectangle.SINGLETON).width;
    }
    IFigure child;
    int totalHeight = 0;
    int totalMinHeight = 0;
    int prefMinSumHeight = 0;

    for (int i = 0; i < numChildren; i++) {
      child = (IFigure) children.get(i);

      prefSizes[i] = transposer.t(getChildPreferredSize(child, wHint, hHint));
      minSizes[i] = transposer.t(getChildMinimumSize(child, wHint, hHint));

      totalHeight += prefSizes[i].height;
      totalMinHeight += minSizes[i].height;
    }
    totalHeight += (numChildren - 1) * spacing;
    totalMinHeight += (numChildren - 1) * spacing;
    prefMinSumHeight = totalHeight - totalMinHeight;

    int amntShrinkHeight = totalHeight - Math.max(availableHeight, totalMinHeight);

    if (amntShrinkHeight < 0) {
      amntShrinkHeight = 0;
    }

    for (int i = 0; i < numChildren; i++) {
      int amntShrinkCurrentHeight = 0;
      int prefHeight = prefSizes[i].height;
      int minHeight = minSizes[i].height;
      int prefWidth = prefSizes[i].width;
      int minWidth = minSizes[i].width;
      Rectangle newBounds = new Rectangle(x, y, prefWidth, prefHeight);

      child = (IFigure) children.get(i);
      if (child instanceof AbstractTreeSettingContainer) {
        if (!tableMananger.isActivateCondensedTool()) {
          child.setBounds(new Rectangle(x, y, 0, 0));
          continue;
        }
      }

      if (child instanceof FilterContainer) {
        if (!tableMananger.isActivateExpressionFilter()) {
          child.setBounds(new Rectangle(x, y, 0, 0));
          continue;
        }
      }

      if (child instanceof AbstractGlobalMapContainer) {
        if (!tableMananger.isActivateGlobalMap()) {
          child.setBounds(new Rectangle(x, y, 0, 0));
          continue;
        }
      }

      int width = Math.min(prefWidth, transposer.t(child.getMaximumSize()).width);
      if (matchWidth) {
        width = transposer.t(child.getMaximumSize()).width;
      }
      width = Math.max(minWidth, Math.min(clientArea.width, width));
      newBounds.width = width;

      child.setBounds(transposer.t(newBounds));

      amntShrinkHeight -= amntShrinkCurrentHeight;
      prefMinSumHeight -= (prefHeight - minHeight);
      y += newBounds.height + spacing;

      if (child instanceof ScrollPane) {
        IFigure contents = ((ScrollPane) child).getViewport().getContents();
        if (contents instanceof AbstractTable) {
          // ((AbstractTable) contents).setDefautTableWidth(newBounds.width);
        }
      }
    }
  }
Beispiel #24
0
 {
   final int offset = 2;
   final int size = 16;
   errorFigure.setBounds(new Rectangle(offset, offset, size, size));
   errorFigure.setVisible(false);
 }