Hi, all
I refactor my ControlPanel.java which contains the Tree component as a
Border, and change others as page.
I think maybe this is panel swapping tech. (is Border nearly the same as
Panel?)
But when I click the tree, it looks that the page has been redirect to
others and certainly can not remember the state.

I am not sure what happened, and I use the following code to set links for
the tree.

            @Override
            protected MarkupContainer newNodeLink(MarkupContainer parent,
String id, TreeNode node) {
                DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode)
node;
                NavigationTreeNode navigationTreeNode = (NavigationTreeNode)
treeNode.getUserObject();
                if (navigationTreeNode.isURL) {
                    BookmarkablePageLink pageLink = new
BookmarkablePageLink(id, navigationTreeNode.getURL());
                    return pageLink;
                } else {
                    return super.newNodeLink(parent, id, node);
                }
            }


I can not find much reference about Panel Swapping tech from the internet,
So I tried Border. Is there some thing wrong with my code?

Thanks very much.



On Tue, Aug 18, 2009 at 1:55 AM, jWeekend <jweekend_for...@cabouge.com>wrote:

>
> Yes, Igor's solution is easier (and will remember other tree state beyond
> just which nodes are expanded) if you are able to use this panel swapping
> technique instead of your current markup-inheritance solution for the
> common
> menu (tree).
>
> It looks like a common decision one has to make: whether to pass components
> around (remember, only ever use a component instance on a single page
> instance at any one time!) versus just passing around component state (in
> this case, which nodes are expanded and which are collapsed).
>
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket Training and Development
> http://jWeekend.com
>
>
> igor.vaynberg wrote:
> >
> > instead of navigating between pages and passing the tree state around
> > why not simply swap panels. that way the tree instance is the same and
> > keeps its state.
> >
> > -igor
> >
> > On Mon, Aug 17, 2009 at 8:23 AM, Haulyn R. Jason<saharab...@gmail.com>
> > wrote:
> >> Yes, that's right, is that a way to tell the new page(and the new
> >> instance
> >> of the tree), the status of the old tree?
> >> I means expand the node which I clicked?
> >>
> >> Thanks!
> >>
> >>
> >> On Sat, Aug 15, 2009 at 9:00 AM, jWeekend
> >> <jweekend_for...@cabouge.com>wrote:
> >>
> >>>
> >>> Is your menu (tree) in some parent page class that both the first and
> >>> the
> >>> linked-to page extend? When you go to a new page instance you will get
> a
> >>> new
> >>> instance of the Tree.
> >>>
> >>> Regards - Cemal
> >>> jWeekend
> >>> OO & Java Technologies, Wicket Training and Development
> >>> http://jWeekend.com
> >>>
> >>>
> >>> Haulyn Jason-2 wrote:
> >>> >
> >>> > No, just use Tree in extension package.
> >>> >
> >>> > On Fri, Aug 14, 2009 at 11:17 PM, Igor Vaynberg
> >>> > <igor.vaynb...@gmail.com>wrote:
> >>> >
> >>> >> are you using LinkTree?
> >>> >>
> >>> >> -igor
> >>> >>
> >>> >> On Fri, Aug 14, 2009 at 12:15 AM, Haulyn R.
> >>> Jason<saharab...@gmail.com>
> >>> >> wrote:
> >>> >> > Hi,all:
> >>> >> >
> >>> >> > I design a page with a tree for page navigation. But I can not
> find
> >>> >> more
> >>> >> > information from Internet to learn how to use the Tree component.
> >>> >> >
> >>> >> > I can display the tree as
> >>> >> >
> >>> >> > menu1
> >>> >> >    |-sub_menu1
> >>> >> >    |-sub_menu2
> >>> >> > menu2
> >>> >> >    |-sub_menu3
> >>> >> >    |-sub_menu4
> >>> >> >
> >>> >> > and I remove root node, make all tree expand while init the tree,
> >>> but
> >>> I
> >>> >> do
> >>> >> > not know how to add links to the sub_menus, I tried to add some
> >>> code
> >>> >> like
> >>> >> > this:
> >>> >> >            @Override
> >>> >> >            protected void onNodeLinkClicked(AjaxRequestTarget
> >>> target,
> >>> >> > TreeNode node) {
> >>> >> >                DefaultMutableTreeNode treeNode =
> >>> >> (DefaultMutableTreeNode)
> >>> >> > node;
> >>> >> >                NavigationTreeNode navigationTreeNode =
> >>> >> (NavigationTreeNode)
> >>> >> > treeNode.getUserObject();
> >>> >> >                if (navigationTreeNode.isURL) {
> >>> >> >                    setResponsePage(navigationTreeNode.getURL());
> >>> >> >                    super.onNodeLinkClicked(target, node);
> >>> >> >                } else {
> >>> >> >                    super.onNodeLinkClicked(target, node);
> >>> >> >                }
> >>> >> >            }
> >>> >> >
> >>> >> > this looks work well, but when I clink on a link, the page
> redirect
> >>> to
> >>> >> the
> >>> >> > target page, but I can not keep the tree with the selected node
> >>> expand.
> >>> >> >
> >>> >> > Can anyone help me or give me some reference URLs? Thanks!
> >>> >> >
> >>> >> > --
> >>> >> > ------------------
> >>> >> > Enjoy. Thanks!
> >>> >> >
> >>> >> > Mobile: +086-15864011231
> >>> >> > email: saharab...@gmail.com, hmp.hau...@foxmail.com
> >>> >> > website: http://haulynjason.net
> >>> >> > gtalk: saharab...@gmail.com
> >>> >> > yahoo: jia_hao...@yahoo.com
> >>> >> > msn: saharab...@gmail.com
> >>> >> > skype: saharabear
> >>> >> > QQ: 378606292
> >>> >> >
> >>> >> > Haulyn Jason
> >>> >> >
> >>> >>
> >>> >>
> ---------------------------------------------------------------------
> >>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> > ------------------
> >>> > Enjoy. Thanks!
> >>> >
> >>> > Mobile: +086-15864011231
> >>> > email: saharab...@gmail.com, hmp.hau...@foxmail.com
> >>> > website: http://haulynjason.net
> >>> > gtalk: saharab...@gmail.com
> >>> > yahoo: jia_hao...@yahoo.com
> >>> > msn: saharab...@gmail.com
> >>> > skype: saharabear
> >>> > QQ: 378606292
> >>> >
> >>> > 贾昊林 Haulyn Jason
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p24980702.html
> >>> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>
> >>>
> >>
> >>
> >> --
> >> ------------------
> >> Enjoy. Thanks!
> >>
> >> Haulyn Microproduction
> >>
> >> Mobile: +086-15864011231
> >> email: saharab...@gmail.com,
> >>         hmp.hau...@foxmail.com
> >> website: http://haulynjason.net
> >> gtalk: saharab...@gmail.com
> >> yahoo: jia_hao...@yahoo.com
> >> msn: saharab...@gmail.com
> >> skype: saharabear
> >> QQ: 378606292
> >>
> >> Haulyn Jason
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p25011340.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
------------------
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
         hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason

Reply via email to