Search in sources :

Example 6 with CSSPosition

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

the class JSCSSPosition method t.

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

Example 7 with CSSPosition

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

the class PersistHelper method createCSSPosition.

public static CSSPosition createCSSPosition(String s) {
    if (s == null)
        return null;
    String top = "-1";
    String left = "-1";
    String bottom = "-1";
    String right = "-1";
    String width = "-1";
    String height = "-1";
    try {
        // $NON-NLS-1$
        StringTokenizer tk = new StringTokenizer(s, ",");
        if (tk.hasMoreTokens())
            top = tk.nextToken();
        if (tk.hasMoreTokens())
            right = tk.nextToken();
        if (tk.hasMoreTokens())
            bottom = tk.nextToken();
        if (tk.hasMoreTokens())
            left = tk.nextToken();
        if (tk.hasMoreTokens())
            width = tk.nextToken();
        if (tk.hasMoreTokens())
            height = tk.nextToken();
    } catch (Exception ex) {
        Debug.error(ex);
        return null;
    }
    return new CSSPosition(top, right, bottom, left, width, height);
}
Also used : StringTokenizer(java.util.StringTokenizer) CSSPosition(com.servoy.j2db.persistence.CSSPosition) FontFormatException(java.awt.FontFormatException) IOException(java.io.IOException)

Example 8 with CSSPosition

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

the class JSCSSPosition method b.

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

Example 9 with CSSPosition

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

the class JSCSSPosition method setBottom.

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

Example 10 with CSSPosition

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

the class JSCSSPosition method h.

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

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