Package org.zkoss.zk.ui.metainfo

Examples of org.zkoss.zk.ui.metainfo.LanguageDefinition$LabelTemplate


    final Configuration config = wapp.getConfiguration();
    final Set disabled = config.getDisabledThemeURIs();
    final List sses = new LinkedList(); //a list of StyleSheet
    for (Iterator it = LanguageDefinition.getByDeviceType(deviceType).iterator();
    it.hasNext();) {
      final LanguageDefinition langdef = (LanguageDefinition)it.next();
      for (Iterator e = langdef.getStyleSheets().iterator(); e.hasNext();) {
        final StyleSheet ss = (StyleSheet)e.next();
        if (!disabled.contains(ss.getHref()))
          sses.add(ss);
      }
    }
View Full Code Here


    if (name.length() == 0)
      throw new UiException("The name attribute must be specified, "+root.getLocator()+", "+path);
    final boolean zk = "zk".equals(name),
      aaas = "zk.aaas".equals(name);
    final String lang = root.getAttributeValue("language");
    final LanguageDefinition langdef = //optional
      lang != null ? LanguageDefinition.lookup(lang): null;
    final String dir = path.substring(0, path.lastIndexOf('/') + 1);
    final boolean cacheable = !"false".equals(root.getAttributeValue("cacheable"));

    final WpdContent wc =
      zk || aaas || !cacheable || isWpdContentRequired(root) ?
        new WpdContent(dir, zk, cacheable): null;

    final Provider provider = getProvider();
    final ByteArrayOutputStream out = new ByteArrayOutputStream(1024*16);
    String depends = null;
    if (zk) {
      write(out, "if(!window.zk){\n");
          //may be loaded multiple times because specified in lang.xml
    } else if (!aaas) {
      depends = root.getAttributeValue("depends");
      if (depends != null && depends.length() == 0)
        depends = null;
      if (depends != null) {
        write(out, "zk.load('");
        write(out, depends);
        write(out, "',");
      } else
        write(out, '(');
      write(out, "function(){if(zk._p=zkpi('");
      write(out, name);
      write(out, '\'');
      if (provider != null && provider.getResource(dir + "wv/zk.wpd") != null)
        write(out, ",true");
      write(out, "))try{\n");
    }

    final Map moldInfos = new HashMap();
    for (Iterator it = root.getElements().iterator(); it.hasNext();) {
      final Element el = (Element)it.next();
      final String elnm = el.getName();
      if ("widget".equals(elnm)) {
        final String wgtnm = IDOMs.getRequiredAttributeValue(el, "name");
        final String jspath = wgtnm + ".js"; //eg: /js/zul/wgt/Div.js
        if (!writeResource(out, jspath, dir, false)) {
          log.error("Widget "+wgtnm+": "+jspath+" not found, "+el.getLocator()+", "+path);
          continue;
        }

        final String wgtflnm = name + "." + wgtnm;
        write(out, "zkreg('");
        write(out, wgtflnm);
        write(out, '\'');
        WidgetDefinition wgtdef = langdef != null ? langdef.getWidgetDefinitionIfAny(wgtflnm): null;
        if (wgtdef != null && wgtdef.isBlankPreserved())
          write(out, ",true");
        write(out, ");");
        if (wgtdef == null)
          continue;
View Full Code Here

      sb.append("','','");

    sb.append("',{");
    for (Iterator it = LanguageDefinition.getByDeviceType("ajax").iterator();
    it.hasNext();) {
      final LanguageDefinition langdef = (LanguageDefinition)it.next();
      for (Iterator e = langdef.getJavaScriptModules().entrySet().iterator();
      e.hasNext();) {
        final Map.Entry me = (Map.Entry)e.next();
        sb.append('\'').append(me.getKey())
          .append("':'").append(me.getValue()).append("',");
      }
View Full Code Here

  }
  private ComponentDefinition
  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
      }
    }
View Full Code Here

    //write definition
    if (_def == ComponentsCtrl.DUMMY) {
      s.writeObject(null);
    } else {
      LanguageDefinition langdef = _def.getLanguageDefinition();
      if (langdef != null) {
        s.writeObject(langdef.getName());
        s.writeObject(_def.getName());
      } else {
        s.writeObject(_def);
      }
    }
View Full Code Here

    s.defaultReadObject();

    //read definition
    Object def = s.readObject();
    if (def instanceof String) {
      LanguageDefinition langdef = null;
      try {
        langdef = LanguageDefinition.lookup((String)def);
      } catch (DefinitionNotFoundException ex) {
      }
      if (langdef != null) {
        _def = langdef.getComponentDefinitionIfAny((String)s.readObject());
        //don't throw exception since some might not be associated
        //with a definition (e.g., JSP's native and page components)
      } else {
        s.readObject(); //ignore the component name
        _def = null;
View Full Code Here

    final Component p = getParent();
    return p == null || !isVisible()
      || getId().length() > 0 || !isRawLabel(p);
  }
  private static boolean isRawLabel(Component comp) {
    final LanguageDefinition langdef =
      comp.getDefinition().getLanguageDefinition();
    return langdef != null && langdef.isRawLabel();
  }
View Full Code Here

    //FUTURE: Extendlet can be specified in zk.xml
    //Note: getAll loads config.xml, which must be processed before zk.xml
    ZumlExtendlet extlet = null;
    for (Iterator it = LanguageDefinition.getAll().iterator();
    it.hasNext();) {
      final LanguageDefinition langdef = (LanguageDefinition)it.next();
      final List exts = langdef.getExtensions();
      if (!exts.isEmpty()) {
        if (extlet == null)
          extlet = new ZumlExtendlet();
        _cwr.addExtendlet((String)exts.get(0), extlet);
        //Add to the first extension only (the main one)
View Full Code Here

      ^ _wapp.getBuild().hashCode()
      ^ WebApps.getEdition().hashCode();

    for (Iterator it = LanguageDefinition.getAll().iterator();
    it.hasNext();) {
      final LanguageDefinition langdef = (LanguageDefinition)it.next();
      for (Iterator e = langdef.getJavaScriptModules().entrySet().iterator();
      e.hasNext();) {
        final Map.Entry me = (Map.Entry)e.next();
        code ^= Objects.hashCode(me.getKey())
          + Objects.hashCode(me.getValue());
      }
      for (Iterator e = langdef.getMergeJavaScriptPackages().iterator();
      e.hasNext();) {
        code ^= Objects.hashCode(e.next());
      }
    }
View Full Code Here

  public Component getComponentByUuidIfAny(String uuid) {
    return (Component)_comps.get(uuid);
  }
  public void addComponent(Component comp) {
    //to avoid misuse, check whether new comp belongs to the same device type
    final LanguageDefinition langdef =
      comp.getDefinition().getLanguageDefinition();
    if (langdef != null && !_devType.equals(langdef.getDeviceType()))
      throw new UiException("Component, "+comp+", does not belong to the same device type of the desktop, "+_devType);
    final String uuid = comp.getUuid();
    final Object old = _comps.put(uuid, comp);
    if (old != comp && old != null) {
      _comps.put(uuid, old); //recover
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.metainfo.LanguageDefinition$LabelTemplate

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.