Folks,
I have been trying with no success to get the tree to be expanded by
default. I can get everything to work but I cannot control the state of the
tree. Could some kind soul please look and see what I'm doing wrong?
Alternately, can someone please explain how you are supposed to manage the
state?
Thank you,
Ty
Here is my code:
PAGE
<page-specification
class="com.tyco.web.pages.enterprise.SwitchEnterpriseTreePage">
<description>Tree Demo</description>
<property name="item" />
<property name="locationState" persist="session" initial-value="ognl: new
java.util.HashSet()"/>
<bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
<property name="treeState" persist="session" initial-value="ognl:new
java.util.HashSet()"/>
<component id="tree" type="tacos:Tree">
<binding name="value" value="item"/>
<binding name="nodeLinkAjax" value="ognl:false" />
<binding name="evenOdd" value="ognl:page.beans.evenOdd" />
<binding name="rowStyle" value="ognl:beans.evenOdd"/>
<binding name="state" value="treeState"/>
</component>
<component id="nodeLink" type="tacos:AjaxDirectLink">
<binding name="listener"
value="ognl:components.tree.listeners.contentExpansion"/>
<binding name="parameters"
value="ognl:{keyProvider.getKey(components.tree.value),
not
components.tree.isExpanded(components.tree.value),item.parent}"/>
</component>
</page-specification>
HTML
<div
jwcid="tree"
id="tree"
keyProvider="ognl:keyProvider"
contentProvider="ognl:treeContentProvider"
style="overflow: auto; width: auto; height: auto;">
<span jwcid="@If" condition="ognl:item.active" conditionValue="true">
<a style="active" href="#" jwcid="nodeLink"
id="ognl:{item.keyId}">
<span jwcid="@Insert" value="ognl:item.name"></span>
<span jwcid="@If" condition="ognl:item.routing"
conditionValue="!null">
(<span jwcid="@Insert"
value="ognl:item.routing"></span>)
</span>
</a>
</span>
<span jwcid="@Else">
<span jwcid="@Insert" value="ognl:item.name"
style="inactive"></span>
<span jwcid="@If" condition="ognl:item.routing"
conditionValue="!null">
(<span jwcid="@Insert" value="ognl:item.routing"
style="inactive">
</span>)
</span>
</span>
METHOD THAT INITS THE CONTENT PROVIDER
public void initializeEnterpriseTreeContentProvider()
{
EnterpriseTreeContentProvider contentProvider = new
EnterpriseTreeContentProvider( getUser() );
contentProvider.setToggleActiveOnly( true );
setTreeContentProvider( contentProvider );
// ATTEPTING TO FORCE THE NODES NAMED BY THIS TO BE OPEN. (DIDN'T WORK)
Set state = new HashSet();
state.add( 0 );
state.add( 1 );
state.add( 2 );
state.add( 3 );
state.add( 4 );
state.add( 5 );
state.add( 6 );
state.add( 7 );
state.add( 8 );
setEnterpriseTreeState( state );
ITreeManager tm = this.getTreeManager();
tm.expandAll();
}
public void expandAll(IRequestCycle cycle)
{
getTreeManager().expandAll();
}
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel