Hi ,
I have a problem with the tacos:Tree component. Although I set a
listener to the "linkListener" parameter, it does not seem to be called.
I use tacos4-beta-2 with tapestry 4.0.2.
My code looks like this :
java:
{code}
@Component( type = "tacos:Tree", id = "tree",
bindings = {
"contentProvider = contentProvider",
"keyProvider = keyProvider",
"value = currentItem",
"state = pageParameters.status",
"rowStyle = beans.evenOdd",
"linkListener = listener:select",
"partialBlockClass = 'treeBlock'"
} )
public abstract Tree getTreeComponent();
public void select( IRequestCycle cycle )
{
throw new RuntimeException( "select" ); // just not to miss the call
//getNavigationManager().load( getNavPage(), false, true );
}
{code}
html:
{code}
<div jwcid="tree" id="tree" >
<span jwcid="@Insert" value="ognl:currentItem.display"/>
</div>
{code}
I had a quick look over the tacos:tree code and I found something that
at first glance dosen't look quite right:
Tree.jwc :
.....
{code}
<component id="linkToggle" type="DirectLink">
<binding name="listener" value="listener:expansion"/>
<binding name="parameters"
value="ognl:{keyProvider.getKey(value), not
isExpanded(value)}"/>
<binding name="stateful">false</binding>
<binding name="renderer"
value="ognl:@[EMAIL PROTECTED]"/>
</component>
<component id="linkToggleAjax" type="AjaxDirectLink">
<binding name="listener" value="listener:expansion"/>
<binding name="parameters"
value="ognl:{keyProvider.getKey(value), not
isExpanded(value)}"/>
<binding name="updateComponents"
value="ognl:{keyProvider.getKey(value).toString() }" />
<binding name="stateful">false</binding>
</component>
{code}
Tree.java :
...
{code}
public void expansion(IRequestCycle cycle)
{
Object[] params = cycle.getListenerParameters();
Serializable key = (Serializable)params[0];
Boolean expanded = (Boolean)params[1];
getManager().setExpandedKey(key, expanded.booleanValue());
setState(getState());
}
public void contentExpansion(IRequestCycle cycle)
{
// Call expansion first
expansion(cycle);
// If they specified a listener we will now invoke it
if (getLinkListener() == null) {
log
.warn("contentExpansion() called but no linkListener
was specified on the tree. "
+ "Use the linkListener parameter if you
want your page/component to be invoked "
+ "as well.");
return;
}
getListenerInvoker().invokeListener(getLinkListener(), this, cycle);
}
{code}
Both "linkToggle" and "linkToggleAjax" components seem to call the
expansion() listener ... but I cannot find the place where
contentExpansion() is called.
If the code is correct then the listener is supposed to be called only
when invoke the contentExpansion listener myself(from my code). If this
is the case then I really don't see the point on having the
"linkListener" parameter ... it seems both unintuitive and illogic to
have a listener from a component called by another component which is
written by me and from which I can call any number of listeners I want.
Am I missing something ?
Now, all this aside, what I would like is to have some initializations
when the +/- icons are indicated(when a node is collapsed/expanded). Is
there any way to achieve that, because I couldn't find a way, and, I
really need it ? :)
Thanks,
Andrei Chiritescu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]