-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Igor Vaynberg
Sent:
Tuesday, March 28, 2006 12:46 PM
To: [email protected]
Subject: Re: [Wicket-user] Location of image files

 

it should work, what does the finished output look like. btw for tag w/out body you should use WebComponent not WebMarkupContainer.

-Igor

OK, I start with a class called “PicturePage” with the following HTML.  Note that there is a src attribute hardcoded to “BagsPosition.png” for the sake of previewing:

 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en">

<head>

  <link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>

          <img wicket:id = "picture" alt="Picture" src="BagsPosition.png"/>

</body>

</html>

 

My PicturePage class with the changes you’ve suggested is:

 

package common.components.pictures;

import wicket.markup.html.WebPage;

import wicket.PageParameters;

import wicket.AttributeModifier;

import wicket.model.Model;

import wicket.markup.html.WebComponent;

 

public class PicturePage extends WebPage {

 

  public PicturePage( PageParameters pageParameters ) {

    String pictureFile = pageParameters.getString("pictureFile");

 

    WebComponent wmc = new WebComponent("picture");

    wmc.add( new AttributeModifier( "src", true, new Model(pictureFile) )  );

    add( wmc );

  }

}

 

My test-page with two links, each of which should cause an image to pop-up was rendered by Wicket as:

 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en">
<head>
  <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
    <span wicket:id="link1"><wicket:panel>
    <a href="/SpssWebModule/commonTest?wicket:bookmarkablePage=popupPageMap:common.components.pictures.PicturePage&amp;filename=PrimaryChutes.png" wicket:id="popupLink" onclick="window.open(href, '', 'scrollbars=yes,location=no,menuBar=no,resizable=yes,status=no,toolbar=no,width=1000,height=500');  return false;">
      <span wicket:id="popupText">Primary Chutes</span>
    </a>
  </wicket:panel></span>
    <br />
    <span wicket:id="link2"><wicket:panel>
    <a href="/SpssWebModule/commonTest?wicket:bookmarkablePage=popupPageMap:common.components.pictures.PicturePage&amp;filename=Secondary.png" wicket:id="popupLink" onclick="window.open(href, '', 'scrollbars=yes,location=no,menuBar=no,resizable=yes,status=no,toolbar=no,width=1000,height=500');  return false;">
      <span wicket:id="popupText">Secondary</span>
    </a>
  </wicket:panel></span>
</body>
</html>

 

Note that the page parameters seem to be set correctly to two different image files (“PrimaryChutes.png” and “Secondary.png”).  Clicking on the first one yields the original hardcoded default picture (“BagsPosition.png”).  When I view page source I get:

 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/" xml:lang="en" lang="en">
<head>
  <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
          <img wicket:id="picture" src="BagsPosition.png" alt="Picture"/>
</body>
</html>

 

Note that my src attribute was not replaced.  In fact, it appears as if nothing at all has been done to the HTML file upon which PicturePage is based.

 

Reply via email to