RE: best way to accommodate dynamic properties

2011-12-05 Thread Daniel Watrous
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.watr...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: best way to accommodate dynamic properties

2011-12-05 Thread Martin Grigorov
class MyImage extends WebComponent {

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

On Mon, Dec 5, 2011 at 7:16 PM, Daniel Watrous
daniel.watr...@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.watr...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




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

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



Re: best way to accommodate dynamic properties

2011-12-05 Thread John Toncart
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.watr...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



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



Re: best way to accommodate dynamic properties

2011-12-05 Thread Igor Vaynberg
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 john.tonc...@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.watr...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


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


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