Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-09-06       - By Manu Mahajan

 Back
Hi Session

I don't know if it can be done only via the struts tags but I was able to
achieve this by using some dojo javascript code in my jsp.

Here are some code snippets that might solve your problem

<html>
<head>
.
.
.
 <s:head theme="ajax" debug="true"/>
 
 //The following extensions are required to save or restore state of a tree
 dojo.require("dojo.widget.TreeLoadingController");
 dojo.require("dojo.widget.TreeControllerExtension");
 
 dojo.addOnLoad(function() {
   dojo.lang.mixin(dojo.widget.byId('treeController'),
dojo.widget.TreeControllerExtension.prototype);
   //The following code will make sure that the saveExpandedIndices
function is called everytime a node
   //is collapsed or expanded
   dojo.event.topic.subscribe("contentTree/expand",saveExpandedIndices);
   dojo.event.topic.subscribe("contentTree/collapse",saveExpandedIndices);

   
 });
 
 //The following function saves the state of the tree
 function saveExpandedIndices() {
   // You can save this object as tree persistent state
   indices = dojo.widget.byId('treeController').saveExpandedIndices(
     dojo.widget.byId('contentTree')
   );
   /*
   * "indices" is a javascript object which is nothing but a
multi-dimension arrays containing indices of all expanded nodes
   * I am saving this object inside a cookie. You can have a different
implementation...
   * I am using json.js to convert the object into a string
   * and then a custom function called storeCookie which stores the string
in a cookie
   */
   storeCookie("categoryTreeState",indices.toJSONString(),1);
 }
.
.
.
 //The following function restores the state of the tree. This can probably
be called body-onload
 //You will have to pass it the stored indices object though
 function restoreExpandedIndices(indices) {
     dojo.widget.byId('treeController').restoreExpandedIndices(
     dojo.widget.byId('contentTree'), indices
   );
 }
.
.
.
</head>
<body>
.
.
.
<div dojoType="TreeLoadingController" widgetId="treeController"
RPCUrl="local"></div>
<s:tree id="contentTree"
   name="contentTree"
   theme = "ajax"
       rootNode="%{category}"
       childCollectionProperty="categoryList"
       nodeIdProperty="identifierString"
       nodeTitleProperty="name">
</s:tree>
.
.
.
</body>

Hope this helps.

Manu

-- --Original Message-- --
From: Session A Mwamufiya [mailto:smwamufi@(protected)]
Sent: Wednesday, September 05, 2007 10:34 PM
To: Struts Users Mailing List
Cc: Struts Users Mailing List
Subject: Re: reloading a tree at a certain level of expension

Anyone knows whether this feature has been added in yet?

> Session A Mwamufiya wrote:
>> I'm relaunching this thread in case an s:tree expert may have missed it
>> the first time around :).
>>
>>> Is there a way that when a s:tree is reloaded, it expends to a
>>> particular level of expansion?  I presume that I will save that
>>> expansion level in my session object, but I'm not sure how to get it
>>> or set the tree to it, or if it's even possible.
>
>
> Looking into TreeSelector API I found a selectedNode parameter - will it
> do the job? Feel free to ask Struts2 developers to include selectedNode
> parameter into s:tree tag if is does what you expect (and if it's not
> included there yet - sometimes S2 code changes faster than its
> documentation).
>
> Oleg
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To
> unsubscribe, e-mail: user-unsubscribe@(protected) For additional
> commands, e-mail: user-help@(protected)
>
>
>


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)




-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.