List of usage examples for com.vaadin.ui NativeSelect NativeSelect
public NativeSelect(String caption)
From source file:annis.gui.flatquerybuilder.FlatQueryBuilder.java
License:Apache License
private void launch(QueryController cp) { this.cp = cp; rsc = new ReducingStringComparator(); this.query = ""; mainLayout = new VerticalLayout(); // tracking lists for vertical nodes, edgeboxes and metaboxes vnodes = new ArrayList<>(); eboxes = new ArrayList<>(); mboxes = new ArrayList<>(); spbox = null;// w w w . j av a2 s. c o m // buttons and checks btGo = new Button(BUTTON_GO_LABEL, (Button.ClickListener) this); btGo.setStyleName(ChameleonTheme.BUTTON_SMALL); btClear = new Button(BUTTON_CLEAR_LABEL, (Button.ClickListener) this); btClear.setStyleName(ChameleonTheme.BUTTON_SMALL); btInverse = new Button(BUTTON_INV_LABEL, (Button.ClickListener) this); btInverse.setStyleName(ChameleonTheme.BUTTON_SMALL); btInitLanguage = new Button("Initialize", (Button.ClickListener) this); btInitLanguage.setDescription(INFO_INIT_LANG); btInitSpan = new Button("Initialize", (Button.ClickListener) this); btInitSpan.setDescription(INFO_INIT_SPAN); btInitMeta = new Button("Initialize", (Button.ClickListener) this); btInitMeta.setDescription(INFO_INIT_META); filtering = new NativeSelect("Filtering mechanisms"); filtering.setDescription(INFO_FILTER); ReducingStringComparator rdc = new ReducingStringComparator(); Set mappings = rdc.getMappings().keySet(); int i; for (i = 0; i < mappings.size(); i++) { String mapname = (String) mappings.toArray()[i]; filtering.addItem(i); filtering.setItemCaption(i, mapname); } filtering.addItem(i + 1); filtering.setItemCaption(i + 1, "generic"); filtering.select(i + 1); filtering.setNullSelectionAllowed(false); filtering.setImmediate(true); // language layout language = new HorizontalLayout(); languagenodes = new HorizontalLayout(); language.addComponent(languagenodes); language.addComponent(btInitLanguage); language.setMargin(true); language.setCaption(LANG_CAPTION); language.addStyleName("linguistics-panel"); // span layout span = new HorizontalLayout(); span.setSpacing(true); span.addComponent(btInitSpan); span.setMargin(true); span.setCaption(SPAN_CAPTION); span.addStyleName("span-panel"); // meta layout meta = new HorizontalLayout(); meta.setSpacing(true); meta.addComponent(btInitMeta); meta.setMargin(true); meta.setCaption(META_CAPTION); meta.addStyleName("meta-panel"); // toolbar layout toolbar = new HorizontalLayout(); toolbar.setSpacing(true); toolbar.addComponent(btGo); toolbar.addComponent(btClear); toolbar.addComponent(btInverse); toolbar.setMargin(true); toolbar.setCaption(TOOLBAR_CAPTION); toolbar.addStyleName("toolbar-panel"); // advanced advanced = new HorizontalLayout(); advanced.setSpacing(true); advanced.addComponent(filtering); advanced.setMargin(true); advanced.setCaption(ADVANCED_CAPTION); advanced.addStyleName("advanced-panel"); // put everything on the layout mainLayout.setSpacing(true); mainLayout.addComponent(language); mainLayout.addComponent(span); mainLayout.addComponent(meta); mainLayout.addComponent(toolbar); mainLayout.addComponent(advanced); setContent(mainLayout); getContent().setWidth("100%"); getContent().setHeight("-1px"); }
From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationMakeView.java
License:Open Source License
public ReservationMakeView() { fromField = new DateField("Start Date"); fromField.setLocale(new Locale("de", "DE")); fromField.setResolution(Resolution.MINUTE); fromField.setDateFormat("dd.MM.yyyy HH:mm"); fromField.setIcon(FontAwesome.CALENDAR); fromField.setWidth(12, Unit.EM);/*from w w w . j av a2s . c o m*/ toField = new DateField("End Date"); toField.setLocale(new Locale("de", "DE")); toField.setResolution(Resolution.MINUTE); toField.setDateFormat("dd.MM.yyyy HH:mm"); toField.setIcon(FontAwesome.CALENDAR); toField.setWidth(12, Unit.EM); roomSelect = new NativeSelect("Room Number"); roomSelect.setIcon(FontAwesome.BED); roomSelect.setNullSelectionAllowed(true); roomSelect.setImmediate(true); makeReservationButton = new Button("Make Reservation", FontAwesome.CHECK); makeReservationButton.setWidth(12, Unit.EM); logoutButton = new Button("Logout"); Panel panel = new Panel("Create New Reservation"); FormLayout content = new FormLayout(); content.addComponents(fromField, toField, roomSelect, makeReservationButton); content.setSizeUndefined(); content.setMargin(true); VerticalLayout formAndLogout = new VerticalLayout(content, logoutButton); formAndLogout.setMargin(true); panel.setContent(formAndLogout); makeViewLayout = new VerticalLayout(panel); makeViewLayout.setSizeUndefined(); makeViewLayout.setMargin(true); }
From source file:ch.bfh.ti.soed.hs16.srs.purple.view.ReservationView.java
License:Open Source License
/** * Shows the popup window where a reservation can be modified, deleted or inserted * @param res The Reservation Object (for a new reservation, fill the startDate with the current Timestamp!) *///from w ww .j a v a2 s . co m @SuppressWarnings("serial") private void showPopup(Reservation res) { this.res = res; //Update the member boolean newRes = res.getReservationID() > 0 ? false : true; boolean isHost = isHost(actualUser, res.getHostList()); boolean isParticipant = isHost(actualUser, res.getParticipantList()); final GridLayout gridLayout = new GridLayout(3, 5); ValueChangeListener vcl = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (ReservationView.this.res.getReservationID() > 0) { System.out.println("Aktuellen Raum"); rooms.addItem(ReservationView.this.res.getRoom().getRoomID()); rooms.setItemCaption(ReservationView.this.res.getRoom().getRoomID(), ReservationView.this.res.getRoom().getName() + " (" + ReservationView.this.res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(ReservationView.this.res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (ReservationView.this.res.getReservationID() <= 0 && actualRoom != null) rooms.select(actualRoom.getRoomID()); } }; popUpWindow = new Window(); popUpWindow.center(); popUpWindow.setModal(true); startDate = new DateField("Startzeit"); startDate.setLocale(VaadinSession.getCurrent().getLocale()); startDate.setValue(res.getStart()); startDate.addValueChangeListener(vcl); startDate.setDateFormat("dd.MM.yyyy HH:mm"); startDate.setResolution(Resolution.HOUR); endDate = new DateField("Endzeit"); endDate.setValue(res.getEnd()); endDate.addValueChangeListener(vcl); endDate.setDateFormat("dd.MM.yyyy HH:mm"); endDate.setLocale(VaadinSession.getCurrent().getLocale()); endDate.setResolution(Resolution.HOUR); title = new TextField("Titel"); title.setValue(res.getTitle()); title.setWidth(100, Unit.PERCENTAGE); description = new TextArea("Beschreibung"); description.setValue(res.getDescription()); description.setRows(3); description.setWidth(100, Unit.PERCENTAGE); hosts = new ListSelect("Reservierender"); hosts.setMultiSelect(true); hosts.clear(); for (int i = 0; i < hostList.size(); i++) { hosts.addItem(hostList.get(i).getUserID()); hosts.setItemCaption(hostList.get(i).getUserID(), hostList.get(i).getUsername()); } //select the hosts in list if (!newRes) { List<User> resHosts = res.getHostList(); for (int i = 0; i < resHosts.size(); i++) for (int y = 0; y < hostList.size(); y++) if (hostList.get(y).getUserID() == resHosts.get(i).getUserID()) hosts.select(resHosts.get(i).getUserID()); } else hosts.select(actualUser.getUserID()); hosts.select(0); hosts.setRows(hostList.size() > 5 ? 5 : hostList.size()); participantList = new ListSelect("Teilnehmer"); participantList.setMultiSelect(true); participantList.clear(); for (int i = 0; i < participant.size(); i++) { participantList.addItem(participant.get(i).getUserID()); participantList.setItemCaption(participant.get(i).getUserID(), participant.get(i).getUsername()); } //select the participants in list if (!newRes) { List<User> resPart = res.getParticipantList(); for (int i = 0; i < resPart.size(); i++) for (int y = 0; y < participant.size(); y++) if (participant.get(y).getUserID() == resPart.get(i).getUserID()) participantList.select(resPart.get(i).getUserID()); } participantList.setRows(participant.size() > 5 ? 5 : participant.size()); rooms = new NativeSelect("Raum"); rooms.setNullSelectionAllowed(false); rooms.removeAllItems(); List<Room> roomList = resCont.getAllFreeRooms(new Timestamp(startDate.getValue().getTime()), new Timestamp(endDate.getValue().getTime())); if (!newRes) { rooms.addItem(res.getRoom().getRoomID()); rooms.setItemCaption(res.getRoom().getRoomID(), res.getRoom().getName() + " (" + res.getRoom().getNumberOfSeats() + " Pltze)"); rooms.select(res.getRoom().getRoomID()); } for (int i = 0; i < roomList.size(); i++) { rooms.addItem(roomList.get(i).getRoomID()); String caption = roomList.get(i).getName() + " (" + roomList.get(i).getNumberOfSeats() + " Pltze)"; rooms.setItemCaption(roomList.get(i).getRoomID(), caption); } if (newRes && actualRoom != null) rooms.select(actualRoom.getRoomID()); saveButton = new Button("Speichern"); saveButton.addClickListener(clButton); deleteButton = new Button("Lschen"); deleteButton.addClickListener(clButton); deleteButton.setVisible(res.getReservationID() > 0 ? true : false); if (!newRes) setEditable(false); gridLayout.addComponent(startDate, 0, 0); gridLayout.addComponent(endDate, 0, 1); gridLayout.addComponent(hosts, 1, 0, 1, 1); gridLayout.addComponent(participantList, 2, 0, 2, 1); gridLayout.addComponent(title, 0, 2); gridLayout.addComponent(rooms, 1, 2, 2, 2); gridLayout.addComponent(description, 0, 3, 1, 3); if (roomList.size() == 0) saveButton.setEnabled(false); if (isHost || newRes) //show buttons for edit and delete only if the user is host or its a new reservation { gridLayout.addComponent(saveButton, 0, 4); gridLayout.addComponent(deleteButton, 1, 4); } if (isParticipant) //show buttons for accept oder decline a reservation { acceptButton = new Button("Zusagen"); rejectButton = new Button("Absagen"); acceptButton.addClickListener(clButton); rejectButton.addClickListener(clButton); if (isHost(actualUser, res.getAcceptedParticipantsList())) { acceptButton.setEnabled(false); rejectButton.setEnabled(true); } else { rejectButton.setEnabled(false); acceptButton.setEnabled(true); } gridLayout.addComponent(acceptButton, 0, 4); gridLayout.addComponent(rejectButton, 1, 4); } gridLayout.setSpacing(true); gridLayout.setMargin(new MarginInfo(false, false, false, true)); gridLayout.setWidth(100, Unit.PERCENTAGE); popUpWindow.setContent(gridLayout); popUpWindow.setWidth("600px"); popUpWindow.setHeight("450px"); popUpWindow.setCaption(res.getReservationID() > 0 ? "Reservierungsdetails" : "Neue Reservierung"); UI.getCurrent().addWindow(popUpWindow); }
From source file:com.cavisson.gui.dashboard.components.controls.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);/*from w ww . j av a 2 s . c o m*/ Label h1 = new Label("Selects"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("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); } }
From source file:com.concur.ui.WebApp.java
License:Apache License
private Window createWindow() { FormLayout fl = new FormLayout(); // final SessionGuard sg = new SessionGuard(); // sg.setKeepalive(true); // fl.addComponent(sg); fl.setSizeFull();//from w ww . j a v a 2 s . c o m fl.setMargin(true); fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML)); actionField = new NativeSelect("Action:"); actionField.addItem("Authenticate"); actionField.addItem("GetTuple"); actionField.addItem("PutTuple"); actionField.addItem("GetConfigurations"); actionField.select("Authenticate"); fl.addComponent(actionField); tokenField = new TextField("Authentication Token:"); tokenField.setColumns(40); fl.addComponent(tokenField); tupleKeyField = new TextField("TupleKey:"); tupleKeyField.setColumns(40); fl.addComponent(tupleKeyField); tupleDataArea = new TextArea("TupleData:"); tupleDataArea.setColumns(40); tupleDataArea.setRows(5); fl.addComponent(tupleDataArea); Button b = new Button("Send Request"); b.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { submit(); } }); fl.addComponent(b); final Window w = new Window("ATS Tuple Store -- DEMO"); w.setContent(fl); return w; }
From source file:com.demo.tutorial.agenda.ui.SearchView.java
public SearchView(final MyUI app) { this.app = app; setCaption("Buscar Contactos"); setSizeFull();/*w ww . ja va 2s . co m*/ addStyleName("view"); /* Usar un FormLayout como layout principal para este Panel*/ FormLayout formLayout = new FormLayout(); /* Creando componente UI */ txtTextField = new TextField("Buscar"); cmbFieldtoSearch = new NativeSelect("Campo por buscar"); chkSaveSearch = new CheckBox("Guardar Bsqueda"); txtSearchName = new TextField("Buscar nombre"); Button btnBuscar = new Button("Buscar"); btnBuscar.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { performSearch(); } }); /* Inicializar combo */ for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) { cmbFieldtoSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]); cmbFieldtoSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]); } cmbFieldtoSearch.setValue("apPaterno"); cmbFieldtoSearch.setNullSelectionAllowed(false); /* Inicializando save checkbox */ chkSaveSearch.setValue(true); chkSaveSearch.setImmediate(true); chkSaveSearch.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } }); /* chkSaveSearch.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } });*/ /* Aadiendo los componentes creados al formulario */ formLayout.addComponent(txtTextField); formLayout.addComponent(cmbFieldtoSearch); formLayout.addComponent(chkSaveSearch); formLayout.addComponent(txtSearchName); formLayout.addComponent(btnBuscar); setContent(formLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java
License:Open Source License
private Panel createControls() { Panel panel = new Panel(); panel.setWidth(100, Unit.PERCENTAGE); HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true);//w w w . j a v a 2 s .co m controls.setMargin(true); panel.setContent(controls); start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE)); start.setValue(gantt.getStartDate()); start.setResolution(Resolution.DAY); start.setImmediate(true); start.addValueChangeListener(startDateValueChangeListener); end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE)); end.setValue(gantt.getEndDate()); end.setResolution(Resolution.DAY); end.setImmediate(true); end.addValueChangeListener(endDateValueChangeListener); reso = new NativeSelect("Resolution"); reso.setNullSelectionAllowed(false); reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour); reso.addItem(org.tltv.gantt.client.shared.Resolution.Day); reso.addItem(org.tltv.gantt.client.shared.Resolution.Week); reso.setValue(gantt.getResolution()); reso.setImmediate(true); reso.addValueChangeListener(resolutionValueChangeListener); controls.addComponent(start); controls.addComponent(end); controls.addComponent(reso); panel.setStyleName(UIConstants.THEME_NO_BORDER); return panel; }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartViewImpl.java
License:Open Source License
private Panel createControls() { Panel panel = new Panel(); panel.setWidth(100, Unit.PERCENTAGE); MHorizontalLayout controls = new MHorizontalLayout().withMargin(true); panel.setContent(controls);/*from w w w.j av a 2 s . com*/ DateFieldExt start = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE)); start.setValue(gantt.getStartDate()); start.setResolution(Resolution.DAY); start.setImmediate(true); start.addValueChangeListener(startDateValueChangeListener); DateField end = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE)); end.setValue(gantt.getEndDate()); end.setResolution(Resolution.DAY); end.setImmediate(true); end.addValueChangeListener(endDateValueChangeListener); reso = new NativeSelect("Resolution"); reso.setNullSelectionAllowed(false); reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour); reso.addItem(org.tltv.gantt.client.shared.Resolution.Day); reso.addItem(org.tltv.gantt.client.shared.Resolution.Week); reso.setValue(gantt.getResolution()); reso.setImmediate(true); reso.addValueChangeListener(resolutionValueChangeListener); controls.with(start, end, reso); panel.setStyleName(UIConstants.THEME_NO_BORDER); return panel; }
From source file:com.kpg.diary.ui.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);/*from www . jav a 2 s . co m*/ 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); } }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * This method creates select filed to choose as a favorite or not for * current track.//from w w w .j a v a2s . c om * * @return NativeSelect element with proper value. */ private NativeSelect setFavorite() { // TODO: Add this element to database. NativeSelect favorite = new NativeSelect("Mark the track as:"); favorite.setWidth("130px"); favorite.addItem("Not favorite"); favorite.addItem("Favorite"); favorite.setNullSelectionAllowed(false); favorite.select("Not favorite"); return favorite; }