List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initDescription(HorizontalLayout layout) { final CssLayout descriptionLayout = new CssLayout(); descriptionLayout.setWidth(100, Unit.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 {//?? descriptionText = i18nManager.getMessage(Messages.TASK_NO_DESCRIPTION); }/* www .jav a 2 s . c om*/ final Label descriptionLabel = new Label(descriptionText); descriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE); descriptionLayout.addComponent(descriptionLabel); descriptionLayout.addLayoutClickListener(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, Unit.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.addClickListener(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:com.klwork.explorer.ui.task.TaskEventsPanel.java
License:Apache License
protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) { VerticalLayout layout = new VerticalLayout(); layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT); layout.setWidth("100%"); eventGrid.addComponent(layout);//from ww w . j av a 2 s . co m // Actual text Label text = taskEventTextResolver.resolveText(taskEvent); text.setWidth("100%"); layout.addComponent(text); // Time Label time = new Label(new HumanTime(i18nManager).format(taskEvent.getTime())); time.setSizeUndefined(); time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME); layout.addComponent(time); }
From source file:com.klwork.explorer.ui.task.TaskRelatedContentComponent.java
License:Apache License
protected void initActions() { // WW_TODO ?/*from w ww . ja v a2 s . c o m*/ HorizontalLayout actionsContainer = new HorizontalLayout(); actionsContainer.setSizeFull(); // Title Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processTitle.setSizeFull(); actionsContainer.addComponent(processTitle); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT); actionsContainer.setExpandRatio(processTitle, 1.0f); // Add content button Button addRelatedContentButton = new Button(); addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD); addRelatedContentButton.addClickListener(new com.vaadin.ui.Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow(); if (task.getProcessInstanceId() != null) { popup.setProcessInstanceId(task.getProcessInstanceId()); } else { popup.setTaskId(task.getId()); } // Add listener to update attachments when added popup.addListener(new SubmitEventListener() { private static final long serialVersionUID = 1L; @Override protected void submitted(SubmitEvent event) { taskDetailPanel.notifyRelatedContentChanged(); } @Override protected void cancelled(SubmitEvent event) { // No attachment was added so updating UI isn't // needed. } }); ViewToolManager.showPopupWindow(popup); } }); actionsContainer.addComponent(addRelatedContentButton); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT); addComponent(actionsContainer); }
From source file:com.klwork.explorer.ui.task.UserDetailsComponent.java
License:Apache License
protected void addUserDetails() { VerticalLayout detailsLayout = new VerticalLayout(); addComponent(detailsLayout);/*w w w. j av a2 s . com*/ // Layout for name + skype HorizontalLayout nameLayout = new HorizontalLayout(); nameLayout.setSpacing(true); detailsLayout.addComponent(nameLayout); // Name Label nameLabel = null; if (user != null) { nameLabel = new Label(user.getFirstName() + " " + user.getLastName()); nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD); } else { nameLabel = new Label(" ", Label.CONTENT_XHTML); } nameLayout.addComponent(nameLabel); // Layout for lower details HorizontalLayout actionsLayout = new HorizontalLayout(); actionsLayout.setSpacing(true); detailsLayout.addComponent(actionsLayout); // Role Label roleLabel = new Label(role); actionsLayout.addComponent(roleLabel); // Action button if (clickListener != null) { Button button = new Button(buttonCaption); button.addStyleName(Reindeer.BUTTON_SMALL); button.addClickListener(clickListener); actionsLayout.addComponent(button); } }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initContactSection() { Label header = createProfileHeader(i18nManager.getMessage(Messages.PROFILE_CONTACT)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); GridLayout contactLayout = createInfoSectionLayout(2, 4); // Email/*from w w w . j a v a 2 s .c om*/ if (!editable && isDefined(user.getEmail())) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail()); } else if (editable) { emailField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail()); } // Phone if (!editable && isDefined(phone)) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone); } else if (editable) { phoneField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone); } // Twitter if (!editable && isDefined(twitterName)) { Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName)); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink); } else if (editable) { twitterField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName); } // Skype if (!editable && isDefined(skypeId)) { // The skype entry shows the name + skype icon, laid out in a small grid GridLayout skypeLayout = new GridLayout(2, 1); skypeLayout.setSpacing(true); skypeLayout.setSizeUndefined(); Label skypeIdLabel = new Label(skypeId); skypeIdLabel.setSizeUndefined(); skypeLayout.addComponent(skypeIdLabel); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout); } else if (editable) { skypeField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId); } }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected Label createProfileHeader(String headerName) { Label label = new Label(headerName); label.setWidth(100, UNITS_PERCENTAGE); label.addStyleName(ExplorerLayout.STYLE_H3); return label; }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void addProfileInputField(GridLayout layout, String name, AbstractField inputField, String inputFieldValue) { Label label = new Label(name + ": "); label.addStyleName(ExplorerLayout.STYLE_PROFILE_FIELD); label.setSizeUndefined();/*from w w w . ja v a 2s . co m*/ layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); if (inputFieldValue != null) { inputField.setValue(inputFieldValue); } layout.addComponent(inputField); layout.setComponentAlignment(inputField, Alignment.MIDDLE_LEFT); }
From source file:com.klwork.explorer.ui.user.UserEventsPanel.java
License:Apache License
protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) { VerticalLayout layout = new VerticalLayout(); layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT); layout.setWidth("100%"); eventGrid.addComponent(layout);/*from w w w . java2s . c o m*/ // Actual text Label text = taskEventTextResolver.resolveText(taskEvent); text.setWidth("100%"); layout.addComponent(text); // Time String humFormat = new HumanTime(i18nManager).format(taskEvent.getTime()); Label time = new Label(humFormat + " (" + StringDateUtil.dateToString(taskEvent.getTime(), 4) + ")"); time.setSizeUndefined(); time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME); layout.addComponent(time); }
From source file:com.kpg.diary.ui.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);// ww w.j a v a2 s. co m Label h1 = new Label("Selects"); h1.addStyleName(ValoTheme.LABEL_H2); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); NativeSelect select = new NativeSelect("Drop Down Select"); row.addComponent(select); ListSelect list = new ListSelect("List Select"); list.setNewItemsAllowed(true); row.addComponent(list); TwinColSelect tcs = new TwinColSelect("TwinCol Select"); tcs.setLeftColumnCaption("Left Column"); tcs.setRightColumnCaption("Right Column"); tcs.setNewItemsAllowed(true); row.addComponent(tcs); TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select"); tcs2.setLeftColumnCaption("Left Column"); tcs2.setRightColumnCaption("Right Column"); tcs2.setNewItemsAllowed(true); tcs2.setWidth("280px"); tcs2.setHeight("200px"); row.addComponent(tcs2); for (int i = 1; i <= 10; i++) { select.addItem("Option " + i); list.addItem("Option " + i); tcs.addItem("Option " + i); tcs2.addItem("Option " + i); } }
From source file:com.liferay.mail.vaadin.MessageContainer.java
License:Open Source License
private Property formatSubject(Message m, String value) { if (value == null) { return null; }/* ww w . j a v a 2 s. c o m*/ Label l = new Label(value, Label.CONTENT_XHTML); if (!MessageUtil.isSeen(m)) { l.addStyleName(MessageList.STYLE_NOT_SEEN); } if (MessageUtil.isImportant(m)) { l.addStyleName(MessageList.STYLE_IMPORTANT); } l.setWidth(null); return new ObjectProperty(l); }