Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Viritin - AbstractForm -Vertical Scrollbar
Hi,
I use the AbstractForm of viritin (1.49).
My form is (vertically) larger than my browser window.
However, if I open the form (by myform.openInModalPopup()), no vertical scrollbar is shown.
Therefore, I can not scroll to the bottom of the form (containing the submit and cancel buttons).
If I enter something in the form, the scrollbar is shown.
How can I ensure that the scrollbar is shown directly after opening the form?
Thanks
Hi,
There appears to be some issue in the layouts you are using. Could you share your form code so somebody could investigate it. The debug dialog (opened with ?debug query paramter) also has a functionality that might help you to discover some layout issues.
cheers,
mastti
Dear Matti,
Please find below some code:
First the form itself (MyForm) and then its superclass JAbstractForm.
Strange thing is that sometimes the form opens with vertical scrollbars and sometimes not.
Best,
JG
------------------------------------------------------------------
One of the classes that gives a problem:
public class MyForm extends JAbstractForm<MyClass> {
@EJB(name = "MyClassService")
MyClassService s;
private MTextField myattr= new MTextField("my attr");
....
@PropertyId("myProp")
JMultiSelectTable<Property> myProp = (JMultiSelectTable<Property>) new JMultiSelectTable<ElementaryDevice>(
"myProp", "my prop").withProperties("prop")
.withColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
@Inject
private javax.enterprise.event.Event<mySavedEvent> saveEvent;
@Inject
private javax.enterprise.event.Event<myResetEvent> resetEvent;
private AbstractForm.SavedHandler<DeviceType> formSaveHandler = new AbstractForm.SavedHandler<MyClass>() {
@Override
public void onSave(DeviceType type) {
...
}
};
private AbstractForm.ResetHandler<MyClass> formResetHandler = new AbstractForm.ResetHandler<MyClass>() {
@Override
public void onReset(MyClass entity) {
....
}
};
public MyForm () {
super();
setEagerValidation(true);
setSavedHandler(formSaveHandler);
setResetHandler(formResetHandler);
getFormLayout().addComponent(myattr);
...
}
@Override
public MBeanFieldGroup<DeviceType> setEntity(DeviceType entity) {
myattr.setRequired(true);
myattr.setReadOnly(false);
....
MBeanFieldGroup<MyClass> fg = super.setEntity(entity);
return fg;
}
@Override
protected Component createContent() {
return (super.createContent());
}
...
}
--------------------------------------------------
// the super class I use for all forms:
public abstract class JAbstractForm<P extends Identifiable>
extends AbstractForm<P> {
private MFormLayout formLayout;
public JAbstractForm() {
super();
setFormLayout(new MFormLayout());
}
/**
* @return the formLayout
*/
public MFormLayout getFormLayout() {
return formLayout;
}
/**
* @param formLayout
* the formLayout to set
*/
public void setFormLayout(MFormLayout formLayout) {
this.formLayout = formLayout;
}
protected void addComponents(FormLayout fl) {
// placeholder
}
protected void setComponents() {
// placeholder
}
@Override
public MBeanFieldGroup<P> setEntity(Identifiable entity) {
MBeanFieldGroup<Identifiable> fg = (MBeanFieldGroup<Identifiable>) super.setEntity(
(P) entity);
return (MBeanFieldGroup<P>) fg;
}
@Override
protected Component createContent() {
// getFormLayout().setSizeFull();
getFormLayout().setSizeUndefined();
getFormLayout().setMargin(false);
for (Component component : formLayout) {
component.setWidth(100, Unit.PERCENTAGE);
}
Layout toolbar = getToolbar();
VerticalLayout layout = new MVerticalLayout(formLayout)
.add(toolbar, Alignment.BOTTOM_RIGHT).expand(formLayout);
toolbar.setVisible(true);
for (Component component : formLayout) {
component.setReadOnly(false);
}
return layout;
}
}
Which browser/OS are you using? I tried to replicate the issue, but couldn't do it. It might be because of the incomplete test code as well. If you can e.g. provide an example project in github or as zip file, it might be easier to reproduce the issue.
cheers,
matti
Hi Matty,
I used Chrome and Edge on Win 10.
I'll try to create an example project.
Best,
-- JG