Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultGraphCell


    Iterator<DefaultGraphCell> iterCellsList = cellsList.iterator();
    ReachabilityEdgeModel returnEdge = new ReachabilityEdgeModel(arc.getTrigger());
    int differ = 1;
    if (cellsList != null && !cellsList.isEmpty()) {
      while (iterCellsList.hasNext()) {
        DefaultGraphCell cell = iterCellsList.next();
        if (cell instanceof ReachabilityEdgeModel) {
          ReachabilityEdgeModel edge = (ReachabilityEdgeModel) cell;
          // Source
          ReachabilityPortModel srcRpom = (ReachabilityPortModel) edge.getSource();
          ReachabilityPlaceModel srcRplm = (ReachabilityPlaceModel) srcRpom.getParent();
View Full Code Here


  }

  private ReachabilityPlaceModel getPlace(Marking marking) {
    Iterator<DefaultGraphCell> iter = cellsList.iterator();
    while (iter.hasNext()) {
      DefaultGraphCell comp = iter.next();
      if (comp.getUserObject() != null && comp.getUserObject().equals(marking)) {
        return (ReachabilityPlaceModel) comp;
      }
    }
    ReachabilityPlaceModel place = new ReachabilityPlaceModel(marking);
    // (x,y,w,h)
View Full Code Here

    map.put(arc, arc.getAttributes());
    getGraph().getModel().edit(map, null, null, null);
  }

  public void addPointToSelectedArc() {
    DefaultGraphCell cell = (DefaultGraphCell) getGraph()
        .getNextCellForLocation(null, getLastMousePosition().getX(),
            getLastMousePosition().getY());
    if (cell instanceof ArcModel) {
      addPointToArc((ArcModel) cell,
          getGraph().fromScreen(getLastMousePosition()));
View Full Code Here

    if (changes == null) {
      changes = new HashMap<GraphCell, AttributeMap>();
    }
    for (short i = 0; i < toMove.length; i++) {
      if (toMove[i] instanceof DefaultGraphCell) {
        DefaultGraphCell tempCell = (DefaultGraphCell) toMove[i];
        if (tempCell.getChildCount() > 0) {
          move(tempCell.getChildren().toArray(), dx, dy, changes,
              true);
        }
      }
      if (toMove[i] instanceof GraphCell) {
        GraphCell noGroupElement = (GraphCell) toMove[i];
View Full Code Here

                                if (toDelete[i] instanceof AbstractPetriNetElementModel) {
                                    AbstractPetriNetElementModel element = (AbstractPetriNetElementModel) toDelete[i];
                                    // if there are trigger, delete their jgraph model
                                    if (toDelete[i] instanceof TransitionModel) {
                                        if (((TransitionModel) toDelete[i]).getToolSpecific().getTrigger() != null) {
                                            DefaultGraphCell cell = ((TransitionModel) editor.getModelProcessor()
                                                    .getElementContainer().getElementById(element.getId()))
                                                    .getToolSpecific().getTrigger();
                                            if (cell != null) {
                                                deleteCells(new Object[] { cell });
                                            }
View Full Code Here

        if (this.editor.isTokenGameEnabled()) {
            graph.clearSelection();
            return;

        }
        DefaultGraphCell cell = (DefaultGraphCell) graph.getFirstCellForLocation(e.getPoint().x, e.getPoint().y);
        if ((cell == null) && (e.getClickCount() == 2)) {
            deHighlightModel(true);
            rgp.setUnselectButtonEnabled(false);
        } else {
            rgp = (ReachabilityGraphPanel) graph.getParent().getParent().getParent();
View Full Code Here

    map.setResourcePosition(transition.getResourcePosition());

    // Remove old trigger plus resource classes if existing
    // Remember them here as deleteCell will cross-update the tool-specific
    // info
    DefaultGraphCell trigger = transition.hasTrigger() ? transition
        .getToolSpecific().getTrigger() : null;
    DefaultGraphCell resource = transition.hasResource() ? transition
        .getToolSpecific().getTransResource() : null;
    if (trigger != null) {
      getEditor().deleteCell(trigger, true);
    }
    if (resource != null) {
View Full Code Here

    // Remove the old transition
    // If we are part of a group (we always should be if we're a transition),
    // we delete the group to make sure we delete name and any other cells
    // that might be grouped along with us
    DefaultGraphCell transitionCell = transition;
    if (transition.getParent() instanceof GroupModel) {
      transitionCell = (DefaultGraphCell) transition.getParent();
    }
    editor.deleteCell(transitionCell, true);
    editor.create(newMap);
View Full Code Here

    }
    //
    // The Swing MVC Pattern
    //
    // Model Column
    DefaultGraphCell gm = new DefaultGraphCell("GraphModel");
    attributes.put(gm,
        createBounds(new AttributeMap(), 20, 100, Color.blue));
    gm.addPort(null, "GraphModel/Center");
    DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel");
    attributes.put(dgm, createBounds(new AttributeMap(), 20, 180,
        Color.blue));
    dgm.addPort(null, "DefaultGraphModel/Center");
    DefaultEdge dgmImplementsGm = new DefaultEdge("implements");
    cs.connect(dgmImplementsGm, gm.getChildAt(0), dgm.getChildAt(0));
    attributes.put(dgmImplementsGm, implementStyle);
    DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup");
    modelGroup.add(gm);
    modelGroup.add(dgm);
    modelGroup.add(dgmImplementsGm);
    // JComponent Column
    DefaultGraphCell jc = new DefaultGraphCell("JComponent");
    attributes.put(jc, createBounds(new AttributeMap(), 180, 20,
        Color.green));
    jc.addPort(null, "JComponent/Center");
    DefaultGraphCell jg = new DefaultGraphCell("JGraph");
    attributes.put(jg, createBounds(new AttributeMap(), 180, 100,
        Color.green));
    jg.addPort(null, "JGraph/Center");
    DefaultEdge jgExtendsJc = new DefaultEdge("extends");
    cs.connect(jgExtendsJc, jc.getChildAt(0), jg.getChildAt(0));
    attributes.put(jgExtendsJc, extendStyle);
    // UI Column
    DefaultGraphCell cu = new DefaultGraphCell("ComponentUI");
    attributes
        .put(cu, createBounds(new AttributeMap(), 340, 20, Color.red));
    cu.addPort(null, "ComponentUI/Center");
    DefaultGraphCell gu = new DefaultGraphCell("GraphUI");
    attributes.put(gu,
        createBounds(new AttributeMap(), 340, 100, Color.red));
    gu.addPort(null, "GraphUI/Center");
    DefaultGraphCell dgu = new DefaultGraphCell("BasicGraphUI");
    attributes.put(dgu, createBounds(new AttributeMap(), 340, 180,
        Color.red));
    dgu.addPort(null, "BasicGraphUI/Center");
    DefaultEdge guExtendsCu = new DefaultEdge("extends");
    cs.connect(guExtendsCu, cu.getChildAt(0), gu.getChildAt(0));
    attributes.put(guExtendsCu, extendStyle);
    DefaultEdge dguImplementsDu = new DefaultEdge("implements");
    cs.connect(dguImplementsDu, gu.getChildAt(0), dgu.getChildAt(0));
    attributes.put(dguImplementsDu, implementStyle);
    DefaultGraphCell uiGroup = new DefaultGraphCell("UIGroup");
    uiGroup.add(cu);
    uiGroup.add(gu);
    uiGroup.add(dgu);
    uiGroup.add(dguImplementsDu);
    uiGroup.add(guExtendsCu);
    // Aggregations
    DefaultEdge jgAggregatesGm = new DefaultEdge("model");
    cs.connect(jgAggregatesGm, jg.getChildAt(0), gm.getChildAt(0));
    attributes.put(jgAggregatesGm, aggregateStyle);
    DefaultEdge jcAggregatesCu = new DefaultEdge("ui");
View Full Code Here

    }

    public DefaultGraphCell createVertex(String name, double x, double y, Color bg, boolean raised) {

        // Create vertex with the given name
        DefaultGraphCell cell = new DefaultGraphCell(name);

        GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createEtchedBorder());
        GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(x, y, 10, 10));
        GraphConstants.setResize(cell.getAttributes(), true);
        GraphConstants.setAutoSize(cell.getAttributes(), true);

        // Set fill color
        if (bg != null) {
            GraphConstants.setOpaque(cell.getAttributes(), true);
            GraphConstants.setGradientColor(cell.getAttributes(), bg);
        }

        // Set raised border
        if (raised)
            GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder());
        else
            // Set black border
            GraphConstants.setBorderColor(cell.getAttributes(), Color.black);

        return cell;
    }
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultGraphCell

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.