Re: Wicket LinkTree subtree collapse/expand

2008-02-23 Thread Matej Knopp
Hi, I will certainly look at this once i have some spare time.

-Matej

On Sat, Feb 23, 2008 at 2:09 PM, Kent Tong <[EMAIL PROTECTED]> wrote:
>
>
>  Sebastiaan van Erk wrote:
>  >
>  > Ok, thanks for the quick reply. :-)
>  >
>  > https://issues.apache.org/jira/browse/WICKET-1366
>  >
>
>  I've added some comments to it. For a workaround, try:
>
>  tree = new LinkTree("t", model) {
> protected Component newNodeComponent(String id, IModel model) {
> return new LinkIconPanel(id, model, this) {
> protected void onNodeLinkClicked(TreeNode node,
> BaseTree tree, AjaxRequestTarget 
> target) {
> tree.getTreeState().selectNode(node,
> 
> !tree.getTreeState().isNodeSelected(node));
> onClicked(node, tree, target);
> }
> protected Component newContentComponent(String 
> componentId,
> BaseTree tree, IModel model) {
> return new Label(componentId, 
> getNodeTextModel(model));
> }
> };
> }
>
> protected void onClicked(TreeNode node, BaseTree tree,
>
> AjaxRequestTarget target) {
> if (!node.isLeaf()) {
> if (tree.getTreeState().isNodeExpanded(node)) {
> collapseAll(node);
> } else {
> expandAll(node);
> }
> tree.updateTree(target);
> } else {
> System.out.println(Arrays
> .toString(((DefaultMutableTreeNode) 
> node)
> 
> .getUserObjectPath()));
> }
> }
>  };
>
>
>
>  -
>  --
>  Kent Tong
>  Wicket tutorials freely available at http://www.agileskills2.org/EWDW
>  Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
>  --
>  View this message in context: 
> http://www.nabble.com/Wicket-LinkTree-subtree-collapse-expand-tp15639680p15651849.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Resizable and reorderable grid components.
http://www.inmethod.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket LinkTree subtree collapse/expand

2008-02-23 Thread Kent Tong


Sebastiaan van Erk wrote:
> 
> Ok, thanks for the quick reply. :-)
> 
> https://issues.apache.org/jira/browse/WICKET-1366
> 

I've added some comments to it. For a workaround, try:

tree = new LinkTree("t", model) {
protected Component newNodeComponent(String id, IModel model) {
return new LinkIconPanel(id, model, this) {
protected void onNodeLinkClicked(TreeNode node,
BaseTree tree, AjaxRequestTarget 
target) {
tree.getTreeState().selectNode(node,

!tree.getTreeState().isNodeSelected(node));
onClicked(node, tree, target);
}
protected Component newContentComponent(String 
componentId,
BaseTree tree, IModel model) {
return new Label(componentId, 
getNodeTextModel(model));
}
};
}

protected void onClicked(TreeNode node, BaseTree tree,
AjaxRequestTarget target) {
if (!node.isLeaf()) {
if (tree.getTreeState().isNodeExpanded(node)) {
collapseAll(node);
} else {
expandAll(node);
}
tree.updateTree(target);
} else {
System.out.println(Arrays
.toString(((DefaultMutableTreeNode) 
node)
.getUserObjectPath()));
}
}
};



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-LinkTree-subtree-collapse-expand-tp15639680p15651849.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket LinkTree subtree collapse/expand

2008-02-22 Thread Sebastiaan van Erk

Ok, thanks for the quick reply. :-)

https://issues.apache.org/jira/browse/WICKET-1366

Regards,
Sebastiaan

Igor Vaynberg wrote:

looks like a bug in the tree, please file a jira issue

-igor


On Fri, Feb 22, 2008 at 9:57 AM, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:

Hi,

 I'm trying to have a wicket LinkTree collapse and expand subtrees when I
 click on the respective nodes. I have the following code:

tree = new LinkTree("tree", createTreeModel()) {
@Override
protected void onNodeLinkClicked(final TreeNode node, 
final BaseTree
 tree, final AjaxRequestTarget target) {
if (!node.isLeaf()) {
if 
(tree.getTreeState().isNodeExpanded(node)) {
collapseAll(node);
} else {
expandAll(node);
}
tree.updateTree(target);
} else {

System.out.println(Arrays.toString(((DefaultMutableTreeNode)
 node).getUserObjectPath()));
}
}
};


 with the methods expandAll/collapseAll as follows:

protected void collapseAll(final TreeNode treeNode) {
tree.getTreeState().collapseNode(treeNode);
for (final Enumeration e = treeNode.children(); 
e.hasMoreElements();) {
collapseAll((TreeNode) e.nextElement());
}
}

protected void expandAll(final TreeNode treeNode) {
tree.getTreeState().expandNode(treeNode);
for (final Enumeration e = treeNode.children(); 
e.hasMoreElements();) {
expandAll((TreeNode) e.nextElement());
}
}

 However, I keep getting the following errors (specifically, this happens
 when I collapse a subtree first, and then collapse a subtree of which
 the other subtree is a sibling):

 java.lang.IllegalStateException: No Page found for component
 [MarkupContainer [Component id = 200, page = , path =
 200.AbstractTree$TreeItem]]
  at org.apache.wicket.Component.getPage(Component.java:1639)
  at
 
org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:689)
  at
 
org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:605)
  at
 org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:520)
  at
 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
  at
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241)
  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316)
  at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
  at
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354)
  at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
  at
 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  at
 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at
 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  at
 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  at
 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
  at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  at
 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  at
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  at java.lang.Thread.run(Thread.java:595)

 Does anybody have any ideas what I'm doing wrong and what the correct
 way to implement this is?

 Regards,
 Sebastiaan



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Wicket LinkTree subtree collapse/expand

2008-02-22 Thread Igor Vaynberg
looks like a bug in the tree, please file a jira issue

-igor


On Fri, Feb 22, 2008 at 9:57 AM, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I'm trying to have a wicket LinkTree collapse and expand subtrees when I
>  click on the respective nodes. I have the following code:
>
> tree = new LinkTree("tree", createTreeModel()) {
> @Override
> protected void onNodeLinkClicked(final TreeNode node, 
> final BaseTree
>  tree, final AjaxRequestTarget target) {
> if (!node.isLeaf()) {
> if 
> (tree.getTreeState().isNodeExpanded(node)) {
> collapseAll(node);
> } else {
> expandAll(node);
> }
> tree.updateTree(target);
> } else {
> 
> System.out.println(Arrays.toString(((DefaultMutableTreeNode)
>  node).getUserObjectPath()));
> }
> }
> };
>
>
>  with the methods expandAll/collapseAll as follows:
>
> protected void collapseAll(final TreeNode treeNode) {
> tree.getTreeState().collapseNode(treeNode);
> for (final Enumeration e = treeNode.children(); 
> e.hasMoreElements();) {
> collapseAll((TreeNode) e.nextElement());
> }
> }
>
> protected void expandAll(final TreeNode treeNode) {
> tree.getTreeState().expandNode(treeNode);
> for (final Enumeration e = treeNode.children(); 
> e.hasMoreElements();) {
> expandAll((TreeNode) e.nextElement());
> }
> }
>
>  However, I keep getting the following errors (specifically, this happens
>  when I collapse a subtree first, and then collapse a subtree of which
>  the other subtree is a sibling):
>
>  java.lang.IllegalStateException: No Page found for component
>  [MarkupContainer [Component id = 200, page = , path =
>  200.AbstractTree$TreeItem]]
>   at org.apache.wicket.Component.getPage(Component.java:1639)
>   at
>  
> org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:689)
>   at
>  
> org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:605)
>   at
>  org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:520)
>   at
>  
> org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
>   at
>  
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
>   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241)
>   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316)
>   at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
>   at
>  org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354)
>   at
>  org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
>   at
>  
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>   at
>  
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>   at
>  
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>   at
>  
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>   at
>  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>   at
>  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>   at
>  
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>   at
>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>   at
>  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>   at
>  
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>   at
>  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>   at java.lang.Thread.run(Thread.java:595)
>
>  Does anybody have any ideas what I'm doing wrong and what the correct
>  way to implement this is?
>
>  Regards,
>  Sebastiaan
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket LinkTree subtree collapse/expand

2008-02-22 Thread Sebastiaan van Erk

Hi,

I'm trying to have a wicket LinkTree collapse and expand subtrees when I 
click on the respective nodes. I have the following code:


tree = new LinkTree("tree", createTreeModel()) {
@Override
			protected void onNodeLinkClicked(final TreeNode node, final BaseTree 
tree, final AjaxRequestTarget target) {

if (!node.isLeaf()) {
if 
(tree.getTreeState().isNodeExpanded(node)) {
collapseAll(node);
} else {
expandAll(node);
}
tree.updateTree(target);
} else {
	System.out.println(Arrays.toString(((DefaultMutableTreeNode) 
node).getUserObjectPath()));

}
}
};


with the methods expandAll/collapseAll as follows:

protected void collapseAll(final TreeNode treeNode) {
tree.getTreeState().collapseNode(treeNode);
for (final Enumeration e = treeNode.children(); 
e.hasMoreElements();) {
collapseAll((TreeNode) e.nextElement());
}
}

protected void expandAll(final TreeNode treeNode) {
tree.getTreeState().expandNode(treeNode);
for (final Enumeration e = treeNode.children(); 
e.hasMoreElements();) {
expandAll((TreeNode) e.nextElement());
}
}

However, I keep getting the following errors (specifically, this happens 
when I collapse a subtree first, and then collapse a subtree of which 
the other subtree is a sibling):


java.lang.IllegalStateException: No Page found for component 
[MarkupContainer [Component id = 200, page = , path = 
200.AbstractTree$TreeItem]]

 at org.apache.wicket.Component.getPage(Component.java:1639)
 at 
org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:689)
 at 
org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:605)
 at 
org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:520)
 at 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
 at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)

 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
 at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354)
 at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

 at java.lang.Thread.run(Thread.java:595)

Does anybody have any ideas what I'm doing wrong and what the correct 
way to implement this is?


Regards,
Sebastiaan


smime.p7s
Description: S/MIME Cryptographic Signature