/** * Constructs a graph layout cache. */ public GraphLayoutCache() { this(new DefaultGraphModel(), new DefaultCellViewFactory()); }
/** * Constructs a view for the specified cell and associates it with the * specified object using the specified CellMapper. This calls refresh on * the created CellView to create all dependent views. * <p> * Note: The mapping needs to be available before the views of child cells * and ports are created. * <b>Note: This method must return new instances!</b> * * @param cell * reference to the object in the model */ public CellView createView(GraphModel model, Object cell) { CellView view = null; if (model.isPort(cell)) view = createPortView(cell); else if (model.isEdge(cell)) view = createEdgeView(cell); else view = createVertexView(cell); return view; }
/** * Constructs an EdgeView view for the specified object. */ protected EdgeView createEdgeView(Object cell) { if (cell instanceof Edge) return createEdgeView((Edge) cell); else return new EdgeView(cell); }
/** * Constructs a PortView view for the specified object. */ protected PortView createPortView(Object cell) { if (cell instanceof Port) return createPortView((Port) cell); else return new PortView(cell); }
private void initializeJPanel() { initiate = true; graph.setGraphLayoutCache(new GraphLayoutCache(new DefaultGraphModel(), new DefaultCellViewFactory(), true)); graph.setEditable(false); for (K key : stateKeys) stateCells.put(key, createCell(key, new Point2D(0, 0))); for (K key : stateKeys) createStateTransitionDiagram(key); graph.getGraphLayoutCache().insert(stateCells.values().toArray()); JGraphFacade facade = new JGraphFacade(graph.getGraphLayoutCache()); facade.setEdgePromotion(false); JGraphTreeLayout layout = new JGraphTreeLayout(); layout.run(facade); Map<?, ?> map = facade.createNestedMap(true, true); graph.getGraphLayoutCache().edit(map); }
if (layoutCache == null) layoutCache = new GraphLayoutCache(model, new DefaultCellViewFactory()); setGraphLayoutCache(layoutCache); updateUI();
setDataDomain(domain); GraphLayoutCache view = new GraphLayoutCache(model, new DefaultCellViewFactory()); graph.setGraphLayoutCache(view);
private void initializeJPanel() { initiate = true; graph.setGraphLayoutCache(new GraphLayoutCache(new DefaultGraphModel(), new DefaultCellViewFactory(), true)); graph.setEditable(false); for (int i = 0; i < numberOfStates; i++) { isStateEmpty(stateMachine.states.get(i)); } stateCells = new DefaultGraphCell[numberOfStates]; State<E> parent = getParentState(); stateCells[stateCellIndex] = createCell(parent.getStateEnum().toString(), new Point2D(0, 0), stateCellIndex); stateCellIndex++; createStateMachineDiagram(parent); graph.getGraphLayoutCache().insert(stateCells); JGraphFacade facade = new JGraphFacade(graph.getGraphLayoutCache()); facade.setEdgePromotion(false); JGraphTreeLayout layout = new JGraphTreeLayout(); layout.run(facade); Map<?, ?> map = facade.createNestedMap(true, true); graph.getGraphLayoutCache().edit(map); createDefaultArrows(); createArrowsForStateTransitions(); }
private void initializeJPanel() { initiate = true; graph.setGraphLayoutCache(new GraphLayoutCache(new DefaultGraphModel(), new DefaultCellViewFactory(), true)); graph.setEditable(false); for (int i = 0; i < numberOfStates; i++) { isStateEmpty(stateMachine.states.get(i)); } stateCells = new DefaultGraphCell[numberOfStates]; State<E> parent = getParentState(); stateCells[stateCellIndex] = createCell(parent.getStateEnum().toString(), new Point2d(0, 0), stateCellIndex); stateCellIndex++; createStateMachineDiagram(parent); graph.getGraphLayoutCache().insert(stateCells); JGraphFacade facade = new JGraphFacade(graph.getGraphLayoutCache()); facade.setEdgePromotion(false); JGraphTreeLayout layout = new JGraphTreeLayout(); layout.run(facade); Map<?, ?> map = facade.createNestedMap(true, true); graph.getGraphLayoutCache().edit(map); createDefaultArrows(); createArrowsForStateTransitions(); }