Package org.zkoss.zk.ui.metainfo

Examples of org.zkoss.zk.ui.metainfo.ComponentDefinition


  }
  public ComponentDefinitionMap getComponentDefinitionMap() {
    return _compdefs;
  }
  public ComponentDefinition getComponentDefinition(String name, boolean recurse) {
    final ComponentDefinition compdef = _compdefs.get(name);
    if (!recurse || compdef != null)
      return compdef;

    try {
      return _langdef.getComponentDefinition(name);
View Full Code Here


    } catch (DefinitionNotFoundException ex) {
    }
    return null;
  }
  public ComponentDefinition getComponentDefinition(Class cls, boolean recurse) {
    final ComponentDefinition compdef = _compdefs.get(cls);
    if (!recurse || compdef != null)
      return compdef;

    try {
      return _langdef.getComponentDefinition(cls);
View Full Code Here

    if (exec != null) {
      final ExecutionCtrl execCtrl = (ExecutionCtrl)exec;
      final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
      final Page page = execCtrl.getCurrentPage();

      final ComponentDefinition compdef =
        pgdef != null ? pgdef.getComponentDefinition(cls, true):
        page != null ?   page.getComponentDefinition(cls, true): null;
      if (compdef != null && compdef.getLanguageDefinition() != null)
        return compdef; //already from langdef (not from pgdef)

      final ComponentDefinition compdef2 =
        Components.getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), cls);
      return compdef != null && (compdef2 == null ||
      !Objects.equals(compdef.getImplementationClass(), compdef2.getImplementationClass())) ?
        compdef: compdef2; //Feature 2816083: use compdef2 if same class
    }

    for (Iterator it = LanguageDefinition.getDeviceTypes().iterator(); it.hasNext();) {
      final ComponentDefinition compdef =
        Components.getDefinitionByDeviceType((String)it.next(), cls);
      if (compdef != null)
        return compdef;
    }
    return null;
View Full Code Here

  getDefinitionByDeviceType(String deviceType, String name) {
    for (Iterator it = LanguageDefinition.getByDeviceType(deviceType).iterator();
    it.hasNext();) {
      final LanguageDefinition ld = (LanguageDefinition)it.next();
      try {
        final ComponentDefinition def = ld.getComponentDefinition(name);
        if (def.isInstance(this))
          return def;
      } catch (DefinitionNotFoundException ex) { //ignore
      }
    }
    return null;
View Full Code Here

    if (exec != null) {
      final ExecutionCtrl execCtrl = (ExecutionCtrl)exec;
      final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
      final Page page = execCtrl.getCurrentPage();

      ComponentDefinition compdef =
        pgdef != null ? pgdef.getComponentDefinition(name, true):
        page != null ?   page.getComponentDefinition(name, true): null;
      if (compdef == null)
        compdef = getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), name);
      if (compdef != null) {
        setDefinition(compdef);
        return;
      }
    } else {
      for (Iterator it = LanguageDefinition.getDeviceTypes().iterator(); it.hasNext();) {
        final ComponentDefinition compdef =
          getDefinitionByDeviceType((String)it.next(), name);
        if (compdef != null) {
          setDefinition(compdef);
          return;
        }
View Full Code Here

    if (exec != null) {
      final ExecutionCtrl execCtrl = (ExecutionCtrl)exec;
      final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
      final Page page = execCtrl.getCurrentPage();

      final ComponentDefinition compdef =
        pgdef != null ? pgdef.getComponentDefinition(cls, true):
        page != null ?   page.getComponentDefinition(cls, true): null;
      if (compdef != null && compdef.getLanguageDefinition() != null)
        return compdef; //already from langdef (not from pgdef)

      final ComponentDefinition compdef2 =
        Components.getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), cls);
      return compdef != null && (compdef2 == null ||
      !Objects.equals(compdef.getImplementationClass(), compdef2.getImplementationClass())) ?
        compdef: compdef2; //Feature 2816083: use compdef2 if same class
    }

    for (Iterator it = LanguageDefinition.getDeviceTypes().iterator(); it.hasNext();) {
      final ComponentDefinition compdef =
        Components.getDefinitionByDeviceType((String)it.next(), cls);
      if (compdef != null)
        return compdef;
    }
    return null;
View Full Code Here

  getDefinitionByDeviceType(String deviceType, String name) {
    for (Iterator it = LanguageDefinition.getByDeviceType(deviceType).iterator();
    it.hasNext();) {
      final LanguageDefinition ld = (LanguageDefinition)it.next();
      try {
        final ComponentDefinition def = ld.getComponentDefinition(name);
        if (def.isInstance(this))
          return def;
      } catch (DefinitionNotFoundException ex) { //ignore
      }
    }
    return null;
View Full Code Here

    if (exec != null) {
      final ExecutionCtrl execCtrl = (ExecutionCtrl)exec;
      final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
      final Page page = execCtrl.getCurrentPage();

      ComponentDefinition compdef =
        pgdef != null ? pgdef.getComponentDefinition(name, true):
        page != null ?   page.getComponentDefinition(name, true): null;
      if (compdef == null)
        compdef = getDefinitionByDeviceType(exec.getDesktop().getDeviceType(), name);
      if (compdef != null) {
        setDefinition(compdef);
        return;
      }
    } else {
      for (Iterator it = LanguageDefinition.getDeviceTypes().iterator(); it.hasNext();) {
        final ComponentDefinition compdef =
          getDefinitionByDeviceType((String)it.next(), name);
        if (compdef != null) {
          setDefinition(compdef);
          return;
        }
View Full Code Here

      .append("zk.wgt.WidgetInfo.register([");

    boolean first = true;
    for (Iterator it = LanguageDefinition.lookup(lang)
    .getComponentDefinitions().iterator(); it.hasNext();) {
      final ComponentDefinition compdef = (ComponentDefinition)it.next();
      for (Iterator e = compdef.getMoldNames().iterator(); e.hasNext();) {
        final String mold = (String)e.next();
        final String wgtcls = compdef.getWidgetClass(null, mold);
        if (wgtcls != null) {
          if (first) first = false;
          else sb.append(',');
          sb.append('\'').append(wgtcls).append('\'');
        }
View Full Code Here

  public void setAsText(String text) {
    if (text.indexOf('.') < 0 && Character.isLowerCase(text.charAt(0))) {
      final Execution exec = Executions.getCurrent();
      if (exec != null) {
        final Page page = ((ExecutionCtrl)exec).getCurrentPage();
        final ComponentDefinition cd = page.getComponentDefinition(text, true);
        if (cd != null) {
          setAsText0(cd);
          return;
        }
      } else {
        final int j = text.indexOf(':');
        if (j >= 0) {
          final String ext = text.substring(0, j);
          final LanguageDefinition ld = LanguageDefinition.getByExtension(ext);
          final ComponentDefinition cd = ld.getComponentDefinitionIfAny(text.substring(j+1));
          if (cd != null) {
            setAsText0(cd);
            return;
          }
        } else {
          //TODO: search in user specified extention order?
          final List langds = LanguageDefinition.getAll();
          for (final Iterator it = langds.iterator(); it.hasNext();) {
            final LanguageDefinition ld = (LanguageDefinition) it.next();
            final ComponentDefinition cd = ld.getComponentDefinitionIfAny(text);
            if (cd != null) {
              setAsText0(cd);
              return;
            }
          }
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.metainfo.ComponentDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.