package com.example.vaadintest;
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings(“serial”)
@Theme(“vaadintest”)
public class VaadintestUI extends UI {
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
TestComponent t = new TestComponent();
layout.addComponent(t);
layout.setSizeFull();
t.setSizeFull();
}
}
package com.example.vaadintest;
import com.vaadin.annotations.AutoGenerated;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.HorizontalSplitPanel;
public class TestComponent extends CustomComponent {
/*- VaadinEditorProperties={“grid”:“RegularGrid,20”,“showGrid”:true,“snapToGrid”:true,“snapToObject”:true,“movingGuides”:false,“snappingDistance”:10} */
@AutoGenerated
private AbsoluteLayout mainLayout;
@AutoGenerated
private HorizontalSplitPanel horizontalSplitPanel_1;
/**
- The constructor should first build the main layout, set the
- composition root and then do any custom initialization.
- The constructor will not be automatically regenerated by the
- visual editor.
*/
public TestComponent() {
buildMainLayout();
setCompositionRoot(mainLayout);
// TODO add user code here
mainLayout.setSizeFull();
horizontalSplitPanel_1.setSizeFull();
}
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth(“100%”);
mainLayout.setHeight(“100%”);
// top-level component properties
setWidth(“100.0%”);
setHeight(“100.0%”);
// horizontalSplitPanel_1
horizontalSplitPanel_1 = new HorizontalSplitPanel();
horizontalSplitPanel_1.setImmediate(false);
horizontalSplitPanel_1.setWidth(“100.0%”);
horizontalSplitPanel_1.setHeight(“100.0%”);
mainLayout
.addComponent(horizontalSplitPanel_1, “top:0.0px;left:0.0px;”);
return mainLayout;
}
}
With the code above nothings renders on the screen (I expected to see a Horizontal split bar). We want to avoid giving any hardcoded absolute pixel values as sizes so that the components occpy the whole browser under all circumstances.
The debug window reports the following problem
Id19
ConnectorHorizontalSplitPanelConnector
WidgetVSplitPanelHorizontal
Captionnull
Description
Width100.0% (actual: 0px)
Height100.0% (actual: 0px)
First childnull
Read onlyfalse
Resources{}
Error messagenull
Immediatefalse
Enabledtrue
Registered event listenersnull
Stylesnull
Splitter statecom.vaadin.shared.ui.splitpanel.AbstractSplitPanelState$SplitterState@a4
Second childnull
Primary style namev-splitpanel-horizontal