use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method addComponent.
/**
* @see com.taobao.weex.dom.WXDomStatement#addDom(JSONObject, String, int)
*/
void addComponent(WXDomObject dom, String parentRef, int index) {
WXVContainer parent = (WXVContainer) mRegistry.get(parentRef);
WXComponent component = generateComponentTree(dom, parent);
parent.addChild(component, index);
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class BasicListComponent method onCreateViewHolder.
/**
* Create an instance of {@link ListBaseViewHolder} for the given viewType (not for the given
* index). This method will look up for the first component that fits the viewType requirement and
* doesn't be used. Then create the certain type of view, detach the view f[rom the component.
*
* @param parent the ViewGroup into which the new view will be inserted
* @param viewType the type of the new view
* @return the created view holder.
*/
@Override
public ListBaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (mChildren != null) {
if (mViewTypes == null)
return createVHForFakeComponent(viewType);
ArrayList<WXComponent> mTypes = mViewTypes.get(viewType);
checkRecycledViewPool(viewType);
if (mTypes == null)
return createVHForFakeComponent(viewType);
for (int i = 0; i < mTypes.size(); i++) {
WXComponent component = mTypes.get(i);
if (component == null || component.isUsing()) {
continue;
}
if (component.getDomObject() != null && component.getDomObject().isFixed()) {
return createVHForFakeComponent(viewType);
} else {
if (component instanceof WXCell) {
if (component.getRealView() != null) {
return new ListBaseViewHolder(component, viewType);
} else {
((WXCell) component).lazy(false);
component.createView();
component.applyLayoutAndEvent(component);
return new ListBaseViewHolder(component, viewType);
}
} else if (component instanceof WXBaseRefresh) {
return createVHForRefreshComponent(viewType);
} else {
WXLogUtils.e(TAG, "List cannot include element except cell、header、fixed、refresh and loading");
return createVHForFakeComponent(viewType);
}
}
}
}
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "Cannot find request viewType: " + viewType);
}
return createVHForFakeComponent(viewType);
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXDomStatement method removeEvent.
/**
* Create a command object for removing the event listener of the corresponding {@link
* WXDomObject} and put the command event in the queue.
* @param ref Reference of the dom.
* @param type the type of the event, this may be a plain event defined in
* {@link com.taobao.weex.common.Constants.Event} or a gesture defined in {@link com.taobao
* .weex.ui.view.gesture.WXGestureType}
*/
void removeEvent(final String ref, final String type) {
if (mDestroy) {
return;
}
WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(mInstanceId);
final WXDomObject domObject = mRegistry.get(ref);
if (domObject == null) {
if (instance != null) {
instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEEVENT);
}
return;
}
domObject.removeEvent(type);
mNormalTasks.add(new IWXRenderTask() {
@Override
public void execute() {
WXComponent comp = mWXRenderManager.getWXComponent(mInstanceId, ref);
if (comp != null) {
//sync dom change to component
comp.updateDom(domObject);
mWXRenderManager.removeEvent(mInstanceId, ref, type);
}
}
@Override
public String toString() {
return "removeEvent";
}
});
mDirty = true;
if (instance != null) {
instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
}
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method setPadding.
/**
* set padding style of View
*/
void setPadding(String ref, Spacing padding, Spacing border) {
WXComponent component = mRegistry.get(ref);
if (component == null) {
return;
}
component.setPadding(padding, border);
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method removeEvent.
/**
* @see WXDomObject#removeEvent(String)
*/
void removeEvent(String ref, String type) {
WXComponent component = mRegistry.get(ref);
if (component == null) {
return;
}
component.removeEvent(type);
}
Aggregations