Tuesday, September 4, 2012

Re: Issue with flush when implementing a NullableSetEditor by wrapping a NullalbleListEditor

Hi Thomas,

In the original post, I forgot to mention that, I tried the following flush() implementation but it didn't make a difference:
@Override public void flush() {wrappedEditor.asEditor().flush();}


I am not sure what else I can do within flush() since the only member variable of the class is the wrappedEditor.

Thanks!


On Tuesday, September 4, 2012 1:33:38 AM UTC-7, Thomas Broyer wrote:
You say you implemented flush() as a no-op, so it's no surprise it doesn't do what you expect, right?

On Tuesday, September 4, 2012 9:08:16 AM UTC+2, Jeff wrote:
HI,

I spent a lot of time on the following issue but couldn't figure it out. Any clue is appreciated. Thanks!

I have a working NullableStringListEditor implementation:
public class NullableStringListEditor extends Composite implements IsEditor<OptionalFieldEditor< List<String>, ListEditor<String, StringEditor> >> {...}
   
Now, I am building a NullableStringSetEditor by wrapping it. With the following implementation, values are displayed by the wrapped editor successfully, however any modifications(the NullableStringListEditor supports edit/add strings) are not reflected after flush(). I am using SimpleBeanEditorDriver. I debugged into it and it looks like the underline values(List) in the wrappedEditor(NullableStringListEditor) have been changed, but they are not populated to NullableStringSetEditor. Am I still missing something?

public class NullableStringSetEditor extends Composite implements CompositeEditor<Set<String>, List<String>, ListEditor<String, StringEditor>>, LeafValueEditor<Set<String>> {
    private final NullableStringListEditor wrappedEditor = new NullableStringListEditor();

    @Override
    public void setEditorChain(com.google.gwt.editor.client.CompositeEditor.EditorChain<List<String>, ListEditor<String, StringEditor>> chain) {
        wrappedEditor.asEditor().setEditorChain(chain);                   
    }

    @Override
    public Set<String> getValue() {
        List<String> list = wrappedEditor.asEditor().getValue();
        return (list != null) ? new TreeSet<String>(list) : null;
    }

    @Override
    public void setValue(Set<String> values) {
        List<String> list = new ArrayList<String>();
        list.addAll(values);
        wrappedEditor.asEditor().setValue(list);
   }

   //no-op implementation for other required @Override such as flush() and setDelegate(EditorDelegate<Set<String>> delegate)
   //...
}

--
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/-/qI1NbNylT4MJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment