List of usage examples for com.vaadin.ui CssLayout addComponent
@Override public void addComponent(Component c)
From source file:org.activiti.explorer.ui.custom.DetailPanel.java
License:Apache License
public DetailPanel() { setSizeFull();//from w w w. j a v a2 s .c om addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); setMargin(true); CssLayout cssLayout = new CssLayout(); // Needed for rounded corners cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); cssLayout.setSizeFull(); super.addComponent(cssLayout); mainPanel = new Panel(); mainPanel.addStyleName(Reindeer.PANEL_LIGHT); mainPanel.setSizeFull(); cssLayout.addComponent(mainPanel); // Use default layout VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth(100, UNITS_PERCENTAGE); verticalLayout.setMargin(true); mainPanel.setContent(verticalLayout); }
From source file:org.activiti.explorer.ui.custom.SkypeLabel.java
License:Apache License
/** * Constructs a {@link SkypeLabel} based on the given Skype id *//*from w w w. ja v a 2 s . c om*/ public SkypeLabel(String skypeId) { CssLayout layout = new CssLayout(); setCompositionRoot(layout); Label label = new Label( "<script type='text/javascript' src='http://download.skype.com/share/skypebuttons/js/skypeCheck.js'></script>", Label.CONTENT_XHTML); layout.addComponent(label); Link link = new Link(null, new ExternalResource("skype:" + skypeId + "?call")); link.setIcon(Images.SKYPE); layout.addComponent(link); setWidth(16, UNITS_PIXELS); setHeight(16, UNITS_PIXELS); }
From source file:org.activiti.explorer.ui.custom.TaskListHeader.java
License:Apache License
protected void initInputField() { // Csslayout is used to style inputtext as rounded CssLayout csslayout = new CssLayout(); csslayout.setHeight(24, UNITS_PIXELS); csslayout.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(csslayout);/*from w w w . j a va2s . c o m*/ inputField = new TextField(); inputField.setWidth(100, UNITS_PERCENTAGE); inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX); inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW)); inputField.focus(); csslayout.addComponent(inputField); layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT); layout.setExpandRatio(csslayout, 1.0f); }
From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initDescription(HorizontalLayout layout) { final CssLayout descriptionLayout = new CssLayout(); descriptionLayout.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(descriptionLayout); layout.setExpandRatio(descriptionLayout, 1.0f); layout.setComponentAlignment(descriptionLayout, Alignment.MIDDLE_LEFT); String descriptionText = null; if (task.getDescription() != null && !"".equals(task.getDescription())) { descriptionText = task.getDescription(); } else {/*from w w w.jav a 2 s .c om*/ descriptionText = i18nManager.getMessage(Messages.TASK_NO_DESCRIPTION); } final Label descriptionLabel = new Label(descriptionText); descriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE); descriptionLayout.addComponent(descriptionLabel); descriptionLayout.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) { // layout for textarea + ok button final VerticalLayout editLayout = new VerticalLayout(); editLayout.setSpacing(true); // textarea final TextArea descriptionTextArea = new TextArea(); descriptionTextArea.setNullRepresentation(""); descriptionTextArea.setWidth(100, UNITS_PERCENTAGE); descriptionTextArea.setValue(task.getDescription()); editLayout.addComponent(descriptionTextArea); // ok button Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); editLayout.addComponent(okButton); editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT); // replace descriptionLayout.replaceComponent(descriptionLabel, editLayout); // When OK is clicked -> update task data + ui okButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { // Update data task.setDescription(descriptionTextArea.getValue().toString()); taskService.saveTask(task); // Update UI descriptionLabel.setValue(task.getDescription()); descriptionLayout.replaceComponent(editLayout, descriptionLabel); } }); } } }); }
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 ww 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.bubblecloud.ilves.component.flow.AbstractFlowViewlet.java
License:Apache License
@Override public final void attach() { super.attach(); setStyleName("ui-content"); final CssLayout layout = new CssLayout(); layout.setSizeFull();/*from w w w . jav a 2 s .com*/ this.setCompositionRoot(layout); topLayout = new CssLayout(); topLayout.setStyleName("flow-top"); topBackButton = new Button(getSite().localize("button-back")); topBackButton.addClickListener(this); topLayout.addComponent(topBackButton); topPathLabel = new Label("", ContentMode.HTML); topPathLabel.setSizeUndefined(); topLayout.addComponent(topPathLabel); topRightLayout = new CssLayout(); topLayout.addComponent(topRightLayout); topLayout.setWidth(100, Unit.PERCENTAGE); bottomLayout = new CssLayout(); bottomLayout.setStyleName("flow-bottom"); bottomBackButton = new Button(getSite().localize("button-back")); bottomBackButton.addClickListener(this); bottomLayout.addComponent(bottomBackButton); bottomPathLabel = new Label("", ContentMode.HTML); bottomPathLabel.setSizeUndefined(); bottomLayout.addComponent(bottomPathLabel); bottomRightLayout = new CssLayout(); bottomLayout.addComponent(bottomRightLayout); bottomLayout.setWidth(100, Unit.PERCENTAGE); tabSheet = new TabSheet(); tabSheet.setStyleName("flow-sheet"); tabSheet.hideTabs(true); tabSheet.setSizeFull(); layout.addComponent(topLayout); layout.addComponent(tabSheet); layout.addComponent(bottomLayout); addFlowlets(); tabSheet.setSelectedTab((Component) getRootFlowlet()); }
From source file:org.bubblecloud.ilves.module.content.RenderFlowlet.java
License:Apache License
@Override public void enter() { final EntityManager entityManager = Site.getCurrent().getSiteContext().getObject(EntityManager.class); final String html; try {//from w w w. j av a 2s .c o m html = new Markdown4jProcessor().process(escapeHtml(content.getMarkup())); } catch (IOException e) { throw new SiteException("Error processing markdown.", e); } ((AbstractFlowViewlet) getFlow()).getTopRightLayout().removeComponent(topEditButton); ((AbstractFlowViewlet) getFlow()).getTopRightLayout().addComponent(topEditButton); ((AbstractFlowViewlet) getFlow()).refreshPathLabels(); final CssLayout layout = new CssLayout(); //layout.addComponent(topEditButton); layout.setStyleName("wiki-content"); layout.addComponent(new Label(html, ContentMode.HTML)); setCompositionRoot(layout); }
From source file:org.bubblecloud.ilves.ui.user.privilege.PrivilegesFlowlet.java
License:Apache License
@Override protected void initialize() { final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true);//w w w . ja v a 2 s.c o m final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-privileges")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); titleLabel = new Label("<h1>" + getSite().localize("view-privileges") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); matrixLayout = new VerticalLayout(); matrixLayout.setSpacing(true); matrixLayout.setMargin(false); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); saveButton = getSite().getButton("save"); buttonLayout.addComponent(saveButton); saveButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { saveGroupMatrix(); saveUserMatrix(); PrivilegeCache.flush((Company) Site.getCurrent().getSiteContext().getObject(Company.class)); } }); discardButton = getSite().getButton("discard"); buttonLayout.addComponent(discardButton); discardButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { refreshGroupMatrix(); refreshUserMatrix(); } }); final CssLayout panel = new CssLayout(); panel.addComponent(titleLayout); panel.addComponent(matrixLayout); panel.addComponent(buttonLayout); setCompositionRoot(panel); }
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 av a2 s. c o m*/ * * @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.component.MultiTextField.java
License:Open Source License
private void renderTextFields() { int size = textFieldEntries.size(); int last = size - 1; for (int i = 0; i <= last; ++i) { TextFieldEntry textFieldEntry = textFieldEntries.get(i); CssLayout css = new CssLayout(); css.setStyleName(STYLE_LINE_LAYOUT); textFieldEntry.textField.setReadOnly(readOnly); css.addComponent(textFieldEntry.textField); if (!readOnly) { if (size > 1) { Button b = createRemoveButton(); textFieldEntry.removeButton = b; css.addComponent(b);/*from w ww. j a v a2 s. c o m*/ } if (size < maxSize && i == last) { css.addComponent(createAddButton()); } } layout.addComponent(css); } }