本文整理汇总了Java中org.jgraph.graph.CellView.getCell方法的典型用法代码示例。如果您正苦于以下问题:Java CellView.getCell方法的具体用法?Java CellView.getCell怎么用?Java CellView.getCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgraph.graph.CellView
的用法示例。
在下文中一共展示了CellView.getCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDescendant
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
protected boolean isDescendant(CellView parentView, CellView childView) {
if (parentView == null || childView == null) {
return false;
}
Object parent = parentView.getCell();
Object child = childView.getCell();
Object ancestor = child;
do {
if (ancestor == parent) {
return true;
}
} while ((ancestor = mediator.getParent(ancestor)) != null);
return false;
}
示例2: getVertexAt
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
/** Gets the first vertex at this position.
*
* @param x horizontal coordinate
* @param y vertical coordinate
* @return first vertex
*/
public JmtCell getVertexAt(int x, int y) {
CellView[] cellViews = getGraphLayoutCache().getAllViews();
for (CellView cellView : cellViews) {
if (cellView.getCell() instanceof JmtCell) {
if (cellView.getBounds().contains(x, y)) {
return (JmtCell) cellView.getCell();
}
}
}
return null;
// Object cell = null;
// Object oldCell = null;
// do {
// cell = getNextCellForLocation(oldCell, x, y);
// if (oldCell == cell)
// return null;
// else
// oldCell = cell;
// } while (!((cell instanceof JmtCell) || cell == null));
}
示例3: getFirstCellForLocation
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
/**
* Helper method for {@link #getFirstCellForLocation(double, double)} and
* {@link #getPortViewAt(double, double)}. Returns the topmost visible cell
* at a given point. A flag controls if we want only vertices or only edges.
* @param x x-coordinate of the location we want to find a cell at
* @param y y-coordinate of the location we want to find a cell at
* @param vertex <tt>true</tt> if we are not interested in edges
* @param edge <tt>true</tt> if we are not interested in vertices
* @return the topmost visible cell at a given point
*/
protected JCell<G> getFirstCellForLocation(double x, double y, boolean vertex, boolean edge) {
x /= this.scale;
y /= this.scale;
JCell<G> result = null;
Rectangle xyArea = new Rectangle((int) (x - 2), (int) (y - 2), 4, 4);
// iterate over the roots and query the visible ones
CellView[] viewRoots = this.graphLayoutCache.getRoots();
for (int i = viewRoots.length - 1; result == null && i >= 0; i--) {
CellView jCellView = viewRoots[i];
if (!(jCellView.getCell() instanceof JCell)) {
continue;
}
@SuppressWarnings("unchecked")
JCell<G> jCell = (JCell<G>) jCellView.getCell();
boolean typeCorrect =
vertex ? jCell instanceof JVertex : edge ? jCell instanceof JEdge : true;
if (typeCorrect && !jCell.isGrayedOut()) {
// now see if this jCell is sufficiently close to the point
if (jCellView.intersects(this, xyArea)) {
result = jCell;
}
}
}
return result;
}
示例4: isDescendant
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
protected boolean isDescendant(CellView parentView, CellView childView) {
if (parentView == null || childView == null) {
return false;
}
Object parent = parentView.getCell();
Object child = childView.getCell();
Object ancestor = child;
do {
if (ancestor == parent)
return true;
} while ((ancestor = graphModel.getParent(ancestor)) != null);
return false;
}
示例5: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
/**
* 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);
}
示例6: isDescendant
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
protected boolean isDescendant(CellView parentView, CellView childView) {
if (parentView == null || childView == null) {
return false;
}
Object parent = parentView.getCell();
Object child = childView.getCell();
Object ancestor = child;
do {
if (ancestor == parent) {
return true;
}
} while ((ancestor = mediator.getParent(ancestor)) != null);
return false;
}
示例7: getVertexAt
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
/**
* Gets the first vertex at this position.
*
* @param x horizontal coordinate
* @param y vertical coordinate
* @return first vertex
*/
public JmtCell getVertexAt(int x, int y) {
CellView[] cellViews = getGraphLayoutCache().getAllViews();
for (CellView cellView : cellViews) {
if (cellView.getCell() instanceof JmtCell) {
if (cellView.getBounds().contains(x, y)) {
return (JmtCell) cellView.getCell();
}
}
}
return null;
}
示例8: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
@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;
}
示例9: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
boolean sel, boolean focus, boolean preview) {
gridColor = graph.getGridColor();
highlightColor = graph.getHighlightColor();
lockedHandleColor = graph.getLockedHandleColor();
isDoubleBuffered = graph.isDoubleBuffered();
if (view instanceof VertexView) {
this.view = (VertexView) view;
setComponentOrientation(graph.getComponentOrientation());
if (graph.getEditingCell() != view.getCell()) {
Object label = graph.convertValueToString(view);
if (label != null)
setText("<html><center><font size='1'><b>"+label.toString()+"</b></font></center></html>");
else
setText("");
} else
setText("");
this.hasFocus = focus;
this.childrenSelected = graph.getSelectionModel()
.isChildrenSelected(view.getCell());
this.selected = sel;
this.preview = preview;
if (this.view.isLeaf()
|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
installAttributes(view);
else
resetAttributes();
return this;
}
return null;
}
示例10: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
boolean sel, boolean focus, boolean preview) {
gridColor = graph.getGridColor();
highlightColor = graph.getHighlightColor();
lockedHandleColor = graph.getLockedHandleColor();
isDoubleBuffered = graph.isDoubleBuffered();
if (view instanceof VertexView) {
this.view = (VertexView) view;
setComponentOrientation(graph.getComponentOrientation());
if (graph.getEditingCell() != view.getCell()) {
Object label = graph.convertValueToString(view);
if (label != null)
setText("<html><center><font size='1'><b>"+label.toString()+"</b></center></font></html>");
else
setText(null);
} else
setText(null);
this.hasFocus = focus;
this.childrenSelected = graph.getSelectionModel()
.isChildrenSelected(view.getCell());
this.selected = sel;
this.preview = preview;
if (this.view.isLeaf()
|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
installAttributes(view);
else
resetAttributes();
return this;
}
return null;
}
示例11: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
boolean sel, boolean focus, boolean preview) {
gridColor = graph.getGridColor();
highlightColor = graph.getHighlightColor();
lockedHandleColor = graph.getLockedHandleColor();
isDoubleBuffered = graph.isDoubleBuffered();
if (view instanceof VertexView) {
this.view = (VertexView) view;
setComponentOrientation(graph.getComponentOrientation());
if (graph.getEditingCell() != view.getCell()) {
Object label = graph.convertValueToString(view);
if (label != null)
setText("<html><center><font size='3'>"+label.toString()+"</font></center></html>");
else
setText(null);
} else
setText(null);
this.hasFocus = focus;
this.childrenSelected = graph.getSelectionModel()
.isChildrenSelected(view.getCell());
this.selected = sel;
this.preview = preview;
if (this.view.isLeaf()
|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
installAttributes(view);
else
resetAttributes();
return this;
}
return null;
}
示例12: installAttributes
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
protected void installAttributes (CellView view){
Map map = view.getAllAttributes();
StateCell cell = (StateCell) view.getCell();
// store the fill and the line color
Color bordercolor = GraphConstants.getBorderColor(map);
// apply the parameter to the bounding box only
setOpaque(GraphConstants.isOpaque(map));
bordercolor = GraphConstants.getBorderColor(map);
if (getBorder() == null && bordercolor != null)
{
setBorder(BorderFactory.createLineBorder(bordercolor, 1));
}
// Set the foreground color
Color foreground = GraphConstants.getForeground(map);
// The FillColor takes precedence over the background color
Color background = GraphConstants.getBackground(map);
setBackground(background);
Font font = GraphConstants.getFont(map);
header.setOpaque(false);
header.setFont(font);
header.setForeground(foreground);
header.setBackground(background);
Icon icon = GraphConstants.getIcon(map);
header.setIcon(icon);
internalStateArea.setFont(font);
internalStateArea.setOpaque(false); ;
internalStateArea.setVisible(true);
internalStateArea.setText(cell.getInternalState());
}
示例13: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
boolean sel, boolean focus, boolean preview) {
gridColor = graph.getGridColor();
highlightColor = graph.getHighlightColor();
lockedHandleColor = graph.getLockedHandleColor();
isDoubleBuffered = graph.isDoubleBuffered();
if (view instanceof VertexView) {
this.view = (VertexView) view;
setComponentOrientation(graph.getComponentOrientation());
if (graph.getEditingCell() != view.getCell()) {
Object label = graph.convertValueToString(view);
if (label != null)
setText("<html><font size='4'><b>"+label.toString()+"</b></font></html>");
else
setText("");
} else
setText("");
this.hasFocus = focus;
this.childrenSelected = graph.getSelectionModel()
.isChildrenSelected(view.getCell());
this.selected = sel;
this.preview = preview;
if (this.view.isLeaf()
|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
installAttributes(view);
else
resetAttributes();
return this;
}
return null;
}
示例14: getRendererComponent
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
public Component getRendererComponent(JGraph graph, CellView view,
boolean sel, boolean focus, boolean preview) {
gridColor = graph.getGridColor();
highlightColor = graph.getHighlightColor();
lockedHandleColor = graph.getLockedHandleColor();
isDoubleBuffered = graph.isDoubleBuffered();
if (view instanceof VertexView) {
this.view = (VertexView) view;
setComponentOrientation(graph.getComponentOrientation());
if (graph.getEditingCell() != view.getCell()) {
Object label = graph.convertValueToString(view);
if (label != null)
setText("<html><font size='3'><b>"+label.toString()+"</b></font></html>");
else
setText("");
} else
setText("");
this.hasFocus = focus;
this.childrenSelected = graph.getSelectionModel()
.isChildrenSelected(view.getCell());
this.selected = sel;
this.preview = preview;
if (this.view.isLeaf()
|| GraphConstants.isGroupOpaque(view.getAllAttributes()))
installAttributes(view);
else
resetAttributes();
return this;
}
return null;
}
示例15: getVisibleVertexes
import org.jgraph.graph.CellView; //导入方法依赖的package包/类
/**
* 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;
}