Example usage for com.vaadin.ui AbstractComponent setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:de.mhus.lib.vaadin.layouter.LayUtil.java

License:Apache License

public static void configure(AbstractComponent layout, ResourceNode config) throws MException {
    if (config.getBoolean(LayoutBuilder.FULL_SIZE, false))
        layout.setSizeFull();/*from   w ww  .  jav a2  s . c o  m*/
    else {
        String width = config.getString(LayoutBuilder.WIDTH, null);
        if (width != null)
            layout.setWidth(width);
        String height = config.getString(LayoutBuilder.HEIGHT, null);
        if (height != null)
            layout.setHeight(height);
    }

    // margin
    //TODO      if (layout instanceof Layout && config.isProperty(LayoutBuilder.MARGIN))
    //         ((Layout)layout).setMargin(config.getBoolean(LayoutBuilder.MARGIN, false));
    // spacing
    if (layout instanceof Layout.SpacingHandler && config.isProperty(LayoutBuilder.SPACING))
        ((Layout.SpacingHandler) layout).setSpacing(config.getBoolean(LayoutBuilder.SPACING, false));
    // styles
    if (config.isProperty(LayoutBuilder.STYLE)) {
        layout.setStyleName(config.getExtracted(LayoutBuilder.STYLE));
    }
    // hidden
    if (config.getBoolean(LayoutBuilder.HIDDEN, false))
        layout.setVisible(false);

    // split
    if (layout instanceof AbstractSplitPanel) {
        String a = config.getString(LayoutBuilder.SPLIT_MIN, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setMinSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
        a = config.getString(LayoutBuilder.SPLIT_MAX, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setMaxSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
        a = config.getString(LayoutBuilder.SPLIT_POS, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
    }

}