001package com.hfg.html;
002
003import java.util.List;
004
005import com.hfg.html.attribute.Align;
006import com.hfg.html.attribute.VAlign;
007import com.hfg.css.CssUtil;
008import com.hfg.xml.XMLNode;
009
010//------------------------------------------------------------------------------
011/**
012 * Represents a table body (<tbody>) tag.
013 *
014 * @author J. Alex Taylor, hairyfatguy.com
015 */
016//------------------------------------------------------------------------------
017// com.hfg XML/HTML Coding Library
018//
019// This library is free software; you can redistribute it and/or
020// modify it under the terms of the GNU Lesser General Public
021// License as published by the Free Software Foundation; either
022// version 2.1 of the License, or (at your option) any later version.
023//
024// This library is distributed in the hope that it will be useful,
025// but WITHOUT ANY WARRANTY; without even the implied warranty of
026// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027// Lesser General Public License for more details.
028//
029// You should have received a copy of the GNU Lesser General Public
030// License along with this library; if not, write to the Free Software
031// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
032//
033// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
034// jataylor@hairyfatguy.com
035//------------------------------------------------------------------------------
036
037public class TBody extends HTMLTag
038{
039
040   //##########################################################################
041   // PRIVATE FIELDS
042   //##########################################################################
043
044
045   //##########################################################################
046   // CONSTRUCTORS
047   //##########################################################################
048
049   //--------------------------------------------------------------------------
050   public TBody()
051   {
052      super(HTML.TBODY);
053   }
054
055   //--------------------------------------------------------------------------
056   public TBody(XMLNode inXMLNode)
057   {
058      this();
059      initFromXMLNode(inXMLNode);
060   }
061
062   //##########################################################################
063   // PUBLIC METHODS
064   //##########################################################################
065
066
067   //--------------------------------------------------------------------------
068   public Tr addRow()
069   {
070      Tr tr = new Tr();
071      addSubtag(tr);
072      return tr;
073   }
074
075   //--------------------------------------------------------------------------
076   public void addRow(Tr inRow)
077   {
078      addSubtag(inRow);
079   }
080
081   //--------------------------------------------------------------------------
082   public List<Tr> getRows()
083   {
084      return (List<Tr>) (Object) getSubtagsByName(HTML.TR);
085   }
086
087   //---------------------------------------------------------------------------
088   public TBody setOnClick(String inValue)
089   {
090      setAttribute(HTML.ONCLICK, inValue);
091      return this;
092   }
093
094   //--------------------------------------------------------------------------
095   @Override
096   public TBody setClass(String inValue)
097   {
098      setAttribute(HTML.CLASS, inValue);
099      return this;
100   }
101
102
103   //--------------------------------------------------------------------------
104   @Override
105   public TBody setId(String inValue)
106   {
107      setAttribute(HTML.ID, inValue);
108      return this;
109   }
110
111   //--------------------------------------------------------------------------
112   @Override
113   public TBody setStyle(CharSequence inValue)
114   {
115      setAttribute(HTML.STYLE, inValue);
116      return this;
117   }
118
119   //--------------------------------------------------------------------------
120   @Override
121   public TBody addStyle(String inValue)
122   {
123      CssUtil.addStyle(this, inValue);
124      return this;
125   }
126
127   //--------------------------------------------------------------------------
128   public TBody setAlign(Align inValue)
129   {
130      setAttribute(inValue.getHTMLAttributeName(), inValue.toString());
131      return this;
132   }
133
134   //--------------------------------------------------------------------------
135   public TBody setVAlign(VAlign inValue)
136   {
137      setAttribute(inValue.getHTMLAttributeName(), inValue.toString());
138      return this;
139   }
140
141   //--------------------------------------------------------------------------
142   /**
143    Alignment char, e.g. char=':'.
144    */
145   public TBody setChar(char inValue)
146   {
147      setAttribute(HTML.CHAR, inValue);
148      return this;
149   }
150
151   //--------------------------------------------------------------------------
152   /**
153    Offset for the alignment char.
154    */
155   public TBody setCharOffset(int inValue)
156   {
157      setAttribute(HTML.CHAROFF, inValue);
158      return this;
159   }
160
161}