Re: tree reload problem

2005-02-11 Thread Sean Schofield
> Becareful, there are the myfaces tree component(with his strucutre and
> model), and the jsf component tree ( interface form's represantion )
> Here i speak about the jsf component tree. Update this code, it's just
> an example, you have to find in jsf tree where is the myfaces component
> and then remove it.

Don't you really need to replace the tree instead of removing it?  I
thought if you just removed the tree from JSF tree that it won't get
rendered.  You're not dumping the whole JSF tree are you?  (That's not
what your code shows.)  Also, I assume you have a new model for the
new tree.

If you guys didn't know I am working on a new Tree for MyFaces.  Its
going to be much simpler to configure and hopefully more powerful.  On
Monday I am going to submit it to the CVS repository (on the trunk) as
tree2.  It will be tree2 until we are satisified with it and can get
rid of the original tree.

In the new tree all you would need to do is update the model that
underlies the tree component.  You leave the JSF tree alone.  Just
update the data you provide the tree and it will re-render.  The only
catch is that if you replace the tree data, it wouldn't know which of
the nodes was open earlier.  That would be a bit tricky but it could
be managed (possibly by an extended class or renderer.)

Stay tuned for the new tree.  I definitely need help testing it.  I
should have a pretty good server-side only example on Monday.  The
javascript version will follow shortly!

sean
 
> Adrien,


Re: tree reload problem

2005-02-11 Thread Adrien FOURES
Steffen,
I have in interface commandButton with an actionlistener who exectute this:
public void resetTree2(ActionEvent event) {
 try{
  UIComponent UIPater = event.getComponent().getParent().getParent();
  UIComponent UITree2 = UIPater.findComponent("tree2");
  UIPater.getChildren().remove(UITree2);
   }...
}
So jsf automaticly rebuild her tree model, and take the update. it's not 
an beautiful solution but it's work !!
Becareful, there are the myfaces tree component(with his strucutre and 
model), and the jsf component tree ( interface form's represantion )
Here i speak about the jsf component tree. Update this code, it's just 
an example, you have to find in jsf tree where is the myfaces component 
and then remove it.

Adrien,
Steffen Hankiewicz wrote:
Hello all again. Dear Adrien,
Thanks  a  lot  for  your response. I'm at home now, so that I can not
test your solution until tomorrow. But how do you exactly destroy your
tree?
And  if  you  really  destroy  it  to build it new: isn't your current
visualized   structure  (the  expanded  and  collapsed  nodes)  also
destroyed,  so that all the expanded nodes are collapsed again? How do
you restore the view exactly as it was before the update of the tree?
Thanks again for your help,
Steffen
 



Re: tree reload problem

2005-02-10 Thread Steffen Hankiewicz
Hello all again. Dear Adrien,

Thanks  a  lot  for  your response. I'm at home now, so that I can not
test your solution until tomorrow. But how do you exactly destroy your
tree?

And  if  you  really  destroy  it  to build it new: isn't your current
visualized   structure  (the  expanded  and  collapsed  nodes)  also
destroyed,  so that all the expanded nodes are collapsed again? How do
you restore the view exactly as it was before the update of the tree?

Thanks again for your help,

Steffen



Re: tree reload problem

2005-02-10 Thread Adrien FOURES
Steffen,
I have the same problem, to solve it i destroy  the tree component in 
the jsf model, when you update the tree structure.

Adrien
Steffen Hankiewicz wrote:
Hi all,
I have a little problem with my treeview. I'd like to give the user the
possibility to change the order of the tree items. Now the user for
example clicks a button to move the current node up to another parent
(the parent of his parent). Until now all works fine. The node gets
indeed another parent. But in my form the tree never gets updated. I
tried all I can. But the tree never gets reloaded. The node stays
visually under its former parent.
Can you give me any advise, how to solve this problem?
Thanks a lot,
Steffen
Here is my code so far:

   /**
* move node up
*/
   public String NodeUp() {
   myLogger.debug("Metadaten() - NodeUp() Start");
   // get the parents
   DefaultMutableTreeNode oldFather = (DefaultMutableTreeNode) 
myNode.getParent();
   DefaultMutableTreeNode newFather = (DefaultMutableTreeNode) 
myNode.getParent().getParent();
   myLogger.info("old father: " + oldFather);
   myLogger.info("new father: " + newFather);
   // set the new parent
   myNode.setParent((DefaultMutableTreeNode) newFather);
   myLogger.info("new father after: " + 
myNode.getParent().toString());
   // all these commands don't update the tree
   // myTree.nodeStructureChanged(newFather);
   // myTree.nodeStructureChanged(oldFather);
   // myTree.nodeStructureChanged((DefaultMutableTreeNode) 
myTree.getRoot());
   myLogger.debug("Metadaten() - NodeUp() End");
   // show the same page again
   return null;
   }


 



tree reload problem

2005-02-10 Thread Steffen Hankiewicz
Hi all,

I have a little problem with my treeview. I'd like to give the user the
possibility to change the order of the tree items. Now the user for
example clicks a button to move the current node up to another parent
(the parent of his parent). Until now all works fine. The node gets
indeed another parent. But in my form the tree never gets updated. I
tried all I can. But the tree never gets reloaded. The node stays
visually under its former parent.

Can you give me any advise, how to solve this problem?

Thanks a lot,

Steffen

Here is my code so far:



/**
 * move node up
 */
public String NodeUp() {
myLogger.debug("Metadaten() - NodeUp() Start");

// get the parents
DefaultMutableTreeNode oldFather = (DefaultMutableTreeNode) 
myNode.getParent();
DefaultMutableTreeNode newFather = (DefaultMutableTreeNode) 
myNode.getParent().getParent();
myLogger.info("old father: " + oldFather);
myLogger.info("new father: " + newFather);

// set the new parent
myNode.setParent((DefaultMutableTreeNode) newFather);
myLogger.info("new father after: " + 
myNode.getParent().toString());

// all these commands don't update the tree
// myTree.nodeStructureChanged(newFather);
// myTree.nodeStructureChanged(oldFather);
// myTree.nodeStructureChanged((DefaultMutableTreeNode) 
myTree.getRoot());

myLogger.debug("Metadaten() - NodeUp() End");
// show the same page again
return null;
}