예제 #1
0
 public Component getRendererComponent(
     JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) {
   return RenderComponentManager.retrievePanel(
       "Plan",
       ((Entity) ((DefaultGraphCell) (view.getCell())).getUserObject())
           .getPrefs(graph.getModel().getAttributes(view.getCell()))
           .getView());
 }
예제 #2
0
 /**
  * This method checks to determine whether the specified port is allowed to have incoming flows
  * attached to it.
  *
  * @param portView
  * @return true if flows can end at this port, false otherwise.
  */
 private boolean acceptsIncomingFlows(PortView portView) {
   CellView parentView = portView.getParentView();
   YAWLPort yawlPort = (YAWLPort) portView.getCell();
   YAWLCell vertex = (YAWLCell) parentView.getCell();
   return yawlPort.acceptsIncomingFlows()
       && vertex.acceptsIncomingFlows()
       && getNet().acceptsIncomingFlows(vertex);
 }
예제 #3
0
 /**
  * This method checks to determine whether the specified port can have outgoing flows drawn from
  * it.
  *
  * @param portView
  * @return true if flows can start from this port, false otherwise.
  */
 private boolean generatesOutgoingFlows(PortView portView) {
   CellView parentView = portView.getParentView();
   YAWLPort yawlPort = (YAWLPort) portView.getCell();
   YAWLCell vertex = (YAWLCell) parentView.getCell();
   return yawlPort.generatesOutgoingFlows()
       && vertex.generatesOutgoingFlows()
       && getNet().generatesOutgoingFlows(vertex);
 }
예제 #4
0
  public Component getRendererComponent(
      JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) {

    ConflictCell cc = (ConflictCell) view.getCell();
    Conflict conflict = (Conflict) cc.getUserObject();

    if (conflict.getTopic().length() > 0) {
      conflictLabel.setText("<html><center>" + conflict.getTopic() + "</center></html>");
    } else {
      conflictLabel.setText("<html><center>Konflikt</center></html>");
    }

    return component;
  }
예제 #5
0
  protected List getChildren(CellView view) {
    ArrayList children = new ArrayList();
    GraphModel model = graph.getModel();
    Object cell = view.getCell();

    for (int i = 0; i < model.getChildCount(cell); i++) {
      if (canceled) return null;

      Object port = model.getChild(cell, i);

      for (Iterator edges = model.edges(port); edges.hasNext(); ) {
        Object edge = edges.next();

        if (port == model.getSource(edge)) {
          Object targetPort = model.getTarget(edge);
          Object targetVertex = model.getParent(targetPort);
          children.add(graph.getGraphLayoutCache().getMapping(targetVertex, false));
        }
      }
    }

    return children;
  }
예제 #6
0
    public void setPosition(Point parent, int levelHeight) {
      int nextLevelHeight = 0;

      for (Iterator it = children.iterator(); it.hasNext(); ) {
        nextLevelHeight = Math.max(nextLevelHeight, ((TreeNode) it.next()).height);
      }

      if (parent == null) {
        Rectangle2D b = view.getBounds();
        Rectangle bounds =
            new Rectangle(
                (int) b.getX(), (int) b.getY(),
                (int) b.getWidth(), (int) b.getHeight());
        Point p = bounds.getLocation();

        if (centerRoot) {
          int lw = getLeftWidth();
          int rw = getRightWidth();
          int h = getHeight();

          Insets i = graph.getInsets();

          if (orientation == SwingConstants.NORTH) {
            bounds.x = lw - (width / 2);
            bounds.y = i.top;
          } else if (orientation == SwingConstants.EAST) {
            bounds.x = (i.left + h) - width;
            bounds.y = lw - (height / 2);
          } else if (orientation == SwingConstants.SOUTH) {
            bounds.x = lw - (width / 2);
            bounds.y = i.top + h;
          } else if (orientation == SwingConstants.WEST) {
            bounds.x = i.right;
            bounds.y = lw - (width / 2);
          }

          Object cell = view.getCell();
          Map attributes = GraphConstants.createAttributes(cell, GraphConstants.BOUNDS, bounds);
          graph.getGraphLayoutCache().edit(attributes, null, null, null);

          if ((orientation == SwingConstants.WEST) || (orientation == SwingConstants.EAST)) {
            graph.setPreferredSize(new Dimension(h + i.left + i.right, lw + rw + i.top + i.bottom));
          } else {
            graph.setPreferredSize(new Dimension(lw + rw + i.left + i.right, h + i.top + i.bottom));
          }

          p = bounds.getLocation();
        }

        if ((orientation == SwingConstants.WEST) || (orientation == SwingConstants.EAST)) {
          int tmp = p.x;
          p.x = p.y;
          p.y = tmp;
        }

        if ((orientation == SwingConstants.NORTH) || (orientation == SwingConstants.WEST)) {
          parent = new Point(p.x + (width / 2), p.y + height);
        } else if ((orientation == SwingConstants.SOUTH) || (orientation == SwingConstants.EAST)) {
          parent = new Point(p.x + (width / 2), p.y);
        }

        for (Iterator it = children.iterator(); it.hasNext(); ) {
          ((TreeNode) it.next()).setPosition(parent, nextLevelHeight);
        }

        return;
      }

      if (combineLevelNodes) {
        levelHeight = this.levelheight;
      }

      Rectangle cellBounds = new Rectangle(width, height);

      if ((orientation == SwingConstants.NORTH) || (orientation == SwingConstants.WEST)) {
        cellBounds.x = (x + parent.x) - (width / 2);
        cellBounds.y = parent.y + levelDistance;
      } else {
        cellBounds.x = (x + parent.x) - (width / 2);
        cellBounds.y = parent.y - levelDistance - levelheight;
      }

      if (alignment == SwingConstants.CENTER) {
        cellBounds.y += ((levelHeight - height) / 2);
      } else if (alignment == SwingConstants.BOTTOM) {
        cellBounds.y += (levelHeight - height);
      }

      if ((orientation == SwingConstants.WEST) || (orientation == SwingConstants.EAST)) {
        int tmp = cellBounds.x;
        cellBounds.x = cellBounds.y;
        cellBounds.y = tmp;

        tmp = cellBounds.width;
        cellBounds.width = cellBounds.height;
        cellBounds.height = tmp;
      }

      Object cell = view.getCell();
      Map attributes = GraphConstants.createAttributes(cell, GraphConstants.BOUNDS, cellBounds);
      graph.getGraphLayoutCache().edit(attributes, null, null, null);

      if ((orientation == SwingConstants.NORTH) || (orientation == SwingConstants.WEST)) {
        y = parent.y + levelDistance + levelHeight;
      } else {
        y = parent.y - levelDistance - levelHeight;
      }

      for (Iterator it = children.iterator(); it.hasNext(); ) {
        ((TreeNode) it.next()).setPosition(new Point(x + parent.x, y), nextLevelHeight);
      }
    }
 public Component getRendererComponent(
     JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) {
   return RenderComponentManager.retrievePanel(
       "DeploymentUnitByTypeMSEntity",
       ((Entity) ((DefaultGraphCell) (view.getCell())).getUserObject()).getPrefs().getView());
 }