Example usage for com.vaadin.ui Label setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.escidoc.browser.ui.maincontent.FolderView.java

License:Open Source License

private VerticalLayout bindNameToHeader() {
    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setMargin(false);//from   ww  w  .  ja va  2 s.co m
    headerLayout.setWidth("100%");
    final Label headerContext = new Label(ViewConstants.RESOURCE_NAME_CONTEXT + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth");
    headerContext.setDescription(ViewConstants.RESOURCE_NAME_CONTEXT);
    headerLayout.addComponent(headerContext);
    return headerLayout;
}

From source file:org.escidoc.browser.ui.maincontent.ItemContent.java

License:Open Source License

private void initView() {
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.COMPONENTS);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (true) {// w  w  w  . j  a  v  a  2s.  co  m
        final Button btnAddNew = new Button();
        btnAddNew.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                Window modalWindow = new Window("Select a file to add.");
                modalWindow.setWidth("25%");
                modalWindow.setHeight("20%");
                modalWindow.setModal(true);
                modalWindow.addComponent(new ComponentUploadView(repositories, controller, itemProxy,
                        ItemContent.this, mainWindow));
                mainWindow.addWindow(modalWindow);
            }
        });
        btnAddNew.setStyleName(BaseTheme.BUTTON_LINK);
        btnAddNew.addStyleName("floatright paddingtop3");
        btnAddNew.setWidth("20px");
        btnAddNew.setIcon(ICON);
        cssLayout.addComponent(btnAddNew);
    }

    verticalLayout.addComponent(cssLayout);
    wrap(verticalLayout);
    if (controller.hasComponents()) {
        verticalLayout.addComponent(buildTable());
    } else {
        final Label lblNoComponents = new Label(
                "No components in this Item. You can drag n'drop some file from your computer to this box to add new components!");
        lblNoComponents.setWidth("90%");
        lblNoComponents.setStyleName("skybluetext");
        verticalLayout.addComponent(lblNoComponents);
    }
}

From source file:org.escidoc.browser.ui.maincontent.ItemContent.java

License:Open Source License

private void buildPanelHeader(CssLayout cssLayout, String name) {
    cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext");
    cssLayout.setWidth("100%");
    cssLayout.setMargin(false);//from   www .  j  a va 2s  .  c  om

    final Label nameofPanel = new Label(name, Label.CONTENT_RAW);
    nameofPanel.setStyleName("accordion v-captiontext");
    nameofPanel.setWidth("70%");
    cssLayout.addComponent(nameofPanel);

}

From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java

License:Open Source License

private VerticalLayout bindNameToHeader() {
    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setMargin(false);/*from   w w w  .  ja  va  2 s . co m*/
    headerLayout.setWidth("100%");
    final Label headerContext = new Label("Organizational Unit: " + resourceProxy.getName());
    headerContext.setStyleName("h1 fullwidth");
    headerContext.setDescription("Organizational Unit");
    headerLayout.addComponent(headerContext);
    return headerLayout;
}

From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java

License:Open Source License

private HorizontalLayout bindProperties() {
    HorizontalLayout hlProperties = new HorizontalLayout();
    hlProperties.setWidth("100%");
    vlLeft = new VerticalLayout();
    VerticalLayout vlRight = new VerticalLayout();
    final Label descMetadata1 = new Label("ID: " + resourceProxy.getId());
    status = resourceProxy.getType().getLabel() + " is ";
    lblStatus = new Label(status + resourceProxy.getStatus(), Label.CONTENT_RAW);

    if (orgUnitController.hasAccess()) {
        lblStatus.setDescription(ViewConstants.DESC_STATUS);
        lblStatus.setStyleName("inset");
    }/*from w w w.  jav  a  2  s.  c o  m*/

    lblStatus.setDescription(ViewConstants.DESC_STATUS);

    vlLeft.addComponent(descMetadata1);
    vlLeft.addComponent(lblStatus);

    // RIGHT SIDE
    final Label descMetadata2 = new Label(ViewConstants.CREATED_BY + " " + resourceProxy.getCreator() + " on "
            + resourceProxy.getCreatedOn() + "<br/>" + ViewConstants.LAST_MODIFIED_BY + " "
            + resourceProxy.getModifier() + " on " + resourceProxy.getModifiedOn(), Label.CONTENT_XHTML);

    descMetadata2.setStyleName("floatright columnheight50");
    descMetadata2.setWidth("65%");
    vlRight.addComponent(descMetadata2);

    hlProperties.addComponent(vlLeft);
    hlProperties.setExpandRatio(vlLeft, 0.4f);
    hlProperties.addComponent(vlRight);
    hlProperties.setExpandRatio(vlRight, 0.6f);
    return hlProperties;
}

From source file:org.escidoc.browser.ui.maincontent.SearchAdvancedView.java

License:Open Source License

public SearchAdvancedView(final Router router, final EscidocServiceLocation serviceLocation) {
    this.router = router;
    this.serviceLocation = serviceLocation;
    setWidth("100.0%");
    setHeight("85%");
    setMargin(true);//  ww w. j a v a2 s .c om

    // CssLayout to hold the BreadCrumb
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setWidth("60%");
    cssLayout.setCaption("Advanced Search");
    // Css Hack * Clear Div
    final Label lblClear = new Label();
    lblClear.setStyleName("clear");

    txtTitle = new TextField();
    txtTitle.setInputPrompt("Title");
    txtTitle.setImmediate(false);
    txtDescription = new TextField();
    txtDescription.setInputPrompt("Description");
    txtDescription.setImmediate(false);
    // Clean Divs
    cssLayout.addComponent(lblClear);

    txtCreator = new TextField();
    txtCreator.setInputPrompt("Creator");
    txtCreator.setImmediate(false);
    // DatePicker for CreationDate
    creationDate = new PopupDateField();
    creationDate.setInputPrompt("Creation date");
    creationDate.setResolution(PopupDateField.RESOLUTION_DAY);
    creationDate.setImmediate(false);

    // Dropdown for MimeType
    final String[] mimetypes = new String[] { "application/octet-stream", "text/html", "audio/aiff",
            "video/avi", "image/bmp", "application/book", "text/plain", "image/gif", "image/jpeg", "audio/midi",
            "video/quicktime", "audio/mpeg", "application/xml", "text/xml" };
    mimes = new ComboBox();

    for (final String mimetype : mimetypes) {
        mimes.addItem(mimetype);
    }
    mimes.setInputPrompt("Mime Types");
    mimes.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
    mimes.setImmediate(true);

    // Dropdown for Resource Type
    final String[] resourcearr = new String[] { "Context", "Container", "Item" };
    resource = new ComboBox();
    for (final String element : resourcearr) {
        resource.addItem(element);
    }
    resource.setInputPrompt("Resource Type");
    resource.setFilteringMode(Filtering.FILTERINGMODE_OFF);
    resource.setImmediate(true);

    txtFullText = new TextField();
    txtFullText.setInputPrompt("FullText");
    txtFullText.setImmediate(false);

    final Button bSearch = new Button("Search", this, "onClick");
    bSearch.setDescription("Search Tooltip");

    // Placing the elements in the design:
    txtTitle.setWidth("50%");
    txtTitle.setStyleName("floatleft paddingtop20 ");
    cssLayout.addComponent(txtTitle);

    txtDescription.setWidth("50%");
    txtDescription.setStyleName("floatright paddingtop20 ");
    cssLayout.addComponent(txtDescription);

    txtCreator.setWidth("50%");
    txtCreator.setStyleName("floatleft paddingtop20");
    cssLayout.addComponent(txtCreator);

    creationDate.setWidth("50%");
    creationDate.setStyleName("floatright");
    cssLayout.addComponent(creationDate);

    // Clean Divs
    cssLayout.addComponent(lblClear);

    mimes.setWidth("45%");
    mimes.setStyleName("floatleft");
    cssLayout.addComponent(mimes);

    resource.setWidth("45%");
    resource.setStyleName("floatright");
    cssLayout.addComponent(resource);

    txtFullText.setWidth("70%");
    txtFullText.setStyleName("floatleft");
    cssLayout.addComponent(txtFullText);

    bSearch.setStyleName("floatright");
    cssLayout.addComponent(bSearch);

    addComponent(cssLayout);
    this.setComponentAlignment(cssLayout, VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER,
            VerticalLayout.ALIGNMENT_VERTICAL_CENTER);
}

From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java

License:Open Source License

@SuppressWarnings("serial")
private CssLayout headerButton() throws EscidocClientException {
    CssLayout cssLayout = new CssLayout();
    cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext");
    cssLayout.setWidth("100%");
    cssLayout.setMargin(false);/*from   w  w  w. java 2 s  .c o  m*/

    final Label nameofPanel = new Label(ViewConstants.DIRECT_MEMBERS, Label.CONTENT_RAW);
    nameofPanel.setStyleName("accordion v-captiontext");
    nameofPanel.setWidth("70%");
    cssLayout.addComponent(nameofPanel);

    ThemeResource plusIcon = new ThemeResource("images/assets/plus.png");
    if (resourceType == ResourceType.CONTAINER.toString()) {
        resourceProxy = new ContainerProxyImpl(
                router.getRepositories().container().findContainerById(parentId));
        contextId = resourceProxy.getContext().getObjid();
    } else {
        // It has to be a context
        resourceProxy = router.getRepositories().context().findById(parentId);
    }

    final Button addResourceButton = new Button();
    addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
    addResourceButton.addStyleName("floatright paddingtop3");
    addResourceButton.setWidth("20px");
    addResourceButton.setIcon(plusIcon);
    addResourceButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
            try {
                new ResourceAddViewImpl(resourceProxy, contextId, router).openSubWindow();
            } catch (final EscidocClientException e) {
                mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    cssLayout.addComponent(nameofPanel);
    cssLayout.addComponent(addResourceButton);
    return cssLayout;
}

From source file:org.escidoc.browser.ui.view.helpers.ItemPropertiesVH.java

License:Open Source License

private void bindHrRuler() {
    final Label descRuler = new Label("<hr/>", Label.CONTENT_RAW);
    descRuler.setStyleName("hr");
    cssLayout.addComponent(descRuler);/*w  w w.  j  ava2  s  .  c o  m*/
}

From source file:org.hip.vif.admin.groupadmin.ui.AbstractContributionsProcessView.java

License:Open Source License

/** Table | chk : Nr. : Question : Status |
 *
 * @param inData {@link ContributionContainer}
 * @param inCheckedState int the contribution's workflow state (e.g.
 *            <code>WorkflowAwareContribution.S_PRIVATE</code>)
 * @param inListener {@link ValueChangeListener}
 * @return Table *///from  w w  w .  ja v a  2 s  .co  m
protected Table createTable(final ContributionContainer inData, final int inCheckedState,
        final ValueChangeListener inListener) {
    final Table outTable = new Table();
    outTable.setStyleName("vif-table"); //$NON-NLS-1$
    outTable.setWidth("100%"); //$NON-NLS-1$

    outTable.setContainerDataSource(inData);
    // generate check box
    outTable.addGeneratedColumn(ContributionContainer.CONTRIBUTION_CHECK, new Table.ColumnGenerator() {
        @Override
        public Component generateCell(final Table inSource, // NOPMD
                final Object inItemId, final Object inColumnId) {
            final ContributionWrapper lContribution = (ContributionWrapper) inItemId;
            // the check box is generated only if the contributions
            // state is e.g. 'private' or 'waiting for review'
            return lContribution.getState() == inCheckedState
                    ? VIFViewHelper.createCheck(lContribution, new VIFViewHelper.IConfirmationModeChecker() {
                        @Override
                        public boolean inConfirmationMode() { // NOPMD
                            return isConfirmationMode();
                        }
                    })
                    : new Label();
        }
    });
    // generate label component for html text
    outTable.addGeneratedColumn(ContributionContainer.CONTRIBUTION_TEXT, new Table.ColumnGenerator() {
        @Override
        public Component generateCell(final Table inSource, // NOPMD
                final Object inItemId, final Object inColumnId) {
            final Label out = new Label(((ContributionWrapper) inItemId).getContributionText(),
                    ContentMode.HTML);
            out.setStyleName("vif-cell");
            return out;
        }
    });

    outTable.setColumnCollapsingAllowed(true);
    outTable.setColumnReorderingAllowed(true);
    outTable.setSelectable(true);
    outTable.setImmediate(true);
    outTable.setPageLength(0);
    outTable.setColumnExpandRatio(ContributionContainer.CONTRIBUTION_TEXT, 1);
    outTable.addValueChangeListener(inListener);

    outTable.setVisibleColumns(ContributionContainer.NATURAL_COL_ORDER);
    outTable.setColumnHeaders(
            VIFViewHelper.getColumnHeaders(ContributionContainer.COL_HEADERS, Activator.getMessages()));

    return outTable;
}

From source file:org.hip.vif.forum.groups.ui.AbstractContributionsProcessView.java

License:Open Source License

/** Table | chk : Nr. : Question : Status |
 *
 * @param inData {@link ContributionContainer}
 * @param inCheckedState int the contribution's workflow state (e.g.
 *            <code>WorkflowAwareContribution.S_PRIVATE</code>)
 * @param inListener {@link ValueChangeListener}
 * @return Table *///from  w w  w . j a  v  a2  s  .  c  om
protected Table createTable(final ContributionContainer inData, final int inCheckedState,
        final ValueChangeListener inListener) {
    final Table outTable = new Table();
    outTable.setStyleName("vif-table"); //$NON-NLS-1$
    outTable.setWidth("100%"); //$NON-NLS-1$

    outTable.setContainerDataSource(inData);
    // generate check box
    outTable.addGeneratedColumn(ContributionContainer.CONTRIBUTION_CHECK, new Table.ColumnGenerator() {
        @Override
        public Component generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { // NOPMD
            final ContributionWrapper lContribution = (ContributionWrapper) inItemId;
            // the check box is generated only if the contributions state is e.g. 'private' or 'waiting for review'
            return lContribution.getState() == inCheckedState
                    ? VIFViewHelper.createCheck(lContribution, new VIFViewHelper.IConfirmationModeChecker() {
                        @Override
                        public boolean inConfirmationMode() { // NOPMD
                            return isConfirmationMode();
                        }
                    })
                    : new Label();
        }
    });
    // generate label component for html text
    outTable.addGeneratedColumn(ContributionContainer.CONTRIBUTION_TEXT, new Table.ColumnGenerator() {
        @Override
        public Component generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { // NOPMD
            final Label out = new Label(((ContributionWrapper) inItemId).getContributionText(),
                    ContentMode.HTML);
            out.setStyleName("vif-cell");
            return out;
        }
    });

    outTable.setColumnCollapsingAllowed(true);
    outTable.setColumnReorderingAllowed(true);
    outTable.setSelectable(true);
    outTable.setImmediate(true);
    outTable.setPageLength(0);
    outTable.setColumnExpandRatio(ContributionContainer.CONTRIBUTION_TEXT, 1);
    outTable.addValueChangeListener(inListener);

    outTable.setVisibleColumns(ContributionContainer.NATURAL_COL_ORDER);
    outTable.setColumnHeaders(
            VIFViewHelper.getColumnHeaders(ContributionContainer.COL_HEADERS, Activator.getMessages()));

    return outTable;
}