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.explorer.ui.management.crystalball.EventOverviewPanel.java

License:Apache License

protected void initEventTitle(HorizontalLayout eventsHeader) {
    Label usersHeader = new Label(i18nManager.getMessage(Messages.ADMIN_DEFINITIONS));
    usersHeader.addStyleName(ExplorerLayout.STYLE_H3);
    eventsHeader.addComponent(usersHeader);
}

From source file:org.activiti.explorer.ui.management.db.DatabaseDetailPanel.java

License:Apache License

protected void addTableName() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);/*from  www.ja va2  s  .co m*/

    // TODO: use right image
    Embedded image = new Embedded(null, Images.DATABASE_50);
    header.addComponent(image);
    header.setComponentAlignment(image, Alignment.MIDDLE_LEFT);
    header.setMargin(false, false, true, false);

    Label name = new Label(tableName);
    name.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(name);

    header.setExpandRatio(name, 1.0f);
    header.setComponentAlignment(name, Alignment.MIDDLE_LEFT);
    addDetailComponent(header);

    Label spacer = new Label();
    spacer.setWidth(100, UNITS_PERCENTAGE);
    spacer.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    addDetailComponent(spacer);
}

From source file:org.activiti.explorer.ui.management.db.DatabaseDetailPanel.java

License:Apache License

protected void addTableData() {
    LazyLoadingQuery lazyLoadingQuery = new TableDataQuery(tableName, managementService);
    LazyLoadingContainer lazyLoadingContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);

    if (lazyLoadingContainer.size() > 0) {

        Table data = new Table();
        data.setContainerDataSource(lazyLoadingContainer);
        data.setEditable(false);//w  w w .  ja v  a2  s.  c  o m
        data.setSelectable(true);
        data.setColumnReorderingAllowed(true);
        if (lazyLoadingQuery.size() < 10) {
            data.setPageLength(0);
        } else {
            data.setPageLength(10);
        }
        addDetailComponent(data);

        data.setWidth(100, UNITS_PERCENTAGE);
        data.setHeight(100, UNITS_PERCENTAGE);
        data.addStyleName(ExplorerLayout.STYLE_DATABASE_TABLE);
        setDetailExpandRatio(data, 1.0f);

        // Create column headers
        TableMetaData metaData = managementService.getTableMetaData(tableName);
        for (String columnName : metaData.getColumnNames()) {
            data.addContainerProperty(columnName, String.class, null);
        }

    } else {
        Label noDataLabel = new Label(i18nManager.getMessage(Messages.DATABASE_NO_ROWS));
        noDataLabel.addStyleName(Reindeer.LABEL_SMALL);
        addDetailComponent(noDataLabel);
        setDetailExpandRatio(noDataLabel, 1.0f);
    }
}

From source file:org.activiti.explorer.ui.management.deployment.DeleteDeploymentPopupWindow.java

License:Apache License

protected void addDeleteWarning() {
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
            .deploymentId(deployment.getId()).list();

    int nrOfProcessInstances = 0;
    for (ProcessDefinition processDefinition : processDefinitions) {
        nrOfProcessInstances += runtimeService.createProcessInstanceQuery()
                .processDefinitionId(processDefinition.getId()).count();
    }/*  www.  j a  v a2  s  . c o  m*/

    if (nrOfProcessInstances == 0) {
        Label noInstancesLabel = new Label(i18nManager.getMessage(Messages.DEPLOYMENT_NO_INSTANCES));
        noInstancesLabel.addStyleName(Reindeer.LABEL_SMALL);
        addComponent(noInstancesLabel);
    } else {
        HorizontalLayout warningLayout = new HorizontalLayout();
        warningLayout.setSpacing(true);
        addComponent(warningLayout);

        Embedded warningIcon = new Embedded(null, Images.WARNING);
        warningIcon.setType(Embedded.TYPE_IMAGE);
        warningLayout.addComponent(warningIcon);

        Label warningLabel = new Label(
                i18nManager.getMessage(Messages.DEPLOYMENT_DELETE_POPUP_WARNING, nrOfProcessInstances),
                Label.CONTENT_XHTML);
        warningLabel.setSizeUndefined();
        warningLabel.addStyleName(Reindeer.LABEL_SMALL);
        warningLayout.addComponent(warningLabel);
    }

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

From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java

License:Apache License

protected void addDeploymentName() {

    GridLayout taskDetails = new GridLayout(3, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);//  www.  ja v a  2 s  . c om
    taskDetails.setMargin(false, false, true, false);

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

    // Add deployment name
    Label nameLabel = new Label();
    if (deployment.getName() != null) {
        nameLabel.setValue(deployment.getName());
    } else {
        nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME));
    }
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 2, 0);

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

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

    addDetailComponent(taskDetails);
}

From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java

License:Apache License

protected void addProcessDefinitionLinks() {
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery()
            .deploymentId(deployment.getId()).orderByProcessDefinitionName().asc().list();

    if (!processDefinitions.isEmpty()) {

        // Header
        Label processDefinitionHeader = new Label(
                i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_DEFINITIONS));
        processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_H3);
        processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
        processDefinitionHeader.setWidth(100, UNITS_PERCENTAGE);
        addDetailComponent(processDefinitionHeader);

        // processes
        VerticalLayout processDefinitionLinksLayout = new VerticalLayout();
        processDefinitionLinksLayout.setSpacing(true);
        processDefinitionLinksLayout.setMargin(true, false, true, false);
        addDetailComponent(processDefinitionLinksLayout);

        for (final ProcessDefinition processDefinition : processDefinitions) {
            Button processDefinitionButton = new Button(getProcessDisplayName(processDefinition));
            processDefinitionButton.addListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    viewManager.showDeployedProcessDefinitionPage(processDefinition.getId());
                }/*from  ww  w .j a  v  a 2  s  .  c  o m*/
            });
            processDefinitionButton.addStyleName(Reindeer.BUTTON_LINK);
            processDefinitionLinksLayout.addComponent(processDefinitionButton);
        }
    }
}

From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java

License:Apache License

protected void addResourceLinks() {
    List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
    Collections.sort(resourceNames); // small nr of elements, so we can do it in-memory

    if (!resourceNames.isEmpty()) {
        Label resourceHeader = new Label(i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_RESOURCES));
        resourceHeader.setWidth("95%");
        resourceHeader.addStyleName(ExplorerLayout.STYLE_H3);
        resourceHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
        addDetailComponent(resourceHeader);

        // resources
        VerticalLayout resourceLinksLayout = new VerticalLayout();
        resourceLinksLayout.setSpacing(true);
        resourceLinksLayout.setMargin(true, false, false, false);
        addDetailComponent(resourceLinksLayout);

        for (final String resourceName : resourceNames) {
            StreamResource.StreamSource streamSource = new StreamSource() {
                public InputStream getStream() {
                    return repositoryService.getResourceAsStream(deployment.getId(), resourceName);
                }/* ww  w .  j  a v  a  2s  . c o m*/
            };
            Link resourceLink = new Link(resourceName,
                    new StreamResource(streamSource, resourceName, ExplorerApp.get()));
            resourceLinksLayout.addComponent(resourceLink);
        }
    }
}

From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);// w ww.j a  va  2  s .  com
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded groupImage = new Embedded(null, Images.GROUP_50);
    layout.addComponent(groupImage);

    Label groupName = new Label(getGroupName(group));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);
}

From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java

License:Apache License

protected void initGroupDetails() {
    Label groupDetailsHeader = new Label(i18nManager.getMessage(Messages.GROUP_HEADER_DETAILS));
    groupDetailsHeader.addStyleName(ExplorerLayout.STYLE_H3);
    groupDetailsHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);

    addDetailComponent(groupDetailsHeader);

    detailLayout = new HorizontalLayout();
    detailLayout.setSpacing(true);/*from   ww w .j  a va2  s. c o m*/
    detailLayout.setMargin(true, false, true, false);
    addDetailComponent(detailLayout);

    populateGroupDetails();
}