Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.IFigure


     * @param relocateFigure
     * @return a modifiable Rectangle that represents the bounds of the figure to be relocated
     */
    protected Rectangle getCurrentTargetBounds(IFigure relocateFigure)
    {
        IFigure reference = getReferenceFigure();
        Rectangle targetBounds = new PrecisionRectangle(getReferenceBox().getResized(-1, -1));
        reference.translateToAbsolute(targetBounds);
        relocateFigure.translateToRelative(targetBounds);
        return targetBounds;
    }
View Full Code Here


       
        switch (_stateMachine._curState)
        {
            case STATE_START:
                hide(_elementMenuBar, false);
                IFigure parent = getParent();
                if (parent != null)
                {
                    parent.remove(this);
                }
            break;
           
            case STATE_HOST_HOVER:
                if (_hoverParent != null)
View Full Code Here

*/
public class NonVisualComponentEditPart extends NodeEditPart
{
    protected IFigure createFigure()
    {
        IFigure figure_ = new ImageFigure(getTagConverter().getVisualImage())
        {

            protected void paintFigure(Graphics graphics) {
                super.paintFigure(graphics);
               
                if (getImage() == null)
                    return;

                Rectangle srcRect = new Rectangle(getImage().getBounds());
                graphics.drawImage(getImage(), srcRect, getClientArea());
            }
           
        };
       
        figure_.setMinimumSize(new Dimension(0,0));
        return figure_;
    }
View Full Code Here

    List list = new ArrayList();
    TableUtil.getTrElements(this._table, list);
    Element tr = (Element) list.get(domIndex);

    IFigure cellFigure = getFigureInfo(tr);
    int oldRowHeight = cellFigure.getBounds().height;
    int cellPadding = cellFigure.getInsets().getHeight();
    int newHeight = oldRowHeight + this._delta - cellPadding;
    if (this._rowIndex - 1 < 0) {
      newHeight = oldRowHeight - this._delta - cellPadding;
    }
    Map map = new HashMap();
View Full Code Here

            return targetBounds;
        }

        private Rectangle getFinalMenuBounds(final IFigure target)
        {
            final IFigure referenceFigure =  _referenceFigure;
           
            Rectangle targetBounds = getInitialMenuBounds(target);
            Dimension targetSize = target.getPreferredSize();

            // copied from super.relocate because relativeX/Y are private in super
            // changed from super to remove div by 2 that centers target; we want
            // it to be corner-to-corner
            targetBounds.x
                += targetBounds.width+4;
            targetBounds.y
                  -= (targetSize.height / 2) - referenceFigure.getBounds().height/2;
            targetBounds.setSize(targetSize);
            //target.setBounds(targetBounds);

//            final Rectangle viewPortRect =
//                ((IHTMLGraphicalViewer)_owner.getViewer()).getViewport().getBounds();
View Full Code Here

      } else {
        int offset = position.getOffset();
        // there is no child
        if (containerEditPart.getChildren().isEmpty()
            || LayoutPart.getConcretePart(containerEditPart) == null) {
          IFigure figure = ((GraphicalEditPart) containerEditPart)
              .getFigure();
          Rectangle bounds = figure.getBounds();
          if (figure instanceof CSSFigure) {
            List fragments = ((CSSFigure) figure)
                .getFragmentsForRead();
            if (fragments.size() > 0) {
              FlowBox box = (FlowBox) fragments.get(fragments
                  .size() - 1);
              bounds = LayoutPart.getBounds(box);
            }
          }

          ret = new Rectangle(bounds.x + CARET_OFFSET, bounds.y,
              CaretUpdater.CARET_WIDTH, bounds.height);

          figure.translateToAbsolute(ret);
        } else if (offset >= 0
            && offset <= containerEditPart.getChildren().size()) {
          ret = getRefRect(position);
        }
      }
View Full Code Here

      layoutPart = new LayoutPart(part, null);
      boolean caretIsAtRight = caretLocation.get(0)
          .booleanValue();
      final int CARET_OFFSET = 1;
      Rectangle bounds = null;
      IFigure figure = ((GraphicalEditPart) part).getFigure();
      if (!caretIsAtRight) {
        FlowBox box;
        if ((box = layoutPart.getLine(0)) != null) {
          bounds = LayoutPart.getBounds(box);
        }
      } else {
        FlowBox box;
        if ((box = layoutPart.getLastLine()) != null) {
          bounds = LayoutPart.getBounds(box);
        }
      }
      if (bounds == null) {
        bounds = figure.getBounds();
      }
      if (!caretIsAtRight) {
        rect = new Rectangle(bounds.x - CARET_OFFSET, bounds.y,
            CaretUpdater.CARET_WIDTH, bounds.height);// new
      } else {
        rect = new Rectangle(bounds.getRight().x + CARET_OFFSET,
            bounds.y, CaretUpdater.CARET_WIDTH, bounds.height);// new
      }
      figure.translateToAbsolute(rect);
    } else {
      System.out.println("No concrete part?"); //$NON-NLS-1$
    }
    return rect;
  }
View Full Code Here

    for (int i = 0, size = children.size(); i < size; i++) {
      GraphicalEditPart child = (GraphicalEditPart) children.get(i);
      Rectangle rect = getAbsoluteBounds(child);

      if (rect.contains(p)) {
        IFigure figure = child.getFigure();
        if (figure instanceof ICSSFigure) {
          List frags = ((ICSSFigure) figure).getFragmentsForRead();
          if (frags.size() > 1) // more than one frags, so is a zig
          // zag.
          {
View Full Code Here

    if (tableAdapter == null) {
      return;
    }
    for (int i = 0, size = children.size(); i < size; i++) {
      Rectangle rect = null;
      IFigure child = (IFigure) children.get(i);
      if (child instanceof RowHandle) {
        RowHandle rowHandle = (RowHandle) child;
        int rowIndex = rowHandle.getIndex();
        rect = new Rectangle(0, tableAdapter.getRowStart(rowIndex),
            TableEditConst.WIDTH, tableAdapter
                .getRowHeight(rowIndex));
      } else if (child instanceof RowResizeHandle) {
        RowResizeHandle resizeHandle = (RowResizeHandle) child;
        int rowIndex = resizeHandle.getRowIndex();
        rect = new Rectangle(0, tableAdapter
            .getRowResizeStart(rowIndex), TableEditConst.WIDTH,
            tableAdapter.getRowResizeWidth());
      } else {
        // should not happen.
      }
      if (rect != null) {
        child.setBounds(rect);
      }
    }
  }
View Full Code Here

            //TODO: need better flow of control.
            return;
        }
       
    Node childNode = (Node) childEditPart.getModel();
    IFigure childFigure = ((GraphicalEditPart) childEditPart).getFigure();
    ConvertPosition position = _tagConverter
        .getChildVisualPosition(childNode);
    if (position != null) {
      Node parent = position.getParentNode();
      // link up figure.
      IFigure parentFigure = getFigure(parent);
      if (parentFigure != null) {
        parentFigure.add(childFigure, position.getIndex());
        figureAdded = true;
      }
      // link up style
      if (parent instanceof INodeNotifier) {
        ICSSStyle parentStyle = (ICSSStyle) ((INodeNotifier) parent)
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.IFigure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.