summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'vaadin-app/src/ch')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/LayoutLayout.java106
1 files changed, 106 insertions, 0 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/LayoutLayout.java b/vaadin-app/src/ch/asynk/helloworld/LayoutLayout.java
new file mode 100644
index 0000000..f5efedf
--- /dev/null
+++ b/vaadin-app/src/ch/asynk/helloworld/LayoutLayout.java
@@ -0,0 +1,106 @@
+package ch.asynk.helloworld;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ListSelect;
+
+public class LayoutLayout extends VerticalLayout {
+
+ private static final long serialVersionUID = 1L;
+
+ public LayoutLayout() {
+ //
+ final AbstractComponent topComponent = buildTopComponent();
+ topComponent.setWidth(500,UNITS_PIXELS);
+ topComponent.setHeight(400,UNITS_PIXELS);
+ addComponent(topComponent);
+ setComponentAlignment(topComponent, Alignment.MIDDLE_CENTER);
+ //
+ final AbstractComponent grid = buildGrid();
+ grid.setSizeFull();
+ addComponent(grid);
+ //
+ Button nextButton = new Button("next layout");
+ nextButton.setDescription("Go to next layout");
+ addComponent(nextButton );
+ nextButton.addListener( new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getApplication().getMainWindow().setContent( new EndLayout() );
+ }
+ });
+ }
+
+ private AbstractComponent buildTopComponent() {
+
+ Panel panel = new Panel("Panel 1");
+ VerticalLayout layout = (VerticalLayout) panel.getContent();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ layout.setHeight(100,UNITS_PERCENTAGE);
+ //
+ float width = 90;
+ float height = 100;
+ //
+ ListSelect receptionList = new ListSelect("List 1");
+ receptionList.setWidth(width, UNITS_PERCENTAGE);
+ receptionList.setHeight(height, UNITS_PERCENTAGE);
+ layout.addComponent(receptionList);
+ //
+ ListSelect splitList = new ListSelect("List 2");
+ splitList.setWidth(width, UNITS_PERCENTAGE);
+ splitList.setHeight(height, UNITS_PERCENTAGE);
+ layout.addComponent(splitList);
+ //
+ ListSelect ctrlList = new ListSelect("Liste 3");
+ ctrlList.setWidth(width, UNITS_PERCENTAGE);
+ ctrlList.setHeight(height, UNITS_PERCENTAGE);
+ layout.addComponent(ctrlList);
+ //
+ Button goButton = new Button("Select");
+ goButton.setHeight(height, UNITS_PERCENTAGE);
+ layout.addComponent(goButton);
+ //
+ layout.setExpandRatio(receptionList,3.0f);
+ layout.setExpandRatio(splitList,3.0f);
+ layout.setExpandRatio(ctrlList,3.0f);
+ layout.setExpandRatio(goButton,1.0f);
+ layout.setComponentAlignment(goButton, Alignment.MIDDLE_CENTER);
+ //
+ return panel;
+ }
+
+ private AbstractComponent buildGrid() {
+ Panel panel = new Panel("Grid Panel");
+ VerticalLayout layout = (VerticalLayout) panel.getContent();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ layout.setHeight(100,UNITS_PERCENTAGE);
+ //
+ GridLayout grid = new GridLayout(3, 3);
+ grid.setSizeFull();
+ grid.addStyleName("mygrid");
+ // excess space usage
+ //grid.setColumnExpandRatio(1, 1);
+ //grid.setColumnExpandRatio(2, 5);
+ //grid.setRowExpandRatio(1, 1);
+ Button b0 = new Button("[0;0] [0;2]");
+ b0.setSizeFull();
+ grid.addComponent(b0,0,0,0,2);
+ final Panel p2 = new Panel("Panel 2");
+ p2.setSizeFull();
+ grid.addComponent(p2,1,0,2,1);
+ Button b1 = new Button("[1;2] [2;2]");
+ b1.setSizeFull();
+ grid.addComponent(b1,1,2,2,2);
+ panel.setContent(grid);
+ //
+ return panel;
+ }
+}