Search in sources :

Example 41 with WXDomObject

use of com.taobao.weex.dom.WXDomObject in project incubator-weex by apache.

the class Statements method getComponentId.

public static String getComponentId(WXComponent component) {
    if (component instanceof WXCell || component == null) {
        return null;
    }
    WXDomObject domObject = (WXDomObject) component.getDomObject();
    WXAttr attr = domObject.getAttrs();
    if (attr.get(ELUtils.IS_COMPONENT_ROOT) != null && WXUtils.getBoolean(attr.get(ELUtils.IS_COMPONENT_ROOT), false)) {
        if (attr.get(ELUtils.COMPONENT_PROPS) != null && attr.get(ELUtils.COMPONENT_PROPS) instanceof JSONObject) {
            Object componentId = attr.get(CellDataManager.VIRTUAL_COMPONENT_ID);
            if (componentId == null) {
                return null;
            }
            return componentId.toString();
        }
    }
    return getComponentId(component.getParent());
}
Also used : WXDomObject(com.taobao.weex.dom.WXDomObject) JSONObject(com.alibaba.fastjson.JSONObject) WXDomObject(com.taobao.weex.dom.WXDomObject) JSONObject(com.alibaba.fastjson.JSONObject) WXCell(com.taobao.weex.ui.component.list.WXCell) WXAttr(com.taobao.weex.dom.WXAttr)

Example 42 with WXDomObject

use of com.taobao.weex.dom.WXDomObject in project incubator-weex by apache.

the class WXCell method getStickyOffset.

public int getStickyOffset() {
    if (getDomObject() == null) {
        return 0;
    }
    WXDomObject domObject = (WXDomObject) getDomObject();
    if (domObject.getAttrs().get(STICKY_OFFSET) == null) {
        return 0;
    }
    float offset = WXUtils.getFloat(domObject.getAttrs().get(STICKY_OFFSET));
    return (int) (WXViewUtils.getRealPxByWidth(offset, domObject.getViewPortWidth()));
}
Also used : WXDomObject(com.taobao.weex.dom.WXDomObject)

Aggregations

WXDomObject (com.taobao.weex.dom.WXDomObject)42 WXSDKInstance (com.taobao.weex.WXSDKInstance)15 WXComponent (com.taobao.weex.ui.component.WXComponent)10 JSONObject (com.alibaba.fastjson.JSONObject)8 WXVContainer (com.taobao.weex.ui.component.WXVContainer)8 Spacing (com.taobao.weex.dom.flex.Spacing)7 WXEvent (com.taobao.weex.dom.WXEvent)6 WXTextDomObject (com.taobao.weex.dom.WXTextDomObject)6 Test (org.junit.Test)6 WXSDKInstanceTest (com.taobao.weex.WXSDKInstanceTest)5 Before (org.junit.Before)5 ArrayMap (android.support.v4.util.ArrayMap)4 WXAttr (com.taobao.weex.dom.WXAttr)4 WXDiv (com.taobao.weex.ui.component.WXDiv)4 WXCell (com.taobao.weex.ui.component.list.WXCell)4 HashMap (java.util.HashMap)4 WXStyle (com.taobao.weex.dom.WXStyle)3 FlatGUIContext (com.taobao.weex.ui.flat.FlatGUIContext)3 Map (java.util.Map)3 SpannableString (android.text.SpannableString)2