Thursday, October 17, 2013

Re: Error when defining a generic Composite widget using Java Generics

Hi Steve & Jens

Thanks for your input - I haven't yet had time to look at it, but your input is appreciated. 
I will leave a note here, as soon as I have had time to dig a little more into it...

BR
Steen

Den onsdag den 9. oktober 2013 16.12.46 UTC+2 skrev Steen Lillethorup Frederiksen:
I am trying to create a generic Composite widget, using Java Generics. However I keep getting the assertion error:

java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()

I have defined my Composite widget as follows:

public class DataEntry<DataType extends FocusWidget> extends Composite {

    final protected FlowPanel panel;
    final protected InlineLabel promptLabel;
    final protected DataType inputElement;
    
    public DataEntry(final DataType inputField, final String guiId, final String prompt) {
        super();

        promptLabel = new InlineLabel(prompt);
        inputElement = inputField;

        panel = new FlowPanel();
        panel.add(promptLabel);
        panel.add(inputField);
        initWidget(panel);

        getElement().setId(guiId);
        promptLabel.setStylePrimaryName("dio-DataEntry-Prompt");
        inputElement.setStylePrimaryName("dio-DataEntry-Input");
    }

And I am defining my concrete Composite widgets as follows (could be TextBox, TextArea etc.):

public class ListEntry extends DataEntry<ListBox> {
    public ListEntry(String guiId, String prompt) {
        super(new ListBox(), guiId, prompt);
    }
    ...
}

Can anyone explain to me, what I have missed here?

Thanx
Steen

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate