IHeaderResponse has javadoc which explains all these methods...

-igor

On Feb 19, 2008 4:19 PM, Warren <[EMAIL PROTECTED]> wrote:
> What is the difference between IHeaderResponse renderJavascript(...),
> renderOnBeforeUnloadJavascript(...) and renderOnLoadJavascript(...) methods?
> I would like to add different chunks of JavaScript to the head based on the
> requirements of my Page. Can I do this?
>
> public void renderHead(IHeaderResponse response) {
>        response.renderJavascript("JavaScript 1 Blah Blah");
>        response.renderJavascript("JavaScript 2 Blah Blah");
>        response.renderJavascript("JavaScript 3 Blah Blah");
>          ...
>     }
>
> Will each one of the renderJavascript(...) overwrite the previous one or
> will they be added together?
>
>
>
>
> > -----Original Message-----
> > From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, February 19, 2008 3:43 PM
> > To: [email protected]
> > Subject: Re: Custom JavaScript Panel ?
> >
> >
> > instead of a panel use IHeaderContributor. you can make the page or
> > any component in the page implement it.
> >
> > -igor
> >
> >
> > On Feb 19, 2008 3:22 PM, Warren <[EMAIL PROTECTED]> wrote:
> > > I am trying to design a Panel that dynamically creates
> > JavaScript into the
> > > <head> markup. I understand how to do this statically, but not
> > dynamically.
> > > My app runs on wireless PDA scanning devices used in grocery
> > stores. One of
> > > the requirements is that it does not allow the user to place
> > focus on any
> > > other part of the page other than where I want it. I did this
> > statically on
> > > every JSP I had in my last Struts version app. It would be nice to add a
> > > panel to each page that would dynamically create the JavaScript
> > needed based
> > > on the relevant components that need focus. Something like this:
> > >
> > > public class MyPage extends WebPage
> > > {
> > >
> > >         public MyPage()
> > >         {
> > >
> > >                 add(...);
> > >                 add(...);
> > >                 add(...);
> > >
> > >                 ...
> > >
> > >                 add(new ForceFocusPanel("forceFocus", this));
> > >         }
> > >
> > >         ...
> > >
> > > }
> > >
> > >
> > > public class ForceFocusPanel extends Panel
> > > {
> > >         public ForceFocusPanel()
> > >         {
> > >                 // Iterate thru components on the original page
> > and add relevant ones and
> > > the necessary JavaScript
> > >                 // to some kind of repeater or ListView ?
> > >                 // Add this repeater to the markup template to
> > appear in the head markup ?
> > >                 add(relevantFocusComponent);
> > >         }
> > > }
> > >
> > > ForceFocusPanel.html
> > >
> > > <wicket:head>
> > > <script type="text/javascript">
> > > <??? wicket:id="relevantFocusComponents" />
> > > </script>
> > > </wicket:head>
> > > <wicket:panel>
> > > </wicket:panel>
> > >
> > > Here are my questions,
> > >
> > > 1. Please stop me if I am trying to reinvent the wheel and
> > point me to that
> > > magical component if there is one.
> > >
> > > 2. Since I only want to modify the original Page's <head>
> > markup, do I have
> > > to include the Panel's wicket:id somewhere on the original
> > Page's markup?
> > >
> > > 3. What method do I use to get the Page's components so that I
> > can iterate
> > > over them?
> > >
> > > 4. What type of component would I add to my Panel that would contain the
> > > relevant "focus components" JavaScript? A repeater of some kind
> > or ListView?
> > >
> > > 5. What type of markup would I use to place this repeater
> > component into my
> > > Panel's <head> markup and will this even work within the <head> markup?
> > >
> > > <wicket:head>
> > > <script type="text/javascript">
> > > ...
> > > <??? wicket:id="relevantFocusComponents" />
> > > ...
> > > </script>
> > > </wicket:head>
> > >
> > > I know this is a lot of questions, and by no means am I asking anyone to
> > > write code for me. I am just looking for hints, suggestions or
> > point me to
> > > some examples if available.
> > >
> > > Thanks,
> > >
> > > Warren Bell
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to