Java Code Examples for org.jgraph.graph.CellView#getCell()
The following examples show how to use
org.jgraph.graph.CellView#getCell() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphRenderer.java From chipster with MIT License | 6 votes |
/** * Overrides the parent implementation to return the value component stored * in the user object instead of this renderer if a value component exists. * This applies some of the values installed to this renderer to the value * component (border, opaque) if the latter is a JComponent. * * @return Returns a configured renderer for the specified view. */ @Override public Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) { isSelected = sel; graphForeground = graph.getForeground(); isGroup = view.getCell() instanceof GroupVertex; isPhenodata = view.getCell() instanceof PhenodataVertex; if(view.getCell() instanceof AbstractGraphVertex){ if(isGroup){ vertex = (GroupVertex)view.getCell(); } else if(isPhenodata){ vertex = (PhenodataVertex)view.getCell(); } else { vertex = (GraphVertex)view.getCell(); } } this.graph = graph; return super.getRendererComponent(graph, view, sel, focus, preview); }
Example 2
Source File: SubjectAreaCellView.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
@Override public Component getRendererComponent(JGraph aGraph, CellView aView, boolean aSelected, boolean aHasFocus, boolean aPreview) { SubjectAreaCellView theView = (SubjectAreaCellView) aView; SubjectAreaCell theCell = (SubjectAreaCell) aView.getCell(); subjectArea = (SubjectArea) ((SubjectAreaCell) theView.getCell()).getUserObject(); selected = aSelected; expanded = theCell.isExpanded(); return this; }
Example 3
Source File: MicroarrayGraph.java From chipster with MIT License | 5 votes |
/** * Gets all visible vertexes on the graph. */ public List<AbstractGraphVertex> getVisibleVertexes() { CellView[] views = this.getGraphLayoutCache().getCellViews(); List<AbstractGraphVertex> vertexes = new ArrayList<AbstractGraphVertex>(); for (CellView view : views) { if (view != null && view.getCell() instanceof AbstractGraphVertex) { AbstractGraphVertex vertex = (AbstractGraphVertex) view.getCell(); vertexes.add(vertex); } } return vertexes; }
Example 4
Source File: ModelVertexRenderer.java From CQL with GNU Affero General Public License v3.0 | 4 votes |
/** * Returns the renderer component after initializing it * * @param graph The graph (really a M in disguise) * @param view The cell view * @param sel If the view is selected or not * @param focus If the view has focus or not * @param preview If the graph is in preview mode or not * @return The renderer component fully initialized */ @Override @SuppressWarnings("unchecked") public Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) { this.model = (M) graph; this.selected = sel; this.preview = preview; this.hasFocus = focus; ModelVertex<F, GM, M, N, E> v = (ModelVertex<F, GM, M, N, E>) view.getCell(); // If the constraint is hidden, return a completely empty JPanel that // doesn't paint anything if ((v instanceof ModelConstraint) && !((ModelConstraint<F, GM, M, N, E>) v).isVisible()) { return new JPanel() { private static final long serialVersionUID = -8516030326162065848L; @Override public void paint(Graphics g) { } }; } // if entity moved, set overview as dirty FIXME(if not working properly, // may be because of int casting and off by one) if ((int) (view.getBounds().getX()) != v.getX() || (int) (view.getBounds().getY()) != v.getY()) { model.setDirty(); } // Initialize panel removeAll(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // Add in entity/constraint label add(_entity = new JPanel(new GridLayout(1, 1))); _entity.add(_entityLabel = new JLabel(v.getName(), SwingConstants.CENTER)); N myNode = (N) v; // Add in attributes _attributes = new JPanel(new GridLayout(0, 1)); add(_attributes); for (EntityAttribute<F, GM, M, N, E> att : myNode.getEntityAttributes()) { _attributes.add(new JLabel(" @ " + att.getName())); } if ((_attributes.getComponentCount() == 0) || !model.getFrame().getShowAttsVal()) { _attributes.setVisible(false); } // Add in unique keys _uniqueKeys = new JPanel(new GridLayout(0, 1)); add(_uniqueKeys); for (UniqueKey<F, GM, M, N, E> key : myNode.getUniqueKeys()) { _uniqueKeys.add(new JLabel(" $ " + key.getKeyName())); } if ((_uniqueKeys.getComponentCount() == 0) || !model.getFrame().getShowAttsVal()) { _uniqueKeys.setVisible(false); } @SuppressWarnings("rawtypes") Map attributes = view.getAllAttributes(); installAttributes(v, attributes); // Set desired size setSize(getPreferredSize()); return this; }