Thanks, I will give it a try. > -----Original Message----- > From: Beyonder Unknown [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 20, 2008 9:16 AM > To: [email protected] > Subject: Re: Custom JavaScript Panel ? > > > Hi Warren, > > Try this. Have your panel implement IHeaderContributor, and > implement the method: > > /** > * This method will call this javascript to set the button to > its default state. > */ > public void renderHead(IHeaderResponse response) { > response.renderOnDomReadyJavascript("foo();"); > } > > > Hope this helps. > > Best, > Wen Tong > > > -- > The only constant in life is change. > > ----- Original Message ---- > From: Warren <[EMAIL PROTECTED]> > To: [email protected] > Sent: Tuesday, February 19, 2008 3:22:42 PM > Subject: Custom JavaScript Panel ? > > 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] > > > > > > > > __________________________________________________________________ > __________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
--------------------------------------------------------------------- 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]
