Is VBox serializable?
John McDonnell
mcdonnell.john at gmail.com
Sat Oct 6 09:18:32 PDT 2012
Cheers Jonathon, didn't actually think that about doing it that way, I just
thought I could move the Visible node.
Thanks
John
On 6 October 2012 15:33, Jonathan Giles <jonathan.giles at oracle.com> wrote:
> When you start the drag, rather than insert the visual nodes into the drag
> board, you should be inserting the relevant serializable domain data
> instead. Then, when the domain data is dropped elsewhere, you should create
> the relevant visual nodes at that point.
>
> -- Jonathan
>
>
> On 6/10/2012 5:10 a.m., John McDonnell wrote:
>
>> Hey all.
>>
>> I am working adding some drag and drop functionality to a project I have,
>> where I have a list of nodes, and I would like a user to be able to drag a
>> item from a list and drop it elsewhere within the scene.
>>
>> When displaying the items in the list cells, I have a Region,
>> TrafficListingItem, which contains a VBox. When I add the
>> TrafficListingItem to the Dragboard, I get an the following error:
>>
>> Exception in thread "JavaFX Application Thread"
>> java.lang.IllegalArgumentException: Could not serialize the data
>> at
>>
>> com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:500)
>> at javafx.scene.input.Clipboard.setContent(Clipboard.java:226)
>> at
>>
>> ie.john.client.core.platform.TrafficListingItem.drag(TrafficListingItem.java:105)
>> at
>>
>> ie.john.client.main.controller.MainPaneController$TrafficCell$1.handle(MainPaneController.java:101)
>> at
>>
>> ie.john.client.main.controller.MainPaneController$TrafficCell$1.handle(MainPaneController.java:96)
>> at
>>
>> com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
>> at
>>
>> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
>> at
>>
>> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
>> at
>>
>> com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
>> at
>>
>> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
>> at
>>
>> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
>> at
>>
>> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
>> at
>>
>> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
>> at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
>> at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
>> at javafx.event.Event.fireEvent(Event.java:171)
>> at javafx.scene.Scene$DnDGesture.fireEvent(Scene.java:2627)
>> at javafx.scene.Scene$DnDGesture.process(Scene.java:2706)
>> at javafx.scene.Scene$DnDGesture.access$8700(Scene.java:2603)
>> at javafx.scene.Scene$MouseHandler.process(Scene.java:3340)
>> at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
>> at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
>> at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
>> at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
>> at
>>
>> com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
>> at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
>> at com.sun.glass.ui.View.notifyMouse(View.java:922)
>> at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
>> at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:82)
>> at java.lang.Thread.run(Thread.java:722)
>> Caused by: java.io.NotSerializableException: javafx.scene.layout.VBox
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
>> at
>>
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
>> at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
>> at
>>
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> at
>>
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
>> at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
>> at
>>
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
>> at
>>
>> com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:496)
>> ... 81 more
>>
>>
>> It appears as though VBox is not serialisable? Is this correct? If it is
>> how would one go about dragging a node that contains a VBox within the
>> Drag/Drop Events system of JavaFX?
>>
>>
>>
>
--
John
More information about the openjfx-dev
mailing list