List of usage examples for com.vaadin.ui ListSelect ListSelect
public ListSelect(String caption)
From source file:edu.nps.moves.mmowgli.modules.administration.VipListManager.java
License:Open Source License
@SuppressWarnings({ "unchecked", "serial" }) private void showViewOrDelete(final DeleteListener lis) { dialog = new Window("View / Delete VIPs"); dialog.setModal(true);/*from w w w. j a v a 2s .c o m*/ VerticalLayout layout = new VerticalLayout(); dialog.setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); List<VipPii> vLis = VHibPii.getAllVips(); vipListSelect = new ListSelect("Select items to delete"); StringBuffer sb = new StringBuffer(); // for popup vipListSelect.addStyleName("m-greyborder"); String lf = System.getProperty("line.separator"); for (int i = 0; i < vLis.size(); i++) { VipPii v; vipListSelect.addItem(v = vLis.get(i)); sb.append(v.getEntry()); sb.append(lf); } if (sb.length() > 0) sb.setLength(sb.length() - 1); // last space vipListSelect.setNullSelectionAllowed(true); vipListSelect.setMultiSelect(true); vipListSelect.setImmediate(true); vipListSelect.addValueChangeListener(new VipSelectListener()); layout.addComponent(vipListSelect); Label copyPopupList = new HtmlLabel("<pre>" + sb.toString() + "</pre>"); Panel p = new Panel(); VerticalLayout lay = new VerticalLayout(); p.setContent(lay); lay.addComponent(copyPopupList); p.setWidth("400px"); p.setHeight("300px"); PopupView popup = new PopupView("Display list as copyable text", p); popup.setHideOnMouseOut(false); if (sb.length() <= 0) popup.setEnabled(false); layout.addComponent(popup); layout.setComponentAlignment(popup, Alignment.MIDDLE_CENTER); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); deleteButt = new Button("Delete & Close", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Set<VipPii> set = (Set<VipPii>) vipListSelect.getValue(); if (set.size() <= 0) set = null; dialog.close(); lis.continueOrCancel(set); } }); deleteButt.setEnabled(false); hl.addComponent(cancelButt); hl.addComponent(deleteButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); dialog.setWidth("300px"); dialog.setHeight("350px"); hl.setWidth("100%"); vipListSelect.setWidth("99%"); vipListSelect.setHeight("99%"); layout.setExpandRatio(vipListSelect, 1.0f); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:facs.components.BookAdmin.java
License:Open Source License
public BookAdmin(User user) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar Admin accessed! - User: " + LiferayAndVaadinUtils.getUser().getScreenName()); Label infoLabel = new Label( DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName()) + " " + LiferayAndVaadinUtils.getUser().getScreenName()); infoLabel.addStyleName("h4"); String buttonRefreshTitle = "Refresh"; Button refresh = new Button(buttonRefreshTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull();//from w w w. j av a2s.c o m refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); String buttonUpdateTitle = "Update"; Button updateUser = new Button(buttonUpdateTitle); updateUser.setIcon(FontAwesome.WRENCH); updateUser.setSizeFull(); updateUser.setDescription("Click here to update your user role and group!"); userDevice = new ListSelect("Select a device"); userDevice.addItems(DBManager.getDatabaseInstance().getDeviceNames()); userDevice.setRows(6); userDevice.setNullSelectionAllowed(false); userDevice.setSizeFull(); userDevice.setImmediate(true); /* * userDevice.addValueChangeListener(e -> Notification.show("Device:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userGroup = new ListSelect("Select a user group"); userGroup.addItems(DBManager.getDatabaseInstance().getUserGroups()); userGroup.setRows(6); userGroup.setNullSelectionAllowed(false); userGroup.setSizeFull(); userGroup.setImmediate(true); /* * userGroup.addValueChangeListener(e -> Notification.show("User Group:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userRole = new ListSelect("Select a user role"); userRole.addItems(DBManager.getDatabaseInstance().getUserRoles()); userRole.setRows(6); userRole.setNullSelectionAllowed(false); userRole.setSizeFull(); userRole.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUser.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496909L; @Override public void buttonClick(ClickEvent event) { try { if (userDevice.getValue().equals(null) || userRole.getValue().equals(null) || userGroup.getValue().equals(null)) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); // System.out.println("Device: "+userDevice.getValue()+" Group: "+userGroup.getValue()+" Role: "+userRole.getValue()); } else { DBManager.getDatabaseInstance().getShitDone( DBManager.getDatabaseInstance().getUserRoleIDbyDesc(userRole.getValue().toString()), DBManager.getDatabaseInstance() .getUserIDbyLDAPID(LiferayAndVaadinUtils.getUser().getScreenName()), DBManager.getDatabaseInstance() .getDeviceIDByName(userDevice.getValue().toString())); DBManager.getDatabaseInstance().getShitDoneAgain( DBManager.getDatabaseInstance() .getUserGroupIDByName(userGroup.getValue().toString()), LiferayAndVaadinUtils.getUser().getScreenName()); } } catch (Exception e) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); } refreshDataSources(); } }); // only admins are allowed to see the admin panel ;) if (!DBManager.getDatabaseInstance() .getUserAdminPanelAccessByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName()).equals("1")) { VerticalLayout errorLayout = new VerticalLayout(); infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); showErrorNotification("Access Denied!", "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'."); setCompositionRoot(errorLayout); return; } this.setCaption("Admin"); final TabSheet bookAdmin = new TabSheet(); bookAdmin.addStyleName(ValoTheme.TABSHEET_FRAMED); bookAdmin.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS); ArrayList<String> deviceNames = new ArrayList<String>(); deviceNames = DBManager.getDatabaseInstance().getDeviceNames(); bookAdmin.addTab(awaitingRequestsGrid()); for (int i = 0; i < deviceNames.size(); i++) { bookAdmin.addTab(newDeviceGrid(deviceNames.get(i))); } bookAdmin.addTab(deletedBookingsGrid()); bookAdmin.addSelectedTabChangeListener(new SelectedTabChangeListener() { /** * */ private static final long serialVersionUID = 8987818794404251063L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { userDevice.select(bookAdmin.getSelectedTab().getCaption()); userRole.select(DBManager.getDatabaseInstance() .getUserGroupDescriptionByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName(), DBManager .getDatabaseInstance().getDeviceIDByName(bookAdmin.getSelectedTab().getCaption()))); userGroup.select(DBManager.getDatabaseInstance() .getUserRoleNameByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName())); } }); gridLayout.setWidth("100%"); // add components to the grid layout // gridLayout.addComponent(infoLabel, 0, 0, 3, 0); gridLayout.addComponent(bookAdmin, 0, 1, 5, 1); gridLayout.addComponent(refresh, 0, 2); gridLayout.addComponent(userDevice, 0, 4, 1, 4); gridLayout.addComponent(userRole, 2, 4, 3, 4); gridLayout.addComponent(userGroup, 4, 4, 5, 4); gridLayout.addComponent(updateUser, 0, 5, 5, 5); gridLayout.setSizeFull(); gridLayout.setSpacing(true); setCompositionRoot(gridLayout); /* * JavaScript to update the Grid try { JDBCConnectionPool connectionPool = new * SimpleJDBCConnectionPool("com.mysql.jdbc.Driver", * "jdbc:mysql://localhost:8889/facs_facility", "facs", "facs"); QueryDelegate qd = new * FreeformQuery("select * from facs_facility", connectionPool, "id"); final SQLContainer c = * new SQLContainer(qd); bookAdmin.setContainerDataSource(c); } * * JavaScript.getCurrent().execute("setInterval(function(){refreshTable();},5000);"); * JavaScript.getCurrent().addFunction("refreshTable", new JavaScriptFunction() { * * @Override public void call(JsonArray arguments) { // TODO Auto-generated method stub * * } }); */ }
From source file:facs.components.UserAdmin.java
License:Open Source License
public UserAdmin(User user) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar User Manager accessed! - User: " + LiferayAndVaadinUtils.getUser().getScreenName()); Label infoLabel = new Label( DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName()) + " " + LiferayAndVaadinUtils.getUser().getScreenName()); infoLabel.addStyleName("h4"); CheckBox isAdmin = new CheckBox("user has admin panel access"); isAdmin.setEnabled(false);/*from w w w . j a v a 2 s. com*/ String buttonGroupUpdateTitle = "Edit Group"; Button updateUserGroup = new Button(buttonGroupUpdateTitle); updateUserGroup.setIcon(FontAwesome.EDIT); updateUserGroup.setSizeFull(); updateUserGroup.setDescription("Click here to update the group of the user!"); String buttonWorkgroupUpdateTitle = "Edit Workgroup"; Button updateUserWorkgroup = new Button(buttonWorkgroupUpdateTitle); updateUserWorkgroup.setIcon(FontAwesome.EDIT); updateUserWorkgroup.setSizeFull(); updateUserWorkgroup.setDescription("Click here to update the workgroup of the user!"); String buttonUpdateTitle = "Update (user role & group for device)"; Button updateUserRightsAndRoles = new Button(buttonUpdateTitle); updateUserRightsAndRoles.setIcon(FontAwesome.WRENCH); updateUserRightsAndRoles.setSizeFull(); updateUserRightsAndRoles.setDescription("Click here to update the user's role and group for a device!"); String buttonTitle = "Refresh"; Button refresh = new Button(buttonTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull(); refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); // String buttonTitleSave = "Save"; // Button save = new Button(buttonTitleSave); // save.setIcon(FontAwesome.SAVE); // save.setSizeFull(); // save.setDescription("Click here to save all changes!"); // save.addStyleName(ValoTheme.BUTTON_BORDERLESS); userDevice = new ListSelect("Devices"); userDevice.addItems(DBManager.getDatabaseInstance().getDeviceNames()); userDevice.setRows(6); userDevice.setNullSelectionAllowed(false); userDevice.setSizeFull(); userDevice.setImmediate(true); /* * userDevice.addValueChangeListener(e -> Notification.show("Device:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userGroup = new ListSelect("User Groups"); userGroup.addItems(DBManager.getDatabaseInstance().getUserGroups()); userGroup.addItem("N/A"); userGroup.setRows(6); userGroup.setNullSelectionAllowed(false); userGroup.setSizeFull(); userGroup.setImmediate(true); /* * userGroup.addValueChangeListener(e -> Notification.show("User Group:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userRole = new ListSelect("User Roles"); userRole.addItems(DBManager.getDatabaseInstance().getUserRoles()); userRole.addItem("N/A"); userRole.setRows(6); userRole.setNullSelectionAllowed(false); userRole.setSizeFull(); userRole.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userWorkgroup = new ListSelect("Workgroups"); userWorkgroup.addItems(DBManager.getDatabaseInstance().getUserWorkgroups()); userWorkgroup.setRows(6); userWorkgroup.setNullSelectionAllowed(false); userWorkgroup.setSizeFull(); userWorkgroup.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ Button updateUser = new Button(buttonTitle); updateUser.setIcon(FontAwesome.WRENCH); updateUser.setDescription("Click here to update your user role and group!"); refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUser.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496909L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUserWorkgroup.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -295434651623561492L; @Override public void buttonClick(ClickEvent event) { try { Object selectedRow = ((SingleSelectionModel) usersGrid.getSelectionModel()).getSelectedRow(); if (selectedRow == null || userWorkgroup.getValue().equals(null)) { Notification("Something's missing!", "Please make sure that you selected the user and workgroup! Make sure they are highligthed.", "error"); } else { DBManager.getDatabaseInstance().adminUpdatesUserWorkgroup( DBManager.getDatabaseInstance() .getUserGroupIDByName(userWorkgroup.getValue().toString()), DBManager.getDatabaseInstance().getUserLDAPIDbyID(selectedRow.toString())); // log changes in 'user_log' table DBManager.getDatabaseInstance().logEverything( LiferayAndVaadinUtils.getUser().getScreenName(), "Admin edited Workgroup"); Notification("Successfully Updated", "Selected values are updated in the database. If it was a mistake, please remind that there is no 'undo' functionality yet.", "success"); } } catch (Exception e) { Notification("Something's missing!", "Please make sure that you selected the user and workgroup! Make sure they are highligthed.", "error"); } refreshDataSources(); } }); updateUserGroup.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -5539382755814626288L; @Override public void buttonClick(ClickEvent event) { try { Object selectedRow = ((SingleSelectionModel) usersGrid.getSelectionModel()).getSelectedRow(); if (selectedRow == null || userWorkgroup.getValue().equals(null)) { Notification("Something's missing!", "Please make sure that you selected the user and group! Make sure they are highligthed.", "error"); } else { DBManager.getDatabaseInstance().adminUpdatesUserGroup( DBManager.getDatabaseInstance() .getUserGroupIDByName(userGroup.getValue().toString()), DBManager.getDatabaseInstance().getUserIDbyLDAPID(selectedRow.toString())); // log changes in 'user_log' table DBManager.getDatabaseInstance().logEverything( LiferayAndVaadinUtils.getUser().getScreenName(), "Admin edited User Group"); Notification("Successfully Updated", "Selected values are updated in the database. If it was a mistake, please remind that there is no 'undo' functionality yet.", "success"); } } catch (Exception e) { Notification("Something's missing!", "Please make sure that you selected the user and group! Make sure they are highligthed.", "error"); } refreshDataSources(); } }); updateUserRightsAndRoles.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = -295434651623561492L; @Override public void buttonClick(ClickEvent event) { try { Object selectedRow = ((SingleSelectionModel) usersGrid.getSelectionModel()).getSelectedRow(); if (selectedRow == null || userDevice.getValue().equals(null) || userRole.getValue().equals(null)) { Notification("Something's missing!", "Please make sure that you selected the user, device and role! Each list has to have one highligthed option.", "error"); } else { DBManager.getDatabaseInstance().adminUpdatesUserRoleForDevice( DBManager.getDatabaseInstance().getUserRoleIDbyDesc(userRole.getValue().toString()), DBManager.getDatabaseInstance().getUserIDbyLDAPID( DBManager.getDatabaseInstance().getUserLDAPIDbyID(selectedRow.toString())), DBManager.getDatabaseInstance() .getDeviceIDByName(userDevice.getValue().toString())); // log changes in 'user_log' table DBManager.getDatabaseInstance().logEverything( LiferayAndVaadinUtils.getUser().getScreenName(), "Admin edited Device, Role, Group"); Notification("Successfully Updated", "Selected values are updated in the database. If it was a mistake, please remind that there is no 'undo' functionality yet.", "success"); } } catch (Exception e) { Notification("Something's missing!", "Please make sure that you selected the user, device and role! Each list has to have one highligthed option.", "error"); } refreshDataSources(); } }); try { TableQuery tq = new TableQuery("user", DBManager.getDatabaseInstanceAlternative()); tq.setVersionColumn("OPTLOCK"); SQLContainer container = new SQLContainer(tq); // System.out.println("Print Container: " + container.size()); container.setAutoCommit(isEnabled()); usersGrid = new Grid(container); FieldGroup fieldGroup = usersGrid.getEditorFieldGroup(); fieldGroup.addCommitHandler(new FieldGroup.CommitHandler() { /** * */ private static final long serialVersionUID = 3799806709907688919L; @Override public void preCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException { } @Override public void postCommit(FieldGroup.CommitEvent commitEvent) throws FieldGroup.CommitException { Notification("Successfully Updated", "Selected values are updated in the database. If it was a mistake, please remind that there is no 'undo' functionality yet.", "success"); refreshGrid(); } private void refreshGrid() { container.refresh(); } }); usersGrid.addSelectionListener(selectionEvent -> { // Java 8 // Get selection from the selection model Object selected = ((SingleSelectionModel) usersGrid.getSelectionModel()).getSelectedRow(); if (selected != null) { // userDevice.select(bookAdmin.getSelectedTab().getCaption()); userWorkgroup.select(DBManager.getDatabaseInstance().getUserWorkgroupByUserId(usersGrid .getContainerDataSource().getItem(selected).getItemProperty("user_id").toString())); userGroup.select(DBManager.getDatabaseInstance().getUserRoleByUserId(usersGrid .getContainerDataSource().getItem(selected).getItemProperty("user_id").toString())); userDevice.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = -8696555155016720475L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { userRole.select( DBManager.getDatabaseInstance().getUserGroupDescriptionByUserID( usersGrid.getContainerDataSource().getItem(selected) .getItemProperty("user_id").toString(), userDevice.getValue().toString())); } }); isAdmin.setValue(DBManager.getDatabaseInstance().hasAdminPanelAccess(usersGrid .getContainerDataSource().getItem(selected).getItemProperty("user_id").toString())); Notification.show("Selected " + usersGrid.getContainerDataSource().getItem(selected).getItemProperty("user_id")); } else Notification.show("Nothing selected"); }); } catch (Exception e) { // TODO Auto-generated catch block Notification("Something went wrong!", "Unable to update/connect the database. There may be a connection problem, please check your internet connection settings then try it again.", "error"); e.printStackTrace(); } /* * // only admins are allowed to see the admin panel ;) if (!DBManager.getDatabaseInstance() * .getUserAdminPanelAccessByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName()) * .equals("1")) { VerticalLayout errorLayout = new VerticalLayout(); * infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); * showErrorNotification( "Access Denied!", * "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'." * ); setCompositionRoot(errorLayout); return; } */ this.setCaption("User Manager"); final TabSheet userAdmin = new TabSheet(); userAdmin.addStyleName(ValoTheme.TABSHEET_FRAMED); userAdmin.addTab(usersGrid()); /* * userAdmin.addSelectedTabChangeListener(new SelectedTabChangeListener() { * * @Override public void selectedTabChange(SelectedTabChangeEvent event) { * * } }); */ gridLayout.setWidth("100%"); // add components to the grid layout // gridLayout.addComponent(infoLabel, 0, 0, 3, 0); gridLayout.addComponent(userAdmin, 0, 1, 5, 1); gridLayout.addComponent(refresh, 0, 2); gridLayout.addComponent(isAdmin, 5, 2); // gridLayout.addComponent(save); gridLayout.addComponent(userWorkgroup, 0, 4); gridLayout.addComponent(userDevice, 1, 4); gridLayout.addComponent(userRole, 2, 4, 4, 4); gridLayout.addComponent(userGroup, 5, 4); gridLayout.addComponent(updateUserWorkgroup, 0, 5); gridLayout.addComponent(updateUserRightsAndRoles, 1, 5, 4, 5); gridLayout.addComponent(updateUserGroup, 5, 5); // gridLayout.addComponent(newContainerGrid, 1, 4); gridLayout.setSpacing(true); gridLayout.setSizeFull(); setCompositionRoot(gridLayout); }
From source file:fi.vtt.RVaadin.RUpload.java
License:Apache License
/** * Contruct an upload element for R (implemented as Vaadin CustomComponent). * // w w w .j a va2 s . c o m * @param caption * String caption or null * @param R * the corresponding RSession to upload the files to */ public RUpload(String caption, RContainer R) { /* Create the RUpload custom component */ super.setSizeUndefined(); root = new Panel(caption); root.setWidth("90ex"); setCompositionRoot(root); HorizontalLayout hbox = new HorizontalLayout(); hbox.setWidth("100%"); /* Create the Upload component */ final Upload upload = new Upload("Choose file", this); upload.setButtonCaption("Submit"); /* Listen for events regarding the success of upload. */ upload.addSucceededListener(this); upload.addFailedListener(this); hbox.addComponent(upload); Label hfill = new Label(); hbox.addComponent(hfill); hbox.setExpandRatio(hfill, 1.0f); remove = new Button("Remove", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { String current = getSelection(); if (current != null) { /* Delete the file */ delete(current); /* Update the lists and the notification area */ int i = fileNames.indexOf(current); fileNames.remove(i); mimeTypes.remove(i); uploadedFiles.removeItem(current); /* Gray out the button, if this was the last item */ if (fileNames.isEmpty()) { remove.setEnabled(false); } } } }); hbox.addComponent(remove); remove.setEnabled(false); hbox.setComponentAlignment(remove, Alignment.BOTTOM_RIGHT); /* Notification area for already uploaded files */ uploadedFiles = new ListSelect("Already submitted files"); uploadedFiles.setMultiSelect(false); uploadedFiles.setNullSelectionAllowed(false); uploadedFiles.setHeight("4em"); uploadedFiles.setWidth("100%"); // Changed for Vaadin 7, not tested!! VerticalLayout vbox = new VerticalLayout(); vbox.addComponent(hbox); vbox.addComponent(uploadedFiles); root.setContent(vbox); /* Bind the component to the given R session */ this.R = R; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.TemplateNodeComponent.java
License:Apache License
private void init() { type = new ListSelect(TRANSLATOR.translate("general.type")); name = new TextField(TRANSLATOR.translate("general.name")); VerticalLayout vl = new VerticalLayout(); BeanFieldGroup binder = new BeanFieldGroup(getNode().getClass()); binder.setItemDataSource(getNode()); binder.bind(type, "templateNodeType"); BeanItemContainer<TemplateNodeType> container = new BeanItemContainer<>(TemplateNodeType.class, new TemplateNodeTypeJpaController(DataBaseManager.getEntityManagerFactory()) .findTemplateNodeTypeEntities()); type.setContainerDataSource(container); type.getItemIds().forEach(id -> { TemplateNodeType temp = ((TemplateNodeType) id); type.setItemCaption(id, TRANSLATOR.translate(temp.getTypeName())); });/*from w w w . j a va 2s .c o m*/ type.setNullSelectionAllowed(false); type.addValueChangeListener(listener -> { getNode().setTemplateNodeType((TemplateNodeType) type.getValue()); }); name = (TextField) binder.buildAndBind(TRANSLATOR.translate("general.name"), "nodeName", TextField.class); name.setNullRepresentation(""); name.addValueChangeListener(listener -> { getNode().setNodeName(name.getValue()); }); vl.addComponent(name); vl.addComponent(type); binder.setReadOnly(!edit); setContent(vl); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.template.TemplateScreenProvider.java
License:Apache License
public TemplateScreenProvider() { templates = new ListSelect(TRANSLATOR.translate("template.tab.list.name")); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.workflow.WorkflowViewer.java
License:Apache License
private Component getControls() { VerticalLayout controls = new VerticalLayout(); Button addStep = new Button(TRANSLATOR.translate("general.add.step")); VerticalLayout vl = new VerticalLayout(); TextField name = new TextField(TRANSLATOR.translate("general.name")); vl.addComponent(name);//w ww . jav a 2 s .c om addStep.addClickListener(listener -> { MessageBox prompt = MessageBox.createQuestion().withCaption(TRANSLATOR.translate("general.add.step")) .withMessage(vl).withYesButton(() -> { if (name.getValue() != null && !name.getValue().isEmpty()) { Graph.Node node = new Graph.Node(TRANSLATOR.translate(name.getValue())); nodes.put(--count, node); node.setParam(KEY, "" + count); node.setParam(ITEM_NAME, TRANSLATOR.translate(name.getValue())); added.add(node); refreshWorkflow(); } }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK)) .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE)); prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON); prompt.open(); }); addStep.setWidth(100, Unit.PERCENTAGE); addStep.setEnabled(workflows.getValue() != null); controls.addComponent(addStep); Button addTransition = new Button(TRANSLATOR.translate("general.add.transition")); VerticalLayout vl2 = new VerticalLayout(); TextField transitionName = new TextField(TRANSLATOR.translate("general.name")); ListSelect nodeList = new ListSelect(TRANSLATOR.translate("general.step")); BeanItemContainer<Graph.Node> container = new BeanItemContainer<>(Graph.Node.class, nodes.values()); nodeList.setContainerDataSource(container); nodeList.getItemIds().forEach(id -> { Graph.Node temp = ((Graph.Node) id); nodeList.setItemCaption(id, temp.getId()); }); nodeList.setNullSelectionAllowed(false); vl2.addComponent(transitionName); vl2.addComponent(nodeList); addTransition.addClickListener(listener -> { MessageBox prompt = MessageBox.createQuestion() .withCaption(TRANSLATOR.translate("general.add.transition")).withMessage(vl2) .withYesButton(() -> { if (transitionName.getValue() != null && !transitionName.getValue().isEmpty() && selected instanceof Subgraph.Node) { Subgraph.Edge edge = new Subgraph.Edge(); edge.setDest((Subgraph.Node) nodeList.getValue()); edges.put(transitionName.getValue(), new AbstractMap.SimpleEntry<>((Subgraph.Node) selected, edge)); edge.setParam(KEY, "" + --count); added.add(edge); refreshWorkflow(); } }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK)) .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE)); prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON); prompt.open(); }); addTransition.setWidth(100, Unit.PERCENTAGE); addTransition.setEnabled(selected instanceof Subgraph.Node); controls.addComponent(addTransition); Button delete = new Button(TRANSLATOR.translate("general.delete")); delete.setEnabled(selected != null); delete.setWidth(100, Unit.PERCENTAGE); delete.addClickListener(listener -> { MessageBox prompt = MessageBox.createQuestion().withCaption(TRANSLATOR.translate("general.delete")) .withMessage(TRANSLATOR.translate("general.delete.confirmation")).withYesButton(() -> { if (selected instanceof Subgraph.Edge) { Subgraph.Edge edge = (Subgraph.Edge) selected; edges.remove(edge.getParam("label")); addToDelete(edge); } else { Graph.Node node = (Graph.Node) selected; addToDelete(node); } refreshWorkflow(); }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK)) .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE)); prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON); prompt.open(); }); controls.addComponent(delete); Button rename = new Button(TRANSLATOR.translate("general.rename")); rename.setWidth(100, Unit.PERCENTAGE); rename.setEnabled(selected != null); rename.addClickListener(listener -> { Window w = new VMWindow(TRANSLATOR.translate("general.rename")); w.setWidth(25, Unit.PERCENTAGE); w.setHeight(25, Unit.PERCENTAGE); UI.getCurrent().addWindow(w); }); controls.addComponent(rename); Button save = new Button(TRANSLATOR.translate("general.save")); save.setWidth(100, Unit.PERCENTAGE); save.setEnabled(!added.isEmpty() || !deleted.isEmpty()); save.addClickListener(listener -> { List<Graph.Node> nodesToAdd = new ArrayList<>(); List<Subgraph.Edge> edgesToAdd = new ArrayList<>(); WorkflowServer ws = new WorkflowServer(((Workflow) workflows.getValue()).getId()); added.forEach(a -> { if (a instanceof Graph.Node) { nodesToAdd.add((Graph.Node) a); } else if (a instanceof Subgraph.Edge) { edgesToAdd.add((Subgraph.Edge) a); } }); deleted.forEach(a -> { LOG.log(Level.INFO, "Deleted: {0}", a); }); nodesToAdd.forEach(node -> { try { ws.addStep(node.getParam(ITEM_NAME)); } catch (VMException ex) { LOG.log(Level.SEVERE, ex.getLocalizedMessage(), ex); } }); displayWorkflow(ws.getEntity()); }); controls.addComponent(save); Button cancel = new Button(TRANSLATOR.translate("general.cancel")); cancel.setWidth(100, Unit.PERCENTAGE); cancel.setEnabled(selected != null); cancel.addClickListener(listener -> { Workflow w = (Workflow) workflows.getValue(); if (w != null) { displayWorkflow(w); } deleted.clear(); added.clear(); }); controls.addComponent(cancel); return controls; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static ListSelect addListSelect(AbsoluteLayout parent, String caption, String position, String width) { ListSelect list = new ListSelect(caption); list.setWidth(width);/* ww w . j a va 2 s.c o m*/ list.setNullSelectionAllowed(false); list.setImmediate(true); parent.addComponent(list, position); return list; }
From source file:org.jumpmind.metl.ui.views.deploy.EditAgentDeploymentPanel.java
License:Open Source License
protected ListSelect getScheduleComponent(String caption) { ListSelect listSelect = new ListSelect(caption); listSelect.setWidth(90, Unit.PIXELS); listSelect.setMultiSelect(true);/* w ww . j ava 2 s .co m*/ listSelect.setRows(10); listSelect.setImmediate(true); listSelect.addItem("*"); listSelect.setItemCaption("*", "<All>"); if (caption.equals("Second") || caption.equals("Minute")) { for (int i = 0; i <= 59; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Hour")) { for (int i = 0; i <= 23; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Day")) { for (int i = 1; i <= 31; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Month")) { listSelect.addItems("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"); } else if (caption.equals("Day of Week")) { listSelect.addItems("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"); } else if (caption.equals("Year")) { for (int i = Calendar.getInstance().get(Calendar.YEAR); i <= 2099; i++) { listSelect.addItem(String.valueOf(i)); } } listSelect.select(listSelect.getItemIds().iterator().next()); listSelect.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { updateScheduleExpression(); } }); return listSelect; }
From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceEditWindow.java
License:Open Source License
/** * Constructor/*from w ww . j av a 2 s. c om*/ * * @param businessService the Business Service DTO instance to be configured */ @SuppressWarnings("unchecked") public BusinessServiceEditWindow(BusinessService businessService, BusinessServiceManager businessServiceManager) { /** * set window title... */ super("Business Service Edit"); m_businessService = businessService; /** * ...and basic properties */ setModal(true); setClosable(false); setResizable(false); setWidth(650, Unit.PIXELS); setHeight(550, Unit.PIXELS); /** * create set for Business Service names */ m_businessServiceNames = businessServiceManager.getAllBusinessServices().stream() .map(BusinessService::getName).collect(Collectors.toSet()); if (m_businessService.getName() != null) { m_businessServiceNames.remove(m_businessService.getName()); } /** * construct the main layout */ VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull(); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); /** * add saveBusinessService button */ Button saveButton = new Button("Save"); saveButton.setId("saveButton"); saveButton.addClickListener( UIHelper.getCurrent(TransactionAwareUI.class).wrapInTransactionProxy(new Button.ClickListener() { private static final long serialVersionUID = -5985304347211214365L; @Override public void buttonClick(Button.ClickEvent event) { if (!m_thresholdTextField.isValid() || !m_nameTextField.isValid()) { return; } final ReductionFunction reductionFunction = getReduceFunction(); businessService.setName(m_nameTextField.getValue().trim()); businessService.setReduceFunction(reductionFunction); businessService.save(); close(); } private ReductionFunction getReduceFunction() { try { final ReductionFunction reductionFunction = ((Class<? extends ReductionFunction>) m_reduceFunctionNativeSelect .getValue()).newInstance(); reductionFunction.accept(new ReduceFunctionVisitor<Void>() { @Override public Void visit(HighestSeverity highestSeverity) { return null; } @Override public Void visit(HighestSeverityAbove highestSeverityAbove) { highestSeverityAbove.setThreshold((Status) m_thresholdStatusSelect.getValue()); return null; } @Override public Void visit(Threshold threshold) { threshold.setThreshold(Float.parseFloat(m_thresholdTextField.getValue())); return null; } }); return reductionFunction; } catch (final InstantiationException | IllegalAccessException e) { throw Throwables.propagate(e); } } })); /** * add the cancel button */ Button cancelButton = new Button("Cancel"); cancelButton.setId("cancelButton"); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 5306168797758047745L; @Override public void buttonClick(Button.ClickEvent event) { close(); } }); /** * add the buttons to a HorizontalLayout */ HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(saveButton); buttonLayout.addComponent(cancelButton); /** * instantiate the input fields */ m_nameTextField = new TextField("Business Service Name"); m_nameTextField.setId("nameField"); m_nameTextField.setNullRepresentation(""); m_nameTextField.setNullSettingAllowed(true); m_nameTextField.setValue(businessService.getName()); m_nameTextField.setWidth(100, Unit.PERCENTAGE); m_nameTextField.setRequired(true); m_nameTextField.focus(); m_nameTextField.addValidator(new AbstractStringValidator("Name must be unique") { private static final long serialVersionUID = 1L; @Override protected boolean isValidValue(String value) { return value != null && !m_businessServiceNames.contains(value); } }); verticalLayout.addComponent(m_nameTextField); /** * create the reduce function component */ m_reduceFunctionNativeSelect = new NativeSelect("Reduce Function", ImmutableList.builder() .add(HighestSeverity.class).add(Threshold.class).add(HighestSeverityAbove.class).build()); m_reduceFunctionNativeSelect.setId("reduceFunctionNativeSelect"); m_reduceFunctionNativeSelect.setWidth(100.0f, Unit.PERCENTAGE); m_reduceFunctionNativeSelect.setNullSelectionAllowed(false); m_reduceFunctionNativeSelect.setMultiSelect(false); m_reduceFunctionNativeSelect.setImmediate(true); m_reduceFunctionNativeSelect.setNewItemsAllowed(false); /** * setting the captions for items */ m_reduceFunctionNativeSelect.getItemIds().forEach( itemId -> m_reduceFunctionNativeSelect.setItemCaption(itemId, ((Class<?>) itemId).getSimpleName())); verticalLayout.addComponent(m_reduceFunctionNativeSelect); m_thresholdTextField = new TextField("Threshold"); m_thresholdTextField.setId("thresholdTextField"); m_thresholdTextField.setRequired(false); m_thresholdTextField.setEnabled(false); m_thresholdTextField.setImmediate(true); m_thresholdTextField.setWidth(100.0f, Unit.PERCENTAGE); m_thresholdTextField.setValue("0.0"); m_thresholdTextField.addValidator(v -> { if (m_thresholdTextField.isEnabled()) { try { final float value = Float.parseFloat(m_thresholdTextField.getValue()); if (0.0f >= value || value > 1.0) { throw new NumberFormatException(); } } catch (final NumberFormatException e) { throw new Validator.InvalidValueException("Threshold must be a positive number"); } } }); verticalLayout.addComponent(m_thresholdTextField); /** * Status selection for "Highest Severity Above" */ m_thresholdStatusSelect = new NativeSelect("Threshold"); m_thresholdStatusSelect.setId("thresholdStatusSelect"); m_thresholdStatusSelect.setRequired(false); m_thresholdStatusSelect.setEnabled(false); m_thresholdStatusSelect.setImmediate(true); m_thresholdStatusSelect.setWidth(100.0f, Unit.PERCENTAGE); m_thresholdStatusSelect.setMultiSelect(false); m_thresholdStatusSelect.setNewItemsAllowed(false); m_thresholdStatusSelect.setNullSelectionAllowed(false); for (Status eachStatus : Status.values()) { m_thresholdStatusSelect.addItem(eachStatus); } m_thresholdStatusSelect.setValue(Status.INDETERMINATE); m_thresholdStatusSelect.getItemIds() .forEach(itemId -> m_thresholdStatusSelect.setItemCaption(itemId, ((Status) itemId).getLabel())); verticalLayout.addComponent(m_thresholdStatusSelect); m_reduceFunctionNativeSelect.addValueChangeListener(ev -> { boolean thresholdFunction = m_reduceFunctionNativeSelect.getValue() == Threshold.class; boolean highestSeverityAboveFunction = m_reduceFunctionNativeSelect .getValue() == HighestSeverityAbove.class; setVisible(m_thresholdTextField, thresholdFunction); setVisible(m_thresholdStatusSelect, highestSeverityAboveFunction); }); if (Objects.isNull(businessService.getReduceFunction())) { m_reduceFunctionNativeSelect.setValue(HighestSeverity.class); } else { m_reduceFunctionNativeSelect.setValue(businessService.getReduceFunction().getClass()); businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() { @Override public Void visit(HighestSeverity highestSeverity) { return null; } @Override public Void visit(HighestSeverityAbove highestSeverityAbove) { m_thresholdStatusSelect.setValue(highestSeverityAbove.getThreshold()); return null; } @Override public Void visit(Threshold threshold) { m_thresholdTextField.setValue(String.valueOf(threshold.getThreshold())); return null; } }); } /** * create the edges list box */ m_edgesListSelect = new ListSelect("Edges"); m_edgesListSelect.setId("edgeList"); m_edgesListSelect.setWidth(100.0f, Unit.PERCENTAGE); m_edgesListSelect.setRows(10); m_edgesListSelect.setNullSelectionAllowed(false); m_edgesListSelect.setMultiSelect(false); refreshEdges(); HorizontalLayout edgesListAndButtonLayout = new HorizontalLayout(); edgesListAndButtonLayout.setWidth(100.0f, Unit.PERCENTAGE); VerticalLayout edgesButtonLayout = new VerticalLayout(); edgesButtonLayout.setWidth(110.0f, Unit.PIXELS); edgesButtonLayout.setSpacing(true); Button addEdgeButton = new Button("Add Edge"); addEdgeButton.setId("addEdgeButton"); addEdgeButton.setWidth(110.0f, Unit.PIXELS); addEdgeButton.addStyleName("small"); edgesButtonLayout.addComponent(addEdgeButton); addEdgeButton.addClickListener((Button.ClickListener) event -> { final BusinessServiceEdgeEditWindow window = new BusinessServiceEdgeEditWindow(businessService, businessServiceManager, null); window.addCloseListener(e -> refreshEdges()); this.getUI().addWindow(window); }); Button editEdgeButton = new Button("Edit Edge"); editEdgeButton.setId("editEdgeButton"); editEdgeButton.setEnabled(false); editEdgeButton.setWidth(110.0f, Unit.PIXELS); editEdgeButton.addStyleName("small"); edgesButtonLayout.addComponent(editEdgeButton); editEdgeButton.addClickListener((Button.ClickListener) event -> { final BusinessServiceEdgeEditWindow window = new BusinessServiceEdgeEditWindow(businessService, businessServiceManager, (Edge) m_edgesListSelect.getValue()); window.addCloseListener(e -> refreshEdges()); this.getUI().addWindow(window); }); final Button removeEdgeButton = new Button("Remove Edge"); removeEdgeButton.setId("removeEdgeButton"); removeEdgeButton.setEnabled(false); removeEdgeButton.setWidth(110.0f, Unit.PIXELS); removeEdgeButton.addStyleName("small"); edgesButtonLayout.addComponent(removeEdgeButton); m_edgesListSelect.addValueChangeListener((Property.ValueChangeListener) event -> { removeEdgeButton.setEnabled(event.getProperty().getValue() != null); editEdgeButton.setEnabled(event.getProperty().getValue() != null); }); removeEdgeButton.addClickListener((Button.ClickListener) event -> { if (m_edgesListSelect.getValue() != null) { removeEdgeButton.setEnabled(false); ((Edge) m_edgesListSelect.getValue()).delete(); refreshEdges(); } }); edgesListAndButtonLayout.setSpacing(true); edgesListAndButtonLayout.addComponent(m_edgesListSelect); edgesListAndButtonLayout.setExpandRatio(m_edgesListSelect, 1.0f); edgesListAndButtonLayout.addComponent(edgesButtonLayout); edgesListAndButtonLayout.setComponentAlignment(edgesButtonLayout, Alignment.BOTTOM_CENTER); verticalLayout.addComponent(edgesListAndButtonLayout); /** * create the attributes list box */ m_attributesListSelect = new ListSelect("Attributes"); m_attributesListSelect.setId("attributeList"); m_attributesListSelect.setWidth(100.0f, Unit.PERCENTAGE); m_attributesListSelect.setRows(10); m_attributesListSelect.setNullSelectionAllowed(false); m_attributesListSelect.setMultiSelect(false); refreshAttributes(); HorizontalLayout attributesListAndButtonLayout = new HorizontalLayout(); attributesListAndButtonLayout.setWidth(100.0f, Unit.PERCENTAGE); VerticalLayout attributesButtonLayout = new VerticalLayout(); attributesButtonLayout.setWidth(110.0f, Unit.PIXELS); attributesButtonLayout.setSpacing(true); Button addAttributeButton = new Button("Add Attribute"); addAttributeButton.setId("addAttributeButton"); addAttributeButton.setWidth(110.0f, Unit.PIXELS); addAttributeButton.addStyleName("small"); attributesButtonLayout.addComponent(addAttributeButton); addAttributeButton.addClickListener((Button.ClickListener) event -> { KeyValueInputDialogWindow keyValueInputDialogWindow = new KeyValueInputDialogWindow() .withKeyFieldName("Key").withValueFieldName("Value").withCaption("Attribute").withKey("") .withValue("").withOkAction(new KeyValueInputDialogWindow.Action() { @Override public void execute(KeyValueInputDialogWindow window) { m_businessService.getAttributes().put(window.getKey(), window.getValue()); refreshAttributes(); } }).withKeyValidator(new AbstractStringValidator("Key must not be empty") { private static final long serialVersionUID = 1L; @Override protected boolean isValidValue(String value) { return !Strings.isNullOrEmpty(value); } }).withKeyValidator(new AbstractStringValidator("Key must be unique") { private static final long serialVersionUID = 1L; @Override protected boolean isValidValue(String value) { return !m_businessService.getAttributes().containsKey(value); } }).focusKey(); this.getUI().addWindow(keyValueInputDialogWindow); keyValueInputDialogWindow.focus(); }); Button editAttributeButton = new Button("Edit Attribute"); editAttributeButton.setId("editAttributeButton"); editAttributeButton.setEnabled(false); editAttributeButton.setWidth(110.0f, Unit.PIXELS); editAttributeButton.addStyleName("small"); attributesButtonLayout.addComponent(editAttributeButton); editAttributeButton.addClickListener((Button.ClickListener) event -> { Map.Entry<String, String> entry = (Map.Entry<String, String>) m_attributesListSelect.getValue(); KeyValueInputDialogWindow keyValueInputDialogWindow = new KeyValueInputDialogWindow() .withKeyFieldName("Key").withValueFieldName("Value").withCaption("Attribute") .withKey(entry.getKey()).disableKey().withValue(entry.getValue()) .withOkAction(new KeyValueInputDialogWindow.Action() { @Override public void execute(KeyValueInputDialogWindow window) { m_businessService.getAttributes().put(window.getKey(), window.getValue()); refreshAttributes(); } }).focusValue(); this.getUI().addWindow(keyValueInputDialogWindow); keyValueInputDialogWindow.focus(); }); final Button removeAttributeButton = new Button("Remove Attribute"); removeAttributeButton.setId("removeAttributeButton"); removeAttributeButton.setEnabled(false); removeAttributeButton.setWidth(110.0f, Unit.PIXELS); removeAttributeButton.addStyleName("small"); attributesButtonLayout.addComponent(removeAttributeButton); m_attributesListSelect.addValueChangeListener((Property.ValueChangeListener) event -> { removeAttributeButton.setEnabled(event.getProperty().getValue() != null); editAttributeButton.setEnabled(event.getProperty().getValue() != null); }); removeAttributeButton.addClickListener((Button.ClickListener) event -> { if (m_attributesListSelect.getValue() != null) { removeAttributeButton.setEnabled(false); m_businessService.getAttributes() .remove(((Map.Entry<String, String>) m_attributesListSelect.getValue()).getKey()); refreshAttributes(); } }); attributesListAndButtonLayout.setSpacing(true); attributesListAndButtonLayout.addComponent(m_attributesListSelect); attributesListAndButtonLayout.setExpandRatio(m_attributesListSelect, 1.0f); attributesListAndButtonLayout.addComponent(attributesButtonLayout); attributesListAndButtonLayout.setComponentAlignment(attributesButtonLayout, Alignment.BOTTOM_CENTER); verticalLayout.addComponent(attributesListAndButtonLayout); /** * now add the button layout to the main layout */ verticalLayout.addComponent(buttonLayout); verticalLayout.setExpandRatio(buttonLayout, 1.0f); verticalLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); /** * set the window's content */ setContent(verticalLayout); }