本文整理汇总了Java中y.view.hierarchy.GroupNodeRealizer类的典型用法代码示例。如果您正苦于以下问题:Java GroupNodeRealizer类的具体用法?Java GroupNodeRealizer怎么用?Java GroupNodeRealizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GroupNodeRealizer类属于y.view.hierarchy包,在下文中一共展示了GroupNodeRealizer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import y.view.hierarchy.GroupNodeRealizer; //导入依赖的package包/类
/**
* Converts a view to a Graph2D object.
*
* @param nodes Nodes to convert.
* @param edges Edges to convert.
* @param graphSettings Graph settings used to build the graph.
* @param adjustColors True, to initialize the colors of the nodes. False, otherwise.
*
* @return The created Graph2D object.
* @throws LoadCancelledException Thrown if loading the graph was cancelled.
*/
public Graph2D convert(final Collection<INaviViewNode> nodes, final Collection<INaviEdge> edges,
final ZyGraphViewSettings graphSettings, final boolean adjustColors)
throws LoadCancelledException {
Preconditions.checkNotNull(nodes, "IE00905: View can not be null");
Preconditions.checkNotNull(edges, "IE00906: Edges argument can not be null");
if (!m_loadReporter.report(GraphBuilderEvents.Started)) {
throw new LoadCancelledException();
}
m_loadReporter.start();
final Graph2D graph2D = new Graph2D();
final HierarchyManager hierarchyManager = new HierarchyManager(graph2D);
graph2D.setHierarchyManager(hierarchyManager);
hierarchyManager.addHierarchyListener(new GroupNodeRealizer.StateChangeListener());
checkCancellation(GraphBuilderEvents.InitializedGraph);
// Keep track of all connections between view nodes and yfiles nodes
final HashMap<INaviViewNode, Node> rawNodeToNodeMap = new HashMap<INaviViewNode, Node>();
// To convert the view into a Graph2D object, it is necessary to convert every node
// and every edge from the view into the corresponding yfiles objects.
convertNodes(nodes, graph2D, rawNodeToNodeMap, graphSettings);
checkCancellation(GraphBuilderEvents.ConvertedNodes);
convertEdges(edges, graph2D, rawNodeToNodeMap, adjustColors);
checkCancellation(GraphBuilderEvents.ConvertedEdges);
setupGroupNodes(nodes, graph2D, rawNodeToNodeMap);
checkCancellation(GraphBuilderEvents.CreatedGroupNodes);
checkCancellation(GraphBuilderEvents.Finished);
return graph2D;
}
示例2: setupHierarchyManager
import y.view.hierarchy.GroupNodeRealizer; //导入依赖的package包/类
private void setupHierarchyManager() {
if (m_graph.getHierarchyManager() == null) {
final HierarchyManager hierarchyManager = new HierarchyManager(m_graph);
m_graph.setHierarchyManager(hierarchyManager);
hierarchyManager.addHierarchyListener(new GroupNodeRealizer.StateChangeListener());
}
}
示例3: getIconWidth
import y.view.hierarchy.GroupNodeRealizer; //导入依赖的package包/类
public int getIconWidth() {
if (realizer instanceof GroupNodeRealizer) {
return (defaultWidth + inset);
} else {
return (int) (realizer.getWidth() + inset);
}
}
示例4: getIconHeight
import y.view.hierarchy.GroupNodeRealizer; //导入依赖的package包/类
public int getIconHeight() {
if (realizer instanceof GroupNodeRealizer) {
return (defaultHeight + inset);
} else {
return (int) (realizer.getHeight() + inset);
}
}
示例5: paintIcon
import y.view.hierarchy.GroupNodeRealizer; //导入依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {
realizer.setLocation(x + inset * 0.5d, y + inset * 0.5d);
g = g.create();
Font font = g.getFont();
try {
final Graphics2D gfx = (Graphics2D) g;
if (realizer instanceof GroupNodeRealizer) {
Font labelFont = font.deriveFont(Font.BOLD, 18);
gfx.setFont(labelFont);
FontMetrics fm = gfx.getFontMetrics();
String text = realizer.getLabelText();
int stringW = fm.stringWidth(text);
int stringH = fm.getHeight();
int xPosition = (int) (getIconWidth() - stringW) / 2;
int yPosition = (getIconHeight() - 10) < stringH ? stringH
: (getIconHeight() - 10);
gfx.drawString(text, xPosition, yPosition);
gfx.setColor(Color.DARK_GRAY);
gfx.drawString(text, ShiftWest(xPosition, 1),
ShiftNorth(yPosition, 1));
gfx.drawString(text, ShiftWest(xPosition, 1),
ShiftSouth(yPosition, 1));
gfx.drawString(text, ShiftEast(xPosition, 1),
ShiftNorth(yPosition, 1));
gfx.drawString(text, ShiftEast(xPosition, 1),
ShiftSouth(yPosition, 1));
gfx.setColor(realizer.getFillColor());
gfx.drawString(text, xPosition, yPosition);
} else {
realizer.paint(gfx);
}
} finally {
g.dispose();
}
}