List of usage examples for com.vaadin.ui ListSelect ListSelect
public ListSelect(String caption)
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 w w . j a v a 2 s . c o 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:co.edu.icesi.academ.client.perfiles.propietario.PanelAsignarRolEvaluador.java
License:Open Source License
public void actualizar(List<RolBO> roles) { for (RolBO rol : roles) { ListSelect l = new ListSelect(rol.getNombre()); l.setWidth("100%"); l.setHeight("100%"); tstRoles.addTab(l);//from www. jav a 2 s . c o m } mostrarEvaluadoresDisponibles((ListSelect) tstRoles.getSelectedTab()); }
From source file:com.cavisson.gui.dashboard.components.controls.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);// w w w . ja va 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.github.cjm.TmdbUI.java
private void addUserGrid() { userSectionLayout.setSpacing(true);//from w ww . ja va2 s .c o m userSectionLayout.setWidth("100%"); username = new ComboBox(); username.setInputPrompt("name"); username.setNewItemsAllowed(true); username.setTextInputAllowed(true); username.addValueChangeListener((Property.ValueChangeEvent event) -> { userFavorites.removeAllItems(); if (username.getValue() != null) { User u = (User) username.getValue(); if (u.getFavoriteTvShows() != null) { for (Integer id : u.getFavoriteTvShows()) { userFavorites.addItem(getTvShow(id)); } } } }); username.setNewItemHandler((String newItemCaption) -> { if (newItemCaption != null) { User u = findUser(newItemCaption); users.addBean(u); username.setValue(u); } }); users = new BeanItemContainer<>(User.class); for (User user : userDao.findAll()) { users.addBean(user); } username.setContainerDataSource(users); username.setImmediate(true); username.setItemCaptionPropertyId("username"); userSectionLayout.addComponent(username); userFavorites = new ListSelect("Favorites"); userFavorites.setWidth("70%"); favorites = new BeanItemContainer<>(TvShow.class); userFavorites.setContainerDataSource(favorites); userFavorites.setItemCaptionPropertyId("name"); userSectionLayout.addComponent(userFavorites); userSectionLayout.setExpandRatio(username, 1.0f); userSectionLayout.setExpandRatio(userFavorites, 2.0f); mainLayout.addComponent(userSectionLayout); }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private ListSelect createWordListSelect() { ListSelect ls = new ListSelect("Wordlist"); IndexedContainer c = new IndexedContainer(); c.sort(new Object[] { "id" }, new boolean[] { true }); ls.setContainerDataSource(c);/* w ww . j av a 2s.c o m*/ ls.setSizeFull(); ls.addStyleName("wordlist"); return ls; }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private ListSelect createFileSelect() { final ListSelect ls = new ListSelect("Files"); ls.setSizeFull();// w ww. ja va 2 s . c om ls.setNullSelectionAllowed(false); ls.setImmediate(true); ls.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 2450173366304389892L; public void valueChange(ValueChangeEvent event) { String value = (String) ls.getValue(); editor.setValue(interpreter.getSource(value)); fileName.setValue(value); } }); return ls; }
From source file:com.jain.addon.web.bean.factory.generator.select.MultiSelectFieldGenerator.java
License:Apache License
public Field<?> createField(Class<?> type, JNIPropertyConstraint restriction) { final ListSelect field = new ListSelect(getCaption(restriction.getProperty())); field.setDescription(getDescription(restriction.getProperty())); field.setMultiSelect(true);//from ww w . jav a 2 s. c o m Collection<?> values = extractValues(type, restriction); for (Object object : values) { field.addItem(object); if (object instanceof JNINamed) { field.setItemCaption(object, ((JNINamed) object).getDisplayName()); } } updateField(restriction, field); return field; }
From source file:com.kpg.diary.ui.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);// w ww.j av a 2s .c o 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.skysql.manager.ui.components.ParametersLayout.java
License:Open Source License
/** * Instantiates a new parameters layout. * * @param runningTask the running task/*w w w. j av a 2s. com*/ * @param nodeInfo the node info * @param commandEnum the command enum */ public ParametersLayout(final RunningTask runningTask, final NodeInfo nodeInfo, Commands.Command commandEnum) { this.runningTask = runningTask; addStyleName("parametersLayout"); setSizeFull(); setSpacing(true); setMargin(true); params = new HashMap<String, String>(); runningTask.selectParameter(params); switch (commandEnum) { case backup: backupLevel = new OptionGroup("Backup Level"); backupLevel.setImmediate(true); backupLevel.addItem(BackupRecord.BACKUP_TYPE_FULL); backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_FULL, "Full"); backupLevel.addItem(BackupRecord.BACKUP_TYPE_INCREMENTAL); backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_INCREMENTAL, "Incremental"); addComponent(backupLevel); setComponentAlignment(backupLevel, Alignment.MIDDLE_LEFT); backupLevel.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void valueChange(ValueChangeEvent event) { String level = (String) event.getProperty().getValue(); params.put(PARAM_BACKUP_TYPE, level); if (level.equals(BackupRecord.BACKUP_TYPE_INCREMENTAL)) { addComponent(prevBackupsLayout); selectPrevBackup.select(firstItem); } else { params.remove(PARAM_BACKUP_PARENT); if (getComponentIndex(prevBackupsLayout) != -1) { removeComponent(prevBackupsLayout); } } } }); backupLevel.setValue(BackupRecord.BACKUP_TYPE_FULL); isParameterReady = true; case restore: VerticalLayout restoreLayout = new VerticalLayout(); restoreLayout.setSpacing(true); if (commandEnum == Command.restore) { addComponent(restoreLayout); FormLayout formLayout = new FormLayout(); //formLayout.setMargin(new MarginInfo(false, false, true, false)); formLayout.setMargin(false); restoreLayout.addComponent(formLayout); final NativeSelect selectSystem; selectSystem = new NativeSelect("Backups from"); selectSystem.setImmediate(true); selectSystem.setNullSelectionAllowed(false); SystemInfo systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class); for (SystemRecord systemRecord : systemInfo.getSystemsMap().values()) { if (!systemRecord.getID().equals(SystemInfo.SYSTEM_ROOT)) { selectSystem.addItem(systemRecord.getID()); selectSystem.setItemCaption(systemRecord.getID(), systemRecord.getName()); } } selectSystem.select(systemInfo.getCurrentID()); formLayout.addComponent(selectSystem); selectSystem.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void valueChange(ValueChangeEvent event) { String systemID = (String) event.getProperty().getValue(); Backups backups = new Backups(systemID, null); backupsList = backups.getBackupsList(); selectPrevBackup.removeAllItems(); firstItem = null; if (backupsList != null && backupsList.size() > 0) { Collection<BackupRecord> set = backupsList.values(); Iterator<BackupRecord> iter = set.iterator(); while (iter.hasNext()) { BackupRecord backupRecord = iter.next(); String backupID = backupRecord.getID(); selectPrevBackup.addItem(backupID); selectPrevBackup.setItemCaption(backupID, "ID: " + backupID + ", " + backupRecord.getStarted()); if (firstItem == null) { firstItem = backupID; selectPrevBackup.select(firstItem); } } runningTask.getControlsLayout().enableControls(true, Controls.Run); } else { if (backupInfoLayout != null) { displayBackupInfo(backupInfoLayout, new BackupRecord()); } runningTask.getControlsLayout().enableControls(false, Controls.Run); } } }); } prevBackupsLayout = new HorizontalLayout(); restoreLayout.addComponent(prevBackupsLayout); selectPrevBackup = (commandEnum == Command.backup) ? new ListSelect("Backups") : new ListSelect(); selectPrevBackup.setImmediate(true); selectPrevBackup.setNullSelectionAllowed(false); selectPrevBackup.setRows(8); // Show a few items and a scrollbar if there are more selectPrevBackup.setWidth("20em"); prevBackupsLayout.addComponent(selectPrevBackup); final Backups backups = new Backups(nodeInfo.getParentID(), null); //*** this is for when we only want backups from a specific node // backupsList = backups.getBackupsForNode(nodeInfo.getID()); backupsList = backups.getBackupsList(); if (backupsList != null && backupsList.size() > 0) { Collection<BackupRecord> set = backupsList.values(); Iterator<BackupRecord> iter = set.iterator(); while (iter.hasNext()) { BackupRecord backupRecord = iter.next(); selectPrevBackup.addItem(backupRecord.getID()); selectPrevBackup.setItemCaption(backupRecord.getID(), "ID: " + backupRecord.getID() + ", " + backupRecord.getStarted()); if (firstItem == null) { firstItem = backupRecord.getID(); } } backupInfoLayout = new VerticalLayout(); backupInfoLayout.setSpacing(false); backupInfoLayout.setMargin(new MarginInfo(false, true, false, true)); prevBackupsLayout.addComponent(backupInfoLayout); prevBackupsLayout.setComponentAlignment(backupInfoLayout, Alignment.MIDDLE_CENTER); selectPrevBackup.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void valueChange(ValueChangeEvent event) { String backupID = (String) event.getProperty().getValue(); if (backupID == null) { isParameterReady = false; runningTask.getControlsLayout().enableControls(isParameterReady, Controls.Run); return; } BackupRecord backupRecord = backupsList.get(backupID); displayBackupInfo(backupInfoLayout, backupRecord); if (backupLevel != null) { // we're doing a backup params.put(PARAM_BACKUP_PARENT, backupRecord.getID()); } else { // we're doing a restore params.put(PARAM_BACKUP_ID, backupRecord.getID()); } isParameterReady = true; ScriptingControlsLayout controlsLayout = runningTask.getControlsLayout(); if (controlsLayout != null) { controlsLayout.enableControls(isParameterReady, Controls.Run); } } }); // final DisplayBackupRecord displayRecord = new // DisplayBackupRecord(parameterLayout); if (commandEnum == Command.restore) { restoreLayout.addComponent(prevBackupsLayout); selectPrevBackup.select(firstItem); } } else { // no previous backups if (commandEnum == Command.backup) { backupLevel.setEnabled(false); isParameterReady = true; } else if (commandEnum == Command.restore) { //runningTask.getControlsLayout().enableControls(false, Controls.run); } } break; case connect: VerticalLayout connectLayout = new VerticalLayout(); addComponent(connectLayout); final Validator validator = new Password2Validator(connectPassword); passwordOption.addItem(true); passwordOption.setItemCaption(true, "Authenticate with root user"); passwordOption.addItem(false); passwordOption.setItemCaption(false, "Authenticate with SSH Key"); passwordOption.setImmediate(true); passwordOption.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; @Override public void valueChange(ValueChangeEvent event) { usePassword = (Boolean) event.getProperty().getValue(); if (usePassword) { connectPassword2.addValidator(validator); } else { connectPassword2.removeValidator(validator); } connectPassword.setVisible(usePassword); connectPassword.setRequired(usePassword); connectPassword2.setVisible(usePassword); connectPassword2.setRequired(usePassword); connectKey.setVisible(!usePassword); connectKey.setRequired(!usePassword); boolean isValid; if (runningTask.getControlsLayout() != null) { if (usePassword) { isValid = connectPassword.isValid(); } else { isValid = connectKey.isValid(); } if (isValid) { connectParamsListener.valueChange(null); } else { form.setComponentError(null); form.setValidationVisible(false); runningTask.getControlsLayout().enableControls(false, Controls.Run); } } } }); connectLayout.addComponent(passwordOption); passwordOption.select(false); connectLayout.addComponent(form); form.setImmediate(true); form.setFooter(null); Layout layout = form.getLayout(); form.addField("connectPassword", connectPassword); connectPassword.setImmediate(true); connectPassword.setRequiredError("Root Password is a required field"); connectPassword.addValueChangeListener(connectParamsListener); form.addField("connectPassword2", connectPassword2); connectPassword2.setImmediate(true); connectPassword2.setRequiredError("Confirm Password is a required field"); connectPassword2.addValueChangeListener(connectParamsListener); form.addField("connectKey", connectKey); connectKey.setStyleName("sshkey"); connectKey.setColumns(41); connectKey.setImmediate(true); connectKey.setRequiredError("SSH Key is a required field"); connectKey.addValueChangeListener(connectParamsListener); break; default: isParameterReady = true; break; } }
From source file:com.skysql.manager.ui.MonitorsSettings.java
License:Open Source License
/** * Instantiates a new monitors settings. * * @param settingsDialog the settings dialog * @param systemID the system id//from w w w . j a v a 2s .c om * @param systemType the system type */ MonitorsSettings(SettingsDialog settingsDialog, String systemID, String systemType) { this.settingsDialog = settingsDialog; this.systemID = systemID; this.systemType = systemType; addStyleName("monitorsTab"); setSizeFull(); setSpacing(true); setMargin(true); HorizontalLayout selectLayout = new HorizontalLayout(); addComponent(selectLayout); selectLayout.setSizeFull(); selectLayout.setSpacing(true); Monitors.reloadMonitors(); monitorsAll = Monitors.getMonitorsList(systemType); select = new ListSelect("Monitors"); select.setImmediate(true); for (MonitorRecord monitor : monitorsAll.values()) { String id = monitor.getID(); select.addItem(id); select.setItemCaption(id, monitor.getName()); } select.setNullSelectionAllowed(false); selectLayout.addComponent(select); select.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void valueChange(ValueChangeEvent event) { String monitorID = (String) event.getProperty().getValue(); displayMonitorRecord(monitorID); MonitorRecord monitor = monitorsAll.get(monitorID); if (monitor != null) { String monitorType = monitor.getType(); for (Monitors.EditableMonitorType editable : EditableMonitorType.values()) { if (editable.name().equals(monitorType)) { editMonitor.setEnabled(true); break; } } } } }); selectLayout.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void layoutClick(LayoutClickEvent event) { Component child; if (event.isDoubleClick() && (child = event.getChildComponent()) != null && (child instanceof ListSelect)) { // Get the child component which was double-clicked ListSelect select = (ListSelect) child; String monitorID = (String) select.getValue(); MonitorRecord monitor = monitorsAll.get(monitorID); String monitorType = monitor.getType(); for (Monitors.EditableMonitorType editable : EditableMonitorType.values()) { if (editable.name().equals(monitorType)) { editMonitor(monitor); break; } } } } }); monitorLayout = new FormLayout(); selectLayout.addComponent(monitorLayout); selectLayout.setExpandRatio(monitorLayout, 1.0f); monitorLayout.setSpacing(false); id.setCaption("ID:"); monitorLayout.addComponent(id); name.setCaption("Name:"); monitorLayout.addComponent(name); description.setCaption("Description:"); monitorLayout.addComponent(description); unit.setCaption("Unit:"); monitorLayout.addComponent(unit); // type.setCaption("Type:"); // monitorLayout.addComponent(type); delta.setCaption("Is Delta:"); monitorLayout.addComponent(delta); average.setCaption("Is Average:"); monitorLayout.addComponent(average); chartType.setCaption("Chart Type:"); monitorLayout.addComponent(chartType); interval.setCaption("Interval:"); monitorLayout.addComponent(interval); sql.setCaption("Statement:"); monitorLayout.addComponent(sql); HorizontalLayout selectButtons = new HorizontalLayout(); selectButtons.setSizeFull(); addComponent(selectButtons); selectButtons.setSpacing(true); Button addMonitor = new Button("Add..."); selectButtons.addComponent(addMonitor); selectButtons.setComponentAlignment(addMonitor, Alignment.MIDDLE_LEFT); addMonitor.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { addMonitor(); } }); deleteMonitor = new Button("Delete"); deleteMonitor.setEnabled(false); selectButtons.addComponent(deleteMonitor); selectButtons.setComponentAlignment(deleteMonitor, Alignment.MIDDLE_LEFT); deleteMonitor.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { String monitorID = (String) select.getValue(); if (monitorID != null) { deleteMonitor(monitorsAll.get(monitorID)); } } }); editMonitor = new Button("Edit..."); editMonitor.setEnabled(false); selectButtons.addComponent(editMonitor); selectButtons.setComponentAlignment(editMonitor, Alignment.MIDDLE_CENTER); selectButtons.setExpandRatio(editMonitor, 1.0f); editMonitor.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { String monitorID = (String) select.getValue(); if (monitorID != null) { editMonitor(monitorsAll.get(monitorID)); } } }); }