Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.IFigure


            setFocus();
        }
    }

    public void refresh() {
        IFigure figure = (IFigure) getAdapter(IFigure.class);
        figure.revalidate();
        figure.repaint();
        figure.invalidateTree();
    }
View Full Code Here


        return null;
    }
   
    @Override
    protected EditPolicy createChildEditPolicy(EditPart child) {
        IFigure figure = ((GraphicalEditPart) child).getFigure();
        if (figure instanceof NodeFigure && !((NodeFigure) figure).isResizeable())
            return new NonResizableEditPolicy();
        return new ResizableEditPolicy();
    }
View Full Code Here

        installEditPolicy(EditPolicy.COMPONENT_ROLE, new ActionComponentEditPolicy());
    }

    @Override
    protected IFigure createFigure() {
        IFigure figure = super.createFigure();
        if (getParent() instanceof TransitionGraphicalEditPart) {
            PolylineConnection connection = (PolylineConnection) ((TransitionGraphicalEditPart) getParent()).getConnectionFigure();
            connection.addRoutingListener(new RoutingListener() {
                public void invalidate(Connection connection) {
                }
View Full Code Here

            location.y -= ACTION_SIZE/2;
            return location;
        } else {
            NodeFigure nodeFigure = (NodeFigure) figure;
            List<IFigure> children = nodeFigure.getActionsContainer().getChildren();
            IFigure prevFigure;
            if (children.size() > actionIndex) {
                prevFigure = children.get(children.size() - 1 - actionIndex);
            } else {
                prevFigure = children.get(0);
            }
            Rectangle prevActionBounds = prevFigure.getBounds();
            return new Point(prevActionBounds.x - 5, prevActionBounds.y);
            /*
            // invert visuals
            actionIndex = size - actionIndex;
            int xShift = actionIndex*(ACTION_SIZE+ACTION_DELIM) - addPixels;
View Full Code Here

        SWTGraphics g = null;
        GC gc = null;
        Image image = null;

        LayerManager lm = (LayerManager) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);

        try {
            Rectangle r = figure.getBounds();
            editor.getDefinition().setDimension(new Dimension(r.width, r.height));
            image = new Image(Display.getDefault(), r.width, r.height);
            gc = new GC(image);
            g = new SWTGraphics(gc);
            g.translate(r.x * -1, r.y * -1);
            figure.paint(g);
            ImageLoader imageLoader = new ImageLoader();
            imageLoader.data = new ImageData[] { ImageHelper.downSample(image) };
            imageLoader.save(getImageSavePath(), SWT.IMAGE_JPEG);
        } catch (Exception e) {
            DesignerLogger.logError(e);
View Full Code Here

*/
public class SVGRootPart extends SVGRectPart {

  @Override
  protected IFigure createFigure() {
    IFigure figure = new FreeformLayer();
    figure.setLayoutManager(new FreeformLayout());

    return figure;
  }
View Full Code Here

public class SVGRectPart extends ElementRecordPart {

  @Override
  protected IFigure createFigure() {
    IFigure figure = new RectangleFigure();

    XYLayout layout = new XYLayout();
    figure.setLayoutManager(layout);
    figure.setForegroundColor(ColorConstants.black);

    Border line = new LineBorder(new Color(null, 0, 0, 0));
    figure.setBorder(line);

    return figure;
  }
View Full Code Here

public class SVGEllipsePart extends ElementRecordPart {

  @Override
  protected IFigure createFigure() {
    // TODO provide custom Ellipse with elliptical border
    IFigure figure = new Ellipse();

    XYLayout layout = new XYLayout();
    figure.setLayoutManager(layout);
    figure.setForegroundColor(ColorConstants.black);

    return figure;
  }
View Full Code Here

  @Override
  protected IFigure createSizeOnDropFeedback(CreateRequest createRequest) {
    EditPart part = getHost().getViewer().getEditPartFactory()
        .createEditPart(getHost(), createRequest.getNewObject());
    if (part instanceof AbstractGraphicalEditPart) {
      IFigure figure = ((AbstractGraphicalEditPart) part).getFigure();
      if (figure instanceof Shape) {
        FigureUtilities.makeGhostShape((Shape) figure);
        ((Shape) figure).setLineStyle(Graphics.LINE_DASHDOT);
        figure.setForegroundColor(ColorConstants.white);
      }
      addFeedback(figure);
      return figure;
    }
View Full Code Here

    public static Rectangle getAdjustedColumnBoundingRectangle(GraphicalEditPart editPart)
    {
        Rectangle bounds = editPart.getFigure().getBounds().getCopy();

        if (editPart.getParent() != null) {
            IFigure figure = ((GraphicalEditPart) editPart.getParent())
                    .getFigure();
            if (figure instanceof CSSFigure) {
                CSSFigure cssFigure = (CSSFigure) figure;
                LayoutManager layoutManager = cssFigure.getLayoutManager();
                if (layoutManager instanceof CSSTableLayout2) {
                    CSSTableLayout2 tableLayout = (CSSTableLayout2) layoutManager;
                    bounds.y = tableLayout.getHSpacing();
                    bounds.height = figure.getClientArea().height
                            - tableLayout.getHSpacing() * 2;
                }
            }
        }
        bounds = new PrecisionRectangle(bounds.getResized(-1, -1));
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.