Package railo.commons.lang

Examples of railo.commons.lang.StringList


              name=URLDecoder.decode(name,encoding,true);
              value=URLDecoder.decode(value,encoding,true);
            }
            // MUST valueStruct
            if(name.indexOf('.')!=-1) {
                StringList list=ListUtil.listToStringListRemoveEmpty(name,'.');
                Struct parent=this;
                while(list.hasNextNext()) {
                    parent=_fill(parent,list.next(),new CastableStruct(),false,scriptProteced,sameAsArray);
                }
                _fill(parent,list.next(),value,true,scriptProteced,sameAsArray);
            }
            //else
                _fill(this,name,value,true,scriptProteced,sameAsArray);
        }
    }
View Full Code Here


  }

  public String generateSectionLabel(PieDataset pd, Comparable c) {
    String value=Caster.toString(pd.getKey(pd.getIndex(c)),"");
   
    StringList list = ListUtil.toList(value, '\n');
    StringBuffer sb=new StringBuffer();
    String line;
    int lineLen;
    while(list.hasNext()) {
      line=list.next();
      lineLen=metrics.stringWidth(line);
      if(lineLen>with) {
        reorganize(sb,list,new StringBuffer(line));
        break;
      }
View Full Code Here

      item=list.next();
      rest.append(list.delimiter());
      rest.append(item);
    }
   
    StringList words = ListUtil.toWordList(rest.toString());
    StringBuffer line=new StringBuffer();
   
    while(words.hasNext()) {
      item=words.next();
     
      if(line.length()>0 && metrics.stringWidth(item.concat(" ").concat(line.toString()))>with) {
        if(sb.length()>0) sb.append('\n');
        sb.append(line);
        //print.out("line:"+line);
        line=new StringBuffer(item);
      }
      else {
        //item=words.next();
        if(line.length()>0)line.append(words.delimiter()==0?' ':words.delimiter());
        line.append(item);
      }
    }
    if(line.length()>0){
      if(sb.length()>0) sb.append('\n');
View Full Code Here

   * @param var
   * @return matching Object
   * @throws PageException
   */
  public static Object getVariable(PageContext pc, Collection collection,String var) throws PageException {     
      StringList list = parse(pc,new ParserString(var),false);
        if(list==null) throw new InterpreterException("invalid variable declaration ["+var+"]");
       
        while(list.hasNextNext()) {
            collection=Caster.toCollection(collection.get(KeyImpl.init(list.next())));
        }
        return collection.get(KeyImpl.init(list.next()));
  }
View Full Code Here

    return null;
  }
 

  public static Object getVariableEL(PageContext pc, Collection collection,String var) {     
      StringList list = parse(pc,new ParserString(var),false);
        if(list==null) return null;
      
        while(list.hasNextNext()) {
          collection=Caster.toCollection(collection.get(list.next(),null),null);
          if(collection==null) return null;
        }
        return collection.get(list.next(),null);
  }
View Full Code Here

   * @param var variable string to get value to
   * @return the value
     * @throws PageException
   */
  public static Object getVariable(PageContext pc,String var) throws PageException {
        StringList list = parse(pc,new ParserString(var),false);
        if(list==null) throw new InterpreterException("invalid variable declaration ["+var+"]");
       
    int scope=scopeString2Int(list.next());
    Object coll =null;
    if(scope==Scope.SCOPE_UNDEFINED) {
        coll=pc.undefinedScope().get(list.current());
    }
    else {
      coll=VariableInterpreter.scope(pc, scope, list.hasNext());
    }
   
    while(list.hasNext()) {
      coll=pc.getVariableUtil().get(pc,coll,list.next());
    }
    return coll;
    }
View Full Code Here

    }
 


  public static Object getVariableAsCollection(PageContext pc,String var) throws PageException {
        StringList list = parse(pc,new ParserString(var),false);
        if(list==null) throw new InterpreterException("invalid variable declaration ["+var+"]");
       
    int scope=scopeString2Int(list.next());
    Object coll =null;
    if(scope==Scope.SCOPE_UNDEFINED) {
        coll=pc.undefinedScope().getCollection(list.current());
    }
    else {
        coll=VariableInterpreter.scope(pc, scope, list.hasNext());
    }
   
    while(list.hasNext()) {
      coll=pc.getVariableUtil().getCollection(pc,coll,list.next());
    }
    return coll;
    }
View Full Code Here

   * @param var variable string to get value to
   * @param defaultValue value returnded if variable was not found
   * @return the value or default value if not found
   */
  public static Object getVariableEL(PageContext pc,String var, Object defaultValue) {
        StringList list = parse(pc,new ParserString(var),false);
        if(list==null) return defaultValue;
       
    int scope=scopeString2Int(list.next());
    Object coll =null;
    if(scope==Scope.SCOPE_UNDEFINED) {
        coll=pc.undefinedScope().get(KeyImpl.init(list.current()),NullSupportHelper.NULL());
        if(coll==NullSupportHelper.NULL()) return defaultValue;
    }
    else {
        try {
                coll=VariableInterpreter.scope(pc, scope, list.hasNext());
          //coll=pc.scope(scope);
            }
        catch (PageException e) {
                return defaultValue;
            }
    }
   
    while(list.hasNext()) {
      coll=pc.getVariableUtil().get(pc,coll,KeyImpl.init(list.next()),NullSupportHelper.NULL());
      if(coll==NullSupportHelper.NULL()) return defaultValue;
    }
    return coll;
    }
View Full Code Here

    }
    return coll;
    }
 
  public static Object getVariableELAsCollection(PageContext pc,String var, Object defaultValue) {
        StringList list = parse(pc,new ParserString(var),false);
        if(list==null) return defaultValue;
       
    int scope=scopeString2Int(list.next());
    Object coll =null;
    if(scope==Scope.SCOPE_UNDEFINED) {
        try {
        coll=pc.undefinedScope().getCollection(list.current());
      }
        catch (PageException e) {
        coll=null;
      }
        if(coll==null) return defaultValue;
    }
    else {
        try {
                coll=VariableInterpreter.scope(pc, scope, list.hasNext());
          //coll=pc.scope(scope);
            }
        catch (PageException e) {
                return defaultValue;
            }
    }
   
    while(list.hasNext()) {
      coll=pc.getVariableUtil().getCollection(pc,coll,list.next(),null);
      if(coll==null) return defaultValue;
    }
    return coll;
    }
View Full Code Here

   * @param var variable name to get
   * @return variable as Reference
   * @throws PageException
   */
  public static VariableReference getVariableReference(PageContext pc,String var) throws PageException {
      StringList list = parse(pc,new ParserString(var),false);
        if(list==null) throw new InterpreterException("invalid variable declaration ["+var+"]");
       
    if(list.size()==1) {
      return new VariableReference(pc.undefinedScope(),list.next());
    }
    int scope=scopeString2Int(list.next());
   
    Object coll;
    if(scope==Scope.SCOPE_UNDEFINED){
      coll=pc.touch(pc.undefinedScope(),list.current());
    }
    else{
      coll=VariableInterpreter.scope(pc, scope, list.hasNext());
      //coll=pc.scope(scope);
    }
   
   
    while(list.hasNextNext()) {
      coll=pc.touch(coll,list.next());
    }

    if(!(coll instanceof Collection))
      throw new InterpreterException("invalid variable ["+var+"]");
    return new VariableReference((Collection)coll,list.next());
  }
View Full Code Here

TOP

Related Classes of railo.commons.lang.StringList

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.