Java tutorial
package com.kpg.diary.ui; import org.springframework.stereotype.Component; /* * Copyright 2000-2013 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.ListSelect; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.TwinColSelect; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.ValoTheme; @Component("nativeSelects") public class NativeSelects extends VerticalLayout implements View { public NativeSelects() { setMargin(true); Label h1 = new Label("Selects"); h1.addStyleName(ValoTheme.LABEL_H2); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); NativeSelect select = new NativeSelect("Drop Down Select"); row.addComponent(select); ListSelect list = new ListSelect("List Select"); list.setNewItemsAllowed(true); row.addComponent(list); TwinColSelect tcs = new TwinColSelect("TwinCol Select"); tcs.setLeftColumnCaption("Left Column"); tcs.setRightColumnCaption("Right Column"); tcs.setNewItemsAllowed(true); row.addComponent(tcs); TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select"); tcs2.setLeftColumnCaption("Left Column"); tcs2.setRightColumnCaption("Right Column"); tcs2.setNewItemsAllowed(true); tcs2.setWidth("280px"); tcs2.setHeight("200px"); row.addComponent(tcs2); for (int i = 1; i <= 10; i++) { select.addItem("Option " + i); list.addItem("Option " + i); tcs.addItem("Option " + i); tcs2.addItem("Option " + i); } } @Override public void enter(ViewChangeEvent event) { // TODO Auto-generated method stub } }