Java Code Examples for com.taobao.weex.WXSDKInstance#commitUTStab()
The following examples show how to use
com.taobao.weex.WXSDKInstance#commitUTStab() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoveEventAction.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); WXDomObject domObject = context.getDomByRef(mRef); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT); } return; } domObject.removeEvent(mEvent); mUpdatedDomObject = domObject; context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 2
Source File: WXDomStatement.java From weex-uikit with MIT License | 6 votes |
/** * 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); } }
Example 3
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * 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); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 4
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Update the {@link WXDomObject#style} according to the given style. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. * @param style the new style. This style is only a part of the full style, and will be merged * into {@link WXDomObject#style} * @see #updateAttrs(String, JSONObject) */ void updateStyle(String ref, JSONObject style) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATESTYLE); } return; } domObject.updateStyle(style); transformStyle(domObject, false); updateStyle(domObject, style); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 5
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * 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); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 6
Source File: WXDomStatement.java From weex with Apache License 2.0 | 6 votes |
/** * Create a command object for notifying {@link WXRenderManager} that the process of creating * given view is finished, and put the command object in the queue. */ void createFinish() { if (mDestroy) { return; } final WXDomObject root = mRegistry.get(WXDomObject.ROOT); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.createFinish(mInstanceId, (int) root.getLayoutWidth(), (int) root.getLayoutHeight()); } }); mDirty = true; WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 7
Source File: WXBridgeManager.java From weex with Apache License 2.0 | 5 votes |
public void commitJSBridgeAlarmMonitor(String instanceId, WXErrorCode errCode) { WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId); if (instance == null) { return; } instance.commitUTStab(WXConst.JS_BRIDGE, errCode); }
Example 8
Source File: MoveElementAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); WXDomObject domObject = context.getDomByRef(mRef); WXDomObject parentObject = context.getDomByRef(mParentRef); if (domObject == null || domObject.parent == null || parentObject == null || parentObject.hasNewLayout()) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_MOVEELEMENT); } return; } int index = mIndex; if (domObject.parent.equals(parentObject)) { if(parentObject.index(domObject) == index) { return; } else if(domObject.parent.index(domObject)< index){ index = index -1; } } mNewIndex = index; domObject.parent.remove(domObject); parentObject.add(domObject, mNewIndex); context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 9
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Create a command object for removing the specified {@link WXDomObject}. * If the domObject is null or its parent is null, this method returns directly. * Otherwise, put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. */ void removeDom(final String ref) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } WXDomObject parent = domObject.parent; if (parent == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } clearRegistryForDom(domObject); parent.remove(domObject); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.removeComponent(mInstanceId, ref); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 10
Source File: RemoveElementAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); WXDomObject domObject = context.getDomByRef(mRef); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } WXDomObject parent = domObject.parent; if (parent == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } domObject.traverseTree(context.getRemoveElementConsumer()); parent.remove(domObject); context.unregisterDOMObject(mRef); context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 11
Source File: UpdateFinishAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } context.postRenderTask(this); WXSDKInstance instance = context.getInstance(); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 12
Source File: AbstractLayoutFinishAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXDomObject root = context.getDomByRef(WXDomObject.ROOT); mLayoutHeight = (int)root.getLayoutHeight(); mLayoutWidth = (int)root.getLayoutWidth(); context.postRenderTask(this); WXSDKInstance instance = context.getInstance(); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 13
Source File: ScrollToElementAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override public void executeDom(DOMActionContext context) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); context.postRenderTask(this); if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 14
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Create a command object for adding a default event listener to the corresponding {@link * WXDomObject} and put the command object in the queue. * When the event is triggered, the eventListener will call {@link WXSDKManager#fireEvent * (String, String, String)}, and the JS will handle all the operations from there. * * @param ref {@link WXDomObject#ref} of the dom. * @param type the type of the event, this may be a plain event defined in * {@link com.taobao.weex.ui.component.WXEventType} or a gesture defined in {@link com.taobao * .weex.ui.view.gesture.WXGestureType} */ void addEvent(final String ref, final String type) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_ADDEVENT); } return; } domObject.addEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.addEvent(mInstanceId, ref, type); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 15
Source File: WXDomStatement.java From weex-uikit with MIT License | 5 votes |
/** * Update styles according to the given style. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref Reference of the dom. * @param style the new style. This style is only a part of the full style, and will be merged * into styles * @param byPesudo updateStyle by pesduo class * @see #updateAttrs(String, JSONObject) */ void updateStyle(String ref, JSONObject style, boolean byPesudo) { if (mDestroy || style == null) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATESTYLE); } return; } Map<String, Object> animationMap= new ArrayMap<>(2); animationMap.put(WXDomObject.TRANSFORM, style.remove(WXDomObject.TRANSFORM)); animationMap.put(WXDomObject.TRANSFORM_ORIGIN, style.remove(WXDomObject.TRANSFORM_ORIGIN)); animations.add(new Pair<>(ref, animationMap)); if(!style.isEmpty()){ domObject.updateStyle(style, byPesudo); domObject.traverseTree(ApplyStyleConsumer.getInstance()); updateStyle(domObject, style); } mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 16
Source File: WXDomStatement.java From weex with Apache License 2.0 | 5 votes |
/** * Update the {@link WXDomObject#attr} according to the given attribute. Then creating a * command object for updating corresponding view and put the command object in the queue. * @param ref {@link WXDomObject#ref} of the dom. * @param attrs the new style. This style is only a part of the full attribute set, and will be * merged into {@link WXDomObject#attr} * @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(WXConst.DOM_MODULE, WXErrorCode.WX_ERR_DOM_UPDATEATTRS); } return; } domObject.updateAttr(attrs); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.updateAttrs(mInstanceId, domObject.ref, attrs); } }); mDirty = true; if (instance != null) { instance.commitUTStab(WXConst.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 17
Source File: WXDomStatement.java From weex-uikit with MIT License | 5 votes |
/** * Create a command object for removing the event listener of the corresponding {@link * WXDomObject} and put the command event in the queue. * @param ref Reference of the dom. * @param type the type of the event, this may be a plain event defined in * {@link com.taobao.weex.common.Constants.Event} or a gesture defined in {@link com.taobao * .weex.ui.view.gesture.WXGestureType} */ void removeEvent(final String ref, final String type) { 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_REMOVEEVENT); } return; } domObject.removeEvent(type); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId,ref); if(comp != null){ //sync dom change to component comp.updateDom(domObject); mWXRenderManager.removeEvent(mInstanceId, ref, type); } } @Override public String toString() { return "removeEvent"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 18
Source File: WXDomStatement.java From weex-uikit with MIT License | 4 votes |
/** * Add DOM node. * @param dom * @param isRoot * @param parentRef * @param index */ private void addDomInternal(JSONObject dom,boolean isRoot, String parentRef, final int index){ if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); if (instance == null) { return; } WXErrorCode errCode = isRoot ? WXErrorCode.WX_ERR_DOM_CREATEBODY : WXErrorCode.WX_ERR_DOM_ADDELEMENT; if (dom == null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); } //only non-root has parent. WXDomObject parent; WXDomObject domObject = WXDomObject.parse(dom,instance); if (domObject == null || mRegistry.containsKey(domObject.getRef())) { if (WXEnvironment.isApkDebugable()) { WXLogUtils.e("[WXDomStatement] " + (isRoot ? "createBody" : "addDom") + " error,DOM object is null or already registered!!"); } instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); return; } if (isRoot) { WXDomObject.prepareRoot(domObject, WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexHeight(mInstanceId),WXSDKManager.getInstanceViewPortWidth(mInstanceId)), WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexWidth(mInstanceId),WXSDKManager.getInstanceViewPortWidth(mInstanceId))); } else if ((parent = mRegistry.get(parentRef)) == null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); return; } else { //non-root and parent exist parent.add(domObject, index); } domObject.traverseTree( mAddDOMConsumer, ApplyStyleConsumer.getInstance() ); //Create component in dom thread WXComponent component = isRoot ? mWXRenderManager.createBodyOnDomThread(mInstanceId, domObject) : mWXRenderManager.createComponentOnDomThread(mInstanceId, domObject, parentRef, index); if (component == null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); //stop redner, some fatal happened. return; } AddDomInfo addDomInfo = new AddDomInfo(); addDomInfo.component = component; mAddDom.put(domObject.getRef(), addDomInfo); IWXRenderTask task = isRoot ? new CreateBodyTask(component) : new AddDOMTask(component, parentRef, index); mNormalTasks.add(task); addAnimationForDomTree(domObject); mDirty = true; instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); }
Example 19
Source File: WXDomStatement.java From weex-uikit with MIT License | 4 votes |
/** * Create a command object for removing the specified {@link WXDomObject}. * If the domObject is null or its parent is null, this method returns directly. * Otherwise, put the command object in the queue. * @param ref Reference of the dom. */ void removeDom(final String ref) { if (mDestroy) { return; } WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId); WXDomObject domObject = mRegistry.get(ref); if (domObject == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } WXDomObject parent = domObject.parent; if (parent == null) { if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT); } return; } domObject.traverseTree(new WXDomObject.Consumer() { @Override public void accept(WXDomObject dom) { mRegistry.remove(dom.getRef()); } }); parent.remove(domObject); mRegistry.remove(ref); mNormalTasks.add(new IWXRenderTask() { @Override public void execute() { mWXRenderManager.removeComponent(mInstanceId, ref); } @Override public String toString() { return "removeDom"; } }); mDirty = true; if (instance != null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); } }
Example 20
Source File: AbstractAddElementAction.java From ucar-weex-core with Apache License 2.0 | 4 votes |
/** * Add DOM node. */ protected void addDomInternal(DOMActionContext context, JSONObject dom) { if (context.isDestory()) { return; } WXSDKInstance instance = context.getInstance(); if (instance == null) { return; } WXErrorCode errCode = getErrorCode(); if (dom == null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); } //only non-root has parent. WXDomObject domObject = WXDomObject.parse(dom, instance); if (domObject == null || context.getDomByRef(domObject.getRef()) != null) { if (WXEnvironment.isApkDebugable()) { WXLogUtils.e("[DOMActionContextImpl] " + getStatementName() + " error,DOM object is null or already registered!!"); } instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); return; } appendDomToTree(context, domObject); domObject.traverseTree( context.getAddDOMConsumer(), context.getApplyStyleConsumer() ); //Create component in dom thread WXComponent component = createComponent(context, domObject); if (component == null) { instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, errCode); //stop redner, some fatal happened. return; } context.addDomInfo(domObject.getRef(), component); context.postRenderTask(this); addAnimationForDomTree(context, domObject); instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS); }