Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Insets


  }

  @Override
  public void execute(ICustomContext context) {
    final CompoundDirectedGraph graph = mapDiagramToGraph();
    graph.setDefaultPadding(new Insets(PADDING));
    CompoundDirectedGraphLayout layout = new CompoundDirectedGraphLayout();
    int direction = PreferenceManager.getInstance().loadPreferenceAsInt(PreferencesConstants.EDITOR_LAYOUT_ORIENTATION);
    graph.setDirection(direction);
    layout.visit(graph);
    mapGraphCoordinatesToDiagram(graph);
View Full Code Here


  protected void applyLayoutInternal(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider, double boundsX, double boundsY, double boundsWidth, double boundsHeight) {
    HashMap mapping = new HashMap(entitiesToLayout.length);
    DirectedGraph graph = new DirectedGraph();
   
    graph.setDirection(PositionConstants.SOUTH);
    graph.setMargin(new Insets(20, 60, 20, 60));
    graph.setDefaultPadding(new Insets(30, 50, 30, 50));
   
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode internalNode = entitiesToLayout[i];
      Node node = new Node(internalNode);
      node.setSize(new Dimension(10, 10));
View Full Code Here

    for (int row = 0; row < g.ranks.size(); row++) {
      Rank rank = g.ranks.getRank(row);
      for (int n = 0; n < rank.size(); n++) {
        Node node = rank.getNode(n);
        InternalNode internalNode = (InternalNode) node.data;
        Insets padNode = g.getPadding(node);

        internalNode.setSize(internalNode.getWidthInLayout(), 25);
       
        if (node.getLeft()!=null) {
          // check space to left
          Node left = node.getLeft();
          if (left.data instanceof InternalNode) {
            InternalNode internalLeft = (InternalNode) left.data;
            Insets padLeft = g.getPadding(left);
   
            double left_end = internalLeft.getCurrentX() + internalLeft.getWidthInLayout() + padLeft.right + padNode.left;
            if (internalNode.getCurrentX() <= left_end) {
              // node overlaps with left neighbor
  //            node.x = (int)left_end;
              internalNode.setLocation(left_end, internalNode.getCurrentY());
            }
          } else {
            Activator.getLogger().warning("Unsupported object " + left.data + " can't be cast to InternalNode!");
          }
        }
       
        if (node.getRight()!=null) {
          // check space to right
          Node right = node.getRight();
          if (right.data instanceof InternalNode) {
            InternalNode internalRight = (InternalNode) right.data;
            Insets padRight = g.getPadding(right);
           
            double node_end = internalNode.getCurrentX() + internalNode.getWidthInLayout() + padNode.right + padRight.left;
            if (node_end >= internalRight.getCurrentX()) {
              // node overlaps with right neighbor
  //            right.x = (int)node_end;
View Full Code Here

  g.drawLine(r.x, r.y + 2, r.right() - 1, r.y + 2);
  g.drawLine(r.x, r.bottom() - 3, r.right() - 1, r.bottom() - 3);
  g.drawLine(r.x, r.y + 2, r.x, r.bottom() - 3);
  g.drawLine(r.right() - 1, r.bottom() - 3, r.right() - 1, r.y + 2);
 
  r.crop(new Insets(1, 1, 0, 0));
  r.expand(1, 1);
  r.crop(getInsets(figure));
  drawConnectors(g, figure.getBounds().getCropped(in));
}
View Full Code Here

* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreationFeedbackOffset(org.eclipse.gef.requests.CreateRequest)
*/
protected Insets getCreationFeedbackOffset(CreateRequest request) {
  if (request.getNewObject() instanceof LED
      || request.getNewObject() instanceof Circuit)
    return new Insets(2, 0, 2, 0);
  return new Insets();
}
View Full Code Here

  setGrabBarWidth(width);
  grabBarSize = new Dimension(width, 18);
}

public Insets getInsets(IFigure figure){
  return new Insets(getWidth()+2, grabBarWidth+2, getWidth()+2, getWidth()+2);
}
View Full Code Here

/**
* @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
*/
public Rectangle getHandleBounds() {
  return getBounds().getCropped(new Insets(2,0,2,0));
}
View Full Code Here

  g.drawLine(r.x, r.y + 2, r.right() - 1, r.y + 2);
  g.drawLine(r.x, r.bottom() - 3, r.right() - 1, r.bottom() - 3);
  g.drawLine(r.x, r.y + 2, r.x, r.bottom() - 3);
  g.drawLine(r.right() - 1, r.bottom() - 3, r.right() - 1, r.y + 2);
 
  r.crop(new Insets(1, 1, 0, 0));
  r.expand(1, 1);
  r.crop(getInsets(figure));
  drawConnectors(g, figure.getBounds().getCropped(in));
}
View Full Code Here

/**
* @see org.eclipse.gef.handles.HandleBounds#getHandleBounds()
*/
public Rectangle getHandleBounds() {
  return getBounds().getCropped(new Insets(2,0,2,0));
}
View Full Code Here

/**
* @see org.eclipse.draw2d.Figure#paintFigure(Graphics)
*/
protected void paintFigure(Graphics graphics) {
  Rectangle rect = getBounds().getCopy();
  rect.crop(new Insets(2,0,2,0));
  graphics.fillRectangle(rect);
}
View Full Code Here

TOP

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

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.