List of usage examples for com.vaadin.server FontAwesome WRENCH
FontAwesome WRENCH
To view the source code for com.vaadin.server FontAwesome WRENCH.
Click Source Link
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. java2 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:lifetime.component.user.WorkButton.java
License:Apache License
public WorkButton(String language) { super("Work", language, FontAwesome.WRENCH); }
From source file:main.ProjectwizardUI.java
License:Open Source License
private void initView(final DBManager dbm, final DBVocabularies vocabularies, final String user) { tabs.removeAllComponents();//w ww . j a v a 2s . c om AttachmentConfig attachConfig = new AttachmentConfig(Integer.parseInt(config.getAttachmentMaxSize()), config.getAttachmentURI(), config.getAttachmentUser(), config.getAttachmenPassword()); WizardController c = new WizardController(openbis, dbm, vocabularies, attachConfig); c.init(user); Wizard w = c.getWizard(); WizardProgressListener wl = new WizardProgressListener() { @Override public void activeStepChanged(WizardStepActivationEvent event) { } @Override public void stepSetChanged(WizardStepSetChangedEvent event) { } @Override public void wizardCompleted(WizardCompletedEvent event) { vocabularies.setPeople(dbm.fetchPeople()); vocabularies.setSpaces(openbis.getUserSpaces(user)); initView(dbm, vocabularies, user); } @Override public void wizardCancelled(WizardCancelledEvent event) { vocabularies.setPeople(dbm.fetchPeople()); vocabularies.setSpaces(openbis.getUserSpaces(user)); initView(dbm, vocabularies, user); } }; w.addListener(wl); VerticalLayout wLayout = new VerticalLayout(); wLayout.addComponent(w); wLayout.setMargin(true); tabs.addTab(wLayout, "Create Project").setIcon(FontAwesome.FLASK); // TODO barcode tab, remove once new portlet is online // BarcodeConfig bcConf = new BarcodeConfig(config.getBarcodeScriptsFolder(), tmpFolder, // config.getBarcodeResultsFolder(), config.getBarcodePathVariable()); // SampleFilterGenerator gen = new SampleFilterGenerator(); // BarcodeController bc = new BarcodeController(openbis, bcConf, dbm); // gen.addObserver(bc); // final WizardBarcodeView bw = new WizardBarcodeView(vocabularies.getSpaces(), isAdmin, gen); // bw.initControl(bc); // tabs.addTab(bw, "Create Barcodes").setIcon(FontAwesome.BARCODE); // tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { // // @Override // public void selectedTabChange(SelectedTabChangeEvent event) { // bw.resetSpace(); // } // }); OpenbisCreationController creationController = new OpenbisCreationController(openbis);// will // not // work // when // openbis // is down ExperimentImportController uc = new ExperimentImportController(creationController, vocabularies, openbis, dbm); uc.init(user); tabs.addTab(uc.getView(), "Import Project").setIcon(FontAwesome.FILE); boolean overwriteAllowed = isAdmin || canOverwrite(); tabs.addTab(new MetadataUploadView(openbis, vocabularies, overwriteAllowed), "Update Metadata") .setIcon(FontAwesome.PENCIL); ; if (isAdmin) { logger.info("User is " + user + " and can see admin panel."); VerticalLayout padding = new VerticalLayout(); padding.setMargin(true); padding.addComponent(new AdminView(openbis, vocabularies, creationController, user)); tabs.addTab(padding, "Admin Functions").setIcon(FontAwesome.WRENCH); } if (overwriteAllowed) logger.info("User can overwrite existing metadata for their project."); }
From source file:org.vaadin.spring.samples.sidebar.ValoSideBarUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { super.init(vaadinRequest); CssLayout header = new CssLayout(); MenuBar menuBar = new MenuBar(); header.addComponent(menuBar);//from w w w . j a v a2 s . com MenuBar.MenuItem settingsItem = menuBar.addItem("", FontAwesome.WRENCH, null); MenuBar.MenuItem useLargeIconsItem = settingsItem.addItem("Use large icons", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { sideBar.setLargeIcons(selectedItem.isChecked()); } }); useLargeIconsItem.setCheckable(true); MenuBar.MenuItem showLogoItem = settingsItem.addItem("Show logo", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { if (selectedItem.isChecked()) { showLogo(); } else { hideLogo(); } } }); showLogoItem.setCheckable(true); sideBar.setHeader(header); }
From source file:ui.button.AddToolButton.java
License:Apache License
public AddToolButton(Integer userId, String language, T item) { super(Translator.getTranslation("Add Tool", language), FontAwesome.WRENCH); this.userId = userId; this.language = language; this.item = item; addClickListener(this); }