com.taobao.weex.ui.WXComponentRegistry Java Examples

The following examples show how to use com.taobao.weex.ui.WXComponentRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXSDKEngine.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static boolean registerComponent(IFComponentHolder holder, boolean appendTree, String ... names) throws WXException {
  boolean result =  true;
  for(String name:names) {
    Map<String, Object> componentInfo = new HashMap<>();
    if (appendTree) {
      componentInfo.put("append", "tree");
    }
    result  = result && WXComponentRegistry.registerComponent(name, holder, componentInfo);
  }
  return result;
}
 
Example #2
Source File: WXSDKEngine.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static boolean registerComponent(Map<String, Object> componentInfo, Class<? extends WXComponent> clazz) throws WXException {
  if(componentInfo == null){
    return false;
  }
  String type = (String)componentInfo.get("type");
  if(TextUtils.isEmpty(type)){
    return false;
  }
  return WXComponentRegistry.registerComponent(type,new SimpleComponentHolder(clazz), componentInfo);
}
 
Example #3
Source File: WXSDKEngine.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public static void reload(final Context context,String framework, boolean remoteDebug) {
  WXEnvironment.sRemoteDebugMode = remoteDebug;
  WXBridgeManager.getInstance().restart();
  WXBridgeManager.getInstance().initScriptsFramework(framework);
  WXModuleManager.reload();
  WXComponentRegistry.reload();
  WXSDKManager.getInstance().postOnUiThread(new Runnable() {
    @Override
    public void run() {
      LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(JS_FRAMEWORK_RELOAD));
    }
  }, 1000);
}
 
Example #4
Source File: WXSDKEngine.java    From weex-uikit with MIT License 5 votes vote down vote up
public static boolean registerComponent(IFComponentHolder holder, boolean appendTree, String ... names) throws WXException {
  boolean result =  true;
  for(String name:names) {
    Map<String, Object> componentInfo = new HashMap<>();
    if (appendTree) {
      componentInfo.put("append", "tree");
    }
    result  = result && WXComponentRegistry.registerComponent(name, holder, componentInfo);
  }
  return result;
}
 
Example #5
Source File: WXSDKEngine.java    From weex-uikit with MIT License 5 votes vote down vote up
public static boolean registerComponent(Map<String, Object> componentInfo, Class<? extends WXComponent> clazz) throws WXException {
  if(componentInfo == null){
    return false;
  }
  String type = (String)componentInfo.get("type");
  if(TextUtils.isEmpty(type)){
    return false;
  }
  return WXComponentRegistry.registerComponent(type,new SimpleComponentHolder(clazz), componentInfo);
}
 
Example #6
Source File: WXSDKEngine.java    From weex-uikit with MIT License 5 votes vote down vote up
public static void reload(final Context context,String framework, boolean remoteDebug) {
  WXEnvironment.sRemoteDebugMode = remoteDebug;
  WXBridgeManager.getInstance().restart();
  WXBridgeManager.getInstance().initScriptsFramework(framework);
  WXModuleManager.reload();
  WXComponentRegistry.reload();
  WXSDKManager.getInstance().postOnUiThread(new Runnable() {
    @Override
    public void run() {
      LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent(JS_FRAMEWORK_RELOAD));
    }
  });
}
 
Example #7
Source File: WXSDKEngine.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
public static boolean registerComponent(String type, Class<? extends WXComponent> clazz) throws WXException {
  return WXComponentRegistry.registerComponent(type, new SimpleComponentHolder(clazz),new HashMap<String, Object>());
}
 
Example #8
Source File: WXSDKEngine.java    From weex-uikit with MIT License 4 votes vote down vote up
public static boolean registerComponent(String type, Class<? extends WXComponent> clazz) throws WXException {
  return WXComponentRegistry.registerComponent(type, new SimpleComponentHolder(clazz),new HashMap<String, Object>());
}
 
Example #9
Source File: WXSDKEngine.java    From weex with Apache License 2.0 4 votes vote down vote up
public static boolean registerComponent(String type, Class<? extends WXComponent> clazz) throws WXException {
  return WXComponentRegistry.registerComponent(type, clazz, true);
}
 
Example #10
Source File: WXSDKEngine.java    From weex with Apache License 2.0 4 votes vote down vote up
public static boolean registerComponent(Map<String, String> componentInfo, Class<? extends WXComponent> clazz) throws WXException {
  return WXComponentRegistry.registerComponent(componentInfo, clazz);
}
 
Example #11
Source File: WXSDKEngine.java    From weex with Apache License 2.0 3 votes vote down vote up
/**
 *
 * Register component. The registration is singleton in {@link WXSDKEngine} level
 * @param clazz the class of the {@link WXComponent} to be registered.
 * @param appendTree true for appendTree flag
 * @return true for registration success, false for otherwise.
 * @param names names(alias) of component. Same as type filed in the JS.
 * @throws WXException Throws exception if type conflicts.
 */
public static boolean registerComponent(Class<? extends WXComponent> clazz, boolean appendTree,String ... names) throws WXException {
  boolean result =  true;
  for(String name:names) {
    result  = result && WXComponentRegistry.registerComponent(name, clazz, appendTree);
  }
  return result;
}