Hi,

I have a very simple UiBinder file :
        <g:HTMLPanel>
                Usuários
                <c:CellTable ui:field="grid"></c:CellTable>
                <c:SimplePager ui:field="paginador"></c:SimplePager>
        </g:HTMLPanel>

CellTable and SimplePager needs to be instantiated using generics, and
SimplePager also needs a constructor parameter, so I used
@UiField(provided=true) for both at java side:

        @UiField(provided=true) final CellTable<Usuario> grid;
        @UiField(provided=true) final SimplePager<Usuario> paginador;

        private ArrayList<Usuario> dados = new ArrayList<Usuario>();
        private ListViewAdapter<Usuario> adapter = new
ListViewAdapter<Usuario>();

        public Usuarios() {
                inicializaDados();
                grid = new CellTable<Usuario>();   // <-------------
                adapter.addView(grid);
                adapter.setList(dados);
                paginador = new SimplePager<Usuario>(grid);   // <---------

                initWidget(uiBinder.createAndBindUi(this));  // <--------------

The strange behaviour is when I run this code I get:
10:50:26.196 [ERROR] [app] <c:SimplePager ui:field='paginador'>
missing required attribute(s): location view Element <c:SimplePager
ui:field='paginador'> (:13)

It seems that something is missing (view Element) at UiBinder side,
but I'm using provided=true which means  I'm in control of
instantiating, and I provided the view element.

More strange is that with the same UiBinder file if I mix the
instantiations methods using provided for CellTable and @UiFactory for
SimplePager it works.

        @UiField(provided=true) final CellTable<Usuario> grid;
        @UiField SimplePager<Usuario> paginador;   // <--- not using provided
anymore

        private ArrayList<Usuario> dados = new ArrayList<Usuario>();
        private ListViewAdapter<Usuario> adapter = new
ListViewAdapter<Usuario>();

        public Usuarios() {
                inicializaDados();
                grid = new CellTable<Usuario>();
                adapter.addView(grid);
                adapter.setList(dados);

                initWidget(uiBinder.createAndBindUi(this));
      }
        @UiFactory SimplePager<Usuario> criaSimplePager() {
                SimplePager<Usuario> p = new SimplePager<Usuario>(grid);
                return p;
        }

I'm using GWT 2.1M2.  From what I understand from docs
@UiField(provided=true) and @UiFactory are interchangeable, so I
wanted to use just one way for code clarity.

Can you comment on this subject.

Thanks in advance and sorry my english.

Geraldo Lopes



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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