You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Watter <ma...@welchkin.net> on 2007/08/03 19:33:04 UTC

Link on one frame modifying component on another

I'm not a fan of frames, but in this particular situation, I don't have a lot
of control over the the content that's displayed in one of the frames so I
need to keep it separate from the rest of the application.

I have three frames. A header frame that stretches all the way across the
top, a navigation frame below the header on the left, and a content frame
below the header on the right. The header and navigation frames contain
standard wicket driven pages and the content frame will usually hold
external HTML content.

The navigation frame contains a Tree component. The Header contains links
for  'Next' and 'Previous'. A user can navigate either by clicking one of
the items in the tree or by clicking Next or  Previous in the header. 

I've got the actual navigation working. When someone clicks Next, Previous,
or a tree item, the content frame goes to the right place.  However, I can't
seem to figure out a way to update the Tree's visual indication of which
node is selected when I click Next or Previous in the Header. I thought that
perhaps some javascript magic might take place if I passed my navigation
page (called 'nav' int he code below) to the header frame,  and then did
something like:

add(new AjaxLink("nextLink") {

	public void onClick(final AjaxRequestTarget target) {
		target.addComponent(nav.getLearningItemTree());
		nav.getLearningItemTree().getTreeState().selectNode(nextNode, true);
	}
});

Well, this does actually update the backed of the Tree component, but the
actual visual representation of the tree in the navigation frame doesn't get
updated. Of course, if I put the same Next link actually ON the navigation
frame page, then it works as expected. 

So, it seems like this should be possible, somehow. The link on the
navigation page is simply a javascript call. I should be able to make that
same call from the header frame by means of a "parent.nav.xxxxx", but I
can't figure out what that xxxxx should be. Or maybe there's a call that
will simply refresh that tree component, or parts of it. 

Any ideas?

Matt 



-- 
View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11987813
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Link on one frame modifying component on another

Posted by Matej Knopp <ma...@gmail.com>.
Actually, you are overcomplicated things a bit i guess.
For the top frame, you don't need wicket at all, you just put there
regular link with javascript in onclick handler. That will invoke
parent.nav.clickNextLink(), which will in turn invoke the onclick
handler of wicket component (this is just a slight indirection so that
the top layer doesn't have to know exact id of the wicket link). And
the onclick handler will update the tree and content frame.

-Matej

On 8/3/07, Watter <ma...@welchkin.net> wrote:
>
>
> Matej Knopp-2 wrote:
> >
> > Hi, i think it should be possible to accomplish.
> >
> > Put the next/previous links to the page with the tree. Hide them (e.g.
> > putting inside <div style="display:none"/>
> >
> > Then on the top page in your prev/next links (in the javascript
> > handler) you need to find the corresponding link element in the tree
> > frame and call it's onclick handler.
> >
> > -Matej
> >
> Ha! That's clever! :)
>
> Just to be sure I understand. You are suggesting I modify the links in my
> header frame to not actually do anything except call hidden next and
> previous links in the navigation frame. Is that right?
>
> So that would seem to require javascript in those header next/previous
> links. As I'm sure you can tell, I'm still pretty new when it comes to
> Wicket. What would be the appropriate way to add that javascript? I've read
> hear and there that typically that kind of thing is added via Behaviors. Is
> that right? Or is it preferable to do something like:
>
> add(new AjaxLink("nextLink") {
>          public void onClick(final AjaxRequestTarget target) {
>                  target.appendJavascript("parent.nav.clickNextLink()");
>          }
> });
>
> Matt
> --
> View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11989365
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Link on one frame modifying component on another

Posted by Watter <ma...@welchkin.net>.

Matej Knopp-2 wrote:
> 
> Hi, i think it should be possible to accomplish.
> 
> Put the next/previous links to the page with the tree. Hide them (e.g.
> putting inside <div style="display:none"/>
> 
> Then on the top page in your prev/next links (in the javascript
> handler) you need to find the corresponding link element in the tree
> frame and call it's onclick handler.
> 
> -Matej
> 
Ha! That's clever! :)

Just to be sure I understand. You are suggesting I modify the links in my
header frame to not actually do anything except call hidden next and
previous links in the navigation frame. Is that right?

So that would seem to require javascript in those header next/previous
links. As I'm sure you can tell, I'm still pretty new when it comes to
Wicket. What would be the appropriate way to add that javascript? I've read
hear and there that typically that kind of thing is added via Behaviors. Is
that right? Or is it preferable to do something like:

add(new AjaxLink("nextLink") {
         public void onClick(final AjaxRequestTarget target) {
                 target.appendJavascript("parent.nav.clickNextLink()");
         }
}); 

Matt
-- 
View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11989365
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Link on one frame modifying component on another

Posted by Matej Knopp <ma...@gmail.com>.
Hi, i think it should be possible to accomplish.

Put the next/previous links to the page with the tree. Hide them (e.g.
putting inside <div style="display:none"/>

Then on the top page in your prev/next links (in the javascript
handler) you need to find the corresponding link element in the tree
frame and call it's onclick handler.

-Matej

On 8/3/07, Watter <ma...@welchkin.net> wrote:
>
> I'm not a fan of frames, but in this particular situation, I don't have a lot
> of control over the the content that's displayed in one of the frames so I
> need to keep it separate from the rest of the application.
>
> I have three frames. A header frame that stretches all the way across the
> top, a navigation frame below the header on the left, and a content frame
> below the header on the right. The header and navigation frames contain
> standard wicket driven pages and the content frame will usually hold
> external HTML content.
>
> The navigation frame contains a Tree component. The Header contains links
> for  'Next' and 'Previous'. A user can navigate either by clicking one of
> the items in the tree or by clicking Next or  Previous in the header.
>
> I've got the actual navigation working. When someone clicks Next, Previous,
> or a tree item, the content frame goes to the right place.  However, I can't
> seem to figure out a way to update the Tree's visual indication of which
> node is selected when I click Next or Previous in the Header. I thought that
> perhaps some javascript magic might take place if I passed my navigation
> page (called 'nav' int he code below) to the header frame,  and then did
> something like:
>
> add(new AjaxLink("nextLink") {
>
>         public void onClick(final AjaxRequestTarget target) {
>                 target.addComponent(nav.getLearningItemTree());
>                 nav.getLearningItemTree().getTreeState().selectNode(nextNode, true);
>         }
> });
>
> Well, this does actually update the backed of the Tree component, but the
> actual visual representation of the tree in the navigation frame doesn't get
> updated. Of course, if I put the same Next link actually ON the navigation
> frame page, then it works as expected.
>
> So, it seems like this should be possible, somehow. The link on the
> navigation page is simply a javascript call. I should be able to make that
> same call from the header frame by means of a "parent.nav.xxxxx", but I
> can't figure out what that xxxxx should be. Or maybe there's a call that
> will simply refresh that tree component, or parts of it.
>
> Any ideas?
>
> Matt
>
>
>
> --
> View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11987813
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Link on one frame modifying component on another

Posted by Matej Knopp <ma...@gmail.com>.
I believe what he needs is must finer grained update then refreshing
all pages. Fortunately, since the pages originate from same site, it
is possible to do using little bit of javascript.

-Matej

On 8/3/07, davor-x <da...@gmail.com> wrote:
>
> I think you need to refresh the frameset page.
> The link that updates framed windows should have the target attr set:
> target="_top". Handle the onClick in wicket and use setResponsePage(your
> frameset page). The in the frameset page, setup the src attributes for your
> frames.
>
> There is also a wicket example somewhere about links, frames, tragets..
> Bye
>
>
> Watter wrote:
> >
> > I'm not a fan of frames, but in this particular situation, I don't have a
> > lot of control over the the content that's displayed in one of the frames
> > so I need to keep it separate from the rest of the application.
> >
> > I have three frames. A header frame that stretches all the way across the
> > top, a navigation frame below the header on the left, and a content frame
> > below the header on the right. The header and navigation frames contain
> > standard wicket driven pages and the content frame will usually hold
> > external HTML content.
> >
> > The navigation frame contains a Tree component. The Header contains links
> > for  'Next' and 'Previous'. A user can navigate either by clicking one of
> > the items in the tree or by clicking Next or  Previous in the header.
> >
> > I've got the actual navigation working. When someone clicks Next,
> > Previous, or a tree item, the content frame goes to the right place.
> > However, I can't seem to figure out a way to update the Tree's visual
> > indication of which node is selected when I click Next or Previous in the
> > Header. I thought that perhaps some javascript magic might take place if I
> > passed my navigation page (called 'nav' int he code below) to the header
> > frame,  and then did something like:
> >
> > add(new AjaxLink("nextLink") {
> >
> >       public void onClick(final AjaxRequestTarget target) {
> >               target.addComponent(nav.getLearningItemTree());
> >               nav.getLearningItemTree().getTreeState().selectNode(nextNode, true);
> >       }
> > });
> >
> > Well, this does actually update the backed of the Tree component, but the
> > actual visual representation of the tree in the navigation frame doesn't
> > get updated. Of course, if I put the same Next link actually ON the
> > navigation frame page, then it works as expected.
> >
> > So, it seems like this should be possible, somehow. The link on the
> > navigation page is simply a javascript call. I should be able to make that
> > same call from the header frame by means of a "parent.nav.xxxxx", but I
> > can't figure out what that xxxxx should be. Or maybe there's a call that
> > will simply refresh that tree component, or parts of it.
> >
> > Any ideas?
> >
> > Matt
> >
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11988055
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Link on one frame modifying component on another

Posted by davor-x <da...@gmail.com>.
I think you need to refresh the frameset page.
The link that updates framed windows should have the target attr set:
target="_top". Handle the onClick in wicket and use setResponsePage(your
frameset page). The in the frameset page, setup the src attributes for your
frames.

There is also a wicket example somewhere about links, frames, tragets..
Bye


Watter wrote:
> 
> I'm not a fan of frames, but in this particular situation, I don't have a
> lot of control over the the content that's displayed in one of the frames
> so I need to keep it separate from the rest of the application.
> 
> I have three frames. A header frame that stretches all the way across the
> top, a navigation frame below the header on the left, and a content frame
> below the header on the right. The header and navigation frames contain
> standard wicket driven pages and the content frame will usually hold
> external HTML content.
> 
> The navigation frame contains a Tree component. The Header contains links
> for  'Next' and 'Previous'. A user can navigate either by clicking one of
> the items in the tree or by clicking Next or  Previous in the header. 
> 
> I've got the actual navigation working. When someone clicks Next,
> Previous, or a tree item, the content frame goes to the right place. 
> However, I can't seem to figure out a way to update the Tree's visual
> indication of which node is selected when I click Next or Previous in the
> Header. I thought that perhaps some javascript magic might take place if I
> passed my navigation page (called 'nav' int he code below) to the header
> frame,  and then did something like:
> 
> add(new AjaxLink("nextLink") {
> 
> 	public void onClick(final AjaxRequestTarget target) {
> 		target.addComponent(nav.getLearningItemTree());
> 		nav.getLearningItemTree().getTreeState().selectNode(nextNode, true);
> 	}
> });
> 
> Well, this does actually update the backed of the Tree component, but the
> actual visual representation of the tree in the navigation frame doesn't
> get updated. Of course, if I put the same Next link actually ON the
> navigation frame page, then it works as expected. 
> 
> So, it seems like this should be possible, somehow. The link on the
> navigation page is simply a javascript call. I should be able to make that
> same call from the header frame by means of a "parent.nav.xxxxx", but I
> can't figure out what that xxxxx should be. Or maybe there's a call that
> will simply refresh that tree component, or parts of it. 
> 
> Any ideas?
> 
> Matt 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Link-on-one-frame-modifying-component-on-another-tf4213856.html#a11988055
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org