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