Example usage for com.vaadin.ui.declarative DesignAttributeHandler writeAttribute

List of usage examples for com.vaadin.ui.declarative DesignAttributeHandler writeAttribute

Introduction

In this page you can find the example usage for com.vaadin.ui.declarative DesignAttributeHandler writeAttribute.

Prototype

@SuppressWarnings({ "unchecked", "rawtypes" })
public static void writeAttribute(Object component, String attribute, Attributes attr, Object defaultInstance,
        DesignContext context) 

Source Link

Document

Writes the specified attribute to the design if it differs from the default value got from the defaultInstance .

Usage

From source file:eu.maxschuster.vaadin.colorpickerfield.AbstractColorPickerField.java

License:Apache License

@Override
public void writeDesign(Element design, DesignContext designContext) {
    super.writeDesign(design, designContext);
    Attributes attributes = design.attributes();

    DesignAttributeHandler.writeAttribute("color", attributes, getClientColor(getValue()).getCSS(),
            Color.WHITE.getCSS(), String.class);
    DesignAttributeHandler.writeAttribute("popup-style", attributes,
            (popupStyle == AbstractColorPicker.PopupStyle.POPUP_NORMAL ? "normal" : "simple"), "normal",
            String.class);
    DesignAttributeHandler.writeAttribute("position", attributes, positionX + "," + positionY, "0,0",
            String.class);
}