Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultGraphCell


        /**
         * 1. Add all entities
         */
        for (DataMap map : domain.getDataMaps()) {
            DefaultGraphCell mapCell = new DefaultGraphCell();
            createdObjects.add(mapCell);

            for (Entity entity : getEntities(map)) {
                DefaultGraphCell cell = createEntityCell(entity);

                // mapCell.add(cell);
                // cell.setParent(mapCell);

                List<DefaultGraphCell> array = !isIsolated(domain, entity)
                        ? createdObjects
                        : isolatedObjects;
                array.add(cell);
                array.add((DefaultGraphCell) cell.getChildAt(0)); // port
            }
        }

        /**
         * 2. Add all relationships
         */
        for (DataMap map : domain.getDataMaps()) {
            for (Entity entity : getEntities(map)) {
                DefaultGraphCell sourceCell = entityCells.get(entity.getName());

                postProcessEntity(entity, sourceCell);
            }
        }
        view.insert(createdObjects.toArray());
View Full Code Here


        view.insert(isolatedObjects.toArray());
        graph.getModel().addUndoableEditListener(this);
    }

    protected DefaultGraphCell createEntityCell(Entity entity) {
        DefaultGraphCell cell = new DefaultGraphCell(getCellMetadata(entity));

        GraphConstants.setResize(cell.getAttributes(), true);
        GraphConstants.setBorder(cell.getAttributes(), new LineBorder(Color.BLACK));

        GraphConstants.setEditable(cell.getAttributes(), false);
        entityCells.put(entity.getName(), cell);

        cell.addPort();
        return cell;
    }
View Full Code Here

    /**
     * Updates specified entity on the graph
     */
    protected void updateEntityCell(Entity e) {
        DefaultGraphCell cell = entityCells.get(e.getName());
        if (cell != null) {
            GraphConstants.setValue(cell.getAttributes(), getCellMetadata(e));
            GraphConstants.setResize(cell.getAttributes(), true);

            Map nested = new HashMap();
            nested.put(cell, cell.getAttributes());

            edit(nested);
        }
    }
View Full Code Here

            }
        }
    }

    protected void removeEntityCell(Entity e) {
        final DefaultGraphCell cell = entityCells.get(e.getName());
        if (cell != null) {
            runWithUndoDisabled(new Runnable() {

                public void run() {
                    graph.getGraphLayoutCache().remove(new Object[] {
View Full Code Here

        DefaultEdge edge = createRelationshipCell(rel);
        insert(edge);
    }

    protected void insertEntityCell(Entity entity) {
        DefaultGraphCell cell = createEntityCell(entity);

        // putting cell to a random posistion..
        GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(Math
                .random()
                * graph.getWidth(), Math.random() * graph.getHeight(), 10, 10));

        // setting graph type-specific attrs
        postProcessEntity(entity, cell);
View Full Code Here

     */
    protected void updateRelationshipLabels(
            DefaultEdge edge,
            Relationship rel,
            Relationship reverse) {
        DefaultGraphCell sourceCell = entityCells.get(rel.getSourceEntity().getName());
        DefaultGraphCell targetCell = entityCells.get(rel.getTargetEntity().getName());

        edge.setSource(sourceCell != null ? sourceCell.getChildAt(0) : null);
        edge.setTarget(targetCell != null ? targetCell.getChildAt(0) : null);

        Object[] labels = {
                rel.getName() + " " + getRelationshipLabel(rel),
                reverse == null ? "" : reverse.getName()
                        + " "
View Full Code Here

        for (Entry<String, DefaultGraphCell> entry : entityCells.entrySet()) {
            encoder.print("<entity name=\"");
            encoder.print(entry.getKey());
            encoder.print("\" ");

            DefaultGraphCell cell = entry.getValue();
            Rectangle2D rect = graph.getCellBounds(cell);
            encodeRecangle(encoder, rect);
            encoder.println("/>");
        }
View Full Code Here

           
            propertiesMap = new Hashtable<DefaultGraphCell, Map<String,?>>();
        }
        else if (ENTITY_TAG.equalsIgnoreCase(localName)) {
            String name = attributes.getValue("", "name");
            DefaultGraphCell cell = builder.getEntityCell(name);
            if (cell != null) {
                Map<String, Object> props = new Hashtable<String, Object>();
                GraphConstants.setBounds(props,
                        new Rectangle2D.Double(
                            getAsDouble(attributes, "x"),
View Full Code Here

    DefaultEdge createInheritanceEdge(ObjEntity entity) {
        if (!inheritanceEdges.containsKey(entity)) {
            ObjEntity superEntity = entity.getSuperEntity();
            if (superEntity != null) {
                DefaultGraphCell sourceCell = entityCells.get(entity.getName());
                DefaultGraphCell targetCell = entityCells.get(superEntity.getName());

                DefaultEdge edge = new DefaultEdge();
                edge.setSource(sourceCell.getChildAt(0));
                edge.setTarget(targetCell.getChildAt(0));

                GraphConstants.setDashPattern(edge.getAttributes(), new float[] {
                        5, 5
                });
                GraphConstants.setLineEnd(
View Full Code Here

    ReachabilityEdgeModel edge = getEdge(arc, parentMarking);

    ReachabilityPlaceModel src = getPlace(parentMarking);
    cellsList.add(src);

    DefaultGraphCell tar = getPlace(marking);
    cellsList.add(tar);

    edge.setSource(src.getChildAt(0));
    edge.setTarget(tar.getChildAt(0));
    cellsList.add(edge);
    // activate parallel routing
    GraphConstants.setRouting(edge.getAttributes(), ParallelRouter.getSharedInstance(view));

  }
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.