Java Code Examples for com.taobao.weex.dom.WXDomObject#add()
The following examples show how to use
com.taobao.weex.dom.WXDomObject#add() .
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: 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 2
Source File: AddElementAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override protected void appendDomToTree(DOMActionContext context, WXDomObject domObject) { WXDomObject parent; mRef = domObject.getRef(); if ((parent = context.getDomByRef(mParentRef)) == null) { context.getInstance().commitUTStab(IWXUserTrackAdapter.DOM_MODULE, getErrorCode()); return; } else { //non-root and parent exist parent.add(domObject, mAddIndex); } }