Skip to main content

Mixing Scenegraph and Flexdock

2 replies [Last post]
ildella
Offline
Joined: 2003-06-10

I have this task. No, it is not for pleasure. It is that my app uses flexdock and I want to keep that feature. I have integrated scenario in the application and it works. I also have a window that is part rendered by scenario (that is the BorderLayout.CENTER portion of contentPane) and the other portions are not managed by SG.

Anyway the CENTER portion have floexdock in action. I am receiving this exception:

Exception in thread "AWT-EventQueue-1" java.lang.ClassCastException: della.swaf.docking.DockInternalFrame cannot be cast to com.sun.scenario.scenegraph.JSGPanel

DockInternalFrame is my class, a JPanel that implements DockingStub to make it compliant with flexdock. The main docking port is added as a node to the rootNode of my SG. But its "children", that are the Docking Panel added to the Docking Port are not.

I want to understand: If I add a button or a text box to a panel, I do not need to tell them to be part of the graph. But as far as I can see this is not true for the panels: every Container has to be set by code as part of the SG, so added as child of rootNode or one of his child.

Is this right?

Here is the complete stacktrace.

Exception in thread "AWT-EventQueue-1" java.lang.ClassCastException: della.swaf.docking.DockInternalFrame cannot be cast to com.sun.scenario.scenegraph.JSGPanel
at com.sun.scenario.scenegraph.FocusHandler$SGFocusTraversalPolicy.getComponent(FocusHandler.java:361)
at com.sun.scenario.scenegraph.FocusHandler$SGFocusTraversalPolicy.getLastComponent(FocusHandler.java:388)
at org.flexdock.util.SwingUtility.getNearestFocusableComponent(SwingUtility.java:272)
at org.flexdock.docking.activation.ActiveDockableTracker.focusDockable(ActiveDockableTracker.java:136)
at org.flexdock.docking.activation.ActiveDockableTracker$1.run(ActiveDockableTracker.java:121)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.sun.scenario.scenegraph.SGEventQueue.dispatchEvent(SGEventQueue.java:219)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.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)

Message was edited by: ildella

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
idk
Offline
Joined: 2005-01-12

> I want to understand: If I add a button or a text box to a panel, I do not need to tell them to be part of the graph.

This is correct.

> But as far as I can see this is not true for the panels: every Container has to be set by code as part of the SG, so added as child of rootNode or one of his child.

This should not be so.

There was a bug in scenegraph. FocusHandler could not handle a case when there is a focusCycleRoot component in embedded hierarchy. I just checked in a fix for this bug into the repository (r85).

I think the exception you saw was because of this bug. Could you please run your application with the latest scenegraph sources from the repository to verify this?

-Igor

ildella
Offline
Joined: 2003-06-10

Sorry for delay. It worked, the exception is raised no more. But I still cannot make it really working. I did not investigate further, maybe have time this week. I'll let you know.

Thanks.