Search in sources :

Example 6 with IWXRenderTask

use of com.taobao.weex.ui.IWXRenderTask in project weex-example by KalicyZhou.

the class WXDomStatement method refreshFinish.

/**
   * Create a command object for notifying {@link WXRenderManager} that the process of refreshing
   * given view is finished, and put the command object in the queue.
   */
void refreshFinish() {
    if (mDestroy) {
        return;
    }
    final WXDomObject root = mRegistry.get(WXDomObject.ROOT);
    mNormalTasks.add(new IWXRenderTask() {

        @Override
        public void execute() {
            int realWidth = (int) root.getLayoutWidth();
            int realHeight = (int) root.getLayoutHeight();
            mWXRenderManager.refreshFinish(mInstanceId, realWidth, realHeight);
        }

        @Override
        public String toString() {
            return "refreshFinish";
        }
    });
    mDirty = true;
    WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
    if (instance != null) {
        instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
    }
}
Also used : IWXRenderTask(com.taobao.weex.ui.IWXRenderTask) WXSDKInstance(com.taobao.weex.WXSDKInstance)

Example 7 with IWXRenderTask

use of com.taobao.weex.ui.IWXRenderTask in project weex-example by KalicyZhou.

the class WXDomStatement method getComponentSize.

public void getComponentSize(final String ref, final JSCallback callback) {
    if (mDestroy) {
        Map<String, Object> options = new HashMap<>();
        options.put("result", false);
        options.put("errMsg", "Component does not exist");
        callback.invoke(options);
        return;
    }
    mNormalTasks.add(new IWXRenderTask() {

        @Override
        public void execute() {
            mWXRenderManager.getComponentSize(mInstanceId, ref, callback);
        }

        @Override
        public String toString() {
            return "getComponentSize";
        }
    });
    mDirty = true;
}
Also used : IWXRenderTask(com.taobao.weex.ui.IWXRenderTask) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSONObject(com.alibaba.fastjson.JSONObject)

Example 8 with IWXRenderTask

use of com.taobao.weex.ui.IWXRenderTask in project weex-example by KalicyZhou.

the class WXDomStatement method updateAttrs.

/**
   * Update the attributes according to the given attribute. Then creating a
   * command object for updating corresponding view and put the command object in the queue.
   * @param ref Reference of the dom.
   * @param attrs the new style. This style is only a part of the full attribute set, and will be
   *              merged into attributes
   * @see #updateStyle(String, JSONObject)
   */
void updateAttrs(String ref, final JSONObject attrs) {
    if (mDestroy) {
        return;
    }
    WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
    final WXDomObject domObject = mRegistry.get(ref);
    if (domObject == null) {
        if (instance != null) {
            instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATEATTRS);
        }
        return;
    }
    domObject.updateAttr(attrs);
    mNormalTasks.add(new IWXRenderTask() {

        @Override
        public void execute() {
            mWXRenderManager.updateAttrs(mInstanceId, domObject.getRef(), attrs);
        }

        @Override
        public String toString() {
            return "updateAttr";
        }
    });
    mDirty = true;
    if (instance != null) {
        instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
    }
}
Also used : IWXRenderTask(com.taobao.weex.ui.IWXRenderTask) WXSDKInstance(com.taobao.weex.WXSDKInstance)

Example 9 with IWXRenderTask

use of com.taobao.weex.ui.IWXRenderTask in project weex-example by KalicyZhou.

the class WXDomStatement method updateFinish.

/**
   * Create a command object for notifying {@link WXRenderManager} that the process of update
   * given view is finished, and put the command object in the queue.
   */
void updateFinish() {
    if (mDestroy) {
        return;
    }
    mNormalTasks.add(new IWXRenderTask() {

        @Override
        public void execute() {
            mWXRenderManager.updateFinish(mInstanceId);
        }

        @Override
        public String toString() {
            return "updateFinish";
        }
    });
    WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
    if (instance != null) {
        instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
    }
}
Also used : IWXRenderTask(com.taobao.weex.ui.IWXRenderTask) WXSDKInstance(com.taobao.weex.WXSDKInstance)

Example 10 with IWXRenderTask

use of com.taobao.weex.ui.IWXRenderTask in project weex-example by KalicyZhou.

the class WXDomStatement method scrollToDom.

/**
   * Create a command object for scroll the given view to the specified position.
   * @param ref Reference of the dom.
   * @param options the specified position
   */
void scrollToDom(final String ref, final JSONObject options) {
    if (mDestroy) {
        return;
    }
    WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
    mNormalTasks.add(new IWXRenderTask() {

        @Override
        public void execute() {
            mWXRenderManager.scrollToComponent(mInstanceId, ref, options);
        }

        @Override
        public String toString() {
            return "scrollToPosition";
        }
    });
    mDirty = true;
    if (instance != null) {
        instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
    }
}
Also used : IWXRenderTask(com.taobao.weex.ui.IWXRenderTask) WXSDKInstance(com.taobao.weex.WXSDKInstance)

Aggregations

IWXRenderTask (com.taobao.weex.ui.IWXRenderTask)12 WXSDKInstance (com.taobao.weex.WXSDKInstance)10 WXComponent (com.taobao.weex.ui.component.WXComponent)3 JSONObject (com.alibaba.fastjson.JSONObject)1 WXErrorCode (com.taobao.weex.common.WXErrorCode)1 WXAnimationBean (com.taobao.weex.ui.animation.WXAnimationBean)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1