cyChop
6 Jan 2012, 2:30 AM
Hi there!
I have a problem with the use of FormPanels. Actually not all FormPanels, but I can't say the difference between them.
I have two FormPanels in the same LayoutContainer. When I resize the container, the fields of the first one are resized, the second one is not. If I duplicate the first one, both are layouted on resize, so I guess I am missing something in panels initialization, but I can't tell what.
Also, all FormPanels are resized, only inner fields are not (used the border to make sure).
I have other examples of FormPanels in a LayoutContainer whose fields won't resize, but their initilizations look the same.
So does somebody have a clue about what could hinder a FormPanel's fields dynamic resizing? Would it be linked to pre/post-render addition?
Thanks in advance,
-----
Not sure code will help, but just in case, here is some sample from first case.
Container is initialized as follows:
// extends LayoutContainer
// basically a form with a combobox to choose displayed form
// create a combobox displaying the available screens
this.setLayout(new RowLayout(Orientation.VERTICAL));
ComboBox<ScreenEntry> formList = new ComboBox<ScreenEntry>();
ListStore<ScreenEntry> formStore = new ListStore<ScreenEntry>();
formStore.add(this.getScreens());
formList.setStore(formStore);
formList.setFieldLabel(getComboLabel());
formList.setDisplayField(ScreenEntry.FIELD_LABEL);
formList.setAllowBlank(false);
formList.setForceSelection(true);
formList.setTriggerAction(TriggerAction.ALL);
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setBodyBorder(false);
form.setLabelSeparator(labels.forms_labels_separator());
form.setLabelAlign(LabelAlign.TOP);
form.add(formList, new FormData("100%"));
// margin is negative at bottom to compensate FormPanel's padding
this.add(form, new RowData(1, -1, new Margins(0, 0, -15, 0)));
final RowData data = new RowData(1, -1, new Margins(0));
formList.addSelectionChangedListener(new SelectionChangedListener<ScreenEntry>() {
// switch form
@Override
public void selectionChanged(SelectionChangedEvent<ScreenEntry> se) {
if (currentScreen != null) {
remove(currentScreen);
}
currentScreen = se.getSelectedItem().getScreen();
add(currentScreen, data);
layout();
currentScreen.resetPanel();
}
});
The second form, that will not resize, is reset as follows:
// extends LayoutContainer
public void resetPanel() {
this.log.debug("resetPanel");
this.removeAll();
this.formPanel = new FormPanel();
this.formPanel.setHeaderVisible(false);
this.formPanel.setBodyBorder(false);
this.formPanel.setButtonAlign(HorizontalAlignment.CENTER);
this.formPanel.setLabelSeparator(this.labels.forms_labels_separator());
this.formPanel.setLabelAlign(LabelAlign.TOP);
for (Field<?> f : getSearchFields()) {
f.addListener(Events.SpecialKey, this.returnSubmitter);
this.formPanel.add(f, this.formData100);
}
// Form buttons
Button searchButton =
new Button(this.labels.forms_search(), this.icons.viewmagMedium(),
new SearchSelectionListener());
searchButton.setScale(ButtonScale.MEDIUM);
FormButtonBinding binding = new FormButtonBinding(formPanel);
binding.addButton(searchButton);
this.formPanel.addButton(searchButton);
Button reinitButton =
new Button(this.labels.forms_reinit_short(), this.icons.cancelMedium(),
new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
ECMSimpleSearchSide.this.formPanel.clear();
}
});
reinitButton.setScale(ButtonScale.MEDIUM);
this.formPanel.addButton(reinitButton);
this.add(formPanel);
if (this.isRendered()) {
this.layout();
}
}
GXT 2.1.1, Web mode, Chromium/FireFox 4+
I have a problem with the use of FormPanels. Actually not all FormPanels, but I can't say the difference between them.
I have two FormPanels in the same LayoutContainer. When I resize the container, the fields of the first one are resized, the second one is not. If I duplicate the first one, both are layouted on resize, so I guess I am missing something in panels initialization, but I can't tell what.
Also, all FormPanels are resized, only inner fields are not (used the border to make sure).
I have other examples of FormPanels in a LayoutContainer whose fields won't resize, but their initilizations look the same.
So does somebody have a clue about what could hinder a FormPanel's fields dynamic resizing? Would it be linked to pre/post-render addition?
Thanks in advance,
-----
Not sure code will help, but just in case, here is some sample from first case.
Container is initialized as follows:
// extends LayoutContainer
// basically a form with a combobox to choose displayed form
// create a combobox displaying the available screens
this.setLayout(new RowLayout(Orientation.VERTICAL));
ComboBox<ScreenEntry> formList = new ComboBox<ScreenEntry>();
ListStore<ScreenEntry> formStore = new ListStore<ScreenEntry>();
formStore.add(this.getScreens());
formList.setStore(formStore);
formList.setFieldLabel(getComboLabel());
formList.setDisplayField(ScreenEntry.FIELD_LABEL);
formList.setAllowBlank(false);
formList.setForceSelection(true);
formList.setTriggerAction(TriggerAction.ALL);
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setBodyBorder(false);
form.setLabelSeparator(labels.forms_labels_separator());
form.setLabelAlign(LabelAlign.TOP);
form.add(formList, new FormData("100%"));
// margin is negative at bottom to compensate FormPanel's padding
this.add(form, new RowData(1, -1, new Margins(0, 0, -15, 0)));
final RowData data = new RowData(1, -1, new Margins(0));
formList.addSelectionChangedListener(new SelectionChangedListener<ScreenEntry>() {
// switch form
@Override
public void selectionChanged(SelectionChangedEvent<ScreenEntry> se) {
if (currentScreen != null) {
remove(currentScreen);
}
currentScreen = se.getSelectedItem().getScreen();
add(currentScreen, data);
layout();
currentScreen.resetPanel();
}
});
The second form, that will not resize, is reset as follows:
// extends LayoutContainer
public void resetPanel() {
this.log.debug("resetPanel");
this.removeAll();
this.formPanel = new FormPanel();
this.formPanel.setHeaderVisible(false);
this.formPanel.setBodyBorder(false);
this.formPanel.setButtonAlign(HorizontalAlignment.CENTER);
this.formPanel.setLabelSeparator(this.labels.forms_labels_separator());
this.formPanel.setLabelAlign(LabelAlign.TOP);
for (Field<?> f : getSearchFields()) {
f.addListener(Events.SpecialKey, this.returnSubmitter);
this.formPanel.add(f, this.formData100);
}
// Form buttons
Button searchButton =
new Button(this.labels.forms_search(), this.icons.viewmagMedium(),
new SearchSelectionListener());
searchButton.setScale(ButtonScale.MEDIUM);
FormButtonBinding binding = new FormButtonBinding(formPanel);
binding.addButton(searchButton);
this.formPanel.addButton(searchButton);
Button reinitButton =
new Button(this.labels.forms_reinit_short(), this.icons.cancelMedium(),
new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
ECMSimpleSearchSide.this.formPanel.clear();
}
});
reinitButton.setScale(ButtonScale.MEDIUM);
this.formPanel.addButton(reinitButton);
this.add(formPanel);
if (this.isRendered()) {
this.layout();
}
}
GXT 2.1.1, Web mode, Chromium/FireFox 4+