本文整理汇总了Java中com.taobao.weex.ui.component.WXVContainer类的典型用法代码示例。如果您正苦于以下问题:Java WXVContainer类的具体用法?Java WXVContainer怎么用?Java WXVContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WXVContainer类属于com.taobao.weex.ui.component包,在下文中一共展示了WXVContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDomObj
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
/**
* Update the specified component's dom and mark it as old.
* @param component the component to be updated
*/
private void updateDomObj(WXComponent component) {
if (component == null) {
return;
}
WXDomObject domObject = mRegistry.get(component.getRef());
if (domObject == null) {
return;
}
domObject.old();
component.updateDom(domObject.clone());
if (component instanceof WXVContainer) {
WXVContainer container = (WXVContainer) component;
int count = container.childCount();
for (int i = 0; i < count; ++i) {
updateDomObj(container.getChild(i));
}
}
}
示例2: loadConstructor
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的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;
}
示例3: createBodyOnDomThread
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
WXComponent createBodyOnDomThread(WXDomObject dom) {
if (mWXSDKInstance == null) {
return null;
}
WXDomObject domObject = new WXDomObject();
WXDomObject.prepareGod(domObject);
mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
mGodComponent.createView(null, -1);
if (mGodComponent == null) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("rootView failed!");
}
//TODO error callback
return null;
}
FrameLayout frameLayout = (FrameLayout) mGodComponent.getHostView();
ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParams);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
WXComponent component = generateComponentTree(dom, mGodComponent);
mGodComponent.addChild(component);
mRegistry.put(component.getRef(), component);
return component;
}
示例4: clearRegistryForComponent
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
/**
* Clear registry information that current instance contains.
*/
private void clearRegistryForComponent(WXComponent component) {
WXComponent removedComponent = mRegistry.remove(component.getDomObject().getRef());
if (removedComponent != null) {
removedComponent.removeAllEvent();
removedComponent.removeStickyStyle();
}
if (component instanceof WXVContainer) {
WXVContainer container = (WXVContainer) component;
int count = container.childCount();
for (int i = count - 1; i >= 0; --i) {
clearRegistryForComponent(container.getChild(i));
}
}
}
示例5: generateComponentTree
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
private WXComponent generateComponentTree(WXDomObject dom, WXVContainer parent) {
if (dom == null || parent == null) {
return null;
}
WXComponent component = WXComponentFactory.newInstance(mWXSDKInstance, dom,
parent, parent.isLazy());
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;
}
示例6: updateDomObj
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
/**
* Update the specified component's dom and mark it as old.
* @param component the component to be updated
*/
private void updateDomObj(WXComponent component) {
if (component == null) {
return;
}
WXDomObject domObject = mRegistry.get(component.getRef());
if (domObject == null) {
return;
}
domObject.old();
component.updateDom(domObject);
if (component instanceof WXVContainer) {
WXVContainer container = (WXVContainer) component;
int count = container.childCount();
for (int i = 0; i < count; ++i) {
updateDomObj(container.getChild(i));
}
}
}
示例7: generateComponentTree
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
protected WXComponent generateComponentTree(DOMActionContext context, WXDomObject dom, WXVContainer parent) {
if (dom == null) {
return null;
}
WXComponent component = WXComponentFactory.newInstance(context.getInstance(), dom, parent);
context.registerComponent(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(context, child, parentC));
}
}
}
return component;
}
示例8: loadConstructor
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
private void loadConstructor(){
Class<? extends WXComponent> c = mCompClz;
Constructor<? extends WXComponent> constructor;
try {
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class);
} catch (NoSuchMethodException e) {
WXLogUtils.d("ClazzComponentCreator","Use deprecated component constructor");
try {
//compatible deprecated constructor with 4 args
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class, boolean.class);
} catch (NoSuchMethodException e1) {
try {
//compatible deprecated constructor with 5 args
constructor = c.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class,String.class, boolean.class);
} catch (NoSuchMethodException e2) {
throw new WXRuntimeException("Can't find constructor of component.");
}
}
}
mConstructor = constructor;
}
示例9: createInstance
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
@Override
public WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if(mConstructor == null){
loadConstructor();
}
int parameters = mConstructor.getParameterTypes().length;
WXComponent component;
if(parameters == 3){
component = mConstructor.newInstance(instance,node,parent);
}else if(parameters == 4){
component = mConstructor.newInstance(instance,node,parent,false);
}else{
//compatible deprecated constructor
component = mConstructor.newInstance(instance,node,parent,instance.getInstanceId(),parent.isLazy());
}
return component;
}
示例10: generateComponentTree
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的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;
}
示例11: getComponentNumOfNode
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
private int getComponentNumOfNode(@NonNull WXComponent rootNode) {
Deque<WXComponent> deque = new ArrayDeque<>();
deque.add(rootNode);
int viewNum = 0;
while (!deque.isEmpty()) {
WXComponent node = deque.removeFirst();
viewNum++;
if (node instanceof WXVContainer) {
WXVContainer container = (WXVContainer) node;
for (int i = 0, count = container.childCount(); i < count; i++) {
deque.add(container.getChild(i));
}
}
}
return viewNum;
}
示例12: createBodyOnDomThread
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
WXComponent createBodyOnDomThread(WXDomObject dom) {
if (mWXSDKInstance == null) {
return null;
}
WXDomObject domObject = new WXDomObject();
domObject.type = WXBasicComponentType.DIV;
domObject.ref = "god";
mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
mGodComponent.createView(null, -1);
if (mGodComponent == null) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("rootView failed!");
}
//TODO error callback
return null;
}
FrameLayout frameLayout = (FrameLayout) mGodComponent.getView();
ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParams);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
WXComponent component = generateComponentTree(dom, mGodComponent);
mGodComponent.addChild(component);
mRegistry.put(component.getRef(), component);
return component;
}
示例13: clearRegistryForComponent
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
/**
* Clear registry information that current instance contains.
*/
private void clearRegistryForComponent(WXComponent component) {
WXComponent removedComponent = mRegistry.remove(component.getDomObject().ref);
if (removedComponent != null) {
removedComponent.removeAllEvent();
removedComponent.removeStickyStyle();
}
if (component instanceof WXVContainer) {
WXVContainer container = (WXVContainer) component;
int count = container.childCount();
for (int i = count - 1; i >= 0; --i) {
clearRegistryForComponent(container.getChild(i));
}
}
}
示例14: generateComponentTree
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
private WXComponent generateComponentTree(WXDomObject dom, WXVContainer parent) {
if (dom == null || parent == null) {
return null;
}
WXComponent component = WXComponentFactory.newInstance(mWXSDKInstance, dom,
parent, parent.isLazy());
mRegistry.put(dom.ref, 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;
}
示例15: createInstance
import com.taobao.weex.ui.component.WXVContainer; //导入依赖的package包/类
public WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if(mConstructor == null){
generate();
}
int parameters = mConstructor.getParameterTypes().length;
WXComponent component;
if(parameters == 4){
component = mConstructor.newInstance(instance,node,parent,lazy);
}else{
//compatible deprecated constructor
component = mConstructor.newInstance(instance,node,parent,instance.getInstanceId(),lazy);
}
component.setHolder(this);
return component;
}