Example usage for com.vaadin.ui Component addStyleName

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

Introduction

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

Prototype

public void addStyleName(String style);

Source Link

Document

Adds one or more style names to this component.

Usage

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private void toggleMaximized(final Component panel, final boolean maximized) {
    if (maximized) {
        panel.setVisible(true);//ww w. ja v a  2s. c o m
        panel.addStyleName("max");
    } else {
        panel.removeStyleName("max");
    }
}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

public Component buildServerComponent() {
    Panel component = new Panel();
    component.setSizeFull();//from   w  ww  .j  a va 2  s .  co m
    component.addStyleName(ValoTheme.PANEL_BORDERLESS);

    GridLayout layout = new GridLayout(2, 4);
    layout.setSizeFull();
    layout.setMargin(true);

    Label serverNameLabel = new Label(server.getName());
    serverNameLabel.setStyleName(ValoTheme.LABEL_LARGE);
    serverNameLabel.setWidth("100%");
    Label serverDescriptionLabel = new Label(server.getDescription());
    serverDescriptionLabel.setWidth("100%");
    serverDescriptionLabel.setStyleName(ValoTheme.LABEL_LARGE);
    Label serverUrlLabel = new Label(server.getUrl() + ":" + server.getPort());
    serverUrlLabel.setStyleName(ValoTheme.LABEL_LARGE);
    serverUrlLabel.setWidth("100%");

    layout.addComponent(serverNameLabel, 0, 0);
    layout.addComponent(serverDescriptionLabel, 0, 1);
    layout.addComponent(serverUrlLabel, 0, 2);

    statusLabel.setCaptionAsHtml(true);

    MonitorIcons icon = MonitorIcons.SERVER;
    icon.setSizePixels(64);

    Label serverLabel = new Label();
    serverLabel.setCaption(icon.getHtml());
    serverLabel.setCaptionAsHtml(true);

    layout.addComponent(serverLabel, 1, 0, 1, 2);
    layout.setComponentAlignment(serverLabel, Alignment.MIDDLE_CENTER);

    layout.addComponent(statusLabel, 0, 3, 1, 3);
    layout.setComponentAlignment(statusLabel, Alignment.MIDDLE_CENTER);

    buildFilterTable();

    component.setContent(layout);

    Component contentWrapper = createContentWrapper(component, buildFilterTable());

    contentWrapper.addStyleName("top10-revenue");
    return contentWrapper;
}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

protected void toggleMaximized(final Component panel, final boolean maximized) {
    if (maximized) {

        panel.setVisible(true);//  w ww .  jav  a2 s  . co m
        panel.addStyleName("max");

    } else {
        panel.removeStyleName("max");
    }
}

From source file:org.jpos.qi.QILayout.java

License:Open Source License

public void addMenu(Component menu) {
    menu.addStyleName("valo-menu-part");
    menuLayout.addComponent(menu);
}

From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java

License:Open Source License

/**
 * Attaches the given module to the UI.//from  w  w w. j  a v a  2 s .c o m
 * 
 * @param module
 */
protected void attachModule(IUIModule module) {
    Component topComponent = module.getTopComponent();
    if (topComponent != null) {
        topFrame.addComponent(topComponent);
        topComponent.addStyleName("k-navcomponent");
        topFrame.setComponentAlignment(topComponent, Alignment.MIDDLE_LEFT);
    }

    Component mainComponent = module.getMainComponent();
    if (mainComponent != null) {
        tabSheet.addTab(module.getMainComponent(), module.getCaption());
    }

    Component bottomComponent = module.getBottomComponent();
    if (bottomComponent != null) {
        bottomFrame.addComponent(bottomComponent);
    }
}

From source file:org.lunifera.vaaclipse.ui.preferences.addon.internal.PreferencesPageRenderer.java

License:Open Source License

@SuppressWarnings("restriction")
public void render() {
    pageLayout.addStyleName("preferences-page");

    for (FieldEditor<?> editor : page.getChildren()) {
        Class<? extends FieldEditorRenderer<?>> rendererClass = getRendererClass(editor);
        if (rendererClass != null) {
            IEclipseContext rendererContext = context.createChild();

            Class<?>[] interfaces = editor.getClass().getInterfaces();
            PrefHelper.populateInterfaces(editor, rendererContext, interfaces);
            FieldEditorRenderer<?> fieldRenderer = ContextInjectionFactory.make(rendererClass, rendererContext);
            fieldRenderer.render();//from   w  w w  . j a va2 s  .  c om
            Component fieldComponent = fieldRenderer.getComponent();
            editor.setWidget(fieldComponent);
            editor.setRenderer(fieldRenderer);
        } else {
            logger.warn("{} editor has no renderer. It is not rendered.", editor);
        }
    }

    // If there are contribution let it to layout this page
    if (page.getContributionURI() != null) {
        IContributionFactory contributionFactory = (IContributionFactory) context
                .get(IContributionFactory.class.getName());
        Object pageContribution = contributionFactory.create(page.getContributionURI(), context);
        page.setObject(pageContribution);
    } else {
        // If there are no contribution class for this page, adding with
        // default layout and style 'field-editor'
        Label pageDesc = new Label(page.getDescription());
        pageDesc.addStyleName("field-editor");
        pageLayout.addComponent(pageDesc);
        for (FieldEditor<?> editor : page.getChildren()) {
            Component fieldComponent = (Component) editor.getWidget();
            fieldComponent.addStyleName("field-editor");
            pageLayout.addComponent(fieldComponent);
        }
    }
}

From source file:org.opencms.ui.components.CmsToolLayout.java

License:Open Source License

/**
 * Sets the main component.<p>/* ww  w .  ja v  a  2  s  .  com*/
 *
 * @param component the main component
 */
public void setMainContent(Component component) {

    component.addStyleName("borderless");
    m_main.setContent(component);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.ToolBarRenderer.java

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MToolBar)) {
        return;//  w  ww.  j a va  2s. c om
    }

    MToolBar toolbarModel = (MToolBar) element;
    processContribution(toolbarModel);

    AbstractLayout toolBarWidget;

    if ((MElementContainer<?>) toolbarModel.getParent() instanceof MTrimBar) {
        MTrimBar parentTrimBar = (MTrimBar) (MElementContainer<?>) toolbarModel.getParent();
        int orientation = parentTrimBar.getSide().getValue();

        if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE) {
            toolBarWidget = new HorizontalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("horizontaltoolbar");
        } else {
            toolBarWidget = new VerticalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("verticaltoolbar");
        }

        Component separator = GuiUtils.createSeparator(toolbarModel);
        if (separator != null)
            toolBarWidget.addComponent(separator);
    } else
        toolBarWidget = new HorizontalLayout();

    toolBarWidget.setSizeUndefined();
    toolBarWidget.addStyleName("toolbar");

    for (String css : toolbarModel.getTags()) {
        toolBarWidget.addStyleName(css);
    }

    element.setWidget(toolBarWidget);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.TrimBarRenderer.java

License:Open Source License

@Override
public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) {
    if (!(child instanceof MTrimElement && (MElementContainer<?>) element instanceof MTrimBar))
        return;/*from w  w w .  j a  va2s .c o m*/

    MTrimBar trimBar = (MTrimBar) (MElementContainer<?>) element;

    final Component childWidget = (Component) child.getWidget();
    childWidget.setVisible(child.isVisible());
    childWidget.setSizeUndefined();
    int orientation = trimBar.getSide().getValue();
    if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE)
        childWidget.addStyleName("horizontaltrimelement");
    else
        childWidget.addStyleName("verticaltrimelement");

    int index = indexOf(child, element);
    if (element.getWidget() instanceof CssLayout) {
        CssLayout trimWidget = (CssLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    } else if (element.getWidget() instanceof AbstractOrderedLayout) {
        AbstractOrderedLayout trimWidget = (AbstractOrderedLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    }

    refreshVisibility(trimBar);
}

From source file:org.semanticsoft.vaaclipse.presentation.widgets.TopbarComponent.java

License:Open Source License

/**
 * Sets the content of the top bar./* ww w. ja  va2 s .  c  o m*/
 * 
 * @param content
 */
public void setContent(Component content) {
    if (this.content != null) {
        rootLayout.removeComponent(this.content);
    }
    rootLayout.addComponent(content, 1, 1);

    this.content = content;
    //       content.setSizeFull();
    content.addStyleName("content");
}