/** * Creates a graph cell and initializes it with the specified user object. * The GraphCell allows children only if specified. * * @param userObject an Object provided by the user that constitutes * the cell's data * @param storageMap the storage attribute map for this cell * @param children array of children */ public DefaultGraphCell(Object userObject, AttributeMap storageMap, MutableTreeNode[] children) { super(userObject, true); setAttributes(storageMap); if (children != null) for (int i = 0; i < children.length; i++) add(children[i]); }
attributes.put(dgmImplementsGm, implementStyle); DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup"); modelGroup.add(gm); modelGroup.add(dgm); modelGroup.add(dgmImplementsGm); attributes.put(dguImplementsDu, implementStyle); DefaultGraphCell uiGroup = new DefaultGraphCell("UIGroup"); uiGroup.add(cu); uiGroup.add(gu); uiGroup.add(dgu); uiGroup.add(dguImplementsDu); uiGroup.add(guExtendsCu);
/** * Utility method to create a port for this cell. The method adds a port * at a fixed relative offset within the cell. If the offset is null * then a floating port is added. * @param offset the offset of the port within the cell * @param userObject the user object of the port cell * @return the port created */ public Object addPort(Point2D offset, Object userObject) { DefaultPort port = new DefaultPort(userObject); if (offset == null) { add(port); } else { GraphConstants.setOffset(port.getAttributes(), offset); add(port); } return port; }