/** * Hook for subclassers to avoid cloning the cell's attributes. Return * model.getAttributes(cell) to avoid cloning. */ protected AttributeMap getCellAttributes(GraphModel model) { return (AttributeMap) model.getAttributes(cell).clone(); }
/** * Create a clone of the cell. This method uses the superclass * implementation (which does not clone the children), then * uses clone on the attribute map. This method does not * clone the user object. You should override the * cloneUserObject in the graph model to implement cloning * of custom user objects. * * @return Object a clone of this object. */ public Object clone() { DefaultGraphCell c = (DefaultGraphCell) super.clone(); c.attributes = (AttributeMap) attributes.clone(); return c; }
/** * Replace the keys in <code>map</code> using <code>keyMap</code, which * maps from old to new keys. The value in <code>map</code> must itself * be a map, and is cloned using <code>cloneMap</code>. */ public static Map replaceKeys(Map keyMap, Map map) { Map newMap = new Hashtable(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); if (entry.getValue() instanceof Map) { Object newKey = keyMap.get(entry.getKey()); if (newKey != null) { AttributeMap val = (AttributeMap) ((AttributeMap) entry .getValue()).clone(); newMap.put(newKey, val); } } } return newMap; }
public static Map createAttributesFromModel(Object[] elements, GraphModel model) { Map attributes = new Hashtable(); for (int i = 0; i < elements.length; i++) { AttributeMap attr = model.getAttributes(elements[i]); if (attr != null && attr.size() > 0) attributes.put(elements[i], attr.clone()); } return attributes; }
/** * Returns a nested map of (cell, map) pairs that represent all attributes * of all cell views in this view. * * @see #getCellViews */ public Map createNestedMap() { CellView[] cellViews = getCellViews(); Map nested = new Hashtable(); for (int i = 0; i < cellViews.length; i++) { nested.put(cellViews[i].getCell(), new Hashtable((Map) cellViews[i] .getAllAttributes().clone())); } return nested; }
view = cm.getMapping(key, false); if (view != null) attributes.put(key, view.getAllAttributes().clone()); // FIXME:
map = model.getAttributes(cell); if (map != null) { map = (AttributeMap) map.clone(); if (bounds != null) { GraphConstants.setBounds(map, bounds);
all[i].changeAttributes( graph.getGraphLayoutCache(), (AttributeMap) attr.clone()); all[i].refresh(graph.getGraphLayoutCache(), context, false);
public CellView createMapping(Object cell) { CellView view = graphLayoutCache.getFactory().createView( graph.getModel(), cell); putMapping(cell, view); view.refresh(graph.getGraphLayoutCache(), this, true); // Create Dependent Views // Fetch Attributes From Original View CellView src = graphLayoutCache.getMapping(cell, false); if (src != null) { view.changeAttributes(graphLayoutCache, (AttributeMap) src.getAttributes().clone()); // Inserts portviews into points list view.refresh(graph.getGraphLayoutCache(), this, false); } return view; }
if (orig != null) { AttributeMap origAttr = (AttributeMap) orig .getAllAttributes().clone(); all[i].changeAttributes(graph.getGraphLayoutCache(), origAttr); all[i].refresh(graph.getGraphLayoutCache(), context, false);