Graph package custom NodeRealizer

Hi
i want to create a custom NodeRealizer
i look at yFiles docs and saw they extend other Realizer

openapi provides them to me only as interfaces
is there another way to create my own than creating an adapter and just change the methods i want ?

--
well, creating an adapter didn't work, i get an exception that class a.j.nc is not an interface

what do i do ?

Message was edited by:
Aviram Segal

2 comments

hi,
what are your node and edge objects? have you generated properly equals and
hashCode methods(try alt-ins to generate this methods)?

Serega

i might be using it wrong so here it goes

i create graph, view, datamodel, presentation model :
Graph2D graph =
GraphManager.getGraphManager().createGraph2D();
Graph2DView view =
GraphManager.getGraphManager().createGraph2DView(graph);
CodeGraphDataModel dataModel = new CodeGraphDataModel();
CodeGraphPresentationModel presentationModel = new
CodeGraphPresentationModel(graph);
i create a builder initialize it and get the JComponent to display:
GraphBuilder builder = GraphBuilderFactory.getInstance(project).
createGraphBuilder(codeGraph.getGraph(),
codeGraph.getView(), codeGraph.getDataModel(),
codeGraph.getPresentationModel());
builder.initialize();
builder.getView().getJComponent();
NOW, at the display, the graph comes out perfect

when i click show edge labels first time, they show up but the node
labels disapear

second time everything disapears but one node with no label and i get
an expcetion when i play with the layouts they sometimes come back
with no labels at all.

is this a bug or am i doing something wrong

java.lang.ClassCastException: com.intellij.openapi.util.Key cannot be
cast to com.intellij.openapi.graph.impl.builder.ComparableNode
at
com.intellij.openapi.graph.impl.builder.GraphUtil.b(GraphUtil.java:97)
at
com.intellij.openapi.graph.impl.builder.GraphUtil.a(GraphUtil.java:59)
at
com.intellij.openapi.graph.impl.builder.GraphUtil.a(GraphUtil.java:57)
at
com.intellij.openapi.graph.impl.builder.GraphUtil.getExistedEdge(Graph
Util.java:124)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.a(GraphBuilde
rImpl.java:219)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.a(GraphBuilde
rImpl.java:35)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.addEdge(Graph
BuilderImpl.java:107)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.createDataMod
el(GraphBuilderImpl.java:134)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.buildModel(Gr
aphBuilderImpl.java:129)
at
com.intellij.openapi.graph.impl.builder.GraphBuilderImpl.updateGraph(G
raphBuilderImpl.java:173)
at
com.intellij.openapi.graph.builder.actions.ShowEdgeLabels.setSelected(
ShowEdgeLabels.java:68)
at
com.intellij.openapi.graph.builder.actions.AbstractGraphToggleAction.s
etSelected(AbstractGraphToggleAction.java:84)
at
com.intellij.openapi.actionSystem.ToggleAction.actionPerformed(ToggleA
ction.java:42)
at
com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitte
r.actionPerformed(ActionMenuItem.java:14)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:199
5)
at
com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerfor
med(ActionMenuItem.java:32)
at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:183)
at
com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:1
51)
at
com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleas
ed(BegMenuItemUI.java:3)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:111)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:203)
at
com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:92)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
d.java:273)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
ava:183)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
d.java:173)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA
7.0.1 Build #7364
ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_03 [
87926] ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM)
Client VM ERROR - com.intellij.ide.IdeEventQueue - Vendor:
Sun Microsystems Inc. ERROR -
com.intellij.ide.IdeEventQueue - OS: Windows XP ERROR -
com.intellij.ide.IdeEventQueue - Last Action: Graph.Show.Edge.Labels



0

the problem was that i was disposing the builder

but what do i do with the realizer ?

0

Please sign in to leave a comment.