Re: Tree w/Checkbox on each node--Way to Fix Indent?
getNewUser() ); > tree = getContentProvider(); > } > > // First, compile a Set of the user's enterprises > List userEnts = pUser.getEnterprises(); > if( userEnts == null || userEnts.size() == 0) > { > return; > } > > Iterator userIt = userEnts.iterator(); > Set userEntSet = new HashSet(); > while( userIt.hasNext() ) > { > Enterprise userEnt = (Enterprise) userIt.next(); > userEntSet.add( userEnt.getName() ); > } > > // Next, go through the entepriseTree and display the user's checked > enteprises > List treeRoots = tree.getTreeRoots(); > Iterator it = treeRoots.iterator(); > > while( it.hasNext() ) > { > Object obj = it.next(); > > if( obj instanceof Folder ) > { > Folder aFolder = (Folder) obj; > String folderName = aFolder.getName(); > > if( userEntSet.contains( folderName ) ) > { > aFolder.setChecked( true ); > } > checkChildNodes( aFolder, userEntSet ); > > } > else if( obj instanceof Item ) > { > Item anItem = (Item) obj; > String itemName = anItem.getName(); > > if( userEntSet.contains( itemName ) ) > { > anItem.setChecked( true ); > } > } > } > } > > public void checkChildNodes( Folder pFolder, Set pUserEntSet ) > { > List items = pFolder.getItems(); > Iterator it = items.iterator(); > > while( it.hasNext() ) > { > Item anItem = (Item) it.next(); > if( pUserEntSet.contains( anItem.getName() ) ) > { > anItem.setChecked( true ); > } > } > > List folders = pFolder.getFolders(); > Iterator itF = folders.iterator(); > > while( itF.hasNext() ) > { > Folder aFolder = (Folder) itF.next(); > if( pUserEntSet.contains( aFolder.getName() ) ) > { > aFolder.setChecked( true ); > } > checkChildNodes( aFolder, pUserEntSet ); > } > } > > /** This method added to assist mock testing. */ > public User getUserByID( Long pUserID ) > { > return getAuthorizationService().getUserByID( pUserID ); > } > } > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tree-w-Checkbox-on-each-node--Way-to-Fix-Indent--tf1871290.html#a10131646 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tree w/Checkbox on each node--Way to Fix Indent?
Wow. So this is not just a mis-configured tree? Incidentally, I have found implementing Steve's proposed solution to be pretty challenging. I'm still going to work on it but it would be great if I didn't need to use the volatile. Thank you all for taking care of this. Thank you, Ty -- View this message in context: http://www.nabble.com/Tree-w-Checkbox-on-each-node--Way-to-Fix-Indent--tf1871290.html#a5127594 Sent from the Tapestry - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tree w/Checkbox on each node--Way to Fix Indent?
Ah ok, I've re-opened it. Thanks. On 6/30/06, Steve Shucker <[EMAIL PROTECTED]> wrote: Sorry, I mis-filed it. I saw this as a variation of bug 32 and added a comment on there (dated 5/3/2006). I just looked at the bug tracker and realized that bug had been long-closed. Do you want to reopen 32 or should I re-file? -Steve -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, June 30, 2006 10:48 AM To: Tapestry users Subject: Re: Tree w/Checkbox on each node--Way to Fix Indent? Is there an open issue for this in tacos? Seems like a big enough deal thing that I should fix it. http://tacoscomponents.jot.com/BugReporter On 6/30/06, Steve Shucker <[EMAIL PROTECTED]> wrote: > > I had this problem a while ago and traced it to a PartialFor component > within the tree that was persisting the contents incorrectly in the form. > It's using an iterator that doesn't track depth. As a workaround, you can > create your own html/jwc files for the Tree control (use taco's backing > class) and add a volatile=true property to the PartialFor component. It's > not ideal, but it's working great for me. > > -Steve > > -Original Message- > From: Tyrone Hed [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 29, 2006 9:57 PM > To: users@tapestry.apache.org > Subject: Tree w/Checkbox on each node--Way to Fix Indent? > > > >Folks, > I have developed a Tapestry app (4.0.1) that uses the Tree in > four > places. It works great in three of those places but not in the one that > includes a checkbox on each node of the tree. The problem is that it loses > track of the indent and gives all nodes of the tree the same indent as the > right-most node. So, as the user opens each node, the tree marches from > left > to right. In short, it looks like hell. I've looked at the generated > source > but it just piles on divs and spans to get the indent. The margin indent, > in > short, is broken when you have to enclose a tree in a FORM. Any > suggestions? > Here is my code. > Thank you, > > Ty > > > Files included: > > userEnterprises.page > userEnterprises.html > UserEnterprises.java > > --- > userEnterprises.page > --- > > class="com.tyco.web.pages.authorization.UserEnterprises"> > > Tree > > > > > > >/> > >name="state"value="enterpriseTreeState"/> > > > > > > > > > > > > > > > > --- > userEnterprises.html > --- > > > > >jwcid="tree" > id="tree" > keyProvider="ognl:keyProvider" > contentProvider="ognl:contentProvider" > > style="overflow: auto; width: auto; height: auto;"> >conditionValue="true"> > value="ognl:item.checked" /> > >conditionValue="ognl:true"> > value="ognl:item.name"/> > > > value="ognl:item.name"/> > > > > > > > > --- > UserEnterprises.java > > (I doubt this class will we useful in solving this problem > but just in case I am doing so for completeness.) > --- > > /* > * Created on Jan 17, 2006 > * > * Copyright 2005 Ingenix, Inc. All rights reserved. > * This file contains CONFIDENTIAL and PROPRIETARY information > * and should not be distributed without prior written permission. > */ > package com.ingenix.freya.web.pages.authorization; > > import java.util.ArrayList; > import java.util.HashSet; > import java.util.Iterator; > import java.util.List; > import java.util.Set; > > import org.apache.commons.logging.Log; > import org.apache.c
RE: Tree w/Checkbox on each node--Way to Fix Indent?
Sorry, I mis-filed it. I saw this as a variation of bug 32 and added a comment on there (dated 5/3/2006). I just looked at the bug tracker and realized that bug had been long-closed. Do you want to reopen 32 or should I re-file? -Steve -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, June 30, 2006 10:48 AM To: Tapestry users Subject: Re: Tree w/Checkbox on each node--Way to Fix Indent? Is there an open issue for this in tacos? Seems like a big enough deal thing that I should fix it. http://tacoscomponents.jot.com/BugReporter On 6/30/06, Steve Shucker <[EMAIL PROTECTED]> wrote: > > I had this problem a while ago and traced it to a PartialFor component > within the tree that was persisting the contents incorrectly in the form. > It's using an iterator that doesn't track depth. As a workaround, you can > create your own html/jwc files for the Tree control (use taco's backing > class) and add a volatile=true property to the PartialFor component. It's > not ideal, but it's working great for me. > > -Steve > > -Original Message- > From: Tyrone Hed [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 29, 2006 9:57 PM > To: users@tapestry.apache.org > Subject: Tree w/Checkbox on each node--Way to Fix Indent? > > > >Folks, > I have developed a Tapestry app (4.0.1) that uses the Tree in > four > places. It works great in three of those places but not in the one that > includes a checkbox on each node of the tree. The problem is that it loses > track of the indent and gives all nodes of the tree the same indent as the > right-most node. So, as the user opens each node, the tree marches from > left > to right. In short, it looks like hell. I've looked at the generated > source > but it just piles on divs and spans to get the indent. The margin indent, > in > short, is broken when you have to enclose a tree in a FORM. Any > suggestions? > Here is my code. > Thank you, > > Ty > > > Files included: > > userEnterprises.page > userEnterprises.html > UserEnterprises.java > > --- > userEnterprises.page > --- > > class="com.tyco.web.pages.authorization.UserEnterprises"> > > Tree > > > > > > >/> > >name="state"value="enterpriseTreeState"/> > > > > > > > > > > > > > > > > --- > userEnterprises.html > --- > > > > >jwcid="tree" > id="tree" > keyProvider="ognl:keyProvider" > contentProvider="ognl:contentProvider" > > style="overflow: auto; width: auto; height: auto;"> >conditionValue="true"> > value="ognl:item.checked" /> > >conditionValue="ognl:true"> > value="ognl:item.name"/> > > > value="ognl:item.name"/> > > > > > > > > --- > UserEnterprises.java > > (I doubt this class will we useful in solving this problem > but just in case I am doing so for completeness.) > --- > > /* > * Created on Jan 17, 2006 > * > * Copyright 2005 Ingenix, Inc. All rights reserved. > * This file contains CONFIDENTIAL and PROPRIETARY information > * and should not be distributed without prior written permission. > */ > package com.ingenix.freya.web.pages.authorization; > > import java.util.ArrayList; > import java.util.HashSet; > import java.util.Iterator; > import java.util.List; > import java.util.Set; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > import org.apache.tapestry.IRequestCycle; > import org.apache.tapestr
Re: Tree w/Checkbox on each node--Way to Fix Indent?
Is there an open issue for this in tacos? Seems like a big enough deal thing that I should fix it. http://tacoscomponents.jot.com/BugReporter On 6/30/06, Steve Shucker <[EMAIL PROTECTED]> wrote: I had this problem a while ago and traced it to a PartialFor component within the tree that was persisting the contents incorrectly in the form. It's using an iterator that doesn't track depth. As a workaround, you can create your own html/jwc files for the Tree control (use taco's backing class) and add a volatile=true property to the PartialFor component. It's not ideal, but it's working great for me. -Steve -Original Message- From: Tyrone Hed [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 9:57 PM To: users@tapestry.apache.org Subject: Tree w/Checkbox on each node--Way to Fix Indent? Folks, I have developed a Tapestry app (4.0.1) that uses the Tree in four places. It works great in three of those places but not in the one that includes a checkbox on each node of the tree. The problem is that it loses track of the indent and gives all nodes of the tree the same indent as the right-most node. So, as the user opens each node, the tree marches from left to right. In short, it looks like hell. I've looked at the generated source but it just piles on divs and spans to get the indent. The margin indent, in short, is broken when you have to enclose a tree in a FORM. Any suggestions? Here is my code. Thank you, Ty Files included: userEnterprises.page userEnterprises.html UserEnterprises.java --- userEnterprises.page --- Tree --- userEnterprises.html --- --- UserEnterprises.java (I doubt this class will we useful in solving this problem but just in case I am doing so for completeness.) --- /* * Created on Jan 17, 2006 * * Copyright 2005 Ingenix, Inc. All rights reserved. * This file contains CONFIDENTIAL and PROPRIETARY information * and should not be distributed without prior written permission. */ package com.ingenix.freya.web.pages.authorization; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.annotations.InjectState; import org.apache.tapestry.event.PageBeginRenderListener; import org.apache.tapestry.event.PageEvent; import com.tyco.api.authorization.AuthorizationFactory; import com.tyco.api.authorization.User; import com.tyco.api.enterprise.Enterprise; import com.tyco.web.components.authorization.AuthenticationListComponentBase; import com.tyco.web.components.enterprise.EnterpriseTreeContentProvider; import com.tyco.web.components.enterprise.Folder; import com.tyco.web.components.enterprise.Item; public abstract class UserEnterprises extends UserControllerPage implements PageBeginRenderListener { private List mPermissions; private Enterprise mEnterprise; @InjectState( "contentProvider" ) public abstract EnterpriseTreeContentProvider getContentProvider(); public abstract void setContentProvider( EnterpriseTreeContentProvider pEnterpriseTreeContentProvider ); @InjectState( "enterpriseTreeState" ) public abstract Set getEnterpriseTreeState(); public abstract void setEnterpriseTreeState( Set pEnterpriseTreeState ); @InjectState("newUser") public abstract User getNewUser(); public abstract void setNewUser(User val); public abstract Long getID(); protected Log mLog = LogFactory.getLog(this.getClass().getName()); public void pageBeginRender(PageEvent pEvent) { detectCheckedEnterprises( getNewUser() ); } public void activate(IRequestCycle pCycle) { Object[] parameters = pCycle.getListenerParameters(); if (parameters.length >= 2) { Long userID = (Long) parameters[1]; User user
RE: Tree w/Checkbox on each node--Way to Fix Indent?
I had this problem a while ago and traced it to a PartialFor component within the tree that was persisting the contents incorrectly in the form. It's using an iterator that doesn't track depth. As a workaround, you can create your own html/jwc files for the Tree control (use taco's backing class) and add a volatile=true property to the PartialFor component. It's not ideal, but it's working great for me. -Steve -Original Message- From: Tyrone Hed [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 9:57 PM To: users@tapestry.apache.org Subject: Tree w/Checkbox on each node--Way to Fix Indent? Folks, I have developed a Tapestry app (4.0.1) that uses the Tree in four places. It works great in three of those places but not in the one that includes a checkbox on each node of the tree. The problem is that it loses track of the indent and gives all nodes of the tree the same indent as the right-most node. So, as the user opens each node, the tree marches from left to right. In short, it looks like hell. I've looked at the generated source but it just piles on divs and spans to get the indent. The margin indent, in short, is broken when you have to enclose a tree in a FORM. Any suggestions? Here is my code. Thank you, Ty Files included: userEnterprises.page userEnterprises.html UserEnterprises.java --- userEnterprises.page --- Tree --- userEnterprises.html --- --- UserEnterprises.java (I doubt this class will we useful in solving this problem but just in case I am doing so for completeness.) --- /* * Created on Jan 17, 2006 * * Copyright 2005 Ingenix, Inc. All rights reserved. * This file contains CONFIDENTIAL and PROPRIETARY information * and should not be distributed without prior written permission. */ package com.ingenix.freya.web.pages.authorization; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.annotations.InjectState; import org.apache.tapestry.event.PageBeginRenderListener; import org.apache.tapestry.event.PageEvent; import com.tyco.api.authorization.AuthorizationFactory; import com.tyco.api.authorization.User; import com.tyco.api.enterprise.Enterprise; import com.tyco.web.components.authorization.AuthenticationListComponentBase; import com.tyco.web.components.enterprise.EnterpriseTreeContentProvider; import com.tyco.web.components.enterprise.Folder; import com.tyco.web.components.enterprise.Item; public abstract class UserEnterprises extends UserControllerPage implements PageBeginRenderListener { private List mPermissions; private Enterprise mEnterprise; @InjectState( "contentProvider" ) public abstract EnterpriseTreeContentProvider getContentProvider(); public abstract void setContentProvider( EnterpriseTreeContentProvider pEnterpriseTreeContentProvider ); @InjectState( "enterpriseTreeState" ) public abstract Set getEnterpriseTreeState(); public abstract void setEnterpriseTreeState( Set pEnterpriseTreeState ); @InjectState("newUser") public abstract User getNewUser(); public abstract void setNewUser(User val); public abstract Long getID(); protected Log mLog = LogFactory.getLog(this.getClass().getName()); public void pageBeginRender(PageEvent pEvent) { detectCheckedEnterprises( getNewUser() ); } public void activate(IRequestCycle pCycle) { Object[] parameters = pCycle.getListenerParameters(); if (parameters.length >= 2) { Long userID = (Long) parameters[1]; User user = getAuthorizationService().getUserByID(userID); setNewUser(user); List perm
Tree w/Checkbox on each node--Way to Fix Indent?
Folks, I have developed a Tapestry app (4.0.1) that uses the Tree in four places. It works great in three of those places but not in the one that includes a checkbox on each node of the tree. The problem is that it loses track of the indent and gives all nodes of the tree the same indent as the right-most node. So, as the user opens each node, the tree marches from left to right. In short, it looks like hell. I've looked at the generated source but it just piles on divs and spans to get the indent. The margin indent, in short, is broken when you have to enclose a tree in a FORM. Any suggestions? Here is my code. Thank you, Ty Files included: userEnterprises.page userEnterprises.html UserEnterprises.java --- userEnterprises.page --- Tree --- userEnterprises.html --- --- UserEnterprises.java (I doubt this class will we useful in solving this problem but just in case I am doing so for completeness.) --- /* * Created on Jan 17, 2006 * * Copyright 2005 Ingenix, Inc. All rights reserved. * This file contains CONFIDENTIAL and PROPRIETARY information * and should not be distributed without prior written permission. */ package com.ingenix.freya.web.pages.authorization; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.annotations.InjectState; import org.apache.tapestry.event.PageBeginRenderListener; import org.apache.tapestry.event.PageEvent; import com.tyco.api.authorization.AuthorizationFactory; import com.tyco.api.authorization.User; import com.tyco.api.enterprise.Enterprise; import com.tyco.web.components.authorization.AuthenticationListComponentBase; import com.tyco.web.components.enterprise.EnterpriseTreeContentProvider; import com.tyco.web.components.enterprise.Folder; import com.tyco.web.components.enterprise.Item; public abstract class UserEnterprises extends UserControllerPage implements PageBeginRenderListener { private List mPermissions; private Enterprise mEnterprise; @InjectState( "contentProvider" ) public abstract EnterpriseTreeContentProvider getContentProvider(); public abstract void setContentProvider( EnterpriseTreeContentProvider pEnterpriseTreeContentProvider ); @InjectState( "enterpriseTreeState" ) public abstract Set getEnterpriseTreeState(); public abstract void setEnterpriseTreeState( Set pEnterpriseTreeState ); @InjectState("newUser") public abstract User getNewUser(); public abstract void setNewUser(User val); public abstract Long getID(); protected Log mLog = LogFactory.getLog(this.getClass().getName()); public void pageBeginRender(PageEvent pEvent) { detectCheckedEnterprises( getNewUser() ); } public void activate(IRequestCycle pCycle) { Object[] parameters = pCycle.getListenerParameters(); if (parameters.length >= 2) { Long userID = (Long) parameters[1]; User user = getAuthorizationService().getUserByID(userID); setNewUser(user); List permissionList = getUserPermissions(user); setPermissions(permissionList); } // If Errors found then we need to keep user data with the error for redisplay else if ((getErrorMessage() == null) && (getPasswordError() == null)) { setNewUser(AuthorizationFactory.newUser()); } } /** * Although the superclass has its own save() method, * we need to override it here so that we can get capture * the checked enterprises. It is critical that we do not * execute the superclass save(). */ public void save() { IRequestCycle pCycle = this.getRequestCycle(); if( ACTION_EDIT_USER_UPDATE_ENTERPRISE