/** * A shortcut method that takes a nested map and passes it to the edit * method. */ public void edit(Map attributes) { edit(attributes, null, null, null); }
/** * Applies the <code>attributes</code> to a single <code>cell</code> by * creating a map that contains the attributes for this cell and passing it * to edit on this layout cache. Example: * * <pre> * Map attrs = new java.util.Hashtable(); * GraphConstants.setBackground(attrs, Color.RED); * graph.getGraphLayoutCache().editCell(graph.getSelectionCell(), attrs); * </pre> */ public void editCell(Object cell, Map attributes) { if (attributes != null && cell != null) { edit(new Object[] { cell }, attributes); } }
/** * Applies the <code>attributes</code> to all <code>cells</code> by * creating a map that contains the attributes for each cell and passing it * to edit on this layout cache. Example: * * <pre> * Map attrs = new java.util.Hashtable(); * GraphConstants.setBackground(attrs, Color.RED); * graph.getGraphLayoutCache().edit(graph.getSelectionCells(), attrs); * </pre> */ public void edit(Object[] cells, Map attributes) { if (attributes != null && cells != null && cells.length > 0) { Map nested = new Hashtable(); for (int i = 0; i < cells.length; i++) nested.put(cells[i], attributes); edit(nested, null, null, null); } }
public void run() { graph.getGraphLayoutCache().edit(map); } });
private void applyChanges(final Hashtable<DefaultGraphCell, Map> map) { final Set<DefaultGraphCell> allchildren = parentship.keySet(); if (!map.isEmpty()) { glc.edit(map, null, null, null); for (Object key : map.keySet()) { if (GraphConstants.getBounds(map.get(key)) != null) { occupiedpositions.put((DefaultGraphCell) key, GraphConstants.getBounds(map.get(key)).getBounds()); } } } }
public void mouseReleased(MouseEvent e) { if (index != -1) { cachedBounds = computeBounds(e); vertex.setBounds(cachedBounds); CellView[] views = AbstractCellView .getDescendantViews(new CellView[] { vertex }); Map attributes = GraphConstants.createAttributes(views, null); graph.getGraphLayoutCache().edit(attributes, null, null, null); } e.consume(); cachedBounds = null; initialBounds = null; firstDrag = true; }
edit(nested, null, null, null);
edit(nested, null, pm, null); else insert(newCells.toArray(), nested, null, pm);
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (GRAPH_TAG.equalsIgnoreCase(localName)) { //apply changes builder.getGraph().getGraphLayoutCache().getModel().removeUndoableEditListener(builder); builder.getGraph().getGraphLayoutCache().edit(propertiesMap, null, null, new UndoableEdit[0]); builder.getGraph().getGraphLayoutCache().getModel().addUndoableEditListener(builder); } }
public void objEntityChanged(EntityEvent e) { remapEntity(e); updateEntityCell(e.getEntity()); // maybe super entity was changed ObjEntity entity = (ObjEntity) e.getEntity(); DefaultEdge inheritanceEdge = inheritanceEdges.get(entity); if (inheritanceEdge != null) { if (entity.getSuperEntity() == null) { graph.getGraphLayoutCache().remove(new Object[] { inheritanceEdge }); inheritanceEdges.remove(entity); } else { inheritanceEdge.setTarget(entityCells.get( entity.getSuperEntity().getName()).getChildAt(0)); Map nested = new HashMap(); nested.put(inheritanceEdge, inheritanceEdge.getAttributes()); graph.getGraphLayoutCache().edit(nested); } } else { if (entity.getSuperEntity() != null) { DefaultEdge edge = createInheritanceEdge(entity); graph.getGraphLayoutCache().insert(edge); } } }
pm = new ParentMap(context.getCells(), null); graph.getGraphLayoutCache().edit(attributes, disconnect, pm, null);
cache.edit(nested, null, null, null);
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); }
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(); }
} else { processNestedMap(nested, false); graph.getGraphLayoutCache().edit(nested, cs, null, null);