001package com.hfg.html; 002 003import com.hfg.html.attribute.Align; 004import com.hfg.html.attribute.VAlign; 005import com.hfg.xml.XMLNode; 006 007//------------------------------------------------------------------------------ 008/** 009 Table column group (<colgroup>) tag. 010 <div> 011 @author J. Alex Taylor, hairyfatguy.com 012 </div> 013 */ 014//------------------------------------------------------------------------------ 015// com.hfg XML/HTML Coding Library 016// 017// This library is free software; you can redistribute it and/or 018// modify it under the terms of the GNU Lesser General Public 019// License as published by the Free Software Foundation; either 020// version 2.1 of the License, or (at your option) any later version. 021// 022// This library is distributed in the hope that it will be useful, 023// but WITHOUT ANY WARRANTY; without even the implied warranty of 024// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 025// Lesser General Public License for more details. 026// 027// You should have received a copy of the GNU Lesser General Public 028// License along with this library; if not, write to the Free Software 029// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 030// 031// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 032// jataylor@hairyfatguy.com 033//------------------------------------------------------------------------------ 034// 035// http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP 036// 037// <!ELEMENT COLGROUP - O (COL)* -- table column group --> 038// <!ATTLIST COLGROUP 039// %attrs; -- %coreattrs, %i18n, %events -- 040// span NUMBER 1 -- default number of columns in group -- 041// width %MultiLength; #IMPLIED -- default width for enclosed COLs -- 042// %cellhalign; -- horizontal alignment in cells -- 043// %cellvalign; -- vertical alignment in cells -- 044// > 045// 046// 047 048public class Colgroup extends HTMLTag 049{ 050 //########################################################################## 051 // CONSTRUCTORS 052 //########################################################################## 053 054 //-------------------------------------------------------------------------- 055 public Colgroup() 056 { 057 super(HTML.COLGROUP); 058 } 059 060 //-------------------------------------------------------------------------- 061 public Colgroup(XMLNode inXMLNode) 062 { 063 this(); 064 initFromXMLNode(inXMLNode); 065 } 066 067 068 //########################################################################## 069 // PUBLIC METHODS 070 //########################################################################## 071 072 073 //-------------------------------------------------------------------------- 074 public Col addCol() 075 { 076 Col col = new Col(); 077 addSubtag(col); 078 079 return col; 080 } 081 082 //-------------------------------------------------------------------------- 083 public Colgroup setSpan(int inValue) 084 { 085 setAttribute(HTML.SPAN, inValue); 086 return this; 087 } 088 089 090 //-------------------------------------------------------------------------- 091 public Colgroup setWidth(String inValue) 092 { 093 setAttribute(HTML.WIDTH, inValue); 094 return this; 095 } 096 097 098 //-------------------------------------------------------------------------- 099 public Colgroup setAlign(Align inValue) 100 { 101 setAttribute(inValue.getHTMLAttributeName(), inValue.toString()); 102 return this; 103 } 104 105 //-------------------------------------------------------------------------- 106 public Colgroup setVAlign(VAlign inValue) 107 { 108 setAttribute(inValue.getHTMLAttributeName(), inValue.toString()); 109 return this; 110 } 111 112 //-------------------------------------------------------------------------- 113 /** 114 Alignment char, e.g. char=':'. 115 @param inValue the value to use for the 'char' attribute 116 @return this Col object to enable method chaining 117 */ 118 public Colgroup setChar(char inValue) 119 { 120 setAttribute(HTML.CHAR, inValue); 121 return this; 122 } 123 124 //-------------------------------------------------------------------------- 125 /** 126 Offset for the alignment char. 127 @param inValue the value to use for the 'charoff' attribute 128 @return this Col object to enable method chaining 129 */ 130 public Colgroup setCharOffset(int inValue) 131 { 132 setAttribute(HTML.CHAROFF, inValue); 133 return this; 134 } 135 136 137 // Overrides for HTMLTag setters to allow method chaining. 138 139 //-------------------------------------------------------------------------- 140 @Override 141 public Colgroup addClass(String inValue) 142 { 143 return (Colgroup) super.addClass(inValue); 144 } 145 146 //-------------------------------------------------------------------------- 147 @Override 148 public Colgroup setClass(String inValue) 149 { 150 return (Colgroup) super.setClass(inValue); 151 } 152 153 //-------------------------------------------------------------------------- 154 @Override 155 public Colgroup setId(String inValue) 156 { 157 return (Colgroup) super.setId(inValue); 158 } 159 160 //-------------------------------------------------------------------------- 161 @Override 162 public Colgroup setStyle(CharSequence inValue) 163 { 164 return (Colgroup) super.setStyle(inValue); 165 } 166 167 //-------------------------------------------------------------------------- 168 @Override 169 public Colgroup addStyle(String inValue) 170 { 171 return (Colgroup) super.addStyle(inValue); 172 } 173 174}