Search in sources :

Example 11 with CSSPosition

use of com.servoy.j2db.persistence.CSSPosition in project servoy-client by Servoy.

the class JSCSSPosition method setLeft.

@JSSetter
public void setLeft(String left) {
    CSSPosition position = component.getBaseComponent(true).getCssPosition();
    if (position != null) {
        position.left = left;
        component.getBaseComponent(true).setCssPosition(position);
    }
}
Also used : CSSPosition(com.servoy.j2db.persistence.CSSPosition) JSSetter(org.mozilla.javascript.annotations.JSSetter)

Example 12 with CSSPosition

use of com.servoy.j2db.persistence.CSSPosition in project servoy-client by Servoy.

the class JSCSSPosition method l.

/**
 * Set left css position (in pixels or percent).
 *
 * @param left left position in pixels or percentage
 *
 * @sample
 * comp.cssPosition.l("10").t("10").w("20%").h("30px")
 *
 * @return css position
 */
@Override
@JSFunction
public ICSSPosition l(String left) {
    CSSPosition position = component.getBaseComponent(true).getCssPosition();
    if (position != null) {
        position.left = left;
        component.getBaseComponent(true).setCssPosition(position);
    }
    return this;
}
Also used : CSSPosition(com.servoy.j2db.persistence.CSSPosition) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Example 13 with CSSPosition

use of com.servoy.j2db.persistence.CSSPosition in project servoy-client by Servoy.

the class JSCSSPosition method r.

/**
 * Set right css position (in pixels or percent).
 *
 * @param right right position in pixels or percentage
 *
 * @sample
 * comp.cssPosition.r("10").b("10").w("20%").h("30px")
 *
 * @return css position
 */
@Override
@JSFunction
public ICSSPosition r(String right) {
    CSSPosition position = component.getBaseComponent(true).getCssPosition();
    if (position != null) {
        position.right = right;
        component.getBaseComponent(true).setCssPosition(position);
    }
    return this;
}
Also used : CSSPosition(com.servoy.j2db.persistence.CSSPosition) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Example 14 with CSSPosition

use of com.servoy.j2db.persistence.CSSPosition in project servoy-client by Servoy.

the class JSCSSPosition method w.

/**
 * Set width css position (in pixels or percent).
 *
 * @param width width position in pixels or percentage
 *
 * @sample
 * comp.cssPosition.l("10").t("10").w("20%").h("30px")
 *
 * @return css position
 */
@Override
@JSFunction
public ICSSPosition w(String width) {
    CSSPosition position = component.getBaseComponent(true).getCssPosition();
    if (position != null) {
        position.width = width;
        component.getBaseComponent(true).setCssPosition(position);
    }
    return this;
}
Also used : CSSPosition(com.servoy.j2db.persistence.CSSPosition) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Example 15 with CSSPosition

use of com.servoy.j2db.persistence.CSSPosition in project servoy-client by Servoy.

the class CSSPositionPropertyType method toDesignValue.

/*
	 * (non-Javadoc)
	 *
	 * @see com.servoy.j2db.persistence.IDesignValueConverter#toDesignValue(java.lang.Object, org.sablo.specification.PropertyDescription)
	 */
@Override
public Object toDesignValue(Object javaValue, PropertyDescription pd) {
    if (javaValue instanceof CSSPosition) {
        CSSPosition cssPosition = (CSSPosition) javaValue;
        JSONObject json = new JSONObject();
        json.put("top", cssPosition.top);
        json.put("left", cssPosition.left);
        json.put("bottom", cssPosition.bottom);
        json.put("right", cssPosition.right);
        json.put("width", cssPosition.width);
        json.put("height", cssPosition.height);
        return json;
    }
    return javaValue;
}
Also used : JSONObject(org.json.JSONObject) CSSPosition(com.servoy.j2db.persistence.CSSPosition)

Aggregations

CSSPosition (com.servoy.j2db.persistence.CSSPosition)15 JSFunction (org.mozilla.javascript.annotations.JSFunction)6 JSSetter (org.mozilla.javascript.annotations.JSSetter)5 BaseComponent (com.servoy.j2db.persistence.BaseComponent)1 IFormElement (com.servoy.j2db.persistence.IFormElement)1 Part (com.servoy.j2db.persistence.Part)1 Dimension (java.awt.Dimension)1 FontFormatException (java.awt.FontFormatException)1 Point (java.awt.Point)1 IOException (java.io.IOException)1 StringTokenizer (java.util.StringTokenizer)1 JSONObject (org.json.JSONObject)1 JSGetter (org.mozilla.javascript.annotations.JSGetter)1