Package org.jgraph.graph

Examples of org.jgraph.graph.AttributeMap$SerializablePoint2D


        return null;
    }

    public void setPosition(int x, int y)
    {
        AttributeMap map = getAttributes();
        GraphConstants.setBounds(map, new Rectangle(x, y, getWidth(), getHeight()));
        getAttributes().applyMap(map);
    }
View Full Code Here


  public void setUnknownToolSpecs(Vector<?> unknownToolSpecs) {
    m_unknownToolspecific = unknownToolSpecs;
  }

  public void setSize(Dimension dim) {
    AttributeMap map = getAttributes();
    GraphConstants.setSize(map, dim);
    getAttributes().applyMap(map);
  }
View Full Code Here

     * @param map
     */
    public PlaceModel(CreationMap map)
    {
        super(map);
        AttributeMap attributes = getAttributes();
        GraphConstants.setMoveable(attributes, true);
        GraphConstants.setEditable(attributes, false);
        GraphConstants.setSizeable(attributes, false);
        setAttributes(attributes);
//       System.err.println(this.getToolTipText());
View Full Code Here

                CellView[] all = graphLayoutCache
                    .getAllDescendants(views);
                for (int i = 0; i < all.length; i++) {
                  CellView orig = graphLayoutCache
                      .getMapping(all[i].getCell(), false);
                  AttributeMap attr = orig.getAllAttributes();
                  all[i].changeAttributes(graph
                      .getGraphLayoutCache(),
                      (AttributeMap) attr.clone());
                  all[i].refresh(graph.getGraphLayoutCache(),
                      context, false);
                }
              }
              if (cachedBounds != null) {
View Full Code Here

                  if (view != null
                      && !graphModel.isPort(view
                          .getCell())) {
                    // TODO: Clone required? Same in
                    // GraphConstants.
                    AttributeMap attrs = (AttributeMap) view
                        .getAllAttributes().clone();
                    // Maybe translate?
                    // attrs.translate(dx, dy);
                    attributes.put(cells[i], attrs.clone());
                  }
                }
              }
              ConnectionSet cs = ConnectionSet.create(graphModel,
                  cells, false);
View Full Code Here

  /**
   * Returns the local attributes for the specified cell.
   */
  public Map getAttributes(Object cell) {
    AttributeMap map = (AttributeMap) getAttributes().get(cell);
    if (map == null) {

      // First tries to get a view for the cell. If no view is available
      // tries to get the attributes from the model. Then stores a local
      // clone and associate it with the cell for future reference.
      CellView view = null;
      // Treat the bounds as a special case. If available, get the bounds
      // from the view, since this will return the correct bounds for
      // group cells
      Rectangle2D bounds = null;
      if (graphLayoutCache != null) {
        view = graphLayoutCache.getMapping(cell, false);
      }
      if (view != null) {
        map = view.getAllAttributes();
        bounds = (Rectangle2D)view.getBounds().clone();
      }
      if (map == null)
        map = model.getAttributes(cell);
      if (map != null) {
        map = (AttributeMap) map.clone();
        if (bounds != null) {
          GraphConstants.setBounds(map, bounds);
        }
        getAttributes().put(cell, map);
      }
View Full Code Here

          if (graphLayoutCache != null
              && !graphLayoutCache.isVisible(child)) {
            // If visiblity information is available and the child is
            // not visible do not add it to the bounds of the parent
          } else {
            AttributeMap cellAttributes = (AttributeMap) getAttributes()
                .get(child);

            if (cellAttributes != null) {
              childHasChanged = true;
              Rectangle2D cellBounds = (Rectangle2D) GraphConstants
View Full Code Here

            source.addEdge(edge);
            target.addEdge(edge);
            // Use Edge to Connect Source and Target
            ConnectionSet cs = new ConnectionSet(edge, source, target);
            // Create a Map that holds the attributes for the edge
            AttributeMap attr = edge.getAttributes();// GraphConstants.createMap();
            // Construct a Map from cells to Maps (for insert)
            Hashtable<DefaultEdge, AttributeMap> nest = new Hashtable<DefaultEdge, AttributeMap>();
            // Associate the Edge with its Attributes
            nest.put(edge, attr);
            // Insert wants an Object-Array
View Full Code Here

     * @param graph
     * @param mapper
     */
    public AbstractElementView(Object cell) {
      super(cell);
        setAttributes(new AttributeMap());
    }
View Full Code Here

   */
  public static void addSampleData(GraphModel model) {
    ConnectionSet cs = new ConnectionSet();
    Map attributes = new Hashtable();
    // Styles For Implement/Extend/Aggregation
    AttributeMap implementStyle = new AttributeMap();
    GraphConstants.setLineBegin(implementStyle,
        GraphConstants.ARROW_TECHNICAL);
    GraphConstants.setBeginSize(implementStyle, 10);
    GraphConstants.setDashPattern(implementStyle, new float[] { 3, 3 });
    if (GraphConstants.DEFAULTFONT != null) {
      GraphConstants.setFont(implementStyle, GraphConstants.DEFAULTFONT
          .deriveFont(10));
    }
    AttributeMap extendStyle = new AttributeMap();
    GraphConstants
        .setLineBegin(extendStyle, GraphConstants.ARROW_TECHNICAL);
    GraphConstants.setBeginFill(extendStyle, true);
    GraphConstants.setBeginSize(extendStyle, 10);
    if (GraphConstants.DEFAULTFONT != null) {
      GraphConstants.setFont(extendStyle, GraphConstants.DEFAULTFONT
          .deriveFont(10));
    }
    AttributeMap aggregateStyle = new AttributeMap();
    GraphConstants.setLineBegin(aggregateStyle,
        GraphConstants.ARROW_DIAMOND);
    GraphConstants.setBeginFill(aggregateStyle, true);
    GraphConstants.setBeginSize(aggregateStyle, 6);
    GraphConstants.setLineEnd(aggregateStyle, GraphConstants.ARROW_SIMPLE);
    GraphConstants.setEndSize(aggregateStyle, 8);
    GraphConstants.setLabelPosition(aggregateStyle, new Point2D.Double(500,
        0));
    if (GraphConstants.DEFAULTFONT != null) {
      GraphConstants.setFont(aggregateStyle, GraphConstants.DEFAULTFONT
          .deriveFont(10));
    }
    //
    // 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);
View Full Code Here

TOP

Related Classes of org.jgraph.graph.AttributeMap$SerializablePoint2D

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.