Package railo.transformer.library.tag

Examples of railo.transformer.library.tag.TagLibTagAttr


      sbType.append("struct");
      parseExpression[0]=true;
      parseExpression[1]=true;
    }
    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 createTemplateException(cfml,
                "Attribute "+id+" is not allowed for tag "+tag.getFullName(),tag);
         
          try{
            names=ListUtil.sort(names, "textnocase",null, null);
          }
          catch(Throwable t){}
          throw createTemplateException(cfml,
              "Attribute "+id+" is not allowed for tag "+tag.getFullName(),
              "valid attribute names are ["+names+"]",tag);
        }
        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


  private static void setAddional(PageExceptionImpl pe, TagLibTag tlt) {
    Map<String, TagLibTagAttr> attrs = tlt.getAttributes();
    Iterator<Entry<String, TagLibTagAttr>> it = attrs.entrySet().iterator();
    Entry<String, TagLibTagAttr> entry;
    TagLibTagAttr attr;
   
    // Pattern
    StringBuilder pattern=new StringBuilder("<");
    pattern.append((tlt.getFullName()));
    StringBuilder req=new StringBuilder();
    StringBuilder opt=new StringBuilder();
    StringBuilder tmp;
   
   
    pattern.append(" ");
    int c=0;
    while(it.hasNext()){
      entry = it.next();
      attr=entry.getValue();
      tmp=attr.isRequired()?req:opt;
     
      tmp.append(" ");
      if(!attr.isRequired()) tmp.append("[");
      if(c++>0)pattern.append(" ");
      tmp.append(attr.getName());
      tmp.append("\"");
      tmp.append(attr.getType());
      tmp.append("\"");
      if(!attr.isRequired()) tmp.append("]");
    }

    if(req.length()>0)pattern.append(req);
    if(opt.length()>0)pattern.append(opt);
   
    if(tlt.getAttributeType()==TagLibTag.ATTRIBUTE_TYPE_MIXED || tlt.getAttributeType()==TagLibTag.ATTRIBUTE_TYPE_DYNAMIC)
      pattern.append(" ...");
    pattern.append(">");
    if(tlt.getHasBody()) {
      if(tlt.isBodyReq()){
        pattern.append("</");
        pattern.append(tlt.getFullName());
        pattern.append(">");
      }
      else if(tlt.isBodyFree()){
        pattern.append("[</");
        pattern.append(tlt.getFullName());
        pattern.append(">]");
      }
    }
   
    pe.setAdditional(KeyConstants._Pattern, pattern);
   
    // Documentation
    StringBuilder doc=new StringBuilder(tlt.getDescription());
    req=new StringBuilder();
    opt=new StringBuilder();
   
    doc.append("\n");
   
    it = attrs.entrySet().iterator();
    while(it.hasNext()){
      entry = it.next();
      attr=entry.getValue();
      tmp=attr.isRequired()?req:opt;
     
      tmp.append("* ");
      tmp.append(attr.getName());
      tmp.append(" (");
      tmp.append(attr.getType());
      tmp.append("): ");
      tmp.append(attr.getDescription());
      tmp.append("\n");
    }

    if(req.length()>0)doc.append("\nRequired:\n").append(req);
    if(opt.length()>0)doc.append("\nOptional:\n").append(opt);
View Full Code Here

  private static Struct cfmlBasedTag(PageContext pc, TagLib tld, TagLibTag tag) throws PageException {
   
    //Map attrs = tag.getAttributes();

    TagLibTagAttr attrFilename = tag.getAttribute("__filename");
    //TagLibTagAttr attrName = tag.getAttribute("__name");
    TagLibTagAttr attrIsWeb = tag.getAttribute("__isweb");
   
    String filename = Caster.toString(attrFilename.getDefaultValue());
    String name = Caster.toString(attrFilename.getDefaultValue());
    boolean isWeb = Caster.toBooleanValue(attrIsWeb.getDefaultValue());
    InitFile source = CFTagCore.createInitFile(pc, isWeb, filename);
   
    Component cfc = ComponentLoader.loadComponent(pc,null,source.getPageSource(), source.getFilename().substring(0,source.getFilename().length()-(pc.getConfig().getCFCExtension().length()+1)), false,true);
        ComponentWrap cw=ComponentWrap.toComponentWrap(Component.ACCESS_PRIVATE, cfc);
    Struct metadata=Caster.toStruct(cw.get("metadata",null),null,false);
View Full Code Here

      Struct scp=new StructImpl();
      sct.set(KeyConstants._script,scp);
      scp.set("rtexpr", Caster.toBoolean(script.getRtexpr()));
      scp.set(KeyConstants._type, script.getTypeAsString());
      if(script.getType()==TagLibTagScript.TYPE_SINGLE) {
        TagLibTagAttr attr = script.getSingleAttr();
        if(attr!=null)scp.set("singletype", attr.getScriptSupportAsString());
        else scp.set("singletype", "none");
      }
    }
   
   
    sct.set(KeyConstants._type,"java");
   
    Struct _args=new StructImpl();
    sct.set(KeyConstants._attributes,_args);
   
    Map atts = tag.getAttributes();
    Iterator it = atts.keySet().iterator();
   
    while(it.hasNext()) {
        Object key = it.next();
        TagLibTagAttr attr=(TagLibTagAttr) atts.get(key);
        if(attr.getHidden()) continue;
    //for(int i=0;i<args.size();i++) {
      Struct _arg=new StructImpl();
      _arg.set(KeyConstants._status,TagLibFactory.toStatus(attr.getStatus()));
      _arg.set(KeyConstants._description,attr.getDescription());
      _arg.set(KeyConstants._type,attr.getType());
      if(attr.getValues()!=null)_arg.set(KeyConstants._values,Caster.toArray(attr.getValues()));
      if(attr.getDefaultValue()!=null)_arg.set("defaultValue",attr.getDefaultValue());
      _arg.set(KeyConstants._required,attr.isRequired()?Boolean.TRUE:Boolean.FALSE);
      _arg.set("scriptSupport",attr.getScriptSupportAsString());
      _args.setEL(attr.getName(),_arg);
    }
    return sct;
  }
View Full Code Here

TOP

Related Classes of railo.transformer.library.tag.TagLibTagAttr

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.