webfirmframework for Java Experts

Custom CSS property

com.webfirmframework.wffweb.csswff.CustomCssProperty class may be used to create a custom css property. See the below example.

Eg 1 :-

Div div = new Div(null, new Style(new CustomCssProperty("new-property-name", "new-property-value")));
System.out.println(div.toHtmlString());

Eg 2 :-

Style style = new Style();
CustomCssProperty newCssProperty = new CustomCssProperty("new-property-name", "new-property-value");
style.addCssProperty(newCssProperty);
Div div = new Div(null, style);
System.out.println(div.toHtmlString());

// cssProperty will be the same object newCssProperty
CssProperty cssProperty = style.getCssProperty("new-property-name");

Eg 3 :-

Style style = new Style();
style.addCssProperty("new-property-name", "new-property-value");
Div div = new Div(null, style);
System.out.println(div.toHtmlString());

// cssProperty will be an instance of CustomCssProperty
CssProperty cssProperty = style.getCssProperty("new-property-name");

Or a separate class may be kept as below

public class VibrateCssProperty extends CustomCssProperty {

    public VibrateCssProperty(String cssValue) {
        super("vibrate", cssValue);
    }

    // TODO add needful feature methods for this css property

}