Package org.eclipse.sapphire.ui

Examples of org.eclipse.sapphire.ui.Bounds


    }
    List<DiagramNodeModel> nodes = this.diagramModel.getNodes();
    for (DiagramNodeModel node : nodes)
    {
      DiagramNodePart nodePart = node.getModelPart();
      Bounds bounds = nodePart.getNodeBounds();
      if (bounds.getX() == -1 || bounds.getY() == -1)
      {
        return true;
      }
    }
       
View Full Code Here


    refreshNodeBounds();
  }
 
  private void refreshNodeBounds()
  {
    Bounds nb = getCastedModel().getNodeBounds();
   
    Dimension minSize = getFigure().getMinimumSize();
    Dimension maxSize = getFigure().getMaximumSize();
    int width = nb.getWidth();
    int height = nb.getHeight();
    if (width != -1)
    {
      width = Math.min(width, maxSize.width);
      width = Math.max(width, minSize.width);
    }
    if (height != -1)
    {
      height = Math.min(height, maxSize.height);
      height = Math.max(height, minSize.height);
    }   
   
    Rectangle bounds = new Rectangle(nb.getX(), nb.getY(), width, height);
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this,  getFigure(), bounds);   
  }
View Full Code Here

 
  public void handleAddNode(DiagramNodePart nodePart) {
    DiagramNodePresentation nodePresentation = getPresentation().addNode(nodePart);
    DiagramNodeModel nodeModel = new DiagramNodeModel(this, nodePresentation);
   
    Bounds bounds = nodePart.getNodeBounds();
    if (bounds.getX() < 0 && bounds.getY() < 0) {
      org.eclipse.sapphire.ui.Point position = getDefaultPosition();
      nodePart.setNodeBounds(position.getX(), position.getY(), false, true);
    }
   
    nodes.add(nodeModel);
View Full Code Here

 
  private org.eclipse.sapphire.ui.Point getDefaultPosition() {
    int x = 10;
    int y = -1;
    for (DiagramNodeModel nodeModel : nodes) {
      Bounds bounds = nodeModel.getNodeBounds();
      int height = bounds.getHeight();
      if (height == -1) {
        height = nodeModel.getNodePresentation().getFigure().getBounds().height;
      }
      height += bounds.getY() + 10;
      y = Math.max(y,  height);
    }
    return new org.eclipse.sapphire.ui.Point(x, y);
  }
View Full Code Here

    }
    return null;
  }
     
  public Bounds getNodeBounds() {
    Bounds bounds = getModelPart().getNodeBounds();
    return bounds;
  }
View Full Code Here

    nodeParts.addAll(diagramPagePart.getNodes());
    Collections.sort(nodeParts, new Comparator<DiagramNodePart>()
    {
      public int compare(DiagramNodePart node1, DiagramNodePart node2)
      {
        Bounds bounds1 = node1.getNodeBounds();
        Bounds bounds2 = node2.getNodeBounds();
            if (bounds1.getY() < bounds2.getY())
            {
              return -1;
            }
            else if (bounds1.getY() == bounds2.getY())
            {
              return bounds1.getX() < bounds2.getX() ? -1 :
                (bounds1.getX() == bounds2.getX() ? 0 : 1);
            }
            else
            {
              return 1;
            }
View Full Code Here

    this.connectionIndices.clear();
  }
 
  private Point getNodeLocation(DiagramNodeModel node)
  {
    Bounds bounds = node.getNodeBounds();
    if (node.getShapePresentation().getFigure() != null)
    {
      Rectangle rect = node.getShapePresentation().getFigure().getBounds();
      int x = rect.x != -1 ? rect.x : bounds.getX();
      int y = rect.y != -1 ? rect.y : bounds.getY();
      return new Point(x + rect.width / 2, y + rect.height / 2);
    }
    else
    {         
      return new Point(bounds.getX() + bounds.getWidth() /2, bounds.getY() + bounds.getWidth() / 2);
    }
  }
View Full Code Here

   
  }
 
  private void writeComponentBounds(Component component, DiagramNodePart node)
  {
    Bounds bounds = node.getNodeBounds();
    if (bounds.getX() != component.getPosition().getX().content())
    {
      component.getPosition().setX(bounds.getX());
    }
    if (bounds.getY() != component.getPosition().getY().content())
    {
      component.getPosition().setY(bounds.getY());
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.Bounds

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.