Java Code Examples for com.vaadin.ui.HorizontalLayout.setStyleName()

The following are Jave code examples for showing how to use setStyleName() of the com.vaadin.ui.HorizontalLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: osc-core   File: PageInformationComponent.java   Source Code and License Vote up 4 votes
private Component buildMainLayout() {
    // top-level component properties
    setWidth("100.0%");
    setHeight("-1px");
    setStyleName(StyleConstants.PAGE_INFO_COMPONENT_COMMON);

    // infoLabel
    this.titleLabel = new Label();
    initializeLabel(this.titleLabel);

    final Button collapseButton = new Button();
    collapseButton.setStyleName(Reindeer.BUTTON_LINK);
    collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
    collapseButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            PageInformationComponent.this.contentLabel.setVisible(!PageInformationComponent.this.contentLabel
                    .isVisible());
            if (PageInformationComponent.this.contentLabel.isVisible()) {
                collapseButton.setIcon(new ThemeResource(StyleConstants.COLLAPSE_IMAGE));
            } else {
                collapseButton.setIcon(new ThemeResource(StyleConstants.EXPAND_IMAGE));
            }
        }
    });

    HorizontalLayout titleLayout = new HorizontalLayout();
    initializeLayout(titleLayout);
    titleLayout.setStyleName(StyleConstants.PAGE_INFO_TITLE_LAYOUT);

    titleLayout.addComponent(this.titleLabel);
    titleLayout.addComponent(collapseButton);
    titleLayout.setExpandRatio(this.titleLabel, 1.0f);

    this.contentLabel = new Label();
    initializeLabel(this.contentLabel);
    this.contentLabel.setVisible(false);

    this.contentLabel.setStyleName(StyleConstants.PAGE_INFO_CONTENT_LABEL);
    this.contentLabel.setContentMode(ContentMode.HTML);

    VerticalLayout mainLayout = new VerticalLayout();
    initializeLayout(mainLayout);
    mainLayout.addComponent(titleLayout);
    mainLayout.addComponent(this.contentLabel);

    return mainLayout;
}