scaswell1
8 Jul 2009, 4:27 AM
This code worked in GXT 1.2.4. I'm not wholly sure why it has stopped functioning.
The essence of the idea is that I will have various fields to display in a window.
I want to group them together as I see fit. This includes arranging the fields in columns or rows. The fields need to resize to fit their containers according to the size of the window (as the window changes size, so should the fields.)
I wasn't sure how to do it, so the approach I took was to:
Create a field set
Add to that field set a LayoutContainer with a FlowLayout
Inside the LayoutContainer, add LayoutContainers utilizing whichever layout I wish
i.e., Add an LC with a ColumnLayout and add to that LCs with fields added to them.
And then add an LC using FitLayout with an LC with fields added to it.
This would make two columns of fields taking up whatever width I require, and then fields taking up the entire width below that. I'll attach some sample code:
mainDetails.setHeading("Main Details"); //mainDetails is a FieldSet
mainDetails.setCollapsible(true);
mainDetails.addListener(Events.Expand, new Listener<FieldSetEvent>() {
public void handleEvent(FieldSetEvent be) {
window.layout();
}
});
mainDetails.addListener(Events.Collapse, new Listener<FieldSetEvent>() {
public void handleEvent(FieldSetEvent be) {
window.layout();
}
});
LayoutContainer main = new LayoutContainer();
main.setLayout(new FlowLayout());
LayoutContainer details = new LayoutContainer();
details.setLayout(new ColumnLayout());
LayoutContainer left = new LayoutContainer();
left.setLayout(createLayout()); //createLayout: see below
advertiser.setFieldLabel("Advertiser");
left.add(advertiser, FDATA); // fyi, FDATA = FormData("100%");
confirmNum.setFieldLabel("Confirmation");
left.add(confirmNum, FDATA);
resConfirmBox.setLabelSeparator("");
left.add(resConfirmBox, FDATA);
details.add(left, new ColumnData(HALF_COL_OR_ROW)); // add container as left column taking up half total space
//HALF_COL_OR_ROW = .5
LayoutContainer right = new LayoutContainer();
right.setLayout(createLayout());
arriveStatus.setFieldLabel("Arrival Status");
right.add(arriveStatus, FDATA);
adNumber.setFieldLabel("Ad Number");
right.add(adNumber, FDATA);
arrivalType.setReadOnly(true);
arrivalType.setLabelSeparator("");
right.add(arrivalType, FDATA);
details.add(right, new ColumnData(HALF_COL_OR_ROW)); // add container as right column taking up half total space
main.add(details);
mainDetails.add(details);
private FormLayout createLayout() {
FormLayout flayoutr = new FormLayout();
flayoutr.setLabelAlign(LabelAlign.LEFT);
flayoutr.setLabelWidth(LABEL_LEN);
return flayoutr;
}This worked perfectly in GXT 1.2.4. After migration, it does not. The field sets will resize (as indicated by the borders as the window resizes). I do not believe the columns in the ColumnLayout are resizing, but they should be.
Looking for any comments about how to do this more efficiently, what bug/new behavior/removed behavior is causing this, and/or alternatives.
Thanks!
The essence of the idea is that I will have various fields to display in a window.
I want to group them together as I see fit. This includes arranging the fields in columns or rows. The fields need to resize to fit their containers according to the size of the window (as the window changes size, so should the fields.)
I wasn't sure how to do it, so the approach I took was to:
Create a field set
Add to that field set a LayoutContainer with a FlowLayout
Inside the LayoutContainer, add LayoutContainers utilizing whichever layout I wish
i.e., Add an LC with a ColumnLayout and add to that LCs with fields added to them.
And then add an LC using FitLayout with an LC with fields added to it.
This would make two columns of fields taking up whatever width I require, and then fields taking up the entire width below that. I'll attach some sample code:
mainDetails.setHeading("Main Details"); //mainDetails is a FieldSet
mainDetails.setCollapsible(true);
mainDetails.addListener(Events.Expand, new Listener<FieldSetEvent>() {
public void handleEvent(FieldSetEvent be) {
window.layout();
}
});
mainDetails.addListener(Events.Collapse, new Listener<FieldSetEvent>() {
public void handleEvent(FieldSetEvent be) {
window.layout();
}
});
LayoutContainer main = new LayoutContainer();
main.setLayout(new FlowLayout());
LayoutContainer details = new LayoutContainer();
details.setLayout(new ColumnLayout());
LayoutContainer left = new LayoutContainer();
left.setLayout(createLayout()); //createLayout: see below
advertiser.setFieldLabel("Advertiser");
left.add(advertiser, FDATA); // fyi, FDATA = FormData("100%");
confirmNum.setFieldLabel("Confirmation");
left.add(confirmNum, FDATA);
resConfirmBox.setLabelSeparator("");
left.add(resConfirmBox, FDATA);
details.add(left, new ColumnData(HALF_COL_OR_ROW)); // add container as left column taking up half total space
//HALF_COL_OR_ROW = .5
LayoutContainer right = new LayoutContainer();
right.setLayout(createLayout());
arriveStatus.setFieldLabel("Arrival Status");
right.add(arriveStatus, FDATA);
adNumber.setFieldLabel("Ad Number");
right.add(adNumber, FDATA);
arrivalType.setReadOnly(true);
arrivalType.setLabelSeparator("");
right.add(arrivalType, FDATA);
details.add(right, new ColumnData(HALF_COL_OR_ROW)); // add container as right column taking up half total space
main.add(details);
mainDetails.add(details);
private FormLayout createLayout() {
FormLayout flayoutr = new FormLayout();
flayoutr.setLabelAlign(LabelAlign.LEFT);
flayoutr.setLabelWidth(LABEL_LEN);
return flayoutr;
}This worked perfectly in GXT 1.2.4. After migration, it does not. The field sets will resize (as indicated by the borders as the window resizes). I do not believe the columns in the ColumnLayout are resizing, but they should be.
Looking for any comments about how to do this more efficiently, what bug/new behavior/removed behavior is causing this, and/or alternatives.
Thanks!