use of com.vaadin.ui.Label in project opennms by OpenNMS.
the class SurveillanceViewDetailTable method getImageSeverityLayout.
/**
* Returns the image severity layout for the given content.
*
* @param content the content
* @return the label with the applied style
*/
protected HorizontalLayout getImageSeverityLayout(String content) {
HorizontalLayout horizontalLayout = new HorizontalLayout();
Label placeholder = new Label();
placeholder.addStyleName("placeholder");
horizontalLayout.addComponent(placeholder);
Label contentLabel = new Label(content);
contentLabel.addStyleName("content");
horizontalLayout.addComponent(contentLabel);
return horizontalLayout;
}
use of com.vaadin.ui.Label in project opennms by OpenNMS.
the class DialogWindow method createMainArea.
private Layout createMainArea(final String description) {
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setMargin(true);
layout.setWidth(100, Unit.PERCENTAGE);
Label label = new Label(description, ContentMode.PREFORMATTED);
label.setWidth(100, Unit.PERCENTAGE);
layout.addComponent(label);
return layout;
}
use of com.vaadin.ui.Label in project Activiti by Activiti.
the class TaskDetailPanel method initHeader.
protected void initHeader() {
GridLayout taskDetails = new GridLayout(2, 2);
taskDetails.setWidth(100, UNITS_PERCENTAGE);
taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
taskDetails.setSpacing(true);
taskDetails.setMargin(false, false, true, false);
taskDetails.setColumnExpandRatio(1, 1.0f);
centralLayout.addComponent(taskDetails);
// Add image
Embedded image = new Embedded(null, Images.TASK_50);
taskDetails.addComponent(image, 0, 0, 0, 1);
// Add task name
Label nameLabel = new Label(task.getName());
nameLabel.addStyleName(Reindeer.LABEL_H2);
taskDetails.addComponent(nameLabel, 1, 0);
taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
// Properties
HorizontalLayout propertiesLayout = new HorizontalLayout();
propertiesLayout.setSpacing(true);
taskDetails.addComponent(propertiesLayout);
propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService));
propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService));
initCreateTime(propertiesLayout);
}
use of com.vaadin.ui.Label in project Activiti by Activiti.
the class TaskDetailPanel method initDescription.
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 {
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);
}
});
}
}
});
}
use of com.vaadin.ui.Label in project Activiti by Activiti.
the class TaskDetailPanel method addEmptySpace.
protected void addEmptySpace(ComponentContainer container) {
Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
emptySpace.setSizeUndefined();
container.addComponent(emptySpace);
}
Aggregations