PDA

View Full Version : layout problem in panel-header



rotschi
20 Oct 2008, 1:38 AM
Hello

I have problem with layout the tool (refresh, collapsible etc. ) in the header from panels.
I'm working with GXT 1.1.1.
Here is an example (http://extjs.com/forum/attachment.php?attachmentid=10048&stc=1&d=1224494982).

And here is my code:
-----------------------------------------------------------------------
public class Test implements EntryPoint {

private VerticalPanel vp;

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new FlowLayout());

vp = new VerticalPanel();
vp.setSpacing(10);

createColumnForm();

viewport.add(vp);

RootPanel.get().add(viewport);

}

private void createColumnForm() {
FormPanel panel = new FormPanel();
panel.setFrame(true);
// panel.setIconStyle("icon-form");
panel.setCollapsible(true);
panel.setHeading("FormPanel");
panel.setSize(470, -1);
panel.setButtonAlign(HorizontalAlignment.CENTER);
panel.setLayout(new FlowLayout());

ToolButton tbRefresh = new ToolButton("x-tool-refresh");
tbRefresh.addSelectionListener(new SelectionListener() {
@Override
public void componentSelected(ComponentEvent ce) {
}

public void handleEvent(BaseEvent be) {
Dispatcher.forwardEvent(AppEvents.REFRESH_FILE_LIST);
}
});
panel.getHeader().addTool(tbRefresh);

LayoutContainer main = new LayoutContainer();
main.setWidth(450);
main.setLayout(new ColumnLayout());

LayoutContainer left = new LayoutContainer();

FormLayout layout = new FormLayout();
layout.setLabelAlign(LabelAlign.TOP);
left.setLayout(layout);

TextField<String> first = new TextField<String>();
first.setFieldLabel("First Name");
left.add(first);

TextField<String> company = new TextField<String>();
company.setFieldLabel("Company");
left.add(company);

DateField birthday = new DateField();
birthday.setFieldLabel("Birthday");
left.add(birthday);

LayoutContainer right = new LayoutContainer();

layout = new FormLayout();
layout.setLabelAlign(LabelAlign.TOP);
right.setLayout(layout);

TextField<String> last = new TextField<String>();
last.setFieldLabel("Last");
right.add(last);

TextField<String> email = new TextField<String>();
email.setFieldLabel("Email");
right.add(email);

Radio radio1 = new Radio();
radio1.setBoxLabel("Yes");

Radio radio2 = new Radio();
radio2.setBoxLabel("No");

RadioGroup group = new RadioGroup();
group.setFieldLabel("Ext GWT User");
group.add(radio1);
group.add(radio2);
right.add(group);

main.add(left, new ColumnData(.5));
main.add(right, new ColumnData(.5));

panel.add(main);

LayoutContainer area = new LayoutContainer();
area.setStyleAttribute("padding", "0 10px 5px 10px");
area.setWidth(450);

layout = new FormLayout();
layout.setLabelAlign(LabelAlign.TOP);
layout.setPadding(0);
area.setLayout(layout);

TextArea a = new TextArea();
a.setFieldLabel("Comment");

String adj = GXT.isIE ? "100%" : "-20"; // looking into
a.setData("anchorSpec", adj);
area.add(a);

panel.add(area);

panel.addButton(new Button("Cancel"));
panel.addButton(new Button("Submit"));

vp.add(panel);
}

-----------------------------------------------------------------------

Is this a bug or what is wrong in my code?

Sorry, for my bad english.

gslender
20 Oct 2008, 2:09 AM
make sure your doctype is html4.0 quirks mode

rotschi
20 Oct 2008, 3:34 AM
hi gslender

thanks for your support.

I have

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
doctype in my html-file.

the error continous to exist (hostend-mode and web-mode).

rotschi
20 Jan 2009, 2:26 AM
The Probelm does not exist with GXt version 1.2.1 any longer.