-
FEATURED COMPONENTS
First time here? Check out the FAQ!
<hbox id="hboxx" spacing="0" apply="us.fed.nmcourt.jaa.u.UserAdminGFC">
<groupbox>
<listbox id="usersLB" multiple="true" rows="14" model="@{hboxx$composer.users}">
<listhead>
<listheader label="Users"/>
</listhead>
<listitem self="@{each='user'}" value="@{user}">
<listcell label="@{user.fullname}"/>
</listitem>
</listbox>
</groupbox>
...
public class UserAdminGFC
extends DbSessionGFC
{
private List<User> cAllUsersL;
...
public List<User> getUsers ()
throws SQLException,
SqlExecutorException
{
Connection _C = getDbConnection ();
try
{
SelectUserListSql _SULS = new SelectUserListSql ( _C );
cAllUsersL = _SULS.getSelectResult ();
}
finally
{
_C.close ();
}
return cAllUsersL;
}
...
}
public class User
{
...
private String cFullName;
public User ()
{
}
...
public void setFullName ( String fullName )
{
cFullName = fullName;
}
public String getFullName ()
{
return cFullName;
}
...
}
The method getUsers is never called.
Shouldn't the following line make getUsers get called?
<listbox id="usersLB" multiple="true" rows="14" model="@{hboxx$composer.users}">
One wierd thing is that all my onClick@xxx methods within UserAdminGFC are called
correctly. What am I missing?
James Wilson
[email protected]
(505) 228-5233
1) You see the # button above the forum text editor alongside the B, I, & U? It's for code. It sure makes reading your code much easier.
2) You didn't show all of your ZUL file. Did you put the AnnotateDataBinderInit in it?
Cary, thanks for your response.
I did put AnnotateDataBinderInit in it.
I think the problem has to do with the fact that I create
tabbedpanels dynamically and then make a include call to include
the zul for each tabbedpanel. When I put AnnotateDataBinderInit
in my include call I get an error because AnnotateDataBinderInit
has already been used.
<zk> <?init class="us.fed.nmcourt.jaa.db.CreateDatabasePoolInitiator"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> <window id="mainWindow" title="Judge Assignment Application" border="normal" position="center" mode="modal" closable="true" apply="us.fed.nmcourt.jaa.win.MainWindowGFC"> <tabbox id="mainTabBox"> <tabs id="mainTabs"> <tab id="loginTab" label="Login"/> </tabs> <tabpanels id="mainTabPanels"> <tabpanel id="loginTabPanel"> <include src="login.zul"/> </tabpanel> </tabpanels> </tabbox> </window> </zk>
I haven't added tabs dynamically, but others on the forum have. I think you're going to need to have a reference to the binder in your GFC subclass and add the tabpanel as a component so that the binder knows about it. When the binder initiates, your tab panel isn't there, so it doesn't do any binding.
add
private AnnotateDataBinder binder = null ;
to your controller and see if any of the AnnotateDataBinder::addBinding(...) methods can be used.
...and if all else fails you can create your own binder...
binder = new AnnotateDataBinder(comp, b);
You might peek @ the source for AnnotateDataBinderInit::doAfterCompose(Page page, Component[] comps) to see if you can get any clues from it.
Asked: 2010-12-28 10:28:22 +0800
Seen: 558 times
Last updated: Dec 29 '10