Geraldo Lopes
unread,Jul 11, 2010, 10:12:35 AM7/11/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
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