Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Rectangle


    }

    protected Object createModel() {
        RuleFlowProcessWrapper result = new RuleFlowProcessWrapper();
        StartNodeWrapper start = new StartNodeWrapper();
        start.setConstraint(new Rectangle(100, 100, -1, -1));
        result.addElement(start);
        start.setParent(result);
        IFile file = ((IFileEditorInput)getEditorInput()).getFile();
        String name = file.getName();
        result.setName(name.substring(0, name.length() - 5));
View Full Code Here


    /* (non-Javadoc)
     * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
     */
    protected void refreshVisuals() {
        Rectangle bounds = new Rectangle( getCastedModel().getLocation(),
                                          getCastedModel().getSize() );
        ((GraphicalEditPart) getParent()).setLayoutConstraint( this,
                                                               getFigure(),
                                                               bounds );
    }
View Full Code Here

        layout.visit(graph);
        for (Map.Entry<Long, Node> entry: mapping.entrySet()) {
            Node node = entry.getValue();
            DefaultElementWrapper elementWrapper = (DefaultElementWrapper)
                ((ProcessWrapper) ((GenericModelEditor) editor).getModel()).getElement(entry.getKey() + "");
            elementWrapper.setConstraint(new Rectangle(node.x, node.y, node.width, node.height));
        }
        // TODO: implement changes as a command, so we can support undo
        editor.doSave(null);
    }
View Full Code Here

    }

    public void applyResults(ElementEditPart elementEditPart) {
        Node n = (Node) partToNodesMap.get(elementEditPart);
        ElementFigure elementFigure = (ElementFigure) elementEditPart.getFigure();
        Rectangle bounds = new Rectangle(n.x, n.y, elementFigure.getPreferredSize().width,
                elementFigure.getPreferredSize().height);
        elementFigure.setBounds(bounds);
        for (int i = 0; i < elementEditPart.getSourceConnections().size(); i++) {
            ElementConnectionEditPart connectionPart = (ElementConnectionEditPart) elementEditPart.getSourceConnections().get(i);
            applyResults(connectionPart);
View Full Code Here

            ElementEditPart elementEditPart = (ElementEditPart) iter.next();
            ElementFigure elementFigure = (ElementFigure) elementEditPart.getFigure();
            if (elementFigure == null) {
                continue;
            }
            Rectangle constraint = elementFigure.getBounds().getCopy();
            ElementWrapper elementWrapper = elementEditPart.getElementWrapper();
            elementWrapper.setConstraint(constraint);
        }
        return true;
    }
View Full Code Here

        GC gc = null;
        Image image = null;
        LayerManager layerManager = (LayerManager)
            getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
        IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
        Rectangle r = figure.getBounds();
        try {
            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);
 
View Full Code Here

        Node node = getNode();
        Integer x = (Integer) node.getMetaData().get("x");
        Integer y = (Integer) node.getMetaData().get("y");
        Integer width = (Integer) node.getMetaData().get("width");
        Integer height = (Integer) node.getMetaData().get("height");
        return new Rectangle(
            x == null ? 0 : x,
            y == null ? 0 : y,
            width == null ? -1 : width,
            height == null ? -1 : height);
    }
View Full Code Here

    cLayer.setConnectionRouter(getConnectionRouter());
    if (logger.isLoggable(Level.FINE)) {
      //$ANALYSIS-IGNORE
      logger.fine("End refreshVisuals()");
    }
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(-1,-1,-1,-1));
  }
View Full Code Here

   * @param figure
   */
  public void refreshLayout() {
    ProjectFigure figure = (ProjectFigure) getFigure();
    // Computes constraints
    Rectangle constraint = null;
    Rectangle bounds = figure.getBounds();
    if (bounds.height == 0 || bounds.width == 0) {
      // By setting the width and height to -1, we ensure that the preferred width and height are calculated automatically.
      constraint = new Rectangle(bounds.x, bounds.y, -1, -1);
    } else {
      constraint = new Rectangle(bounds);
    }
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, constraint);

    // Check for first Layout refresh and set model to preferred size
    INode model = (INode) getModel();
View Full Code Here

  protected Command createChangeConstraintCommand(final ChangeBoundsRequest request, final EditPart child, final Object constraint) {
    if (logger.isLoggable(Level.FINE)) {
      //$ANALYSIS-IGNORE
      logger.fine("EditPart : " + child + " , constraint :" + constraint);
    }
    final Rectangle rectangle = (Rectangle) constraint;
    final INode node = (INode) child.getAdapter(INode.class); // = EditPart.getModel()
    Command command = new LayoutCommand(node, request, rectangle);
    return command;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.geometry.Rectangle

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.