• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WXComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onBindViewHolder

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
   * Bind the component of the position to the holder. Then flush the view.
   *
   * @param holder   viewHolder, which holds reference to the view
   * @param position position of component in WXListComponent
   */
  @Override
  public void onBindViewHolder(ListBaseViewHolder holder, int position) {
    if (holder == null) return;
    holder.setComponentUsing(true);
    WXComponent component = getChild(position);
    if (component == null
        || (component instanceof WXRefresh)
        || (component instanceof WXLoading)
        || (component.getDomObject() != null && component.getDomObject().isFixed())
        ) {
      if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.d(TAG, "Bind WXRefresh & WXLoading " + holder);
      }
      return;
    }

    if (holder.getComponent() != null && holder.getComponent() instanceof WXCell) {
      holder.getComponent().bindData(component);
//              holder.getComponent().refreshData(component);
    }

  }
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:29,代码来源:BasicListComponent.java


示例2: scrollTo

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * @see com.taobao.weex.dom.WXDomStatement#scrollToDom(String, JSONObject)
 */
void scrollTo(String ref, Map<String, Object> options) {
  WXComponent component = mRegistry.get(ref);
  if (component == null) {
    return;
  }

  float offsetFloat = 0;
  if (options != null) {
    String offset = options.get("offset") == null ? "0" : options.get("offset").toString();
    if (offset != null) {
      try {
        offsetFloat = WXViewUtils.getRealPxByWidth(Float.parseFloat(offset),mWXSDKInstance.getViewPortWidth());
      }catch (Exception e ){
         WXLogUtils.e("Float parseFloat error :"+e.getMessage());
      }
    }
  }

  Scrollable scroller = component.getParentScroller();
  if (scroller == null) {
    return;
  }
  scroller.scrollTo(component,(int)offsetFloat);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:28,代码来源:WXRenderStatement.java


示例3: loadConstructor

import com.taobao.weex.ui.component.WXComponent; //导入依赖的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;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:SimpleComponentHolder.java


示例4: loadConstructor

import com.taobao.weex.ui.component.WXComponent; //导入依赖的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


示例5: setHeaderView

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 *
 * @param refresh should be {@link WXRefreshView}
 */
public void setHeaderView(WXComponent refresh) {
    setRefreshEnable(true);
    if (swipeLayout != null) {
        if (swipeLayout.getHeaderView() != null) {
            swipeLayout.setRefreshHeight((int) refresh.getDomObject().getLayoutHeight());

            String colorStr = (String) refresh.getDomObject().getStyles().get(Constants.Name.BACKGROUND_COLOR);
            String bgColor = WXUtils.getString(colorStr, null);

            if (bgColor != null) {
                if (!TextUtils.isEmpty(bgColor)) {
                    int colorInt = WXResourceUtils.getColor(bgColor);
                    if (!(colorInt == Color.TRANSPARENT)) {
                        swipeLayout.setRefreshBgColor(colorInt);
                    }
                }
            }
            swipeLayout.getHeaderView().setRefreshView(refresh.getHostView());
        }
    }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:26,代码来源:BaseBounceView.java


示例6: addChild

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
@Override
public void addChild(WXComponent child, int index) {
  super.addChild(child, index);
  if (child == null || index < -1) {
    return;
  }
  setRefreshOrLoading(child);

  // Synchronize DomObject's attr to Component and Native View
  if(mDomObject != null && getHostView() != null && (mColumnWidth != mDomObject.getColumnWidth() ||
          mColumnCount != mDomObject.getColumnCount() ||
          mColumnGap != mDomObject.getColumnGap())) {
    updateRecyclerAttr();
    getHostView().getInnerView().initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:WXListComponent.java


示例7: createInstance

import com.taobao.weex.ui.component.WXComponent; //导入依赖的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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:19,代码来源:SimpleComponentHolder.java


示例8: setFooterView

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 *
 * @param loading should be {@link WXRefreshView}
 */
public void setFooterView(WXComponent loading) {
    setLoadmoreEnable(true);
    if (swipeLayout != null) {
        if (swipeLayout.getFooterView() != null) {
            swipeLayout.setLoadingHeight((int) loading.getDomObject().getLayoutHeight());

            String colorStr = (String) loading.getDomObject().getStyles().get(Constants.Name.BACKGROUND_COLOR);
            String bgColor = WXUtils.getString(colorStr, null);

            if (bgColor != null) {
                if (!TextUtils.isEmpty(bgColor)) {
                    int colorInt = WXResourceUtils.getColor(bgColor);
                    if (!(colorInt == Color.TRANSPARENT)) {
                        swipeLayout.setLoadingBgColor(colorInt);
                    }
                }
            }
            swipeLayout.getFooterView().setRefreshView(loading.getHostView());
        }
    }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:26,代码来源:BaseBounceView.java


示例9: createBody

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * create RootView ,every weex Instance View has a rootView;
 * @see com.taobao.weex.dom.WXDomStatement#createBody(JSONObject)
 */
void createBody(WXComponent component) {
  long start = System.currentTimeMillis();
  component.createView(mGodComponent, -1);
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
  }
  start = System.currentTimeMillis();
  component.applyLayoutAndEvent(component);
  component.bindData(component);

  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
  }

  if (component instanceof WXScroller) {
    WXScroller scroller = (WXScroller) component;
    if (scroller.getInnerView() instanceof ScrollView) {
      mWXSDKInstance.setRootScrollView((ScrollView) scroller.getInnerView());
    }
  }
  mWXSDKInstance.setRootView(mGodComponent.getRealView());
  if (mWXSDKInstance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
    mWXSDKInstance.onViewCreated(mGodComponent);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:30,代码来源:WXRenderStatement.java


示例10: createBodyOnDomThread

import com.taobao.weex.ui.component.WXComponent; //导入依赖的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;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:26,代码来源:WXRenderStatement.java


示例11: remove

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
@Override
public void remove(WXComponent child, boolean destroy) {
  int index = mChildren.indexOf(child);
  if (destroy) {
    child.detachViewAndClearPreInfo();
  }
  unBindViewType(child);

  BounceRecyclerView view = getHostView();
  if(view == null){
    return;
  }
  view.getAdapter().notifyItemRemoved(index);
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d(TAG, "removeChild child at " + index);
  }
  super.remove(child, destroy);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:WXListComponent.java


示例12: generateViewType

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * generate viewtype by component
 *
 * @param component
 * @return
 */
private int generateViewType(WXComponent component) {
  long id;
  try {
    id = Integer.parseInt(component.getDomObject().getRef());
    String type = component.getDomObject().getAttrs().getScope();

    if (!TextUtils.isEmpty(type)) {
      if (mRefToViewType == null) {
        mRefToViewType = new ArrayMap<>();
      }
      if (!mRefToViewType.containsKey(type)) {
        mRefToViewType.put(type, id);
      }
      id = mRefToViewType.get(type);

    }
  } catch (RuntimeException e) {
    WXLogUtils.eTag(TAG, e);
    id = RecyclerView.NO_ID;
    WXLogUtils.e(TAG, "getItemViewType: NO ID, this will crash the whole render system of WXListRecyclerView");
  }
  return (int) id;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:30,代码来源:BasicListComponent.java


示例13: bindViewType

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXListComponent.java


示例14: onNewIntent

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    if (intent == null) {
        return;
    }
    if (intent.getStringExtra("params") != null) {
        String params = intent.getStringExtra("params");
        String backTag = intent.getStringExtra("backTag");
        if (!TextUtils.isEmpty(params)) {
            WXComponent comp = mInstance.getRootComponent();
            if (comp != null) {
                WXEvent events = comp.getDomObject().getEvents();
                boolean hasActive = events.contains(UConstants.Event.ACTIVED);
                if (hasActive) {
                    Map<String, Object> data = new HashMap<>();
                    data.put("param", params);
                    data.put("tagCode", backTag);
                    WXBridgeManager.getInstance().fireEvent(mInstance.getInstanceId(), comp.getRef(), UConstants.Event.ACTIVED, data, null);
                }
            }
        }
    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:26,代码来源:UWXFrameBaseActivity.java


示例15: onViewCreated

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
@Override
    public void onViewCreated(WXSDKInstance wxsdkInstance, View view) {
        super.onViewCreated(wxsdkInstance, view);
        WXComponent comp = mInstance.getRootComponent();
        if (comp != null) {
            WXEvent events = comp.getDomObject().getEvents();
            boolean hasReady = events.contains(UConstants.Event.READY);
            if (hasReady) {
                Map<String, Object> data = new HashMap<>();
                data.put("param", wxInfo.getParam());
                WXBridgeManager.getInstance().fireEvent(mInstance.getInstanceId(), comp.getRef(), UConstants.Event.READY, data, null);
            }
        }
//        if (!isHasNavBar) {
//            setTranslateAnimation(getContainer());
//        }
    }
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:UWXFrameBaseActivity.java


示例16: bindStickStyle

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
public void bindStickStyle(WXComponent component, Map<String, Map<String, WXComponent>> mStickyMap) {
    Scrollable scroller = component.getParentScroller();
    if (scroller == null) {
        return;
    }
    Map<String, WXComponent> stickyMap = mStickyMap.get(scroller
            .getRef());
    if (stickyMap == null) {
        stickyMap = new ConcurrentHashMap<>();
    }
    if (stickyMap.containsKey(component.getRef())) {
        return;
    }
    stickyMap.put(component.getRef(), component);
    mStickyMap.put(scroller.getRef(), stickyMap);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:WXStickyHelper.java


示例17: removeSticky

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * remove top stickyView
 * @param component
 */
private void removeSticky(WXComponent component) {
  final WXCell headComponent = headComponentStack.pop();
  if (!component.getRef().equals(headComponent.getRef())) {
    headComponentStack.push(headComponent);
    return;
  }
  final View headerView = headerViewStack.pop();
  final ViewGroup parent = (ViewGroup) getParent();
  if(parent != null){
    parent.post(WXThread.secure(new Runnable() {
      @Override
      public void run() {
        parent.removeView(headerView);
        headComponent.recoverySticky();
      }
    }));
  }

}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:24,代码来源:BounceRecyclerView.java


示例18: bindViewType

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:21,代码来源:BasicListComponent.java


示例19: setHeaderView

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
/**
 *
 * @param refresh should be {@link WXRefreshView}
 */
public void setHeaderView(WXComponent refresh) {
    setRefreshEnable(true);
    if (swipeLayout != null) {
        WXRefreshView refreshView = swipeLayout.getHeaderView();
        if (refreshView != null) {
            ImmutableDomObject immutableDomObject = refresh.getDomObject();
            if (immutableDomObject != null) {
                int refreshHeight = (int) immutableDomObject.getLayoutHeight();
                swipeLayout.setRefreshHeight(refreshHeight);
                String colorStr = (String) immutableDomObject.getStyles().get(Constants.Name.BACKGROUND_COLOR);
                String bgColor = WXUtils.getString(colorStr, null);
                if (bgColor != null) {
                    if (!TextUtils.isEmpty(bgColor)) {
                        int colorInt = WXResourceUtils.getColor(bgColor);
                        if (!(colorInt == Color.TRANSPARENT)) {
                            swipeLayout.setRefreshBgColor(colorInt);
                        }
                    }
                }
                refreshView.setRefreshView(refresh.getHostView());
            }
        }
    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:29,代码来源:BaseBounceView.java


示例20: executeRender

import com.taobao.weex.ui.component.WXComponent; //导入依赖的package包/类
@Override
public void executeRender(RenderActionContext context) {
  WXComponent comp = context.getComponent(mRef);
  if(comp != null){
    //sync dom change to component
    comp.updateDom(mUpdatedDomObject);
    comp.removeEvent(mEvent);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:10,代码来源:RemoveEventAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Kind类代码示例发布时间:2022-05-22
下一篇:
Java BooleanSubscription类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap