PDA

View Full Version : Displaying pictures in a form panel



Ced4ver
28 Aug 2009, 10:23 PM
Hi,

I want to get a photo in a form panel, in order the users could describe the content of the pic.

I tried doing this with a 2 column layout. It works fine when I wrap the path of the pic in a Html() object, but I would prefer doing this whith a layout container (like in ListView sample)

Off course, Image have parameters that I have to play with

Thanks for any help.

Here is my code :


lc = new LayoutContainer(new ColumnLayout());
// DATA TEST
Photo photo1 = new Photo("http://www.server.com/001.jpg","D109_001","BUlk");

//

LayoutContainer left = new LayoutContainer();
left.setStyleAttribute("paddingRight", "5px");
left.setStyleAttribute("paddingLeft", "5px");
FormLayout layout = new FormLayout();
layout.setLabelAlign(LabelAlign.TOP);
left.setLayout(layout);

TextField<String> titDestination = new TextField<String>();
titDestination.setFieldLabel("Titre Destination");
left.add(titDestination, formData);

(...)

LayoutContainer right = new LayoutContainer(new CenterLayout());
right.setStyleAttribute("paddingRight", "5px");
right.setStyleAttribute("paddingLeft", "5px");
right.setBorders(true);
image=new LayoutContainer(new FitLayout());
detailTp = XTemplate.create(getTemplate());
detailTp.overwrite(image.getElement(), Util.getJsObject(photo1));

right.add(image);
lc.add(left, new ColumnData(.5));
lc.add(right, new ColumnData(.5));