001    package railo.runtime.tag;
002    
003    import javax.servlet.jsp.tagext.Tag;
004    
005    import railo.runtime.exp.TagNotSupported;
006    import railo.runtime.ext.tag.TagImpl;
007    import railo.runtime.type.util.ListUtil;
008    
009    /**
010    * Lets you define a cfgrid that does not use a query as source for row data. If a query attribute is
011    *   specified in cfgrid, the cfgridrow tags are ignored.
012    *
013    *
014    *
015    **/
016    public final class GridRow extends TagImpl {
017            
018    
019            public GridRow() throws TagNotSupported {
020                    throw new TagNotSupported("GridRow");
021            }
022    
023            /** A comma-separated list of column values. If a column value contains a comma character, 
024            **      it must be escaped with a second comma character. */
025            private String[] data;
026    
027            @Override
028            public void release()   {
029                    super.release();
030                    data=null;
031            }
032            
033            /** set the value data
034            *  A comma-separated list of column values. If a column value contains a comma character, 
035            *       it must be escaped with a second comma character.
036            * @param data value to set
037            **/
038            public void setData(String data)        {
039                    this.data=ListUtil.listToStringArray(data, ',');
040            }
041    
042    
043            @Override
044            public int doStartTag() {
045                    // provide to parent
046                    Tag parent=this;
047                    do{
048                            parent = parent.getParent();
049                            if(parent instanceof Grid) {
050                                    ((Grid)parent).addRow(data);
051                                    break;
052                            }
053                    }
054                    while(parent!=null);
055                    
056                    return SKIP_BODY;
057            }
058    
059            @Override
060            public int doEndTag()   {
061                    return EVAL_PAGE;
062            }
063    
064    }