Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultPort


    if (cellMap.get(node.getId()) != null) {
      return cellMap.get(node.getId());
    }

    DefaultGraphCell cell = new DefaultGraphCell(node);
    cell.add(new DefaultPort());
    return cell;
  }
View Full Code Here


  }

  private void addJGraphVertex(ModelNode node) {
    DefaultGraphCell cell = new DefaultGraphCell(node);
    cell.add(new DefaultPort());
    insert(new Object[] { cell }, getVertexAttributes(cell), null, null, null);
    cellMap.put(node.getId(), cell);
  }
View Full Code Here

   * @param userObject
   *            The user object that the port should contain.
   * @return Returns a new port.
   */
  public GraphCell createPort(MutableTreeNode parent, Object userObject) {
    DefaultGraphCell port = new DefaultPort(userObject);
    parent.insert(port, parent.getChildCount());
    port.setParent(parent);
    return port;
  }
View Full Code Here

    else
      // Set black border
      GraphConstants.setBorderColor(cell.getAttributes(), Color.black);

    // Add a Port
    DefaultPort port = new DefaultPort();
    cell.add(port);
    port.setParent(cell);

    return cell;
  }
View Full Code Here

  // Hook for subclassers
  protected DefaultGraphCell createDefaultGraphCell() {
    DefaultGraphCell cell =
      new DefaultGraphCell("Cell " + new Integer(cellCount++));
    // Add one Floating Port
    cell.add(new DefaultPort());
    return cell;
  }
View Full Code Here

    //
    // Model Column
    DefaultGraphCell gm = new DefaultGraphCell("GraphModel");
    attributes.put(gm,
        createBounds(new AttributeMap(), 20, 100, Color.blue));
    gm.add(new DefaultPort("GraphModel/Center"));
    DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel");
    attributes.put(dgm, createBounds(new AttributeMap(), 20, 180,
        Color.blue));
    dgm.add(new DefaultPort("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(), 150, 20,
        Color.green));
    jc.add(new DefaultPort("JComponent/Center"));
    DefaultGraphCell jg = new DefaultGraphCell("JGraph");
    attributes.put(jg, createBounds(new AttributeMap(), 150, 100,
        Color.green));
    jg.add(new DefaultPort("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(), 280, 20, Color.red));
    cu.add(new DefaultPort("ComponentUI/Center"));
    DefaultGraphCell gu = new DefaultGraphCell("GraphUI");
    attributes.put(gu,
        createBounds(new AttributeMap(), 280, 100, Color.red));
    gu.add(new DefaultPort("GraphUI/Center"));
    DefaultGraphCell dgu = new DefaultGraphCell("BasicGraphUI");
    attributes.put(dgu, createBounds(new AttributeMap(), 280, 180,
        Color.red));
    dgu.add(new DefaultPort("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));
View Full Code Here

        // Set black border
        GraphConstants.setBorderColor(
          cell.getAttributes(), Color.black);

      // Add a Port
      DefaultPort port = new DefaultPort();
      cell.add(port);
      port.setParent(cell);

      return cell;
    }
View Full Code Here

    DefaultGraphCell wsCell=findNode(name);
   
    if(wcCell==null||wsCell==null
      return;
   
    DefaultPort zeroChild = (DefaultPort)wcCell.getChildAt(0);
    Set edges = zeroChild.getEdges();
    DefaultEdge edge1=(DefaultEdge)edges.iterator().next();

    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    model.remove(new Object[]{edge1});
   
View Full Code Here

    Object[] insert = new Object[] { connection };
    ConnectionSet cs = new ConnectionSet();
    // Finds sourcePort
    Iterator it;
    it = source.getChildren().iterator();
    DefaultPort tmpPort, sourcePort, targetPort;
    sourcePort = null;
    while (it.hasNext()) {
      tmpPort = (DefaultPort) it.next();
      if (tmpPort instanceof OutputPort) {
        sourcePort = tmpPort;
View Full Code Here

      }
      else if(type.equals(Productions.UNIT))
      {
        GraphConstants.setGradientColor(cell.getAttributes(),
          Color.orange);
        cell.add(new DefaultPort());
      }
      else if(type.equals(Productions.UNIT_BUILDING))
      {
        GraphConstants.setGradientColor(cell.getAttributes(),
          Color.cyan);
        cell.add(new DefaultPort());
      }
     
      return cell;
    }
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultPort

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.