Examples of TagLibTagAttr


Examples of railo.transformer.library.tag.TagLibTagAttr

    tag.setTagLibTag(tlt);
   
    comments(data);
   
    // attribute
    TagLibTagAttr attr = tlt.getScript().getSingleAttr();
    String attrName=null;
    Expression attrValue=null;
    short attrType=ATTR_TYPE_NONE;
    if(attr!=null){
      attrType = attr.getScriptSupport();
      char c = data.cfml.getCurrent();
      if(ATTR_TYPE_REQUIRED==attrType || (!data.cfml.isCurrent(';') && ATTR_TYPE_OPTIONAL==attrType)) {
        attrValue =attributeValue(data, tlt.getScript().getRtexpr());
        if(attrValue!=null && isOperator(c)) {
          data.cfml.setPos(pos);
          return null;
        }
      }
    }
   
    if(attrValue!=null){
      attrName=attr.getName();
      TagLibTagAttr tlta = tlt.getAttribute(attr.getName());
      tag.addAttribute(new Attribute(false,attrName,CastOther.toExpression(attrValue,tlta.getType()),tlta.getType()));
    }
    else if(ATTR_TYPE_REQUIRED==attrType){
      data.cfml.setPos(pos);
      return null;
    }
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

      if(type==TagLibTag.ATTRIBUTE_TYPE_FIXED || type==TagLibTag.ATTRIBUTE_TYPE_MIXED)  {
        Map<String, TagLibTagAttr> hash = tlt.getAttributes();
        Iterator<String> it = hash.keySet().iterator();
       
        while(it.hasNext())  {
          TagLibTagAttr att=hash.get(it.next());
          if(att.isRequired() && !contains(attrs,att.getName()) && att.getDefaultValue()==null && !att.getName().equals(ignoreAttrReqFor))  {
            if(!hasAttributeCollection)throw new TemplateException(data.cfml,"attribute "+att.getName()+" is required for statement "+tlt.getName());
            if(tag!=null)tag.addMissingAttribute(att.getName(),att.getType());
          }
        }
      }
    }
    return attrs.toArray(new Attribute[attrs.size()]);
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

      }   
      CFMLTransformer.comment(data.cfml,true);
     
     
      // Type
      TagLibTagAttr tlta=null;
    if(tlt!=null){
      tlta = tlt.getAttribute(name);
    }
    return new Attribute(dynamic.toBooleanValue(),name,tlta!=null?CastOther.toExpression(value, tlta.getType()):value,sbType.toString());
    }
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

    if("attributecollection".equals(id)){
      dynamic.setValue(tag.getAttribute(id)==null);
      sbType.append("struct");
    }
    else if(typeDef==TagLibTag.ATTRIBUTE_TYPE_FIXED || typeDef==TagLibTag.ATTRIBUTE_TYPE_MIXED) {
      TagLibTagAttr attr=tag.getAttribute(id);
      if(attr==null) {
        if(typeDef==TagLibTag.ATTRIBUTE_TYPE_FIXED) {
          String names=tag.getAttributeNames();
          if(StringUtil.isEmpty(names))
            throw new TemplateException(cfml,"Attribute "+id+" is not allowed for tag "+tag.getFullName());
         
          throw new TemplateException(cfml,
            "Attribute "+id+" is not allowed for statement "+tag.getName(),
            "valid attribute names are ["+names+"]");
        }
        dynamic.setValue(true);
       
      }
      else {
        sbType.append(attr.getType());
        //parseExpression[0]=attr.getRtexpr();
      }
    }
    else if(typeDef==TagLibTag.ATTRIBUTE_TYPE_DYNAMIC){
      dynamic.setValue(true);
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

   
    if(tag.getAttributeType()==TagLibTag.ATTRIBUTE_TYPE_FIXED || tag.getAttributeType()==TagLibTag.ATTRIBUTE_TYPE_MIXED){
      Iterator<Entry<String, TagLibTagAttr>> it = tag.getAttributes().entrySet().iterator();
      int count=0;
      Collection.Key key;
      TagLibTagAttr attr;
      Object value;
      Entry<String, TagLibTagAttr> entry;
      // check existing attributes
      while(it.hasNext()){
        entry = it.next();
        count++;
        key=KeyImpl.toKey(entry.getKey(),null);
        attr=entry.getValue();
        value=attributesScope.get(key,null);
        if(value==null){
          if(attr.getDefaultValue()!=null){
            value=attr.getDefaultValue();
            attributesScope.setEL(key, value);
          }
          else if(attr.isRequired())
            throw new ApplicationException("attribute ["+key.getString()+"] is required for tag ["+tagName+"]");
        }
        if(value!=null) {
          if(!Decision.isCastableTo(attr.getType(),value,true,true,-1))
            throw new CasterException(createMessage(attr.getType(), value));
       
        }
      }
     
      // check if there are attributes not supported
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

      Struct attributes=Caster.toStruct(meta.get(KeyConstants._ATTRIBUTES,null),null,false);
      if(attributes!=null) {
        Iterator<Entry<Key, Object>> it = attributes.entryIterator();
        //Iterator it = attributes.entrySet().iterator();
        Entry<Key, Object> entry;
        TagLibTagAttr attr;
        Struct sct;
        String name;
        Object defaultValue;
        while(it.hasNext()){
          entry=it.next();
          name=Caster.toString(entry.getKey(),null);
          if(StringUtil.isEmpty(name)) continue;
          attr=new TagLibTagAttr(tag);
          attr.setName(name);
         
          sct=Caster.toStruct(entry.getValue(),null,false);
          if(sct!=null){
            attr.setRequired(Caster.toBooleanValue(sct.get(KeyConstants._required,Boolean.FALSE),false));
            attr.setType(Caster.toString(sct.get(KeyConstants._type,"any"),"any"));
           
            defaultValue= sct.get(KeyConstants._default,null);
            if(defaultValue!=null)attr.setDefaultValue(defaultValue);
           
           
            if(!runtime){
              attr.setDescription(Caster.toString(sct.get(KeyConstants._hint,null),null));
              attr.setRtexpr(Caster.toBooleanValue(sct.get(RT_EXPR_VALUE,Boolean.TRUE),true));
            }
          }
          tag.setAttribute(attr);
         
        }
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

        return;
      }
      PageContext orgPC = ThreadLocalPageContext.get();
      ThreadLocalPageContext.register(pc);
        try{
        TagLibTagAttr attrFileName,attrIsWeb;
          String filename;
        Boolean isWeb;
        TagLibTag tlt;
       
        TagLib[] tlds = cw.getTLDs();
        for(int i=0;i<tlds.length;i++){
          Map<String, TagLibTag> tags = tlds[i].getTags();
          Iterator<TagLibTag> it = tags.values().iterator();
          while(it.hasNext()){
            tlt = it.next();
            if("railo.runtime.tag.CFTagCore".equals(tlt.getTagClassName())) {
              attrFileName = tlt.getAttribute("__filename");
              attrIsWeb = tlt.getAttribute("__isweb");
              if(attrFileName!=null && attrIsWeb!=null) {
                filename = Caster.toString(attrFileName.getDefaultValue(),null);
                isWeb=Caster.toBoolean(attrIsWeb.getDefaultValue(),null);
                if(filename!=null && isWeb!=null) {
                  addTagMetaData(pc, tlds[i], tlt, filename,isWeb.booleanValue());
                }
              }
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

        tlt.setParseBody(false);
        tlt.setDescription("");
        tlt.setAttributeType(TagLibTag.ATTRIBUTE_TYPE_MIXED);


        TagLibTagAttr tlta = new TagLibTagAttr(tlt);
        tlta.setName("__filename");
        tlta.setRequired(true);
        tlta.setRtexpr(true);
        tlta.setType("string");
        tlta.setHidden(true);
        tlta.setDefaultValue(filename);
        tlt.setAttribute(tlta);
       
        tlta = new TagLibTagAttr(tlt);
        tlta.setName("__name");
        tlta.setRequired(true);
        tlta.setRtexpr(true);
        tlta.setHidden(true);
        tlta.setType("string");
        tlta.setDefaultValue(name);
        tlt.setAttribute(tlta);
       
        tlta = new TagLibTagAttr(tlt);
        tlta.setName("__isweb");
        tlta.setRequired(true);
        tlta.setRtexpr(true);
        tlta.setHidden(true);
        tlta.setType("boolean");
        tlta.setDefaultValue(this instanceof ConfigWeb?"true":"false");
        tlt.setAttribute(tlta);
       
        tl.setTag(tlt);
    }
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

      if(tag.hasDefaultValue()) {
          Map<String, TagLibTagAttr> hash = tag.getAttributes();
        Iterator<String> it = hash.keySet().iterator();
     
        while(it.hasNext())  {
          TagLibTagAttr att=hash.get(it.next());
          if(!parent.containsAttribute(att.getName()) && att.hasDefaultValue())  {
             
            Attribute attr=new Attribute(tag.getAttributeType()==TagLibTag.ATTRIBUTE_TYPE_DYNAMIC,
                  att.getName(),
                  CastOther.toExpression(LitString.toExprString(Caster.toString(att.getDefaultValue(),null)),att.getType()),att.getType()
              );
              parent.addAttribute(attr);
          }
        }
      }
     
      boolean hasAttributeCollection=args.contains("attributecollection");
     
      // to less attributes
      if(!hasAttributeCollection && min>count)
        throw createTemplateException(data.cfml,"the tag "+tag.getFullName()+" must have at least "+min+" attributes",tag);
     
      // too much attributes
      if(!hasAttributeCollection && max>0 && max<count)
        throw createTemplateException(data.cfml,"the tag "+tag.getFullName()+" can have a maximum of "+max+" attributes",tag);
     
      // not defined attributes
      if(type==TagLibTag.ATTRIBUTE_TYPE_FIXED || type==TagLibTag.ATTRIBUTE_TYPE_MIXED)  {
        Map<String, TagLibTagAttr> hash = tag.getAttributes();
        Iterator<String> it = hash.keySet().iterator();
       
        while(it.hasNext())  {
          TagLibTagAttr att=hash.get(it.next());
          if(att.isRequired() && !args.contains(att.getName()) && att.getDefaultValue()==null)  {
            if(!hasAttributeCollection)throw createTemplateException(data.cfml,"attribute "+att.getName()+" is required for tag "+tag.getFullName(),tag);
            parent.addMissingAttribute(att.getName(),att.getType());
          }
        }
      }
      }
      catch(TemplateException te){
        data.cfml.setPos(start);
        // if the tag supports a non name attribute try this
        TagLibTagAttr sa = tag.getSingleAttr();
        if(sa!=null) attrNoName(parent,tag,data,sa);
        else throw te;
      }
    }
  // tag without attributes name
View Full Code Here

Examples of railo.transformer.library.tag.TagLibTagAttr

      String name=attributeName(data.cfml,dynamic,args,tag,sbType,parseExpression,allowDefaultValue.toBooleanValue());
     
      // mixed in a noname attribute
      if(StringUtil.isEmpty(name)){
        allowDefaultValue.setValue(false);
        TagLibTagAttr attr = tag.getDefaultAttribute();
        if(attr==null)
          throw new TemplateException(data.cfml,"Invalid Identifier.");
        name=attr.getName();
        sbType.append(attr.getType());
        isDefaultValue=true;
      }
     
     
      comment(data.cfml,true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.