当前位置: 首页>>代码示例>>Java>>正文


Java WXDomObject类代码示例

本文整理汇总了Java中com.taobao.weex.dom.WXDomObject的典型用法代码示例。如果您正苦于以下问题:Java WXDomObject类的具体用法?Java WXDomObject怎么用?Java WXDomObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WXDomObject类属于com.taobao.weex.dom包,在下文中一共展示了WXDomObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadConstructor

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
private void loadConstructor(){
  Class<? extends WXComponent> c = mCompClz;
  Constructor<? extends WXComponent> constructor;
  try {
    constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class, boolean.class);
  } catch (NoSuchMethodException e) {
    WXLogUtils.d("ClazzComponentCreator","Use deprecated component constructor");
    try {
      //compatible deprecated constructor
      constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class,String.class, boolean.class);
    } catch (NoSuchMethodException e1) {
      throw new WXRuntimeException("Can't find constructor of component.");
    }
  }
  mConstructor = constructor;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:SimpleComponentHolder.java

示例2: generateComponentTree

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
private WXComponent generateComponentTree(WXDomObject dom, WXVContainer parent) {
  if (dom == null ) {
    return null;
  }
  WXComponent component = WXComponentFactory.newInstance(mWXSDKInstance, dom,parent);

  mRegistry.put(dom.getRef(), component);
  if (component instanceof WXVContainer) {
    WXVContainer parentC = (WXVContainer) component;
    int count = dom.childCount();
    WXDomObject child = null;
    for (int i = 0; i < count; ++i) {
      child = dom.getChild(i);
      if (child != null) {
        parentC.addChild(generateComponentTree(child, parentC));
      }
    }
  }

  return component;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXRenderStatement.java

示例3: executeDom

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Override
public void executeDom(DOMActionContext context) {
  try {
    WXDomObject domObject;
    if (!context.isDestory() &&
        !TextUtils.isEmpty(animation) &&
        (domObject = context.getDomByRef(ref)) != null) {
      WXAnimationBean animationBean = JSONObject.parseObject(animation, WXAnimationBean.class);
      if (animationBean != null && animationBean.styles != null) {
        int width = (int) domObject.getLayoutWidth();
        int height = (int) domObject.getLayoutHeight();
        animationBean.styles.init(animationBean.styles.transformOrigin,
                                  animationBean.styles.transform, width, height,
                                  context.getInstance().getInstanceViewPortWidth());
        mAnimationBean = animationBean;
        context.postRenderTask(this);
      }
    }
  } catch (RuntimeException e) {
    WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:23,代码来源:AnimationAction.java

示例4: testAddChild

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Test
public void testAddChild(){
    WXSDKInstance instance = Mockito.mock(WXSDKInstance.class);
    Mockito.when(instance.getContext()).thenReturn(RuntimeEnvironment.application);

    WXDomObject testDom = Mockito.mock(WXDomObject.class);
    Mockito.when(testDom.getPadding()).thenReturn(new Spacing());
    Mockito.when(testDom.clone()).thenReturn(testDom);
    TestDomObject.setRef(testDom,"2");
    WXText child1 = new WXText(instance, testDom, mWXDiv);
    child1.initView();

    mWXDiv.addChild(child1, 0);

    assertEquals(1, mWXDiv.childCount());

    WXDomObject testDom2 = Mockito.spy(new WXDomObject());
    Mockito.when(testDom2.getPadding()).thenReturn(new Spacing());
    Mockito.when(testDom2.clone()).thenReturn(testDom2);
    TestDomObject.setRef(testDom2,"3");
    child2 = new WXText(instance, testDom2, mWXDiv);
    child2.initView();

    mWXDiv.addChild(child2, -1);

    assertEquals(2, mWXDiv.childCount());
    assertEquals(child2, mWXDiv.getChild(1));

    WXDomObject testDom3 = Mockito.mock(WXDomObject.class);
    Mockito.when(testDom3.getPadding()).thenReturn(new Spacing());
    Mockito.when(testDom3.clone()).thenReturn(testDom3);
    TestDomObject.setRef(testDom3,"4");
    WXText child3 = new WXText(instance, testDom3, mWXDiv);
    child3.initView();

    mWXDiv.addChild(child3, 1);

    assertEquals(3, mWXDiv.childCount());
    assertEquals(child3, mWXDiv.getChild(1));
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:41,代码来源:WXDivTest.java

示例5: createInstance

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Override
public synchronized WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) throws IllegalAccessException, InvocationTargetException, InstantiationException {
  WXComponent component = mCreator.createInstance(instance,node,parent);

  component.bindHolder(this);
  return component;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:8,代码来源:SimpleComponentHolder.java

示例6: createBodyOnDomThread

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
public WXComponent createBodyOnDomThread(String instanceId, WXDomObject domObject) {
  WXRenderStatement statement = mRegistries.get(instanceId);
  if (statement == null) {
    return null;
  }
  return statement.createBodyOnDomThread(domObject);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:8,代码来源:WXRenderManager.java

示例7: createInstance

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Override
public synchronized WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) throws IllegalAccessException, InvocationTargetException, InstantiationException {
  if(mClass == null){
    mClass = mClzGetter.getExternalComponentClass(mType,instance);
  }
  ComponentCreator creator = new SimpleComponentHolder.ClazzComponentCreator(mClass);
  WXComponent component = creator.createInstance(instance,node,parent);

  component.bindHolder(this);
  return component;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:12,代码来源:ExternalLoaderComponentHolder.java

示例8: setLayout

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
/**
 * set layout information of View
 */
void setLayout(String ref, WXDomObject domObject) {
  WXComponent component = mRegistry.get(ref);
  if (component == null) {
    return;
  }
  component.setLayout(domObject);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:11,代码来源:WXRenderStatement.java

示例9: testParseTransforms

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Test
public void testParseTransforms() throws Exception {
  WXDiv div = WXDivTest.create();
  ComponentTest.create(div);

  WXDomObject dom = new WXListDomObject();
  dom.getAttrs().put(WXListComponent.TRANSFORM,"scale(0.9,0.8);translate(10,20);opacity(0.5);rotate(100)");
  component = create(div,dom);
  ComponentTest.create(component);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:11,代码来源:WXListComponentTest.java

示例10: appendDomToTree

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Override
protected void appendDomToTree(DOMActionContext context, WXDomObject domObject) {
  String instanceId = context.getInstanceId();
  WXDomObject.prepareRoot(domObject,
      WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexHeight(instanceId), WXSDKManager.getInstanceViewPortWidth(instanceId)),
      WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexWidth(instanceId), WXSDKManager.getInstanceViewPortWidth(instanceId)));
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:8,代码来源:CreateBodyAction.java

示例11: updateRootComponentStyle

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
private void updateRootComponentStyle(JSONObject style) {
  Message message = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = getInstanceId();
  if (task.args == null) {
    task.args = new ArrayList<>();
  }
  task.args.add(WXDomObject.ROOT);
  task.args.add(style);
  message.obj = task;
  message.what = WXDomHandler.MsgType.WX_DOM_UPDATE_STYLE;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:14,代码来源:WXSDKInstance.java

示例12: executeDom

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:16,代码来源:AbstractLayoutFinishAction.java

示例13: executeDom

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
@Override
public void executeDom(DOMActionContext context) {
  if (context.isDestory() || mData == null) {
    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_UPDATESTYLE);
    }
    return;
  }
  mPadding = domObject.getPadding();
  mBorder = domObject.getBorder();

  Map<String, Object> animationMap = new ArrayMap<>(2);
  animationMap.put(WXDomObject.TRANSFORM, mData.get(WXDomObject.TRANSFORM));
  animationMap.put(WXDomObject.TRANSFORM_ORIGIN, mData.get(WXDomObject.TRANSFORM_ORIGIN));

  context.addAnimationForElement(mRef, animationMap);

  if (!mData.isEmpty()) {
    domObject.updateStyle(mData, mIsCausedByPesudo);
    domObject.traverseTree(context.getApplyStyleConsumer());
    context.postRenderTask(this);
  }

  if (instance != null) {
    instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:33,代码来源:UpdateStyleAction.java

示例14: WXEmbed

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
public WXEmbed(WXSDKInstance instance, WXDomObject node, WXVContainer parent) {
  super(instance, node, parent);
  mListener = new EmbedRenderListener(this);

  ERROR_IMG_WIDTH = (int) WXViewUtils.getRealPxByWidth(270,instance.getViewPortWidth());
  ERROR_IMG_HEIGHT = (int) WXViewUtils.getRealPxByWidth(260,instance.getViewPortWidth());
  if(instance instanceof EmbedManager) {
    Object itemId = node.getAttrs().get(ITEM_ID);
    if (itemId != null) {
      ((EmbedManager) instance).putEmbed(itemId.toString(), this);
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:14,代码来源:WXEmbed.java

示例15: WXComponent

import com.taobao.weex.dom.WXDomObject; //导入依赖的package包/类
public WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy) {
  mInstance = instance;
  mContext = mInstance.getContext();
  mParent = parent;
  mDomObj = dom.clone();
  mInstanceId = instance.getInstanceId();
  mLazy = isLazy;
  mCurrentRef = mDomObj.getRef();
  mGestureType = new HashSet<>();
  ++mComponentNum;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:12,代码来源:WXComponent.java


注:本文中的com.taobao.weex.dom.WXDomObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。