You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Scott Ellsworth <sc...@alodar.com> on 2004/06/08 22:51:51 UTC

I am having trouble wrapping my mind around the state model

To recap, I have a tree.  I have implemented a ITreeDataModel, but I am  
using the default SimpleTreeModel FullTreeSessionStateManager, and the  
SessionStateModel created deep inside the SimpleTreeModel.

Clicking on the root node of my tree causes a page refresh, but the  
tree does not open.

I have logging in all of the method of my root node's TreeNode  
subclass, and the TreeDataModel, so I know that my tree nodes are being  
created, and my inserts are being called.  Further, getObject with the  
UID of my root node is getting called once by me in treeStateChanged.

I suspect I am not properly implementing the treeStateChanged method.

A click on the root node causes treeStateChanged to be called, and the  
node id is the node id of my root node.  So far, so good.

Here is the code:
public void treeStateChanged(TreeStateEvent event) {
	logger.info("treeStateChanged("+event+')');
	logger.info("Type: "+event.getEventType());
	logger.info("UID: "+event.getNodeUID());
	logger.info("Model: "+event.getTreeStateModel());
	Object node =  
getActiveQueueTreeModel().getTreeDataModel().getObject(event.getNodeUID( 
));
	logger.info("Node is " + node);
	event.getTreeStateModel().expand(node);
}

This should, if I understand it right, cause the node to expand.  It  
does not, though, and I am mystified.

I also never see getChildCount, getChildren, children, isLeaf, etc., of  
my root node's TreeNode subclass getting called, so it looks like  
Tapestry is not trying to expand the root, even though I ask it to in  
treeStateChanged.  Similarly, I never see getChildren get called on  
that root node in my TreeDataModel subclass.

Any ideas?

Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: I am having trouble wrapping my mind around the state model

Posted by Shawn Edwards <se...@theedwards.org>.
Can you elaborate on this? I'm having the same problem you were having 
and I'm understanding the explanation you give.  Was the fix a 
modification of your serialized class or abandoning 'implements 
Serializable' or ???

Thanks in advance.

On Tuesday 08 June 2004 20:26, Scott Ellsworth wrote:
> I figured out what was happening.  As one might expect, the state
> model and the listeners were a red herring.  The actual problem was
> coming from my unique key sent back from the tree model.  For some
> reason, when I used a serializable class, things worked poorly.
>
> I will track it down later, but wanted to send feedback that my core
> problems have pretty much been solved.
>
> Scott
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org

-- 
Shawn Edwards
sedwards@theedwards.org

If it was so, it might be; and it were so, it would be; 
but as it isn't, it ain't. That's logic. - Lewis Carrol

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: I am having trouble wrapping my mind around the state model

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 8, 2004, at 9:26 PM, Scott Ellsworth wrote:
> I figured out what was happening.  As one might expect, the state 
> model and the listeners were a red herring.  The actual problem was 
> coming from my unique key sent back from the tree model.  For some 
> reason, when I used a serializable class, things worked poorly.

You have to make sure that .equals and .hashCode are implemented 
properly.  That is the real trick here.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: I am having trouble wrapping my mind around the state model

Posted by Scott Ellsworth <sc...@alodar.com>.
I figured out what was happening.  As one might expect, the state model 
and the listeners were a red herring.  The actual problem was coming 
from my unique key sent back from the tree model.  For some reason, 
when I used a serializable class, things worked poorly.

I will track it down later, but wanted to send feedback that my core 
problems have pretty much been solved.

Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org