I'm not doing anything special to renderHead so it's getting called whatever 
the default is. 
(I thought every page, now I'm not so sure.)


arrowModel is just a private class on the Panel that looks like this:

private class arrowModel implements IModel<Map<String, Object>>
  {
      private Map<String, Object> map;

      arrowModel(Map<String, Object> map) { this.map = map; }

      /**
       * Gets the model object.
       *
       * @return The model object
       */
      public Map<String, Object> getObject() { return map; }

      /** Sets the model object.
       * @param object The model object
       */
      public void setObject(Map<String, Object> object) { }

      /**
       * Detaches model after use. This is generally used to null out transient
       * references that can be
       * re-attached later.
       */
      public void detach() { }
  }

I should probably mention I'm using Wicket 1.5.5

Thanks,
Tom Burton

-----Original Message-----
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Wednesday, April 04, 2012 11:48 AM
To: users@wicket.apache.org
Subject: Re: TextTemplateResourceReference problem

Hi Tom,

Is ArrowModel and the TTRR recreated for for every page ? I guess the answer is 
YES but I need to ask.
Please create a quickstart and attach it to Jira so we can take a look.

On Wed, Apr 4, 2012 at 9:18 PM, Burton, Tom F (DOR) <tom.bur...@alaska.gov> 
wrote:
> Hello,
>
>  I have a component(It displays a menu common across the pages of my
> application.)
>
> All the WebPages in my application inherit from BasePage which 
> includes the menu.
>
>
>
> BasePage includes a component MainMenu, which creates a List of 
> Lists(that contain page links)
>
> The Lists of lists are then wrapped inside of jQuerySlideMenu.
>
>
>
> jQuerySlideMenu has the following method defined
>
> renderHead(IHeaderResponse response)
>
> {
>
>    super.renderHead(response);
>
>    response
>
>                .renderCSSReference(new 
> PackageResourceReference(AppBasePage.class,
>
>
> "includes/css/jqueryslidemenu.css"));
>
>    response
>
>                .renderCSSReference(new 
> PackageResourceReference(AppBasePage.class,
>
>
> "includes/css/printjqueryslidemenu.css"), "print");
>
>
>
>    Map<String, Object> arrows = new HashMap<String, Object>(2);
>
>
>
>    /*
>
>     * TODO: look into Meta-inf staticing the resources (faster)
>
>     * uses MetaInfStaticResourceReference
>
>     * requires the files to be mounted under
>
>     * /META-INF/resources in the final jar
>
>     */
>
>    //TODO: look at finding a way to make sure it gets redone for every 
> page
>
>    PackageResourceReference down =
>
>           new PackageResourceReference(AppBasePage.class,
>
>                                        "includes/menu_down.gif");
>
>    PackageResourceReference right =
>
>               new PackageResourceReference(AppBasePage.class,
>
>                                            "includes/menu_right.gif");
>
>
>
>   arrows.put("menu_down", urlFor(down, null));
>
>   arrows.put("menu_right",   urlFor(right, null));
>
>
>
>    /* this works
>
>    String prefix = getRequest().getContextPath() + "/";
>
>    arrows.put("menu_down", prefix + urlFor(down, null));
>
>    arrows.put("menu_right", prefix + urlFor(right, null));
>
>   */
>
>
>
>    //arrow model just implements IModel to pass arrows for getObject()
>
>    arrowModel model = new arrowModel(arrows);
>
>    response.renderJavaScriptReference(
>
>      new TextTemplateResourceReference(AppBasePage.class,
>
>
> "includes/javascript/jqueryslidemenu.js", model));
>
> }
>
>
>
> When I initially login it works great for /home,  or other 
> /mountedPageName pages, but if I follow a link to 
> /wicket/bookmarkable/full.class.name/?stuffhere  the images will not 
> display.
>
>
>
> It works if I prefix contextPath/ infront of the url.  But some of my 
> sites are behind a proxy, and I would like this to work there as well.
>
>
>
> Thank you for any help,
>
> Tom Burton
>
>
>
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to