Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.IFigure


   *
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#removeChildVisual(org.eclipse.gef.EditPart)
   */
  protected void removeChildVisual(EditPart childEditPart) {
        // remove figure
        IFigure childFigure = ((GraphicalEditPart) childEditPart).getFigure();
        IFigure parent = childFigure.getParent();

    if (parent != null) {
      parent.remove(childFigure);
    }
       
        if (childEditPart instanceof NonVisualComponentEditPart)
        {
            _nonVisualElementBar.removeNonVisualChild((NonVisualComponentEditPart) childEditPart);
View Full Code Here


      }
      cell = ele;
      break;
    }

    IFigure cellFigure = getFigureInfo(cell);
    int oldColumnWidth = cellFigure.getBounds().width;
    int cellPadding = cellFigure.getInsets().getWidth();
    int newWidth = oldColumnWidth + this._delta - cellPadding;
    if (this._columnIndex - 1 < 0) {
      newWidth = oldColumnWidth - this._delta - cellPadding;
    }
    Map map = new HashMap();
View Full Code Here

  private IFigure[] showHoverFeedback(LocationRequest request) {
    if (!shouldUseObjectMode(request) && !isStyleTags(getHost())) {
      return null;
    }

        final IFigure figure = this.getHostFigure();
    Rectangle[] rects;
    if (figure instanceof CSSFigure) {
      rects = ((CSSFigure) figure).getFragmentsBounds();
    } else {
      rects = new Rectangle[] { figure.getBounds() };
    }
        int figureSize = rects.length;
       
        if (_showLabelFeedback)
        {
            figureSize++;
        }
       
    IFigure[] figures = new IFigure[figureSize];
    for (int i = 0; i < rects.length; i++) {
      RectangleFigure fig = new RectangleFigure();
      fig.setFill(false);
      fig.setOutline(true);
      fig.setLineWidth(1);
      fig.setForegroundColor(HOVER_FEEDBACK_COLOR);
      addFeedback(fig);

      Rectangle r = rects[i].getCopy();
      figure.translateToAbsolute(r);
      fig.translateToRelative(r);
      fig.setBounds(r);

      figures[i] = fig;
    }
View Full Code Here

    // we have three different kinds of handles.
    // 1. Those element that is resizable.
    // 2. Those element that is rectangle but not resizable.
    // 3. Those element that is not rectangle (fragments)

    IFigure figure = this.getHostFigure();
    if (figure instanceof CSSFigure && getHost() instanceof ElementEditPart) {
      CSSFigure cssfigure = (CSSFigure) figure;
      List fragments = cssfigure.getFragmentsForRead();

      // XXX: only one fragment and is blockbox, then we think it is
View Full Code Here

   *
   * @param request
   *            the request
   */
  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());

    // to avoid enlarge feedback pane.
    // when draging a editpart inside designer to move/copy it, we do not
    // want to
    // enlarge the canvas, since that may resulting in relayout.
    rect = (PrecisionRectangle) rect.intersect(getFeedbackLayer()
        .getBounds());

    feedback.translateToRelative(rect);
    feedback.setBounds(rect);
  }
View Full Code Here

    ITableEditAdapter adapter = getTableEditAdapter();
    if (adapter == null) {
      return null;
    }

    IFigure figure = ((GraphicalEditPart) this.getSourceEditPart())
        .getFigure();
    Rectangle bounds = figure.getBounds();
    Insets insets = figure.getInsets();
    Rectangle rect;
    if (_isrow) {
      int delta = calculateDelta();
      rect = new Rectangle(0, adapter.getRowResizeStart(_index) + delta,
          bounds.width - insets.getWidth(), adapter
              .getRowResizeWidth());
    } else {
      int delta = calculateDelta();
      rect = new Rectangle(adapter.getColumnResizeStart(_index) + delta,
          0, adapter.getColumnResizeWidth(), bounds.height
              - insets.getHeight());
    }
    rect.translate(bounds.x + insets.left, bounds.y + insets.top);

    figure.translateToAbsolute(rect);
    getMarqueeRectangleFigure().translateToRelative(rect);
    return rect;
  }
View Full Code Here

    public void eraseTargetFeedback(Request request) {
        if (_feedbackFigures != null)
        {
            for (final Iterator it = _feedbackFigures.iterator(); it.hasNext();)
            {
                final IFigure figure = (IFigure) it.next();
               
                if (figure != null)
                {
                    removeFeedback(figure);
                }
View Full Code Here

      // here just skip
      return;
    }
    for (int i = 0, size = children.size(); i < size; i++) {
      Rectangle rect = null;
      IFigure child = (IFigure) children.get(i);
      if (child instanceof ColumnHandle) {
        ColumnHandle columnHandle = (ColumnHandle) child;
        int columnIndex = columnHandle.getIndex();
        rect = new Rectangle(tableAdapter.getColumnStart(columnIndex),
            0, tableAdapter.getColumnWidth(columnIndex),
            TableEditConst.HEIGHT);
      } else if (child instanceof ColumnResizeHandle) {
        ColumnResizeHandle resizeHandle = (ColumnResizeHandle) child;
        int columnIndex = resizeHandle.getColumnIndex();
        rect = new Rectangle(tableAdapter
            .getColumnResizeStart(columnIndex), 0, tableAdapter
            .getColumnResizeWidth(), TableEditConst.HEIGHT);
      } else {
        // should not happen.
      }
      if (rect != null) {
        child.setBounds(rect);
      }
    }
  }
View Full Code Here

  /**
   * @return the associated css style for this text node
   */
  public ICSSStyle getCSSStyle() {
    IFigure figure1 = this.getFigure();
    if (figure1 instanceof ICSSFigure) {
      ICSSStyle style = ((ICSSFigure) figure1).getCSSStyle();
      if (style != null) {
        return style;
      }
View Full Code Here

   * @param tablePart
   * @return the adapter
   */
  public static ITableEditAdapter getTableEditAdapter(
      GraphicalEditPart tablePart) {
    IFigure figure = tablePart.getFigure();
    LayoutManager layout = figure.getLayoutManager();
    if (layout instanceof CSSTableLayout2) {
      return new TableEditAdapter((CSSTableLayout2) layout);
    }
    return null;
  }
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.