List of usage examples for com.vaadin.ui CssLayout addStyleName
@Override public void addStyleName(String style)
From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initTaskForm() { // Check if task requires a form TaskFormData formData = formService.getTaskFormData(task.getId()); if (formData != null && formData.getFormProperties() != null && !formData.getFormProperties().isEmpty()) { taskForm = new FormPropertiesForm(); taskForm.setSubmitButtonCaption(i18nManager.getMessage(Messages.TASK_COMPLETE)); taskForm.setCancelButtonCaption(i18nManager.getMessage(Messages.TASK_RESET_FORM)); taskForm.setFormHelp(i18nManager.getMessage(Messages.TASK_FORM_HELP)); taskForm.setFormProperties(formData.getFormProperties()); taskForm.addListener(new FormPropertiesEventListener() { private static final long serialVersionUID = -3893467157397686736L; @Override//from w w w .j av a 2 s .c o m protected void handleFormSubmit(FormPropertiesEvent event) { Map<String, String> properties = event.getFormProperties(); formService.submitTaskFormData(task.getId(), properties); notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } @Override protected void handleFormCancel(FormPropertiesEvent event) { // Clear the form values taskForm.clear(); } }); // Only if current user is task's assignee taskForm.setEnabled(isCurrentUserAssignee()); // Add component to page centralLayout.addComponent(taskForm); } else { // Just add a button to complete the task // TODO: perhaps move to a better place CssLayout buttonLayout = new CssLayout(); buttonLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); buttonLayout.setWidth(100, UNITS_PERCENTAGE); centralLayout.addComponent(buttonLayout); completeButton = new Button(i18nManager.getMessage(Messages.TASK_COMPLETE)); completeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { // If no owner, make assignee owner (will go into archived then) if (task.getOwner() == null) { task.setOwner(task.getAssignee()); taskService.setOwner(task.getId(), task.getAssignee()); } taskService.complete(task.getId()); notificationManager.showInformationNotification(Messages.TASK_COMPLETED, task.getName()); taskPage.refreshSelectNext(); } }); completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner()); buttonLayout.addComponent(completeButton); } }
From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java
License:Open Source License
/** * Creates the wrapper which contains the menu item and the adjacent label * for displaying the occurred events//from w w w. j a va2 s .com * * @param menuItemButton * the menu item * @param notificationLabel * the label for displaying the occurred events * @return Component of type CssLayout */ private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton, final Component notificationLabel) { final CssLayout dashboardWrapper = new CssLayout(menuItemButton); dashboardWrapper.addStyleName("labelwrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); notificationLabel.addStyleName(ValoTheme.MENU_BADGE); notificationLabel.setWidthUndefined(); notificationLabel.setVisible(false); notificationLabel .setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase()); dashboardWrapper.addComponent(notificationLabel); return dashboardWrapper; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectAboutBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { CssLayout layout = new CssLayout(); layout.addStyleName(STYLE_ABOUT_INFOBOX); layout.setSizeFull();//from w w w . j a v a 2s . c o m String description = "No description available"; if (StringUtils.isNotBlank(project.getDescription())) { description = HtmlUtils.clean(StringUtils.replace(project.getDescription(), "\n", "<br />")); //$NON-NLS-1$ //$NON-NLS-2$ createLabel(layout, description, STYLE_ABOUT); } InfoExtension ext = project.getExtension(InfoExtension.class); if (ext != null && StringUtils.isNotBlank(ext.getPageUrl())) { createLink(layout, "Project Homepage", ext.getPageUrl(), DEFAULT_TARGET, STYLE_HOMEPAGE); } TaggingService taggingService = Services.getService(TaggingService.class); if (taggingService != null) { TagComponent tagComponent = new TagComponent(project, taggingService, util); layout.addComponent(tagComponent); } if (!util.getProjectTemplate().isHidden(Project.class.getName(), Project.PROPERTY_PHASE, util.isUserProjectAdmin(project))) { createLabel(layout, MessageFormat.format("This project is in the <b>{0}</b> phase.", StringEscapeUtils.escapeHtml(project.getPhase())), STYLE_PHASE); } // for ui testing // TODO need to understand why vaadin does not accept the layout to have the id // (it then cannot render a second project, throws ISE) layout.addComponent(new Label("<div id=" + DEBUG_ID + "></div>", Label.CONTENT_XHTML)); //$NON-NLS-1$ //$NON-NLS-2$ addLastModifiedInfo(layout, project); return layout; }
From source file:org.eclipse.skalli.view.internal.window.NewProjectPanel.java
License:Open Source License
/** * Renders the OK/Cancel button bar./*from www. java2 s .c o m*/ */ private void renderButtons(VerticalLayout content) { CssLayout buttons = new CssLayout(); buttons.addStyleName(STYLE_TEMPLATE_SELECT_BUTTONS); Button okButton = new Button("Create Project"); okButton.setIcon(ICON_BUTTON_OK); okButton.addListener(new OKButtonListener()); buttons.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.addListener(new CancelButtonListener()); buttons.addComponent(cancelButton); content.addComponent(buttons); content.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
/** * Renders a OK/Cancel/Validate/Expand All/Collapse All button bar. *//*from w ww.j ava2s. co m*/ @SuppressWarnings("serial") private Button renderButtons(VerticalLayout layout, boolean header) { CssLayout buttons = new CssLayout(); buttons.addStyleName(STYLE_EDIT_PROJECT_BUTTONS); String prefix = header ? HEADER : FOOTER; Button okButton = new Button("OK"); okButton.setIcon(ICON_BUTTON_OK); okButton.setDescription("Save the modified project"); okButton.addStyleName(prefix + BUTTON_OK); okButton.addListener(new OKButtonListener()); buttons.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.setDescription("Discard all changes to the project"); cancelButton.addStyleName(prefix + BUTTON_CANCEL); cancelButton.addListener(new CancelButtonListener()); buttons.addComponent(cancelButton); Button checkButton = new Button("Check"); checkButton.setIcon(ICON_BUTTON_VALIDATE); checkButton.setDescription("Checks the modified project for issues without saving it"); checkButton.addStyleName(prefix + BUTTON_VALIDATE); checkButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { validateModifiedProject(); } }); buttons.addComponent(checkButton); Button expandAllButton = new Button("Expand All"); expandAllButton.setIcon(ICON_BUTTON_EXPAND_ALL); expandAllButton.setDescription("Expand all panels"); expandAllButton.addStyleName(prefix + BUTTON_EXPAND_ALL); expandAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { expandAllPanels(); } }); buttons.addComponent(expandAllButton); Button collapseAllButton = new Button("Collapse All"); collapseAllButton.setIcon(ICON_BUTTON_COLLAPSE_ALL); collapseAllButton.setDescription("Collapse all panels"); collapseAllButton.addStyleName(prefix + BUTTON_COLLAPSE_ALL); collapseAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { collapseAllPanels(); } }); buttons.addComponent(collapseAllButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); return checkButton; }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
private static void buildPanelHeader(CssLayout cssLayout, String name) { cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext"); cssLayout.setWidth("100%"); cssLayout.setMargin(false);/* w w w .j av a2 s. c om*/ final Label nameofPanel = new Label(name, Label.CONTENT_RAW); nameofPanel.setStyleName("accordion v-captiontext"); nameofPanel.setWidth("70%"); cssLayout.addComponent(nameofPanel); }
From source file:org.escidoc.browser.ui.maincontent.ItemContent.java
License:Open Source License
private void buildPanelHeader(CssLayout cssLayout, String name) { cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext"); cssLayout.setWidth("100%"); cssLayout.setMargin(false);/*from www . java2 s . co m*/ final Label nameofPanel = new Label(name, Label.CONTENT_RAW); nameofPanel.setStyleName("accordion v-captiontext"); nameofPanel.setWidth("70%"); cssLayout.addComponent(nameofPanel); }
From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java
License:Open Source License
@SuppressWarnings("serial") private CssLayout headerButton() throws EscidocClientException { CssLayout cssLayout = new CssLayout(); cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext"); cssLayout.setWidth("100%"); cssLayout.setMargin(false);/*w w w .j a v a 2 s .c om*/ final Label nameofPanel = new Label(ViewConstants.DIRECT_MEMBERS, Label.CONTENT_RAW); nameofPanel.setStyleName("accordion v-captiontext"); nameofPanel.setWidth("70%"); cssLayout.addComponent(nameofPanel); ThemeResource plusIcon = new ThemeResource("images/assets/plus.png"); if (resourceType == ResourceType.CONTAINER.toString()) { resourceProxy = new ContainerProxyImpl( router.getRepositories().container().findContainerById(parentId)); contextId = resourceProxy.getContext().getObjid(); } else { // It has to be a context resourceProxy = router.getRepositories().context().findById(parentId); } final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(plusIcon); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { try { new ResourceAddViewImpl(resourceProxy, contextId, router).openSubWindow(); } catch (final EscidocClientException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); cssLayout.addComponent(nameofPanel); cssLayout.addComponent(addResourceButton); return cssLayout; }
From source file:org.hip.vif.web.util.UploadComponent.java
License:Open Source License
private Component createDropBox(final IBibliographyTask inTask) { final CssLayout lDropPane = new CssLayout(); lDropPane.setWidth("200px"); //$NON-NLS-1$ lDropPane.setHeight("40px"); //$NON-NLS-1$ lDropPane.addStyleName("v-textfield"); //$NON-NLS-1$ final Label lHint = new Label(Activator.getMessages().getMessage("ui.upload.drop.box")); //$NON-NLS-1$ lHint.setStyleName("vif-drop-hint"); //$NON-NLS-1$ lDropPane.addComponent(lHint);//w w w . j a v a2 s . c o m final DragAndDropWrapper outDrop = new DragAndDropWrapper(lDropPane); outDrop.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { // NOPMD return AcceptAll.get(); } @Override public void drop(final DragAndDropEvent inEvent) { // NOPMD final Transferable lTransferable = inEvent.getTransferable(); if (lTransferable instanceof WrapperTransferable) { final Html5File[] lFiles = ((WrapperTransferable) lTransferable).getFiles(); for (final Html5File lFile : lFiles) { lFile.setStreamVariable(createStreamVariable(lFile.getFileName(), inTask)); } } } }); outDrop.setSizeUndefined(); outDrop.setImmediate(true); return outDrop; }
From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java
License:BSD License
private Component createContentWrapper(final Component content) { final CssLayout slot = new CssLayout(); slot.setWidth("100%"); slot.addStyleName("dashboard-panel-slot"); CssLayout card = new CssLayout(); card.setWidth("100%"); card.addStyleName(ValoTheme.LAYOUT_CARD); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("dashboard-panel-toolbar"); toolbar.setWidth("100%"); Label caption = new Label(content.getCaption()); caption.addStyleName(ValoTheme.LABEL_H4); caption.addStyleName(ValoTheme.LABEL_COLORED); caption.addStyleName(ValoTheme.LABEL_NO_MARGIN); content.setCaption(null);/*from w w w .j a v a 2 s. com*/ MenuBar tools = new MenuBar(); tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS); MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (!slot.getStyleName().contains("max")) { selectedItem.setIcon(FontAwesome.COMPRESS); toggleMaximized(slot, true); } else { slot.removeStyleName("max"); selectedItem.setIcon(FontAwesome.EXPAND); toggleMaximized(slot, false); } } }); max.setStyleName("icon-only"); MenuItem root = tools.addItem("", VaadinIcons.COG, null); root.addItem("Configure", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); root.addSeparator(); root.addItem("Close", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); toolbar.addComponents(caption, tools); toolbar.setExpandRatio(caption, 1); toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT); card.addComponents(toolbar, content); slot.addComponent(card); return slot; }