Hi,

hopefully you can help me getting some inheritance done with Ui-Binder.

My goal is to create a basic EditPanel. I want to define all styles, some 
fixed text, and some buttons there.
It should also have an area do display some errors. And also a placeholder 
where I could later place a FlowPanel with TextBoxes.

I then want to reuse this BaseEditPanel and want to supply it the FlowPanel 
with 
TextBoxes.
Also some logic should be written inside the extended Panel to validate the 
TextBoxes.

To get an idea of what I'm trying to do, I created the following example:


BaseEditPanel.ui.xml
<g:FlowPanel>
  <some kind of placeholder ui:field="placeholder" />

  <g:Button text="save" ui:field="save" />
  <g:Label ui:field="error" />
</g:FlowPanel>


class BaseEditPanel extends Composite {
    
    @UiField Button save;
    @UiLabel Label error;

    @UiHandler("save")
    void onSave() {
        boolean isValid = validate();
        if (!isValid) {
            error.setText("there were some errors");
        }
    }

    public abstract validate();
}

CustomEditPanel.ui.xml
<g:FlowPanel>
  <g:Label text="name" />
  <g:TextBox ui:field="name" />
</g:FlowPanel>

class CustomEditPanel {
    @UiField TextBox name;

    @Override
    boolean validate() {
        return name.getText().isEmpty() ? false : true;
    }    
}


Questions:

1) What could I use for a placeholder in BaseEditPanel?
2) How could I get the CustomEditPanel to be placed into the BaseEditPanel at 
the position of the placeholder?
3) I know I cannot have a normal BaseEditPanel class with an abstract method. 
What can I change? Make the BaseEditPanel also abstract, as it anyway 
should only be displayed when a Widget for the placeholder is provided?

Hope you could help

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to