Package org.zkoss.idom

Examples of org.zkoss.idom.Attribute


      String ifc = null, unless = null,
        forEach = null, forEachBegin = null, forEachEnd = null;
      AnnotationHelper attrAnnHelper = null;
      for (Iterator it = el.getAttributeItems().iterator();
      it.hasNext();) {
        final Attribute attr = (Attribute)it.next();
        final Namespace attrns = attr.getNamespace();
        final String attURI = attrns != null ? attrns.getURI(): "";
        final String attnm = attr.getLocalName();
        final String attval = attr.getValue();
        if (LanguageDefinition.ANNO_NAMESPACE.equals(attURI)
        || "annotation".equals(attURI)) {
          if (bzk) warnWrongZkAttr(attr);
          else {
            if (attrAnnHelper == null)
              attrAnnHelper = new AnnotationHelper();
            attrAnnHelper.addByRawValue(attnm, attval);
          }
        } else if ("apply".equals(attnm) && isZkAttr(langdef, attrns)) {
          if (bzk) warnWrongZkAttr(attr);
          else compInfo.setApply(attval);
        } else if ("forward".equals(attnm) && isZkAttr(langdef, attrns)) {
          if (bzk) warnWrongZkAttr(attr);
          else compInfo.setForward(attval);
        } else if ("if".equals(attnm) && isZkAttr(langdef, attrns)) {
          ifc = attval;
        } else if ("unless".equals(attnm) && isZkAttr(langdef, attrns)) {
          unless = attval;
        } else if ("forEach".equals(attnm) && isZkAttr(langdef, attrns)) {
          forEach = attval;
        } else if ("forEachBegin".equals(attnm) && isZkAttr(langdef, attrns)) {
          forEachBegin = attval;
        } else if ("forEachEnd".equals(attnm) && isZkAttr(langdef, attrns)) {
          forEachEnd = attval;
        } else if ("fulfill".equals(attnm) && isZkAttr(langdef, attrns)) {
          if (bzk) warnWrongZkAttr(attr);
          else compInfo.setFulfill(attval);
        } else if (bzk) {
          if ("switch".equals(attnm) || "choose".equals(attnm)) {
            if (isZkSwitch(parent))
              throw new UiException("<zk "+attnm+"> cannot be used in <zk switch/choose>, "+el.getLocator());
            ((ZkInfo)compInfo).setSwitch(attval);
          } else if ("case".equals(attnm)) {
            if (!isZkSwitch(parent))
              throw new UiException("<zk case> can be used only in <zk switch>, "+attr.getLocator());
            ((ZkInfo)compInfo).setCase(attval);
          } else if ("when".equals(attnm)) {
            ifc = attval;
          } else {
            final String attPref = attrns != null ? attrns.getPrefix(): null;
            if (!"xmlns".equals(attnm) && !"xml".equals(attnm)
            && attURI.indexOf("w3.org") < 0
            && (attPref == null
             || (!"xmlns".equals(attPref) && !"xml".equals(attPref))))
              warnWrongZkAttr(attr);
          }
        } else if (!("use".equals(attnm) && isZkAttr(langdef, attrns))) {
          final String attPref = attrns != null ? attrns.getPrefix(): "";
          if (!"xmlns".equals(attPref)
          && !("xmlns".equals(attnm) && "".equals(attPref))
          && !"http://www.w3.org/2001/XMLSchema-instance".equals(attURI)) {
            if (isAttrAnnot(attval)) { //annotation
              if (attrAnnHelper == null)
                attrAnnHelper = new AnnotationHelper();
              applyAttrAnnot(attrAnnHelper, compInfo, attnm, attval, true);
            } else {
              addAttribute(compInfo, attrns, attnm, attval, null,
                attr.getLocator());
              if (attrAnnHelper != null)
                attrAnnHelper.applyAnnotations(compInfo, attnm, true);
            }
          }
        }
View Full Code Here


      if (it.next() instanceof Element) {
        bNativeContent = true;
        break;
      }

    final Attribute attr = el.getAttributeItem(null, "name", 0); //by local name
    if (attr == null)
      throw new UiException("The name attribute required, "+el.getLocator());

    final String attnm = attr.getValue();
    noEmpty("name", attnm, el);
    final ConditionImpl cond = ConditionImpl.getInstance(
        el.getAttributeValue("if"), el.getAttributeValue("unless"));
    if (bNativeContent) {
      if (Events.isValid(attnm))
        throw new UiException("Event listeners not support native content");

      final NativeInfo nativeInfo = new NativeInfo(
        parent.getEvaluatorRef(),
        pgdef.getLanguageDefinition().getNativeDefinition(), "");
      parse(pgdef, nativeInfo, el.getChildren(), annHelper, true);
      parent.addProperty(attnm, nativeInfo, cond);
    } else {
      final String trim = el.getAttributeValue("trim");
      noEL("trim", trim, el);
      final String attval = el.getText(trim != null && "true".equals(trim));
      addAttribute(parent, attr.getNamespace(), attnm, attval, cond,
        el.getLocator());
    }

    annHelper.applyAnnotations(parent, attnm, true);
  }
View Full Code Here

    String ifc = null, unless = null, scope = null, composite = null;
    final Map attrs = new HashMap();
    AnnotationHelper attrAnnHelper = null;
    for (Iterator it = el.getAttributeItems().iterator();
    it.hasNext();) {
      final Attribute attr = (Attribute)it.next();
      final Namespace attrns = attr.getNamespace();
      final String attnm = attr.getLocalName();
      final String attval = attr.getValue();
      if ("if".equals(attnm) && isZkElementAttr(langdef, attrns)) {
        ifc = attval;
      } else if ("unless".equals(attnm) && isZkElementAttr(langdef, attrns)) {
        unless = attval;
      } else if ("scope".equals(attnm) && isZkElementAttr(langdef, attrns)) {
View Full Code Here

    String ifc = null, unless = null, composite = null;
    boolean local = false;
    final Map vars = new HashMap();
    for (Iterator it = el.getAttributeItems().iterator();
    it.hasNext();) {
      final Attribute attr = (Attribute)it.next();
      final Namespace attrns = attr.getNamespace();
      final String attnm = attr.getLocalName();
      final String attval = attr.getValue();
      if ("if".equals(attnm) && isZkElementAttr(langdef, attrns)) {
        ifc = attval;
      } else if ("unless".equals(attnm) && isZkElementAttr(langdef, attrns)) {
        unless = attval;
      } else if ("local".equals(attnm) && isZkElementAttr(langdef, attrns)) {
View Full Code Here

      throw new UiException("Child elements are not allowed for the annotations, "+el.getLocator());

    final Map attrs = new HashMap();
    for (Iterator it = el.getAttributeItems().iterator();
    it.hasNext();) {
      final Attribute attr = (Attribute)it.next();
      attrs.put(attr.getLocalName(), attr.getValue());
    }
    annHelper.add(el.getLocalName(), attrs);
  }
View Full Code Here

    for (Iterator it = root.getElements("zscript").iterator();
    it.hasNext();) {
      final Element el = (Element)it.next();
      final String zslang;
      final Attribute attr = el.getAttributeItem("language");
      if (attr == null) {
        zslang = "Java";
      } else {
        zslang = attr.getValue();
        if (zslang == null || zslang.length() == 0)
          throw new UiException("The language attribute cannot be empty, "+attr.getLocator());
      }
      final String s = el.getText(true);
      final String eachTime = el.getAttributeValue("each-time");
      if ("true".equals(eachTime))
        langdef.addEachTimeScript(zslang, s);
View Full Code Here

TOP

Related Classes of org.zkoss.idom.Attribute

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.