import com.vaadin.v7.data.Property.ValueChangeEvent; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public SwipeViewWithNormalContent() {
CssLayout cssLayout = new CssLayout();
cssLayout.addComponent(new Button("Button"));
Form form = new Form();
FormLayout layout = (FormLayout) form.getLayout();
layout.setMargin(false);
form.setSizeUndefined();
CheckBox cb = new CheckBox();
cb.setCaption("Loop views");
cb.addValueChangeListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
loop = !loop;
if (loop) {
setNextComponent(images[0]);
} else {
setNextComponent(null);
}
}
});
cb.setImmediate(true);
form.addField("loop", cb);
TextField tf = new TextField("Foo");
tf.setWidth("100%");
tf.setValue("This is a test page that shows SwipeView can also contain other stuff but just images :-)");
form.addField("foo", tf);
form.addField("bar", new CheckBox("Bar"));
NativeSelect field = new NativeSelect();
field.setCaption("Car");
field.addItem("Foo");
field.addItem("Bar");
field.addItem("Car");
form.addField("car", field);
VerticalComponentGroup fg = new VerticalComponentGroup();
fg.setCaption("Form");
fg.addComponent(form);
cssLayout.addComponent(fg);
VerticalComponentGroup verticalComponentGroup = new VerticalComponentGroup();
verticalComponentGroup
.setCaption("Labels to make this view heavy");
for (int i = 0; i < 40; i++) {
verticalComponentGroup
.addComponent(new Label("Label " + i));
}
cssLayout.addComponent(verticalComponentGroup);
setContent(cssLayout);
}