public Hashtable<String, CollectionPanel> parentHasVisibleContainers( DefaultGraphCell object) { CellView[] views = glc.getAllViews(); Hashtable<String, CollectionPanel> vc = new Hashtable<String, CollectionPanel>(); for (CellView cv : views) { if (cv.getCell() == object) { if (cv instanceof VertexView) { if (((VertexView) cv).getRenderer() instanceof CompositeRenderer) { cv.refresh(glc, new GraphContext(jg, new Object[] { ((VertexView) cv).getCell() }), false); Component element = ((VertexView) cv) .getRendererComponent(jg, false, false, false); // to // set // the // entity CompositeRenderer jc = (CompositeRenderer) ((VertexView) cv) .getRenderer(); vc = evaluate(jc, (ingenias.editor.entities.Entity) object .getUserObject(),jg.getModel().getAttributes(object)); } } } } return vc; }
public SizeHandle(VertexView vertexview, GraphContext ctx) { graph = ctx.getGraph(); vertex = vertexview; editing = graph.getEditingCell() == vertex.getCell(); int sizeableAxis = GraphConstants.getSizeableAxis(vertex .getAllAttributes()); if (sizeableAxis == GraphConstants.X_AXIS) cursors = xCursors; else if (sizeableAxis == GraphConstants.Y_AXIS) cursors = yCursors; else cursors = defaultCursors; // PortView Preview portViews = ctx.createTemporaryPortViews(); initialBounds = (Rectangle2D) vertex.getBounds().clone(); context = ctx; for (int i = 0; i < r.length; i++) r[i] = new Rectangle2D.Double(); invalidate(); }
/** * Constructs a VertexView view for the specified object. */ protected VertexView createVertexView(Object cell) { return new VertexView(cell); }
if (target instanceof VertexView) Point2D startCenter = new Point2D.Double(startView.getBounds().getCenterX(), startView.getBounds().getCenterY()); VertexView targetView = (VertexView) target; end = targetView.getPerimeterPoint(null, startCenter); Point2D start = startView.getPerimeterPoint(null, end);
/** * Returns the intersection of the bounding rectangle and the straight line * between the source and the specified point p. The specified point is * expected not to intersect the bounds. Note: You must override this method * if you use a different renderer. This is because this method relies on * the VertexRenderer interface, which can not be safely assumed for * subclassers. */ public Point2D getPerimeterPoint(EdgeView edge, Point2D source, Point2D p) { if (getRenderer() instanceof VertexRenderer) return ((VertexRenderer) getRenderer()).getPerimeterPoint(this, source, p); return super.getPerimeterPoint(edge, source, p); }
/** Process mouse pressed event. */ public void mousePressed(MouseEvent event) { if (!graph.isSizeable()) return; for (int i = 0; i < r.length; i++) { if (r[i].contains(event.getPoint()) && cursors[i] != 0) { Set set = new HashSet(); set.add(vertex.getCell()); contextViews = context.createTemporaryContextViews(set); Object[] all = AbstractCellView .getDescendantViews(new CellView[] { vertex }); if (all.length >= org.jgraph.plaf.basic.BasicGraphUI.MAXHANDLES) cachedBounds = (Rectangle2D) initialBounds.clone(); event.consume(); index = i; return; } } }
Rectangle2D bounds = view.getBounds(); double x = bounds.getX(); double y = bounds.getY();
/** * Resets attributes that would affect rendering if the * {@link #installAttributes(CellView)} is not being called, which is the * case if the view is a group and it's groupOpaque attribute is set to * false. */ protected void resetAttributes() { super.resetAttributes(); shape = CellConstants.getVertexShape(view.getAllAttributes()); isRichText = false; valueComponent = null; }
/** * Returns {@link #editor} if the user object of the cell is a rich text * value or {@link #redirector} if the user object is a component. * * @return Returns the editor for the cell view. */ public GraphCellEditor getEditor() { Object value = ((DefaultMutableTreeNode) getCell()).getUserObject(); if (value instanceof RichTextBusinessObject) { RichTextBusinessObject obj = (RichTextBusinessObject) value; if (obj.isRichText()) return editor; else if (obj.isComponent()) return redirector; } return super.getEditor(); }
protected Point2D getPointLocation(int index) { Object obj = points.get(index); if (obj instanceof Point2D) { return (Point2D) obj; } else if (obj instanceof VirtualNode) { return ((VirtualNode) obj).getPosition(); } else if (obj instanceof PortView) { VertexView vertex = (VertexView) ((CellView) obj) .getParentView(); if (vertex != null) { return vertex.getCenterPoint(); } } return null; }
if (!ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null).isEmpty()){ Hashtable<String, CollectionPanel> renderers = ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null); for (String field:renderers.keySet()){ Method obtainenumeration;
Rectangle2D r = view.getBounds();
/** * Returns a cell handle for the view, if the graph and the view are * sizeable. */ public CellHandle getHandle(GraphContext context) { if (GraphConstants.isSizeable(getAllAttributes()) && !GraphConstants.isAutoSize(getAllAttributes()) && context.getGraph().isSizeable()) return new SizeHandle(this, context); return null; }
public static boolean isContainer(DefaultGraphCell object, JGraph jg){ boolean found=false; CellView[] views = jg.getGraphLayoutCache().getAllViews(); Hashtable<String, CollectionPanel> vc = new Hashtable<String, CollectionPanel>(); for (CellView cv : views) { if (cv.getCell() == object) { if (cv instanceof VertexView) { if (((VertexView) cv).getRenderer() instanceof CompositeRenderer) { cv.refresh(jg.getGraphLayoutCache(), new GraphContext(jg, new Object[] { ((VertexView) cv).getCell() }), false); Component element = ((VertexView) cv) .getRendererComponent(jg, false, false, false); // to // set // the // entity CompositeRenderer jc = (CompositeRenderer) ((VertexView) cv) .getRenderer(); vc = evaluate(jc, (ingenias.editor.entities.Entity) object .getUserObject(),jg.getModel().getAttributes(object)); } } } } return vc.size()>0; } public boolean isContainer(
if (!ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null).isEmpty()){ Hashtable<String, CollectionPanel> renderers = ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null); for (String field:renderers.keySet()){ Method obtainenumeration;
protected void invalidate() { // Retrieve current bounds and set local vars Rectangle2D tmp = graph.getCellBounds(vertex.getCell()); if (tmp != null) { tmp = (Rectangle2D) tmp.clone(); graph.toScreen(tmp); int handlesize = graph.getHandleSize(); int s2 = 2 * handlesize; double left = tmp.getX() - handlesize; double top = tmp.getY() - handlesize; double w2 = tmp.getX() + (tmp.getWidth() / 2) - handlesize; double h2 = tmp.getY() + (tmp.getHeight() / 2) - handlesize; double right = tmp.getX() + tmp.getWidth() - handlesize; double bottom = tmp.getY() + tmp.getHeight() - handlesize; // Update control point positions r[0].setFrame(left, top, s2, s2); r[1].setFrame(w2, top, s2, s2); r[2].setFrame(right, top, s2, s2); r[3].setFrame(left, h2, s2, s2); r[4].setFrame(right, h2, s2, s2); r[5].setFrame(left, bottom, s2, s2); r[6].setFrame(w2, bottom, s2, s2); r[7].setFrame(right, bottom, s2, s2); } }
Rectangle2D r = view.getBounds();
double height = bottom - top; if (isConstrainedSizeEvent(event) || GraphConstants.isConstrained(vertex.getAllAttributes())) { if (index == 3 || index == 4 || index == 5) height = width;