Re: [s2] Confused about s:tree
In my case, I'm retrieving a specific data object from a persistent store and acting on it. However, the only reason I need the list of child nodes is for the s:tree menu, not in other places where I'll use that object, so I'm retrieving the children separately. Then again, even using this technique, I could always set the childList property on my parent data object before exiting the action, so my question is kind of a moot point. Thanks for your insight :) -Brian On 3/20/07, Dave Newton [EMAIL PROTECTED] wrote: snip That I also don't know, so I wonder why I'm replying to this at all! I would have assumed that children needed to belong to the root node, since that's kind of the definition of a tree. d.
Re: [s2] Confused about s:tree
Hey Dave, That helps a lot, thanks! Do you know if the childCollectionProperty has to be a Set, or can it be anything that implements the Collection interface? Also, is there any way to force childCollectionProperty to look in the action class containing the rootNode object, or does the set of children *have* to be a property of the rootNode object? -Brian On 3/19/07, Dave Newton [EMAIL PROTECTED] wrote: --- Brian Thompson [EMAIL PROTECTED] wrote: [... s:tree.../ issues] s:tree theme=ajax rootNode=%{rootNode} childCollectionProperty=children nodeIdProperty=id nodeTitleProperty=name treeSelectedTopic=treeSelected toggle=explode toggleDuration=0 cssClass=bptree id=bptree /s:tree In my case, rootNode is a Hibernate POJO that has a set name=children.../ mapping element with each element being the same type as the rootNode. So the pseudo-class for rootNode is: public class MyPojo { // s:tree.../ nodeIdProperty attribute @property Long id; // s:tree.../ nodeTitleProperty attribute @property String name; // s:tree.../ childCollectionProperty attribute @property SetMyPojo children; } Does that help? d.
Re: [s2] Confused about s:tree
Hey Martin, I was looking at the Action class you quoted as I was writing the original email in this thread. I saw that the example wanted a Category object for the tree, but I wasn't sure what that Category class was supposed to look like. Thanks, though. -Brian On 3/19/07, Martin Gainty [EMAIL PROTECTED] wrote: Brian Looking at public class DynamicTreeSelectAction extends ActionSupport which acquires the org.apache.struts.action2.showcase.ajax.tree.Categorycategory by nodeID as in private Category currentCategory; when the Action class acquires the Category by nodeID e.g. public String execute() throws Exception { currentCategory = Category.getById(nodeId); return SUCCESS; } Does this answer your question? M--
Re: [s2] Confused about s:tree
--- Brian Thompson wrote: Do you know if the childCollectionProperty has to be a Set, or can it be anything that implements the Collection interface? That I don't know (and I don't have the source in front of me) but I would hope any Collection would work... Famous last words ;) Also, is there any way to force childCollectionProperty to look in the action class containing the rootNode object, or does the set of children *have* to be a property of the rootNode object? That I also don't know, so I wonder why I'm replying to this at all! I would have assumed that children needed to belong to the root node, since that's kind of the definition of a tree. d. Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Confused about s:tree
The tree tag needs more documentation. I have it on my todo list for 2.1(read: Dave could you help on this one on the wiki? :) ) musachy On 3/20/07, Dave Newton [EMAIL PROTECTED] wrote: --- Brian Thompson wrote: Do you know if the childCollectionProperty has to be a Set, or can it be anything that implements the Collection interface? That I don't know (and I don't have the source in front of me) but I would hope any Collection would work... Famous last words ;) Also, is there any way to force childCollectionProperty to look in the action class containing the rootNode object, or does the set of children *have* to be a property of the rootNode object? That I also don't know, so I wonder why I'm replying to this at all! I would have assumed that children needed to belong to the root node, since that's kind of the definition of a tree. d. Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd
Re: [s2] Confused about s:tree
--- Musachy Barroso [EMAIL PROTECTED] wrote: The tree tag needs more documentation. I have it on my todo list for 2.1(read: Dave could you help on this one on the wiki? :) ) :p Yep, but it might not happen until the weekend. Busy little bee this week! Dave Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] Confused about s:tree
Hi, list I'm trying to render a list of objects from my action class as a tree menu using the Struts 2 s:tree tag, and I'm not having any luck. I can get the static example from planetstruts to work, but the dynamic example only leaves me scratching my head (Without digging in the source, how am I supposed to figure out what a Category class does?). The documentation for the tree tag ( http://struts.apache.org/2.0.6/docs/tree.html) is even worse. Can anyone point out some examples that include what I need to set up in my action class and how s:tree attributes should correspond to action/model class attributes? Thanks, -Brian
Re: [s2] Confused about s:tree
--- Brian Thompson [EMAIL PROTECTED] wrote: [... s:tree.../ issues] s:tree theme=ajax rootNode=%{rootNode} childCollectionProperty=children nodeIdProperty=id nodeTitleProperty=name treeSelectedTopic=treeSelected toggle=explode toggleDuration=0 cssClass=bptree id=bptree /s:tree In my case, rootNode is a Hibernate POJO that has a set name=children.../ mapping element with each element being the same type as the rootNode. So the pseudo-class for rootNode is: public class MyPojo { // s:tree.../ nodeIdProperty attribute @property Long id; // s:tree.../ nodeTitleProperty attribute @property String name; // s:tree.../ childCollectionProperty attribute @property SetMyPojo children; } Does that help? d. Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Confused about s:tree
Brian Looking at public class DynamicTreeSelectAction extends ActionSupport which acquires the org.apache.struts.action2.showcase.ajax.tree.Category category by nodeID as in private Category currentCategory; when the Action class acquires the Category by nodeID e.g. public String execute() throws Exception { currentCategory = Category.getById(nodeId); return SUCCESS; } Does this answer your question? M-- --- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. --- Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire. - Original Message - From: Brian Thompson [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, March 19, 2007 6:43 PM Subject: [s2] Confused about s:tree Hi, list I'm trying to render a list of objects from my action class as a tree menu using the Struts 2 s:tree tag, and I'm not having any luck. I can get the static example from planetstruts to work, but the dynamic example only leaves me scratching my head (Without digging in the source, how am I supposed to figure out what a Category class does?). The documentation for the tree tag ( http://struts.apache.org/2.0.6/docs/tree.html) is even worse. Can anyone point out some examples that include what I need to set up in my action class and how s:tree attributes should correspond to action/model class attributes? Thanks, -Brian