Hi, 

I am using the following editor to support a nullable list: 

public class NullableListEditor<T, E extends Editor<T>> extends Composite 
implements IsEditor<OptionalFieldEditor< List<T>, ListEditor<T,E> >> { 
private ListEditor<T, E> list = ListEditor.of(new ListEditorSource()); 
private final OptionalFieldEditor<List<T>, ListEditor<T, E> > editor = 
OptionalFieldEditor.of(list); 
… } 

NullableListEditor for type A and B:
public class NullableAListEditor extends NullableListEditor<A, AEditor> 
{..} 
public class NullableBListEditor extends NullableListEditor<B, BEditor> 
{..} 

If I use both editors in my application, say first create 
NullableAListEditor and then NullableBListEditor, NullableAListEditor will 
work fine but NullableBListEditor will fail with Error:
java.lang.ClassCastException: ..editor.B.BEditor cannot be cast to 
...editor.A.AEditor
at 
..editor.A.AEditor_SimpleBeanEditorDelegate.setEditor(AEditor_SimpleBeanEditorDelegate.java:6)
    at 
com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:200)
    at 
com.google.gwt.editor.client.impl.AbstractEditorDelegate.addSubDelegate(AbstractEditorDelegate.java:156)
    at 
com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.attach(AbstractEditorDelegate.java:78)
    at 
com.google.gwt.editor.client.adapters.ListEditorWrapper.attach(ListEditorWrapper.java:95)
    at 
com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:164)
    at 
com.google.gwt.editor.client.adapters.ListEditor.setValue(ListEditor.java:1)
    at com.google.gwt.editor.client.impl.Refresher.visit(Refresher.java:40)
    at 
com.google.gwt.editor.client.impl.Initializer.visit(Initializer.java:49)
    at 
com.google.gwt.editor.client.impl.AbstractEditorContext.traverse(AbstractEditorContext.java:128)
    at 
com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.traverse(AbstractEditorDelegate.java:100)
    at 
com.google.gwt.editor.client.impl.AbstractEditorDelegate$Chain.attach(AbstractEditorDelegate.java:83)
    at 
com.google.gwt.editor.client.adapters.OptionalFieldEditor.setValue(OptionalFieldEditor.java:113)
    at com.google.gwt.editor.client.impl.Refresher.visit(Refresher.java:40)
    at 
com.google.gwt.editor.client.impl.Initializer.visit(Initializer.java:49)
    at 
com.google.gwt.editor.client.impl.AbstractEditorContext.traverse(AbstractEditorContext.java:128)

I debugged into it and it seemed to be related to 
AbstractEditorDelegate.java: 
http://code.google.com/p/google-web-toolkit/source/browse/releases/2.4/user/src/com/google/gwt/editor/client/impl/AbstractEditorDelegate.java?r=10474
 
in line 75, for NullableBListEditor , the type returned by 
createComposedDelegate()is the same as that of 
NullableAListEditor(editor_A_AEditor_SimpleBeanEditorDelegate). As a 
result, the 
subDelegate type is not correct for B and caused the above errors during 
attaching. (If I create B then A, B will work but A will fail for similar 
errors)

I couldn’t figure out why. Anyone knows how to fix it?

Thanks a lot, 

-Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ofcPl6AjAgMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to