Example usage for com.vaadin.ui Label addStyleName

List of usage examples for com.vaadin.ui Label addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:org.activiti.editor.ui.ConvertProcessDefinitionPopupWindow.java

License:Apache License

protected void addConvertWarning() {
    Label convertLabel = new Label(i18nManager.getMessage(Messages.PROCESS_CONVERT_POPUP_MESSAGE));
    convertLabel.addStyleName(Reindeer.LABEL_SMALL);
    addComponent(convertLabel);//from   ww w  .j a v  a 2  s. co m

    // Some empty space
    Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
    addComponent(emptySpace);
}

From source file:org.activiti.editor.ui.DeleteModelPopupWindow.java

License:Apache License

protected void addDeleteWarning() {
    Label deleteLabel = new Label(i18nManager.getMessage(Messages.PROCESS_DELETE_POPUP_MESSAGE));
    deleteLabel.addStyleName(Reindeer.LABEL_SMALL);
    addComponent(deleteLabel);/*from   ww w  . jav  a 2 s .co  m*/

    // Some empty space
    Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
    addComponent(emptySpace);
}

From source file:org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);//  w w  w  .  jav  a2  s  .  c  o m
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);

    // Image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    details.addComponent(image, 0, 0, 0, 1);

    // Name
    Label nameLabel = new Label(modelData.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);

    // Version
    String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, modelData.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
    propertiesLayout.addComponent(versionLabel);
}

From source file:org.activiti.editor.ui.EditorProcessDefinitionInfoComponent.java

License:Apache License

protected void initImage() {
    processImageContainer = new VerticalLayout();

    Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processImageContainer.addComponent(processTitle);

    StreamSource streamSource = null;
    final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId());
    if (editorSourceExtra != null) {
        streamSource = new StreamSource() {
            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                InputStream inStream = null;
                try {
                    inStream = new ByteArrayInputStream(editorSourceExtra);
                } catch (Exception e) {
                    LOGGER.warn("Error reading PNG in StreamSource", e);
                }/* www .jav  a  2s .c o  m*/
                return inStream;
            }
        };
    }

    if (streamSource != null) {
        Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get()));
        embedded.setType(Embedded.TYPE_IMAGE);
        embedded.setSizeUndefined();

        Panel imagePanel = new Panel(); // using panel for scrollbars
        imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
        imagePanel.setWidth(100, UNITS_PERCENTAGE);
        imagePanel.setHeight(700, UNITS_PIXELS);
        HorizontalLayout panelLayout = new HorizontalLayout();
        panelLayout.setSizeUndefined();
        imagePanel.setContent(panelLayout);
        imagePanel.addComponent(embedded);

        processImageContainer.addComponent(imagePanel);
    } else {
        Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
        processImageContainer.addComponent(noImageAvailable);
    }
    addComponent(processImageContainer);
}

From source file:org.activiti.explorer.ui.alfresco.AlfrescoProcessDefinitionDetailPanel.java

License:Apache License

protected void initProcessInstancesTable() {
    ProcessInstanceTableLazyQuery query = new ProcessInstanceTableLazyQuery(processDefinition.getId());

    // Header/*from ww w  . j a  va 2 s  . co  m*/
    Label instancesTitle = new Label(
            i18nManager.getMessage(Messages.PROCESS_INSTANCES) + " (" + query.size() + ")");
    instancesTitle.addStyleName(ExplorerLayout.STYLE_H3);
    instancesTitle.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    instancesTitle.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    detailPanelLayout.addComponent(instancesTitle);

    if (query.size() > 0) {

        Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
        detailPanelLayout.addComponent(emptySpace);

        Table instancesTable = new Table();
        instancesTable.setWidth(400, UNITS_PIXELS);
        if (query.size() > 6) {
            instancesTable.setPageLength(6);
        } else {
            instancesTable.setPageLength(query.size());
        }

        LazyLoadingContainer container = new LazyLoadingContainer(query);
        instancesTable.setContainerDataSource(container);

        // container props
        instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_ID, String.class, null);
        instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_BUSINESSKEY, String.class,
                null);
        instancesTable.addContainerProperty(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS, Component.class,
                null);

        // column alignment
        instancesTable.setColumnAlignment(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS,
                Table.ALIGN_CENTER);

        // column header
        instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_ID,
                i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID));
        instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_BUSINESSKEY,
                i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY));
        instancesTable.setColumnHeader(AlfrescoProcessInstanceTableItem.PROPERTY_ACTIONS,
                i18nManager.getMessage(Messages.PROCESS_INSTANCE_ACTIONS));

        instancesTable.setEditable(false);
        instancesTable.setSelectable(true);
        instancesTable.setNullSelectionAllowed(false);
        instancesTable.setSortDisabled(true);
        detailPanelLayout.addComponent(instancesTable);

    } else {
        Label noInstances = new Label(i18nManager.getMessage(Messages.PROCESS_NO_INSTANCES));
        detailPanelLayout.addComponent(noInstances);
    }
}

From source file:org.activiti.explorer.ui.flow.ProcessDefinitionDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(4, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/* w w w. ja  va2s.  c o  m*/
    taskDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.FLOW_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(processDefinition.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 3, 0);

    // Add version
    String versionString = i18nManager.getMessage(Messages.FLOW_VERSION, processDefinition.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_VERSION);
    taskDetails.addComponent(versionLabel, 1, 1);

    // Add deploy time
    PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_DEPLOY_TIME),
            deployment.getDeploymentTime(), null);
    deployTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_DEPLOY_TIME);
    taskDetails.addComponent(deployTimeLabel, 2, 1);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);
    taskDetails.setColumnExpandRatio(3, 1.0f);

    verticalLayout.addComponent(taskDetails);
}

From source file:org.activiti.explorer.ui.flow.ProcessDefinitionInfoComponent.java

License:Apache License

protected void initImage() {
    VerticalLayout processImageContainer = new VerticalLayout();

    Label processTitle = new Label(i18nManager.getMessage(Messages.FLOW_HEADER_DIAGRAM));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processImageContainer.addComponent(processTitle);

    if (processDefinition.getDiagramResourceName() != null) {
        StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
                .buildStreamResource(processDefinition, repositoryService);

        Embedded embedded = new Embedded("", diagram);
        embedded.setType(Embedded.TYPE_IMAGE);
        processImageContainer.addComponent(embedded);
    } else {//w w w . j a  va2 s .com
        Label noImageAvailable = new Label(i18nManager.getMessage(Messages.FLOW_NO_DIAGRAM));
        processImageContainer.addComponent(noImageAvailable);
    }
    addComponent(processImageContainer);
}

From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java

License:Apache License

protected void addTasks() {
    Label header = new Label(i18nManager.getMessage(Messages.FLOW_INSTANCE_HEADER_TASKS));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    verticalLayout.addComponent(header);

    Label spacer = new Label();
    spacer.setValue("&nbsp");
    spacer.setContentMode(Label.CONTENT_XHTML);
    verticalLayout.addComponent(spacer);

    Table taskTable = new Table();
    taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    taskTable.setWidth(100, UNITS_PERCENTAGE);

    // Fetch all tasks
    List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
            .processInstanceId(processInstance.getId()).orderByHistoricTaskInstanceEndTime().desc()
            .orderByHistoricActivityInstanceStartTime().desc().list();

    if (tasks.size() > 0) {

        // Finished icon
        taskTable.addContainerProperty("finished", Component.class, null, "", null, Table.ALIGN_CENTER);
        taskTable.setColumnWidth("finished", 22);

        taskTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.TASK_NAME),
                null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("priority", Integer.class, null,
                i18nManager.getMessage(Messages.TASK_PRIORITY), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("assignee", Component.class, null,
                i18nManager.getMessage(Messages.TASK_ASSIGNEE), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("dueDate", Component.class, null,
                i18nManager.getMessage(Messages.TASK_DUEDATE), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("startDate", Component.class, null,
                i18nManager.getMessage(Messages.TASK_CREATE_TIME), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("endDate", Component.class, null,
                i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT);

        verticalLayout.addComponent(taskTable);
        verticalLayout.setExpandRatio(taskTable, 1.0f);

        for (HistoricTaskInstance task : tasks) {
            addTaskItem(task, taskTable);
        }/*from  w  ww.ja v a  2s  . c o m*/

        taskTable.setPageLength(taskTable.size());
    } else {
        // No tasks
        Label noTaskLabel = new Label(i18nManager.getMessage(Messages.FLOW_INSTANCE_NO_TASKS));
        verticalLayout.addComponent(noTaskLabel);
    }
}

From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java

License:Apache License

protected void addFlowImage() {
    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
            .getDeployedProcessDefinition(processDefinition.getId());

    // Only show when graphical notation is defined
    if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
        Label header = new Label(i18nManager.getMessage(Messages.FLOW_INSTANCE_HEADER_DIAGRAM));
        header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
        header.addStyleName(ExplorerLayout.STYLE_H3);
        verticalLayout.addComponent(header);

        StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
                .buildStreamResource(processInstance, repositoryService, runtimeService);

        Embedded embedded = new Embedded("", diagram);
        embedded.setType(Embedded.TYPE_IMAGE);
        verticalLayout.addComponent(embedded);
    }//w w  w . ja v a2  s .c om
}

From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java

License:Apache License

protected void addName() {
    GridLayout header = new GridLayout(3, 2);
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);/*from www.  j  a  va2 s.co m*/
    header.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.FLOW_50);
    header.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(processDefinition.getName() + " (" + processInstance.getId() + ")");
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(nameLabel, 1, 0, 2, 0);

    // Add start time
    PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_START_TIME),
            historicProcessInstance.getStartTime(), null);
    startTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_START_TIME);
    header.addComponent(startTimeLabel, 1, 1);

    header.setColumnExpandRatio(1, 1.0f);
    header.setColumnExpandRatio(2, 1.0f);

    verticalLayout.addComponent(header);
}