001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.tag; 020 021import javax.servlet.jsp.tagext.Tag; 022 023import lucee.runtime.exp.TagNotSupported; 024import lucee.runtime.ext.tag.TagImpl; 025import lucee.runtime.type.util.ListUtil; 026 027/** 028* Lets you define a cfgrid that does not use a query as source for row data. If a query attribute is 029* specified in cfgrid, the cfgridrow tags are ignored. 030* 031* 032* 033**/ 034public final class GridRow extends TagImpl { 035 036 037 public GridRow() throws TagNotSupported { 038 throw new TagNotSupported("GridRow"); 039 } 040 041 /** A comma-separated list of column values. If a column value contains a comma character, 042 ** it must be escaped with a second comma character. */ 043 private String[] data; 044 045 @Override 046 public void release() { 047 super.release(); 048 data=null; 049 } 050 051 /** set the value data 052 * A comma-separated list of column values. If a column value contains a comma character, 053 * it must be escaped with a second comma character. 054 * @param data value to set 055 **/ 056 public void setData(String data) { 057 this.data=ListUtil.listToStringArray(data, ','); 058 } 059 060 061 @Override 062 public int doStartTag() { 063 // provide to parent 064 Tag parent=this; 065 do{ 066 parent = parent.getParent(); 067 if(parent instanceof Grid) { 068 ((Grid)parent).addRow(data); 069 break; 070 } 071 } 072 while(parent!=null); 073 074 return SKIP_BODY; 075 } 076 077 @Override 078 public int doEndTag() { 079 return EVAL_PAGE; 080 } 081 082}