List of usage examples for com.vaadin.ui CheckBox setValue
@Override public void setValue(Boolean value)
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);// w ww . ja va 2 s .co m 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:fr.amapj.view.engine.grid.booleangrid.PopupBooleanGrid.java
License:Open Source License
private void addRow(int lig) { List<Object> cells = new ArrayList<Object>(); Label dateLabel = new Label(param.leftPartLine.get(lig)); dateLabel.addStyleName("big"); dateLabel.addStyleName("align-center"); dateLabel.setWidth(param.largeurCol + "px"); cells.add(dateLabel);//from w ww.j av a 2s . c o m if (param.leftPartLine2 != null) { dateLabel = new Label(param.leftPartLine2.get(lig)); dateLabel.addStyleName("big"); dateLabel.addStyleName("align-center"); dateLabel.setWidth(param.largeurCol + "px"); cells.add(dateLabel); } for (int j = 0; j < param.nbCol; j++) { boolean box = param.box[lig][j]; CheckBox checkbox = new CheckBox(); checkbox.setValue(box); checkbox.addStyleName("align-center"); checkbox.addStyleName("big"); checkbox.setWidth((param.largeurCol - 10) + "px"); cells.add(checkbox); } table.addItem(cells.toArray(), new Integer(lig)); }
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private CheckBox createCheckBox(boolean value, int taille) { CheckBox cb = new CheckBox(); cb.addStyleName("align-center"); cb.setValue(value); cb.setWidth(taille + "px"); cb.setImmediate(true);//from w w w .j ava2 s . c o m return cb; }
From source file:fr.amapj.view.engine.tools.TableBuilder.java
License:Open Source License
public CheckBox createCheckBox(boolean value, int taille) { CheckBox cb = new CheckBox(); cb.addStyleName("align-center"); cb.setValue(value); cb.setWidth(taille + "px"); cb.setImmediate(true);/*from ww w. j a v a2 s . co m*/ return cb; }
From source file:fr.amapj.view.views.cotisation.reception.PopupReceptionMasseCotisation.java
License:Open Source License
@Override protected void createContent(VerticalLayout contentLayout) { listPartContainer = new BeanItemContainer<>(PeriodeCotisationUtilisateurDTO.class); // Bind it to a component beanTable = new Table("", listPartContainer); beanTable.setStyleName("big strong"); beanTable.addGeneratedColumn("etatPaiement", new ColumnGenerator() { @Override/*w ww . j ava2 s .c o m*/ public Object generateCell(final Table source, final Object itemId, Object columnId) { final PeriodeCotisationUtilisateurDTO dto = (PeriodeCotisationUtilisateurDTO) itemId; if (dto.etatPaiementAdhesion == EtatPaiementAdhesion.ENCAISSE) { Label l = new Label("OUI"); return l; } else { CheckBox box = new CheckBox(); box.setValue(false); box.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean b = (Boolean) event.getProperty().getValue(); if (b.booleanValue() == true) { dto.etatPaiementAdhesion = EtatPaiementAdhesion.ENCAISSE; dto.dateReceptionCheque = DateUtils.getDate(); } else { dto.etatPaiementAdhesion = EtatPaiementAdhesion.A_FOURNIR; dto.dateReceptionCheque = null; } } }); return box; } } }); // Gestion de la liste des colonnes visibles beanTable.setVisibleColumns("nomUtilisateur", "prenomUtilisateur", "montantAdhesion", "etatPaiement", "typePaiementAdhesion"); beanTable.setColumnHeader("nomUtilisateur", "Nom"); beanTable.setColumnHeader("prenomUtilisateur", "Prnom"); beanTable.setColumnHeader("montantAdhesion", "Montant en "); beanTable.setColumnAlignment("montantAdhesion", Align.RIGHT); beanTable.setColumnHeader("etatPaiement", "Rceptionn"); beanTable.setColumnAlignment("montantAdhesion", Align.CENTER); beanTable.setColumnHeader("typePaiementAdhesion", "Type"); beanTable.setConverter("montantAdhesion", new CurrencyTextFieldConverter()); beanTable.setSelectable(true); beanTable.setImmediate(true); beanTable.setSizeFull(); contentLayout.addComponent(beanTable); contentLayout.setExpandRatio(beanTable, 1); listPartContainer.addAll(dtos); }
From source file:fr.amapj.view.views.gestioncontratsignes.ReceptionChequeEditorPart.java
License:Open Source License
protected void handleToutSelectionner() { for (int i = 0; i < paiements.size(); i++) { Item item = t.getItem(i);//from w w w . j av a2 s . c o m CheckBox tf = (CheckBox) item.getItemProperty("box").getValue(); tf.setValue(Boolean.TRUE); } }
From source file:kn.uni.gis.ui.GameComposite.java
License:Apache License
private void addToTable(final Player fox2) { LOGGER.info("adding player: {}", fox2.getName()); CheckBox comboBox = new CheckBox(); comboBox.setValue(true); comboBox.setImmediate(true);//from w w w . ja va2 s.c o m comboBox.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { boolean dings = (Boolean) event.getButton().getValue(); LOGGER.info("setting player: {} to {}", fox2.getName(), dings); layer.setPlayerVisible(fox2, dings); } }); gamerTable.addItem(new Object[] { fox2.getName(), comboBox }, fox2); }
From source file:life.qbic.components.PackageManagerTab.java
License:Open Source License
/** * creates the tab for creating new packages * @return vaadin component//from w w w .ja v a2 s . c o m * @throws SQLException: */ static Component createPackageManagerTab() throws SQLException { Database db = qOfferManager.getDb(); VerticalLayout packManVerticalLayout = new VerticalLayout(); packManVerticalLayout.setMargin(true); packManVerticalLayout.setSpacing(true); packManVerticalLayout.setSizeFull(); HorizontalLayout packManHorizontalLayout = new HorizontalLayout(); packManHorizontalLayout.setSpacing(true); Button addPackageButton = new Button("New Package"); addPackageButton.setIcon(FontAwesome.PLUS); addPackageButton.setDescription("Click here to add a new package but don't forget to update the details."); ComboBox updatePackageGroupComboBox = new ComboBox("Select package group"); updatePackageGroupComboBox.addItems("Sequencing", "Project Management", "Bioinformatics Analysis", "Mass spectrometry", "Other"); updatePackageGroupComboBox.setDescription( "Select a package group for the currently selected package and hit the " + "update button."); Button updateSelectedPackageButton = new Button("Update"); updateSelectedPackageButton.setIcon(FontAwesome.SPINNER); updateSelectedPackageButton.setDescription("Click here to update the currently selected package."); Button deleteSelectedPackageButton = new Button("Delete"); deleteSelectedPackageButton.setIcon(FontAwesome.TRASH_O); deleteSelectedPackageButton.setDescription("Click here to delete the currently selected package."); Button exportTableButton = new Button("Export as .csv"); exportTableButton.setIcon(FontAwesome.DOWNLOAD); exportTableButton.setDescription("Click here to export the table as .csv file."); CheckBox calculatePricesAutomaticallyCheckBox = new CheckBox("Auto-calculate external prices"); calculatePricesAutomaticallyCheckBox .setDescription("Click here to enable/disable the automatic calculation of the " + "external prices based on the internal prices."); calculatePricesAutomaticallyCheckBox.setValue(true); TableQuery tq = new TableQuery("packages", DBManager.getDatabaseInstanceAlternative()); tq.setVersionColumn("OPTLOCK"); SQLContainer container = new SQLContainer(tq); container.setAutoCommit(true); GeneratedPropertyContainer gpcontainer = new GeneratedPropertyContainer(container); // create the column holding the offer_ids where the package is being used in // TODO: offer_ids currently not in use; since it's extremely slow.. /* gpcontainer.addGeneratedProperty("offer_ids", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { int package_id = (Integer) item.getItemProperty("package_id").getValue(); // query offers_packages for all offer_ids of the current package ArrayList<String> offerIds = db.getOfferIdsForPackage(package_id); return String.join(",", offerIds); } @Override public Class<String> getType() { return String.class; } }); */ RefreshableGrid packageGrid = new RefreshableGrid(gpcontainer); // add the filters to the grid GridCellFilter filter = new GridCellFilter(packageGrid); filter.setTextFilter("package_id", true, true); filter.setTextFilter("package_name", true, false); filter.setTextFilter("package_facility", true, false); filter.setTextFilter("package_description", true, false); filter.setTextFilter("package_group", true, false); filter.setTextFilter("package_unit_type", true, false); filter.setComboBoxFilter("package_group", Arrays.asList("Bioinformatics Analysis", "Mass spectrometry", "Project Management", "Sequencing", "Other")); packageGrid.getColumn("package_id").setHeaderCaption("Id").setWidth(100); packageGrid.getColumn("package_name").setHeaderCaption("Name"); packageGrid.getColumn("package_facility").setHeaderCaption("Facility"); packageGrid.getColumn("package_description").setHeaderCaption("Description").setWidth(300); packageGrid.getColumn("package_group").setHeaderCaption("Package Group").setEditable(false); packageGrid.getColumn("package_price_internal").setHeaderCaption("Internal Price ()"); packageGrid.getColumn("package_price_external_academic").setHeaderCaption("Ext. Academical Price ()"); packageGrid.getColumn("package_price_external_commercial").setHeaderCaption("Ext. Commercial Price ()"); // TODO: offer_ids currently not in use; since it's extremely slow.. //packageGrid.getColumn("offer_ids").setHeaderCaption("Offer Id's"); packageGrid.getColumn("package_unit_type").setHeaderCaption("Unit Type"); /* // TODO: offer_ids currently not in use; since it's extremely slow.. packageGrid.setColumnOrder("package_id", "package_name", "package_description", "package_group", "package_facility", "package_price_internal", "package_price_external_academic", "package_price_external_commercial", "package_unit_type", "offer_ids");*/ packageGrid.setColumnOrder("package_id", "package_name", "package_description", "package_group", "package_facility", "package_price_internal", "package_price_external_academic", "package_price_external_commercial", "package_unit_type"); packageGrid.removeColumn("added_by"); packageGrid.removeColumn("package_grp"); packageGrid.removeColumn("package_date"); packageGrid.removeColumn("last_edited"); packageGrid.sort("package_name", SortDirection.ASCENDING); packageGrid.setWidth("100%"); packageGrid.setSelectionMode(Grid.SelectionMode.SINGLE); packageGrid.setEditorEnabled(true); addAutomaticPriceCalculation(calculatePricesAutomaticallyCheckBox, container, packageGrid); // add tooltips to the cells packageGrid.setCellDescriptionGenerator((Grid.CellDescriptionGenerator) cell -> { if (cell.getValue() == null) return null; return cell.getValue().toString(); }); // add tooltips to the header row for (Grid.Column column : packageGrid.getColumns()) { Grid.HeaderCell cell = packageGrid.getDefaultHeaderRow().getCell(column.getPropertyId()); String htmlWithTooltip = String.format("<span title=\"%s\">%s</span>", cell.getText(), cell.getText()); cell.setHtml(htmlWithTooltip); } addListeners(db, addPackageButton, updatePackageGroupComboBox, updateSelectedPackageButton, deleteSelectedPackageButton, container, packageGrid, exportTableButton); packManHorizontalLayout.addComponent(addPackageButton); packManHorizontalLayout.addComponent(updatePackageGroupComboBox); packManHorizontalLayout.addComponent(updateSelectedPackageButton); packManHorizontalLayout.addComponent(deleteSelectedPackageButton); packManHorizontalLayout.addComponent(exportTableButton); packManHorizontalLayout.addComponent(calculatePricesAutomaticallyCheckBox); packManHorizontalLayout.setComponentAlignment(addPackageButton, Alignment.BOTTOM_CENTER); packManHorizontalLayout.setComponentAlignment(updatePackageGroupComboBox, Alignment.MIDDLE_CENTER); packManHorizontalLayout.setComponentAlignment(updateSelectedPackageButton, Alignment.BOTTOM_CENTER); packManHorizontalLayout.setComponentAlignment(deleteSelectedPackageButton, Alignment.BOTTOM_CENTER); packManHorizontalLayout.setComponentAlignment(calculatePricesAutomaticallyCheckBox, Alignment.MIDDLE_CENTER); packManHorizontalLayout.setComponentAlignment(exportTableButton, Alignment.BOTTOM_CENTER); packManVerticalLayout.addComponent(packageGrid); packManVerticalLayout.addComponent(packManHorizontalLayout); return packManVerticalLayout; }
From source file:org.activiti.explorer.ui.process.simple.editor.table.PropertyTable.java
License:Apache License
protected void addPropertyRow(Object itemId, String propertyName, String propertyType, Boolean required) { Object newItemId = null;/*from www.j a va2s . c o m*/ if (itemId == null) { // add at the end of list newItemId = addItem(); } else { newItemId = addItemAfter(itemId); } Item newItem = getItem(newItemId); // name newItem.getItemProperty(ID_PROPERTY_NAME) .setValue(propertyName == null ? DEFAULT_PROPERTY_NAME : propertyName); // type ComboBox typeComboBox = new ComboBox("", Arrays.asList("text", "number", "date")); typeComboBox.setNullSelectionAllowed(false); if (propertyType == null) { typeComboBox.setValue(typeComboBox.getItemIds().iterator().next()); } else { typeComboBox.setValue(propertyType); } newItem.getItemProperty(ID_PROPERTY_TYPE).setValue(typeComboBox); // required CheckBox requiredCheckBox = new CheckBox(); requiredCheckBox.setValue(required == null ? false : required); newItem.getItemProperty(ID_PROPERTY_REQUIRED).setValue(requiredCheckBox); // actions HorizontalLayout actionButtons = new HorizontalLayout(); Button deleteRowButton = new Button("-"); deleteRowButton.setData(newItemId); deleteRowButton.addListener(new DeletePropertyClickListener(this)); actionButtons.addComponent(deleteRowButton); Button addRowButton = new Button("+"); addRowButton.setData(newItemId); addRowButton.addListener(new AddPropertyClickListener(this)); actionButtons.addComponent(addRowButton); newItem.getItemProperty(ID_PROPERTY_ACTIONS).setValue(actionButtons); }
From source file:org.activiti.explorer.ui.process.simple.editor.table.TaskTable.java
License:Apache License
protected Object addTaskRow(Object previousTaskItemId, String taskName, String taskAssignee, String taskGroups, String taskDescription, Boolean startWithPrevious) { Object newItemId = null;// w w w.ja v a2 s. c om if (previousTaskItemId == null) { // add at the end of list newItemId = addItem(); } else { newItemId = addItemAfter(previousTaskItemId); } Item newItem = getItem(newItemId); // name newItem.getItemProperty(ID_NAME).setValue(taskName == null ? "my task" : taskName); // assignee ComboBox assigneeComboBox = new ComboBox(); assigneeComboBox.setNullSelectionAllowed(true); try { for (User user : ProcessEngines.getDefaultProcessEngine().getIdentityService().createUserQuery() .orderByUserFirstName().asc().list()) { assigneeComboBox.addItem(user.getId()); assigneeComboBox.setItemCaption(user.getId(), user.getFirstName() + " " + user.getLastName()); } } catch (Exception e) { // Don't do anything. Will be an empty dropdown. } if (taskAssignee != null) { assigneeComboBox.select(taskAssignee); } newItem.getItemProperty(ID_ASSIGNEE).setValue(assigneeComboBox); // groups ComboBox groupComboBox = new ComboBox(); groupComboBox.setNullSelectionAllowed(true); try { for (Group group : ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery() .orderByGroupName().asc().list()) { groupComboBox.addItem(group.getId()); groupComboBox.setItemCaption(group.getId(), group.getName()); } } catch (Exception e) { // Don't do anything. Will be an empty dropdown. } if (taskGroups != null) { groupComboBox.select(taskGroups); } newItem.getItemProperty(ID_GROUPS).setValue(groupComboBox); // description TextField descriptionTextField = new TextField(); descriptionTextField.setColumns(16); descriptionTextField.setRows(1); if (taskDescription != null) { descriptionTextField.setValue(taskDescription); } newItem.getItemProperty(ID_DESCRIPTION).setValue(descriptionTextField); // concurrency CheckBox startWithPreviousCheckBox = new CheckBox( i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_START_WITH_PREVIOUS)); startWithPreviousCheckBox.setValue(startWithPrevious == null ? false : startWithPrevious); newItem.getItemProperty(ID_START_WITH_PREVIOUS).setValue(startWithPreviousCheckBox); // actions newItem.getItemProperty(ID_ACTIONS).setValue(generateActionButtons(newItemId)); return newItemId; }