Hello,
Maybe you missed the @UiField annotations ?

Cheers,
Alberto.

Il giorno mer 2 set 2015 18:05 Matthew McLarty <[email protected]>
ha scritto:

> I have a relatively simple composite widget that's using UIBinder in an
> MVC model.
>
> DrawingSubmissionForm.ui.xml
> ****************************
> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
> xmlns:g="urn:import:com.google.gwt.user.client.ui">
> <g:HTMLPanel ui:field="pnlLineItems" addStyleNames="pnlLineItems">
> <h1>Add Drawings</h1>
> <g:FlexTable ui:field="tblItems" addStyleNames="tblItems"></g:FlexTable>
> <g:Button ui:field="cmdCancel" addStyleNames="cmdCancel">Cancel</g:Button>
> <g:Button ui:field="cmdSubmit" addStyleNames="cmdSubmit">Submit
> Drawings</g:Button>
> </g:HTMLPanel>
> </ui:UiBinder>
>
>
> DrawingSubmissionForm.java
> ****************************
> public class DrawingSubmissionForm extends Composite {
>
> public HTMLPanel pnlLineItems;
> public FlexTable tblItems;
> public Button cmdCancel;
> public Button cmdSubmit;
>
> interface Binder extends UiBinder<Widget, DrawingSubmissionForm> {}
>
> private static final Binder binder = GWT.create(Binder.class);
> interface DrawingSubmissionFormUiBinder extends
> UiBinder<Widget, DrawingSubmissionForm> {
> }
>
> public DrawingSubmissionForm() {
> initWidget(binder.createAndBindUi(this));
> }
>
> public HTMLPanel getPnlLineItems(){
> return pnlLineItems;
> }
> public FlexTable getTblItems(){
> return tblItems;
> }
> public Button getCmdCancel(){
> return cmdCancel;
> }
> public Button getCmdSubmit(){
> return cmdSubmit;
> }
> }
>
> When I try to instantiate a new instance in my Presenter class, I get a
> new instance but all of the fields are null?
>
> public class DrawingSubmissionFormPresenter extends 
> BasePresenter<DrawingSubmissionForm>
> implements ClosableViewInterface {
>
> DrawingSubmissionForm view;
> CloseListener closeListener;
> OrderProxy quoteDTO = null;
>
> public DrawingSubmissionFormPresenter(OrderProxy quoteDTO) {
> super();
> this.quoteDTO = quoteDTO;
> initializeView();
> initializeEventHandlers();
> loadData();
> }
>
> @Override
> public void addCloseListener(CloseListener arg0) {
> this.closeListener = arg0;
> }
>
> @Override
> protected void initializeEventHandlers() {
> // TODO Auto-generated method stub
> }
>
> @Override
> protected void initializeView() {
> view = new DrawingSubmissionForm();
> }
>
> private void loadData(){
> if(quoteDTO != null){
> FlexTable table = view.getTblItems(); *//view exists as expected but
> getTblItems() returns null???*
> table.removeAllRows();
> int row = 0; //we start at 1 because row 0 is the header
> for (OrderLineProxy lineDTO : quoteDTO.getOrderLines()) {
> final DrawingFormSubmissionLine dl = new DrawingFormSubmissionLine();
> dl.getDescription().setText(lineDTO.getOrderLine().getItemDescription1());
> dl.line = lineDTO;
> table.setWidget(row++, 0, dl);
> }
> }else{
> Window.alert("Quote Line Items could not be loaded. Please close and try
> again.");
> }
> }
> }
>
>
> So, as my comment states, "view" exists as I expect but getTblItems()
> returns null? I do this exact same thing in multiple instance of this
> project but I can't seem to figure out what I did wrong here. Any help
> would be appreciated. :)
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to