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:info.magnolia.about.app.AboutViewImpl.java

License:Open Source License

private Component createInstallationSection() {

    // build and bind fields
    Component mgnlEdition = buildAndBind(AboutView.MAGNOLIA_EDITION_KEY,
            i18n.translate("about.app.main.mgnledition"));
    Component mgnlVersion = buildAndBind(AboutView.MAGNOLIA_VERSION_KEY,
            i18n.translate("about.app.main.mgnlversion"));
    Component mgnlInstance = buildAndBind(AboutView.MAGNOLIA_INSTANCE_KEY,
            i18n.translate("about.app.main.instance"));

    Component osInfo = buildAndBind(AboutView.OS_INFO_KEY, i18n.translate("about.app.main.os"));
    Component javaInfo = buildAndBind(AboutView.JAVA_INFO_KEY, i18n.translate("about.app.main.java"));
    Component serverInfo = buildAndBind(AboutView.SERVER_INFO_KEY, i18n.translate("about.app.main.server"));
    Component dbInfo = buildAndBind(AboutView.DB_INFO_KEY, i18n.translate("about.app.main.dbinfo"));
    Component dbDriverInfo = buildAndBind(AboutView.DB_DRIVER_INFO_KEY,
            i18n.translate("about.app.main.dbdriverinfo"));
    Component jcrInfo = buildAndBind(AboutView.JCR_INFO_KEY, i18n.translate("about.app.main.repository"));

    // layout/*  w w  w  .j a  v a2  s .  c  o m*/
    FormLayout layout = new FormLayout();

    Label sectionTitle = new Label(i18n.translate("about.app.main.installation.title"));
    sectionTitle.addStyleName("section-title");
    layout.addComponent(sectionTitle);

    layout.addComponent(createFieldsetTitle(i18n.translate("about.app.main.magnolia.title")));
    layout.addComponent(mgnlEdition);
    layout.addComponent(mgnlVersion);
    layout.addComponent(mgnlInstance);

    Component environmentTitle = createFieldsetTitle(i18n.translate("about.app.main.environment.title"));
    environmentTitle.addStyleName("spacer");
    layout.addComponent(environmentTitle);
    layout.addComponent(osInfo);
    layout.addComponent(javaInfo);
    layout.addComponent(serverInfo);
    layout.addComponent(dbInfo);
    layout.addComponent(dbDriverInfo);
    layout.addComponent(jcrInfo);

    return layout;
}

From source file:info.magnolia.ui.contentapp.detail.DetailEditorViewImpl.java

License:Open Source License

@Override
public void setActionbarView(final ActionbarView actionBar) {
    Component c = actionBar.asVaadinComponent();
    c.addStyleName("stub");
    actionBar.setOpen(false);/*from  w w w .  jav a 2s.c o  m*/

    Component old = actionBarWrapper.getComponentCount() != 0 ? actionBarWrapper.getComponent(0) : null;
    if (old == null) {
        actionBarWrapper.addComponent(c);
    } else {
        actionBarWrapper.replaceComponent(old, c);
    }
    this.actionBar = actionBar;
}

From source file:info.magnolia.ui.framework.app.DefaultAppView.java

License:Open Source License

@Override
public void setTheme(String themeName) {
    String stylename = String.format("app-%s", themeName);
    final String themeUrl = String.format("../%s/styles.css", themeName);

    final Component vaadinComponent = asVaadinComponent();
    vaadinComponent.addStyleName(stylename);
    vaadinComponent.addAttachListener(new AttachListener() {

        @Override/* w  w  w .  j av a  2s .  co m*/
        public void attach(AttachEvent event) {
            ThemeResource res = new ThemeResource(themeUrl);
            CSSInject cssInject = new CSSInject(vaadinComponent.getUI());
            cssInject.addStyleSheet(res);
        }
    });
}

From source file:info.magnolia.ui.mediaeditor.field.image.ImageMediaField.java

License:Open Source License

private void doScaleToFit(HasComponents hc) {
    Iterator<Component> it = hc.iterator();
    while (it.hasNext()) {
        Component c = it.next();
        if (c instanceof Image) {
            c.addStyleName("scale-to-fit");
        } else if (c instanceof HasComponents) {
            doScaleToFit((HasComponents) c);
        }//from   w  w w  . j  av a2s.  com
    }
}

From source file:info.magnolia.ui.vaadin.dialog.Notification.java

License:Open Source License

public void setContent(Component content) {
    layout.addComponent(content);/* w  w  w  . j  a v a  2s  . co  m*/
    content.addStyleName("dialog-content");
    content.addStyleName("title");
}

From source file:info.magnolia.ui.vaadin.editor.JCrop.java

License:Open Source License

public void setSelectionStatusComponent(Component c) {
    if (getState().selectionStatusComponent != null) {
        ((Component) getState().selectionStatusComponent).removeStyleName("");
    }/*from   w  w w.  j a  v a 2 s.  co  m*/
    getState().selectionStatusComponent = c;
    if (getSession() != null) {
        c.addStyleName("crop-status" + getConnectorId());
    }
}

From source file:info.magnolia.ui.vaadin.form.FormSection.java

License:Open Source License

@Override
public void addComponent(Component c) {
    super.addComponent(c);
    components.add(c);/*w  w w.  ja  va 2s .com*/
    c.addStyleName("v-form-field");
    markAsDirty();
}

From source file:info.magnolia.ui.vaadin.layout.SmallAppLayout.java

License:Open Source License

public void addSection(Component section) {
    section.addStyleName("smallapp-section");
    sectionsLayout.addComponent(section);
}

From source file:info.magnolia.ui.vaadin.overlay.Overlay.java

License:Open Source License

public Overlay(final Component content, final Component overlayParent,
        final OverlayLayer.ModalityDomain modalityDomain, final OverlayLayer.ModalityLevel modalityLevel) {
    setImmediate(true);//from ww w .  j a v  a2 s  .c  o  m

    content.addStyleName("overlay-child");
    setContent(content);
    getState().overlayContent = content;
    getState().overlayParent = overlayParent;

    this.addStyleName("overlay");
    this.addStyleName("open");

    // Set css classes of Modal
    this.addStyleName(modalityDomain.getCssClass());
    this.addStyleName(modalityLevel.getCssClass());

    registerRpc(new OverlayServerRpc() {
        @Override
        public void onClosed() {
            if (listener != null) {
                listener.onOverlayClosed();
            }
        }
    });
}

From source file:io.subutai.plugin.accumulo.ui.manager.Manager.java

private void addStyleName(Component... components) {
    for (Component c : components) {
        c.addStyleName(STYLE_NAME);
    }
}