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 (<col>) 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-COL
036//
037// <!ELEMENT COL      - O EMPTY           -- table column -->
038// <!ATTLIST COL                          -- column groups and properties --
039//  %attrs;                              -- %coreattrs, %i18n, %events --
040//  span        NUMBER         1         -- COL attributes affect N columns --
041//  width       %MultiLength;  #IMPLIED  -- column width specification --
042//  %cellhalign;                         -- horizontal alignment in cells --
043//  %cellvalign;                         -- vertical alignment in cells --
044//
045//
046
047public class Col extends HTMLTag
048{
049   //##########################################################################
050   // CONSTRUCTORS
051   //##########################################################################
052
053   //--------------------------------------------------------------------------
054   public Col()
055   {
056      super(HTML.COL);
057   }
058
059   //--------------------------------------------------------------------------
060   public Col(XMLNode inXMLNode)
061   {
062      this();
063      initFromXMLNode(inXMLNode);
064   }
065
066
067   //##########################################################################
068   // PUBLIC METHODS
069   //##########################################################################
070
071   //--------------------------------------------------------------------------
072   public Col setSpan(int inValue)
073   {
074      setAttribute(HTML.SPAN, inValue);
075      return this;
076   }
077
078
079   //--------------------------------------------------------------------------
080   public Col setWidth(String inValue)
081   {
082      setAttribute(HTML.WIDTH, inValue);
083      return this;
084   }
085
086
087   //--------------------------------------------------------------------------
088   public Col setAlign(Align inValue)
089   {
090      setAttribute(inValue.getHTMLAttributeName(), inValue.toString());
091      return this;
092   }
093
094   //--------------------------------------------------------------------------
095   public Col setVAlign(VAlign inValue)
096   {
097      setAttribute(inValue.getHTMLAttributeName(), inValue.toString());
098      return this;
099   }
100
101   //--------------------------------------------------------------------------
102   /**
103    Alignment char, e.g. char=':'.
104    @param inValue the value to use for the 'char' attribute
105    @return this Col object to enable method chaining
106    */
107   public Col setChar(char inValue)
108   {
109      setAttribute(HTML.CHAR, inValue);
110      return this;
111   }
112
113   //--------------------------------------------------------------------------
114   /**
115    Offset for the alignment char.
116    @param inValue the value to use for the 'charoff' attribute
117    @return this Col object to enable method chaining
118    */
119   public Col setCharOffset(int inValue)
120   {
121      setAttribute(HTML.CHAROFF, inValue);
122      return this;
123   }
124
125
126   // Overrides for HTMLTag setters to allow method chaining.
127
128   //--------------------------------------------------------------------------
129   @Override
130   public Col addClass(String inValue)
131   {
132      return (Col) super.addClass(inValue);
133   }
134
135   //--------------------------------------------------------------------------
136   @Override
137   public Col setClass(String inValue)
138   {
139      return (Col) super.setClass(inValue);
140   }
141
142   //--------------------------------------------------------------------------
143   @Override
144   public Col setId(String inValue)
145   {
146      return (Col) super.setId(inValue);
147   }
148
149   //--------------------------------------------------------------------------
150   @Override
151   public Col setStyle(CharSequence inValue)
152   {
153      return (Col) super.setStyle(inValue);
154   }
155
156   //--------------------------------------------------------------------------
157   @Override
158   public Col addStyle(String inValue)
159   {
160      return (Col) super.addStyle(inValue);
161   }
162
163}