Search in sources :

Example 21 with Label

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;
}
Also used : Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 22 with Label

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;
}
Also used : Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 23 with Label

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);
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Embedded(com.vaadin.ui.Embedded) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 24 with Label

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);
                    }
                });
            }
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) CssLayout(com.vaadin.ui.CssLayout) TextArea(com.vaadin.ui.TextArea) Button(com.vaadin.ui.Button) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) ClaimTaskClickListener(org.activiti.explorer.ui.task.listener.ClaimTaskClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 25 with Label

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);
}
Also used : Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel)

Aggregations

Label (com.vaadin.ui.Label)158 HorizontalLayout (com.vaadin.ui.HorizontalLayout)45 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)40 VerticalLayout (com.vaadin.ui.VerticalLayout)33 Embedded (com.vaadin.ui.Embedded)29 Button (com.vaadin.ui.Button)18 GridLayout (com.vaadin.ui.GridLayout)17 Link (com.vaadin.ui.Link)14 ClickEvent (com.vaadin.ui.Button.ClickEvent)13 Table (com.vaadin.ui.Table)13 ClickListener (com.vaadin.ui.Button.ClickListener)11 TextField (com.vaadin.ui.TextField)10 Item (com.vaadin.data.Item)9 ExternalResource (com.vaadin.server.ExternalResource)9 StreamResource (com.vaadin.terminal.StreamResource)8 PostConstruct (javax.annotation.PostConstruct)8 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)6 ExternalResource (com.vaadin.terminal.ExternalResource)6 Component (com.vaadin.ui.Component)6 Panel (com.vaadin.ui.Panel)5