latos / wave-protocol

Automatically exported from code.google.com/p/wave-protocol
0 stars 0 forks source link

Gadget disappears after done edit #173

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a wave
2. Add a gadget by clicking on the "jibsaw" icon and then ok the default gadget 
url.
3. Hit shift+enter to finish editing

What is the expected output? What do you see instead?

Gadget should remain in the blip, instead it disappears and a client shiny. 

Please use labels and text to provide additional information.

Original issue reported on code.google.com by zdw...@google.com on 1 Dec 2010 at 5:02

GoogleCodeExporter commented 8 years ago
Yep, the same bug is occurring with the Caja doodads I'm preparing.

The problem is with the lifecycle of GWT widgets in the editor.  There are a 
number of problems I thinks:

1) when an Editor is destroyed, it detaches any widgets for which it is still a 
logical parent.

This is the direct cause of the widgets being removed when editing is stopped.  
The Editor has two modes of operation now, 'ownsDocument' and '!ownsDocument'.

In Undercurrent, Editors run in !ownsDocument mode, because Undercurrent does 
not keep Editors around, it creates/destroys them when starting/stopping 
editing, and attaches/detaches them to/from documents as needed.  

In Google Wave, Editors run in ownsDocument mode, where the client creates a 
unique long-lived Editor for every blip, and destroying the Editor destroys the 
document (i.e., while the document is alive, its Editor is kept alive).

The !ownsDocument mode is new for Undercurrent, so is not fully robust.  This 
logic, of destroying widgets when the Editor is destroyed, is only legitimate 
in ownsDocument mode.  In !ownsDocument mode, this should throw an Exception 
instead, because all widgets should have been orphaned or reparented off the 
Editor by the time it gets destroyed.

2) On stopping editing, GWT widgets from doodads are not being orphaned from 
the Editor (nor reparented to another Widget like the WavePanel).

In order for GWT widgets to be valid forms of rendering, they need a logical 
parent, and that parent must be something other than the Editor, because 
Editors only exist transiently.  There is currently no code path for this, but 
ContentDOcument's rendering path needs to be given a GWT Panel to serve as the 
logical parent for any GWT widgets created by renderers, and that parent needs 
to be something like the Wave Panel.  It may or may not make sense to reparent 
a ContentDocument's widgets to an Editor when it gets created; it doesn't seem 
necessary though.

I started investigating this with Dan thisafternoon.  We have not reached a 
full solution yet.

Original comment by hearn...@google.com on 1 Dec 2010 at 7:30

GoogleCodeExporter commented 8 years ago

Update: chatted with Dan, solution found, Dan will kindly take this on.

Original comment by hearn...@google.com on 1 Dec 2010 at 8:22

GoogleCodeExporter commented 8 years ago
This should be fixed by now.

Original comment by danila...@google.com on 23 Dec 2010 at 12:59