List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
From source file:de.symeda.sormas.ui.configuration.infrastructure.DistrictsView.java
License:Open Source License
public DistrictsView() { super(VIEW_NAME); criteria = ViewModelProviders.of(DistrictsView.class).get(DistrictCriteria.class); grid = new DistrictsGrid(); grid.setCriteria(criteria);/* ww w . j ava 2s . c o m*/ gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setExpandRatio(grid, 1); gridLayout.setSizeFull(); gridLayout.setStyleName("crud-main-layout"); if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_EXPORT)) { Button exportButton = new Button(I18nProperties.getCaption(Captions.export)); exportButton.setDescription(I18nProperties.getDescription(Descriptions.descExportButton)); exportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); exportButton.setIcon(VaadinIcons.TABLE); addHeaderComponent(exportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_districts", "sormas_districts_" + DateHelper.formatDateForExport(new Date()) + ".csv", DistrictsGrid.EDIT_BTN_ID); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(exportButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.actionNewEntry)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getInfrastructureController().createDistrict()); addHeaderComponent(createButton); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.configuration.infrastructure.RegionsView.java
License:Open Source License
public RegionsView() { super(VIEW_NAME); criteria = ViewModelProviders.of(RegionsView.class).get(RegionCriteria.class); grid = new RegionsGrid(); grid.setCriteria(criteria);/*w w w . j a va2 s . c o m*/ gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setExpandRatio(grid, 1); gridLayout.setSizeFull(); gridLayout.setStyleName("crud-main-layout"); if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_EXPORT)) { Button exportButton = new Button(I18nProperties.getCaption(Captions.export)); exportButton.setDescription(I18nProperties.getDescription(Descriptions.descExportButton)); exportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); exportButton.setIcon(VaadinIcons.TABLE); addHeaderComponent(exportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_regions", "sormas_regions_" + DateHelper.formatDateForExport(new Date()) + ".csv", RegionsGrid.EDIT_BTN_ID); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(exportButton); } if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_CREATE)) { createButton = new Button(I18nProperties.getCaption(Captions.actionNewEntry)); createButton.addStyleName(ValoTheme.BUTTON_PRIMARY); createButton.setIcon(VaadinIcons.PLUS_CIRCLE); createButton.addClickListener(e -> ControllerProvider.getInfrastructureController().createRegion()); addHeaderComponent(createButton); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.contact.ContactsView.java
License:Open Source License
public ContactsView() { super(VIEW_NAME); originalViewTitle = getViewTitleLabel().getValue(); criteria = ViewModelProviders.of(ContactsView.class).get(ContactCriteria.class); if (criteria.getArchived() == null) { criteria.archived(false);// www .jav a 2 s . c o m } grid = new ContactGrid(); grid.setCriteria(criteria); gridLayout = new VerticalLayout(); gridLayout.addComponent(createFilterBar()); gridLayout.addComponent(createStatusFilterBar()); gridLayout.addComponent(grid); gridLayout.setMargin(true); gridLayout.setSpacing(false); gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); grid.getDataProvider().addDataProviderListener(e -> updateStatusButtons()); if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setDescription(I18nProperties.getDescription(Descriptions.descExportButton)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(grid, "sormas_contacts", "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv"); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton .setDescription(I18nProperties.getDescription(Descriptions.descDetailedExportButton)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( ContactExportDto.class, (Integer start, Integer max) -> FacadeProvider.getContactFacade() .getExportList(UserProvider.getCurrent().getUuid(), grid.getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(ContactExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( HospitalizationDto.I18N_PREFIX, propertyId)))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_contacts_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); // Warning if no filters have been selected Label warningLabel = new Label(I18nProperties.getString(Strings.infoExportNoFilters)); warningLabel.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(warningLabel); warningLabel.setVisible(false); exportButton.addClickListener(e -> { warningLabel.setVisible(!criteria.hasAnyFilterActive()); }); } addComponent(gridLayout); }
From source file:de.symeda.sormas.ui.samples.SamplesView.java
License:Open Source License
public SamplesView() { super(VIEW_NAME); sampleListComponent = new SampleGridComponent(getViewTitleLabel(), this); setSizeFull();//w ww.ja v a 2 s .c o m addComponent(sampleListComponent); if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_EXPORT)) { PopupButton exportButton = new PopupButton(I18nProperties.getCaption(Captions.export)); exportButton.setIcon(VaadinIcons.DOWNLOAD); VerticalLayout exportLayout = new VerticalLayout(); exportLayout.setSpacing(true); exportLayout.setMargin(true); exportLayout.addStyleName(CssStyles.LAYOUT_MINIMAL); exportLayout.setWidth(200, Unit.PIXELS); exportButton.setContent(exportLayout); addHeaderComponent(exportButton); Button basicExportButton = new Button(I18nProperties.getCaption(Captions.exportBasic)); basicExportButton.setDescription(I18nProperties.getString(Strings.infoBasicExport)); basicExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); basicExportButton.setIcon(VaadinIcons.TABLE); basicExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(basicExportButton); StreamResource streamResource = new GridExportStreamResource(sampleListComponent.getGrid(), "sormas_samples", "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv", SampleGrid.EDIT_BTN_ID); FileDownloader fileDownloader = new FileDownloader(streamResource); fileDownloader.extend(basicExportButton); Button extendedExportButton = new Button(I18nProperties.getCaption(Captions.exportDetailed)); extendedExportButton.setDescription(I18nProperties.getString(Strings.infoDetailedExport)); extendedExportButton.addStyleName(ValoTheme.BUTTON_PRIMARY); extendedExportButton.setIcon(VaadinIcons.FILE_TEXT); extendedExportButton.setWidth(100, Unit.PERCENTAGE); exportLayout.addComponent(extendedExportButton); StreamResource extendedExportStreamResource = DownloadUtil.createCsvExportStreamResource( SampleExportDto.class, (Integer start, Integer max) -> FacadeProvider.getSampleFacade().getExportList( UserProvider.getCurrent().getUuid(), sampleListComponent.getGrid().getCriteria(), start, max), (propertyId, type) -> { String caption = I18nProperties.getPrefixCaption(SampleExportDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption(PersonDto.I18N_PREFIX, propertyId, I18nProperties.getPrefixCaption( AdditionalTestDto.I18N_PREFIX, propertyId))))); if (Date.class.isAssignableFrom(type)) { caption += " (" + DateHelper.getLocalShortDatePattern() + ")"; } return caption; }, "sormas_samples_" + DateHelper.formatDateForExport(new Date()) + ".csv"); new FileDownloader(extendedExportStreamResource).extend(extendedExportButton); } }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
private HorizontalLayout createFilterComponentLayout() { HorizontalLayout filterComponentLayout = new HorizontalLayout(); filterComponentLayout.setSpacing(true); filterComponentLayout.setWidth(100, Unit.PERCENTAGE); StatisticsFilterComponent filterComponent = new StatisticsFilterComponent(); Button removeFilterButton = new Button(VaadinIcons.CLOSE); removeFilterButton.setDescription(I18nProperties.getCaption(Captions.statisticsRemoveFilter)); CssStyles.style(removeFilterButton, CssStyles.FORCE_CAPTION); removeFilterButton.addClickListener(e -> { filterComponents.remove(filterComponent); filtersLayout.removeComponent(filterComponentLayout); });// w ww . j a v a 2 s. com filterComponentLayout.addComponent(removeFilterButton); filterComponents.add(filterComponent); filterComponentLayout.addComponent(filterComponent); filterComponentLayout.setExpandRatio(filterComponent, 1); return filterComponentLayout; }
From source file:edu.kit.dama.ui.admin.schedule.SchedulerBasePropertiesLayout.java
License:Apache License
/** * Default constructor.//ww w . j a va 2s .co m */ public SchedulerBasePropertiesLayout() { super(); LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull(); setMargin(true); setSpacing(true); setColumns(3); setRows(3); //first row addComponent(getIdField(), 0, 0); addComponent(getGroupField(), 1, 0); addComponent(getNameField(), 2, 0); //second row addComponent(getDescriptionArea(), 0, 1, 2, 1); Button addTriggerButton = new Button(); addTriggerButton.setDescription("Add a new trigger."); addTriggerButton.setIcon(new ThemeResource(IconContainer.ADD)); addTriggerButton.addClickListener((Button.ClickEvent event) -> { addTrigger(); }); Button removeTriggerButton = new Button(); removeTriggerButton.setDescription("Remove the selected trigger."); removeTriggerButton.setIcon(new ThemeResource(IconContainer.DELETE)); removeTriggerButton.addClickListener((Button.ClickEvent event) -> { removeTrigger(); }); Button refreshTriggerButton = new Button(); refreshTriggerButton.setDescription("Refresh the list of triggers."); refreshTriggerButton.setIcon(new ThemeResource(IconContainer.REFRESH)); refreshTriggerButton.addClickListener((Button.ClickEvent event) -> { reloadTriggers(); }); VerticalLayout buttonLayout = new VerticalLayout(addTriggerButton, refreshTriggerButton, removeTriggerButton); buttonLayout.setComponentAlignment(addTriggerButton, Alignment.TOP_RIGHT); buttonLayout.setComponentAlignment(removeTriggerButton, Alignment.TOP_RIGHT); buttonLayout.setMargin(true); GridLayout triggerLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getTriggerTable(), 0, 0, 1, 2) .addComponent(buttonLayout, 1, 0, 1, 2).getLayout(); triggerLayout.setSizeFull(); triggerLayout.setMargin(false); triggerLayout.setColumnExpandRatio(0, .95f); triggerLayout.setColumnExpandRatio(1, .05f); triggerLayout.setRowExpandRatio(0, .9f); triggerLayout.setRowExpandRatio(1, .05f); triggerLayout.setRowExpandRatio(2, .05f); //third row addComponent(triggerLayout, 0, 2, 2, 2); addTriggerComponent = new AddTriggerComponent(this); setRowExpandRatio(1, .3f); setRowExpandRatio(2, .6f); }
From source file:edu.kit.dama.ui.repo.components.EntryRenderPanel.java
License:Apache License
/** * Build the main layout of the representation of one digital object. * * @param pContext The authorization context used to decide whether special * administrative features are available or not. *//* www. ja v a 2 s .c o m*/ private void buildMainLayout(IAuthorizationContext pContext) { //check if the object could be obtained or not, e.g. due to missing permissions. If not, show an error message. if (ERROR_PLACEHOLDER.equals(object.getLabel())) { Label warnLabel = new Label("<h3>Failed to obtain entry with identifier '" + object.getDigitalObjectIdentifier() + "' from database.</h3>", ContentMode.HTML); final Button cleanup = new Button("Cleanup"); cleanup.setDescription("Click to remove object from search index."); cleanup.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { cleanup.setEnabled(false); new Notification("Information", "Cleanup not implemented, yet.", Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent()); } }); if (pContext.getRoleRestriction().atLeast(Role.ADMINISTRATOR)) { //show cleanup button mainLayout = new HorizontalLayout(warnLabel, cleanup); } else { //no cleanup available mainLayout = new HorizontalLayout(warnLabel); } mainLayout.setSizeFull(); return; } //initialize image field typeImage = new Image(); typeImage.setSizeFull(); setImage(object); //initialize title label/field titleField = UIUtils7.factoryTextField(null, "dc:title"); titleField.addStyleName("basic_title"); titleLabel = new Label("dc:title"); titleLabel.setWidth("100%"); titleLabel.addStyleName("basic_title"); //initialize creator label if (object.getUploader() != null) { creatorLabel = new Label(StringUtils.abbreviate(object.getUploader().getFullname(), 100)); creatorLabel.setEnabled(true); } else { creatorLabel = new Label("dc:creator"); creatorLabel.setEnabled(false); } creatorLabel.setWidth("100%"); creatorLabel.addStyleName("basic_left"); //initialize creation label if (object.getStartDate() != null) { creationLabel = new Label(new SimpleDateFormat().format(object.getStartDate())); creationLabel.setEnabled(true); } else { creationLabel = new Label("dc:date"); creationLabel.setEnabled(false); } creationLabel.setWidth("100%"); //initialize identifier label objectIdLabel = new Label(StringUtils.abbreviate(object.getDigitalObjectIdentifier(), 100)); objectIdLabel.setWidth("100%"); //initialize description label/area descriptionLabel = new Label("dc:description"); descriptionArea = UIUtils7.factoryTextArea(null, "dc:description"); descriptionArea.setHeight("50px"); descriptionLabel.setHeight("50px"); descriptionLabel.setWidth("100%"); //action buttons downloadButton = new NativeButton("Download"); downloadButton.setIcon(new ThemeResource("img/32x32/download.png")); downloadButton.setStyleName(BaseTheme.BUTTON_LINK); downloadButton.setDescription("Download the data of this digital object."); downloadButton.setWidth("100%"); shareButton = new NativeButton("Share"); shareButton.setIcon(new ThemeResource("img/16x16/share.png")); shareButton.setStyleName(BaseTheme.BUTTON_LINK); shareButton.setDescription("Share this digital object."); Role eligibleRole = Role.GUEST; if (parent.getParentUI().isUserLoggedIn()) { //obtain role only if a user is logged in and we are not in ingest mode. //Otherwise, the dummy context of MyVaadinUI would be used and will cause unwanted access. try { //Determine eligible role of currently logged in user eligibleRole = ResourceServiceLocal.getSingleton().getGrantRole(object.getSecurableResourceId(), parent.getParentUI().getAuthorizationContext().getUserId(), AuthorizationContext.factorySystemContext()); } catch (EntityNotFoundException | UnauthorizedAccessAttemptException ex) { LOGGER.warn("Failed to determine eligable role for context " + parent.getParentUI().getAuthorizationContext() + ". Continue with GUEST permissions.", ex); } } //Update share button depending on role. Only possessing the role MANAGER (being the owner) entitles to share an object. if (eligibleRole.atLeast(Role.MANAGER)) { shareButton.setEnabled(true); shareButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (parent != null) { parent.showSharingPopup(object); } } }); } else { shareButton.setEnabled(false); shareButton.setDescription("Only the object owner is allowed to change sharing information."); } editButton = new NativeButton("Edit Metadata"); editButton.setIcon(new ThemeResource("img/16x16/edit.png")); editButton.setStyleName(BaseTheme.BUTTON_LINK); editButton.setDescription("Edit this digital object's metadata."); //Update edit button depending on role. If the object is shared with or owned by the logged in user, editing will be allowed. if (eligibleRole.atLeast(Role.MEMBER)) { editButton.setEnabled(true); editButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { switchEditMode(); } }); } else { editButton.setEnabled(false); editButton.setDescription( "Only the object owner and users the object is shared with are allowed to change metadata information."); } starButton = new NativeButton("Favorite"); starButton.setImmediate(true); starButton.setIcon(new ThemeResource("img/16x16/unstarred.png")); starButton.setStyleName(BaseTheme.BUTTON_LINK); starButton.setDescription("Add/remove digital object to/from favorites."); //Update star button depending on role. If the object is shared with or owned by the logged in user, "star'ing" will be allowed. if (eligibleRole.atLeast(Role.MEMBER)) { starButton.setEnabled(true); starButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager(); mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext()); try { DigitalObjectType favoriteType = mdm .findSingleResult("SELECT t FROM DigitalObjectType t WHERE t.identifier='" + MyVaadinUI.FAVORITE_TYPE_IDENTIFIER + "' AND t.typeDomain='" + MyVaadinUI.FAVORITE_TYPE_DOMAIN + "'", DigitalObjectType.class); if (DigitalObjectTypeHelper.isTypeAssignedToObject(object, favoriteType, AuthorizationContext.factorySystemContext())) { //remove favorite status DigitalObjectTypeHelper.removeTypeFromObject(object, favoriteType, AuthorizationContext.factorySystemContext()); starButton.setIcon(new ThemeResource("img/16x16/unstarred.png")); new Notification("Information", "Successfully removed favorite tag from object " + object.getDigitalObjectIdentifier() + ".", Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent()); } else { //assign favorite status DigitalObjectTypeHelper.assignTypeToObject(object, favoriteType, AuthorizationContext.factorySystemContext()); starButton.setIcon(new ThemeResource("img/16x16/starred.png")); new Notification("Information", "Successfully added favorite tag to object " + object.getDigitalObjectIdentifier() + ".", Notification.Type.TRAY_NOTIFICATION).show(Page.getCurrent()); } } catch (Exception e) { LOGGER.error("Failed to change 'favorite' status of digital object.", e); new Notification("Warning", "Failed to update favorite status.", Notification.Type.WARNING_MESSAGE).show(Page.getCurrent()); } } }); } else { starButton.setEnabled(false); starButton.setDescription( "Only the object owner and users the object is shared with are allowed to change the favorite state."); } dcLayout = new UIUtils7.GridLayoutBuilder(3, 5).addComponent(titleLabel, 0, 0, 2, 1) .addComponent(creationLabel, 2, 0, 1, 1).addComponent(creatorLabel, 0, 1, 3, 1) .addComponent(objectIdLabel, 0, 2, 3, 1).fill(descriptionLabel, 0, 3).getLayout(); dcLayout.setSizeFull(); Button.ClickListener saveCancelButtonListener = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (saveEditButton.equals(event.getButton())) { //do save IMetaDataManager mdm = MetaDataManagement.getMetaDataManagement().getMetaDataManager(); mdm.setAuthorizationContext(AuthorizationContext.factorySystemContext()); try { String title = titleField.getValue(); String description = descriptionArea.getValue(); Investigation investigation = object.getInvestigation(); boolean wasError = false; if (description != null && description.length() <= 1024 && investigation != null) { if (!description.equals(investigation.getDescription())) { investigation.setDescription(description); //store investigation mdm.save(investigation); } } else { LOGGER.warn( "Failed to commit updated description '{}'. Either length is exceeded or investigation '{}' is null.", description, investigation); wasError = true; } //store object if (title != null && title.length() >= 3 && title.length() <= 255) { if (!title.equals(object.getLabel())) { //store object object.setLabel(title); object = mdm.save(object); } } else { LOGGER.warn("Failed to commit updated title '{}'. Length is invalid (3<=l<=255).", title); wasError = true; } if (wasError) { new Notification("Warning", "Failed to update title and/or description. See logfile for details.", Notification.Type.WARNING_MESSAGE).show(Page.getCurrent()); } //As there is not automatic sync between database and search index the entry has to be reindexed at this point in order //to keep both systems consistent. However, changes taking place in between are lost. LOGGER.debug("Object committed to database. Updating index."); ElasticsearchHelper.indexEntry(object); } catch (UnauthorizedAccessAttemptException ex) { LOGGER.error("Failed to commit changes.", ex); new Notification("Warning", "Failed to commit changes. See logfile for details.", Notification.Type.WARNING_MESSAGE).show(Page.getCurrent()); } finally { mdm.close(); } } //do cancel/reload and switch back to read-mode reset(); switchEditMode(); } }; //save/cancel buttons saveEditButton = new NativeButton("Commit Update"); saveEditButton.setIcon(new ThemeResource("img/16x16/save.png")); saveEditButton.setStyleName(BaseTheme.BUTTON_LINK); saveEditButton.setDescription("Save changes to this digital object's metadata."); saveEditButton.addClickListener(saveCancelButtonListener); cancelEditButton = new NativeButton("Cancel Update"); cancelEditButton.setIcon(new ThemeResource("img/16x16/cancel.png")); cancelEditButton.setStyleName(BaseTheme.BUTTON_LINK); cancelEditButton.setDescription("Withdraw all changes to this digital object's metadata."); cancelEditButton.addClickListener(saveCancelButtonListener); //default action layout Label spacerMiscActionLayout = new Label(); miscActionLayout = new HorizontalLayout(editButton, shareButton, starButton, spacerMiscActionLayout); miscActionLayout.setWidth("100%"); miscActionLayout.setHeight("18px"); miscActionLayout.setSpacing(false); miscActionLayout.setMargin(false); miscActionLayout.setExpandRatio(spacerMiscActionLayout, .9f); //edit action layout Label spacerEditActionLayout = new Label(); editActionLayout = new HorizontalLayout(saveEditButton, cancelEditButton, spacerEditActionLayout); editActionLayout.setWidth("100%"); editActionLayout.setHeight("18px"); editActionLayout.setSpacing(false); editActionLayout.setMargin(false); editActionLayout.setExpandRatio(spacerEditActionLayout, .9f); //divider generation Label dividerTop = new Label(); dividerTop.setHeight("5px"); dividerTop.addStyleName("horizontal-line"); dividerTop.setWidth("90%"); Label dividerBottom = new Label(); dividerBottom.setHeight("5px"); dividerBottom.addStyleName("horizontal-line"); dividerBottom.setWidth("90%"); Label dividerLeft = new Label(); dividerLeft.addStyleName("vertical-line"); dividerLeft.setWidth("5px"); dividerLeft.setHeight("90%"); Label dividerRight = new Label(); dividerRight.addStyleName("vertical-line"); dividerRight.setWidth("5px"); dividerRight.setHeight("90%"); //build content layout HorizontalLayout contentLayout = new HorizontalLayout(typeImage, dividerLeft, dcLayout, dividerRight, downloadButton); contentLayout.setSizeFull(); contentLayout.setSpacing(true); contentLayout.setComponentAlignment(typeImage, Alignment.TOP_RIGHT); contentLayout.setComponentAlignment(dividerLeft, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(dcLayout, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(dividerRight, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(downloadButton, Alignment.BOTTOM_CENTER); contentLayout.setExpandRatio(typeImage, .1f); contentLayout.setExpandRatio(dcLayout, .8f); contentLayout.setExpandRatio(downloadButton, .1f); //build main layout mainLayout = new VerticalLayout(dividerTop, contentLayout, dividerBottom, miscActionLayout); mainLayout.setExpandRatio(dividerTop, .05f); mainLayout.setComponentAlignment(dividerTop, Alignment.TOP_LEFT); mainLayout.setExpandRatio(contentLayout, .80f); mainLayout.setExpandRatio(dividerBottom, .05f); mainLayout.setComponentAlignment(dividerBottom, Alignment.BOTTOM_RIGHT); mainLayout.setExpandRatio(miscActionLayout, .1f); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.addStyleName("basic"); mainLayout.setWidth("100%"); mainLayout.setHeight("185px"); //do reset to load title and description reset(); LOGGER.debug("Layout successfully build up."); }
From source file:edu.nps.moves.mmowgli.components.SignupsTable.java
License:Open Source License
@SuppressWarnings("serial") public static void showDialog(String title) { final Button bulkMailButt = new Button("Initiate bulk mail job sending to filtered list"); final Button emailButt = new Button("Compose email"); emailButt.setDescription("Opens editing dialog to compose an email message to the selected individuals"); final Button displayButt = new Button("Display as plain text"); Button closeButt;/*from w w w.java 2s .co m*/ final SignupsTable tab = new SignupsTable(null, null, new ValueChangeListener() // selected { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { emailButt.setEnabled(true); } }); final Window dialog = new Window(title); dialog.setWidth("950px"); dialog.setHeight("650px"); VerticalLayout vl = new VerticalLayout(); dialog.setContent(vl); vl.setSizeFull(); vl.setMargin(true); vl.setSpacing(true); addFilterCheckBoxes(vl); vl.addComponent(new Label("Individuals who have established game accounts are shown faintly")); tab.setSizeFull(); vl.addComponent(tab); vl.setExpandRatio(tab, 1.0f); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); buttHL.addComponent(bulkMailButt); bulkMailButt.setImmediate(true); ; Label lab = new Label(""); buttHL.addComponent(lab); buttHL.setExpandRatio(lab, 1.0f); buttHL.addComponent(emailButt); emailButt.setImmediate(true); buttHL.addComponent(displayButt); displayButt.setImmediate(true); buttHL.addComponent(closeButt = new Button("Close")); closeButt.setImmediate(true); emailButt.setEnabled(false); closeButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { dialog.close(); } }); emailButt.addClickListener(new ClickListener() { @SuppressWarnings("rawtypes") @Override public void buttonClick(ClickEvent event) { HSess.init(); Set set = (Set) tab.getValue(); ArrayList<String> emails = new ArrayList<String>(set.size()); Iterator itr = set.iterator(); while (itr.hasNext()) { QueryWrapper wrap = (QueryWrapper) itr.next(); emails.add(wrap.getEmail()); } new SendMessageWindow(emails); HSess.close(); } }); displayButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); dumpSignupsTL(); HSess.close(); } }); bulkMailButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { BulkMailHandler.showDialog((QueryContainer) tab.getContainerDataSource()); } }); vl.addComponent(buttHL); vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabActionPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.addStyleName("m-padding15"); flowLay.setSpacing(true);/*w w w . ja v a 2s.c o m*/ Label titleLab = new Label("All Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("The Action Plans tab displays a list of all action plans in the game."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt.setDescription("Open a page where you can submit a request to create an action plan"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);//from w w w .ja v a2 s . co m Label titleLab = new Label("My Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("Choose a link below to display the filtered list of your choice."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Label lab; flowLay.addComponent(lab = new Label()); lab.setHeight("25px"); Button myPlansButt = new Button("My Plans"); //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK); //flowLay.addComponent(myPlansButt); Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); // Note for the above button request flowLay.addComponent(new Label("(appears in another browser tab)")); ClickListener firstLis; myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-heading { blah:blah;} ) firstLis.buttonClick(null); // loads the table }