use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.
the class BasicListComponent method bindViewType.
/**
* ViewType will be classified into {HashMap<Integer,ArrayList<Integer>> mViewTypes}
*
* @param component
*/
private void bindViewType(WXComponent component) {
int id = generateViewType(component);
if (mViewTypes == null) {
mViewTypes = new SparseArray<>();
}
ArrayList<WXComponent> mTypes = mViewTypes.get(id);
if (mTypes == null) {
mTypes = new ArrayList<>();
mViewTypes.put(id, mTypes);
}
mTypes.add(component);
}
use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.
the class WXRecyclerTemplateList method doRenderTemplate.
/**
* create code context for render component and do render
*/
private List<WXComponent> doRenderTemplate(WXCell cell, int position) {
this.cellRenderContext.clear();
Object item = cellDataManager.listData.get(position);
CellRenderState cellRenderState = cellDataManager.getRenderState(position);
cellRenderContext.renderState = cellRenderState;
cellRenderContext.templateList = this;
cellRenderContext.position = position;
ArrayStack stack = cellRenderContext.stack;
Map map = cellRenderContext.map;
if (cellDataManager.listData != null) {
stack.push(map);
map.put(listDataKey, cellDataManager.listData);
if (!TextUtils.isEmpty(listDataIndexKey)) {
map.put(listDataIndexKey, new PositionRef(cellRenderState));
}
if (!TextUtils.isEmpty(listDataItemKey)) {
map.put(listDataItemKey, item);
} else {
stack.push(item);
}
}
if (cellRenderState.itemId <= 0) {
getItemId(position);
}
List<WXComponent> updates = Statements.doRender(cell, this.cellRenderContext);
if (cellRenderState.isDirty()) {
cellRenderState.resetDirty();
}
return updates;
}
use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.
the class WXRecyclerTemplateList method bindStickStyle.
@Override
public void bindStickStyle(WXComponent component) {
WXComponent template = findParentType(component, WXCell.class);
if (template == null) {
return;
}
if (cellDataManager.listData == null || mStickyHelper == null) {
return;
}
if (!mStickyHelper.getStickyTypes().contains(template.getRef())) {
mStickyHelper.getStickyTypes().add(template.getRef());
notifyUpdateList();
}
}
use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.
the class ConfigComponentHolder method createInstance.
@Override
public synchronized WXComponent createInstance(WXSDKInstance instance, WXDomObject node, WXVContainer parent) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (mClass == null || mClassLoader != instance.getContext().getClassLoader()) {
mClass = WXSDKManager.getInstance().getClassLoaderAdapter().getComponentClass(mType, mClassName, instance);
mClassLoader = instance.getContext().getClassLoader();
}
ComponentCreator creator = new SimpleComponentHolder.ClazzComponentCreator(mClass);
WXComponent component = creator.createInstance(instance, node, parent);
component.bindHolder(this);
return component;
}
use of com.taobao.weex.ui.component.WXComponent in project incubator-weex by apache.
the class FlatGUIContext method getWidgetContainerView.
@Nullable
public View getWidgetContainerView(Widget widget) {
WXComponent component, ancestor;
View ret = null;
if ((component = getComponent(widget)) != null) {
if ((ancestor = getFlatComponentAncestor(component)) != null) {
ret = ancestor.getHostView();
}
}
return ret;
}
Aggregations