com.taobao.weex.dom.WXDomManager Java Examples

The following examples show how to use com.taobao.weex.dom.WXDomManager. 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: WXSliderNeighbor.java    From weex-uikit with MIT License 5 votes vote down vote up
/**
 * we do it in a hack way.
 * travel the dom tree, to get how many children does this slider-neighbor have.
 *
 * @return
 */
private int getNeighborChildrenCount() {

    try {
        WXDomManager domManager = WXSDKManager.getInstance().getWXDomManager();
        Field domRegistriesField = domManager.getClass().getDeclaredField("mDomRegistries");
        domRegistriesField.setAccessible(true);
        ConcurrentHashMap<String, Object> domRegistriesMap = (ConcurrentHashMap<String, Object>) domRegistriesField.get(domManager);
        Object domStatement = domRegistriesMap.get(getInstanceId()); // WXDomStatement
        Field mRegistryField = domStatement.getClass().getDeclaredField("mRegistry");
        mRegistryField.setAccessible(true);
        ConcurrentHashMap<String, WXDomObject> mRegistryMap = (ConcurrentHashMap<String, WXDomObject>) mRegistryField.get(domStatement);
        for(WXDomObject domObject : mRegistryMap.values()) {
            if(domObject.getType().equalsIgnoreCase(WXBasicComponentType.SLIDER_NEIGHBOR)) {
                int sum = 0;
                for (int i = 0,count = domObject.getChildCount(); i < count; i++) {
                    if(domObject.getChild(i) instanceof WXIndicator.IndicatorDomNode) {
                        continue;
                    }
                    sum++;
                }
                return sum;
            }
        }
    } catch (Exception e) {
        // ignore
    }

    return -1;

}
 
Example #2
Source File: WXSDKManager.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
private WXSDKManager(WXRenderManager renderManager) {
  mWXRenderManager = renderManager;
  mWXDomManager = new WXDomManager(mWXRenderManager);
  mBridgeManager = WXBridgeManager.getInstance();
  mWXWorkThreadManager = new WXWorkThreadManager();
}
 
Example #3
Source File: WXSDKManager.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
public WXDomManager getWXDomManager() {
  return mWXDomManager;
}
 
Example #4
Source File: WXSDKManager.java    From weex-uikit with MIT License 4 votes vote down vote up
private WXSDKManager() {
  mWXRenderManager = new WXRenderManager();
  mWXDomManager = new WXDomManager(mWXRenderManager);
  mBridgeManager = WXBridgeManager.getInstance();
}
 
Example #5
Source File: WXSDKManager.java    From weex-uikit with MIT License 4 votes vote down vote up
public WXDomManager getWXDomManager() {
  return mWXDomManager;
}
 
Example #6
Source File: WXSDKManager.java    From weex with Apache License 2.0 4 votes vote down vote up
private WXSDKManager() {
  mWXRenderManager = new WXRenderManager();
  mWXDomManager = new WXDomManager(mWXRenderManager);
  mBridgeManager = WXBridgeManager.getInstance();
}
 
Example #7
Source File: WXSDKManager.java    From weex with Apache License 2.0 4 votes vote down vote up
public WXDomManager getWXDomManager() {
  return mWXDomManager;
}