You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Daniel Watrous <Da...@bodybuilding.com> on 2011/12/03 01:19:44 UTC

best way to accommodate dynamic properties

I'm interested in having pulling the width and height for an img from a database, but I'm not sure what the best way is to create a component and corresponding HTML mapping.

Please send an example or link to previous response if possible. I've searched the users list archives but didn't find what I was looking for.

Thanks.

Re: best way to accommodate dynamic properties

Posted by Igor Vaynberg <ig...@gmail.com>.
class myimage extends image {
  oncomponenttag(tag) {
      Integer width=getImageWidth();
      Integer height=getImageHeight();
      if (width!=null) tag.put("width", width);
      if (height!=null) tag.put("height", height);
  }}

-igor

On Mon, Dec 5, 2011 at 10:20 AM, John Toncart <jo...@gmail.com> wrote:
> I think you can't do this without markup. Put in DB binary data, width and
> height and pul it out then and with this data modify markup. If image
> doesn't have exif data you don't know dimensions (I think...)
>
>
>
> Daniel Watrous wrote:
>>
>> I'm still trying to figure this out. I would like to be able to do
>> something like the following:
>>
>> HTML:
>> <img wicket:id="testimage">
>>
>> JAVA:
>> public class ImageTestPage extends WebPage{
>>    public ImageTestPage() {
>>        Image myImg = new Image("testimage");
>>        myImg.setUrlForImageSrc("http://path/to/image.gif");
>>        myImg.setWidth(200);
>>        myImg.setHeight(100);
>>        add(myImg);
>>    }
>> }
>>
>> Obviously the Image class doesn't work that way... Can someone tell me how
>> I would accomplish this so that I can define the image, height and width
>> independent from the markup?
>>
>> Daniel
>>
>> -----Original Message-----
>> From: Daniel Watrous [mailto:Daniel.Watrous@bodybuilding.com] Sent:
>> Friday, December 02, 2011 5:20 PM
>> To: users@wicket.apache.org
>> Subject: best way to accommodate dynamic properties
>>
>> I'm interested in having pulling the width and height for an img from a
>> database, but I'm not sure what the best way is to create a component and
>> corresponding HTML mapping.
>>
>> Please send an example or link to previous response if possible. I've
>> searched the users list archives but didn't find what I was looking for.
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> 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
>

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


Re: best way to accommodate dynamic properties

Posted by John Toncart <jo...@gmail.com>.
I think you can't do this without markup. Put in DB binary data, width 
and height and pul it out then and with this data modify markup. If 
image doesn't have exif data you don't know dimensions (I think...)


Daniel Watrous wrote:
> I'm still trying to figure this out. I would like to be able to do something like the following:
> 
> HTML:
> <img wicket:id="testimage">
> 
> JAVA:
> public class ImageTestPage extends WebPage{
>     public ImageTestPage() {
>         Image myImg = new Image("testimage");
>         myImg.setUrlForImageSrc("http://path/to/image.gif");
>         myImg.setWidth(200);
>         myImg.setHeight(100);
>         add(myImg);
>     }
> }
> 
> Obviously the Image class doesn't work that way... Can someone tell me how I would accomplish this so that I can define the image, height and width independent from the markup?
> 
> Daniel
> 
> -----Original Message-----
> From: Daniel Watrous [mailto:Daniel.Watrous@bodybuilding.com] 
> Sent: Friday, December 02, 2011 5:20 PM
> To: users@wicket.apache.org
> Subject: best way to accommodate dynamic properties
> 
> I'm interested in having pulling the width and height for an img from a database, but I'm not sure what the best way is to create a component and corresponding HTML mapping.
> 
> Please send an example or link to previous response if possible. I've searched the users list archives but didn't find what I was looking for.
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> 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: best way to accommodate dynamic properties

Posted by Martin Grigorov <mg...@apache.org>.
class MyImage extends WebComponent {

  public void onComponentTag(ComponentTag tag) {
     tag.put("src", url);
    ...
  }
}

On Mon, Dec 5, 2011 at 7:16 PM, Daniel Watrous
<Da...@bodybuilding.com> wrote:
> I'm still trying to figure this out. I would like to be able to do something like the following:
>
> HTML:
> <img wicket:id="testimage">
>
> JAVA:
> public class ImageTestPage extends WebPage{
>    public ImageTestPage() {
>        Image myImg = new Image("testimage");
>        myImg.setUrlForImageSrc("http://path/to/image.gif");
>        myImg.setWidth(200);
>        myImg.setHeight(100);
>        add(myImg);
>    }
> }
>
> Obviously the Image class doesn't work that way... Can someone tell me how I would accomplish this so that I can define the image, height and width independent from the markup?
>
> Daniel
>
> -----Original Message-----
> From: Daniel Watrous [mailto:Daniel.Watrous@bodybuilding.com]
> Sent: Friday, December 02, 2011 5:20 PM
> To: users@wicket.apache.org
> Subject: best way to accommodate dynamic properties
>
> I'm interested in having pulling the width and height for an img from a database, but I'm not sure what the best way is to create a component and corresponding HTML mapping.
>
> Please send an example or link to previous response if possible. I've searched the users list archives but didn't find what I was looking for.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



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

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


RE: best way to accommodate dynamic properties

Posted by Daniel Watrous <Da...@bodybuilding.com>.
I'm still trying to figure this out. I would like to be able to do something like the following:

HTML:
<img wicket:id="testimage">

JAVA:
public class ImageTestPage extends WebPage{
    public ImageTestPage() {
        Image myImg = new Image("testimage");
        myImg.setUrlForImageSrc("http://path/to/image.gif");
        myImg.setWidth(200);
        myImg.setHeight(100);
        add(myImg);
    }
}

Obviously the Image class doesn't work that way... Can someone tell me how I would accomplish this so that I can define the image, height and width independent from the markup?

Daniel

-----Original Message-----
From: Daniel Watrous [mailto:Daniel.Watrous@bodybuilding.com] 
Sent: Friday, December 02, 2011 5:20 PM
To: users@wicket.apache.org
Subject: best way to accommodate dynamic properties

I'm interested in having pulling the width and height for an img from a database, but I'm not sure what the best way is to create a component and corresponding HTML mapping.

Please send an example or link to previous response if possible. I've searched the users list archives but didn't find what I was looking for.

Thanks.

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