001package com.hfg.html;
002
003
004import com.hfg.xml.XMLNode;
005
006//------------------------------------------------------------------------------
007/**
008 * Represents a pre (<pre>) tag.
009 *
010 * @author J. Alex Taylor, hairyfatguy.com
011 */
012//------------------------------------------------------------------------------
013// com.hfg XML/HTML Coding Library
014//
015// This library is free software; you can redistribute it and/or
016// modify it under the terms of the GNU Lesser General Public
017// License as published by the Free Software Foundation; either
018// version 2.1 of the License, or (at your option) any later version.
019//
020// This library is distributed in the hope that it will be useful,
021// but WITHOUT ANY WARRANTY; without even the implied warranty of
022// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
023// Lesser General Public License for more details.
024//
025// You should have received a copy of the GNU Lesser General Public
026// License along with this library; if not, write to the Free Software
027// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
028//
029// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
030// jataylor@hairyfatguy.com
031//------------------------------------------------------------------------------
032
033public class Pre extends HTMLTagWithCoreEvents
034{
035
036   //##########################################################################
037   // CONSTRUCTORS
038   //##########################################################################
039
040   //--------------------------------------------------------------------------
041   public Pre()
042   {
043      super(HTML.PRE);
044   }
045
046   //--------------------------------------------------------------------------
047   public Pre(String inContent)
048   {
049      this();
050      addContent(inContent);
051   }
052
053   //--------------------------------------------------------------------------
054   public Pre(HTMLTag inContent)
055   {
056      this();
057      addSubtag(inContent);
058   }
059
060   //--------------------------------------------------------------------------
061   public Pre(XMLNode inXMLNode)
062   {
063      this();
064      initFromXMLNode(inXMLNode);
065   }
066
067   //##########################################################################
068   // PUBLIC METHODS
069   //##########################################################################
070
071   //--------------------------------------------------------------------------
072   public Form addForm()
073   {
074      Form form = new Form();
075      // Using addSubtag() instead of addSubtag() because content (text) in
076      // the body may flow around embedded subtags.
077      addSubtag(form);
078
079      return form;
080   }
081
082   //--------------------------------------------------------------------------
083   public Form addForm(String inFormName)
084   {
085      Form form = new Form(inFormName);
086      // Using addSubtag() instead of addSubtag() because content (text) in
087      // the body may flow around embedded subtags.
088      addSubtag(form);
089
090      return form;
091   }
092
093   //--------------------------------------------------------------------------
094   public Table addTable()
095   {
096      Table table = new Table();
097      // Using addSubtag() instead of addSubtag() because content (text) in
098      // the body may flow around embedded subtags.
099      addSubtag(table);
100
101      return table;
102   }
103
104
105   //--------------------------------------------------------------------------
106   public Span addSpan()
107   {
108      Span span = new Span();
109      // Using addSubtag() instead of addSubtag() because content (text)
110      // may flow around embedded subtags.
111      addSubtag(span);
112
113      return span;
114   }
115
116   //--------------------------------------------------------------------------
117   public Span addSpan(String inContent)
118   {
119      Span span = new Span(inContent);
120      // Using addSubtag() instead of addSubtag() because content (text)
121      // may flow around embedded subtags.
122      addSubtag(span);
123
124      return span;
125   }
126
127   //--------------------------------------------------------------------------
128   public Span addSpan(HTMLTag inContent)
129   {
130      Span span = new Span(inContent);
131      // Using addSubtag() instead of addSubtag() because content (text)
132      // may flow around embedded subtags.
133      addSubtag(span);
134
135      return span;
136   }
137
138
139   //--------------------------------------------------------------------------
140   public Img addImage(String inSrc)
141   {
142      Img image = new Img(inSrc);
143      // Using addSubtag() instead of addSubtag() because content (text)
144      // may flow around embedded subtags.
145      addSubtag(image);
146
147      return image;
148   }
149
150   //--------------------------------------------------------------------------
151   public Link addLink()
152   {
153      Link link = new Link();
154      addSubtag(link);
155
156      return link;
157   }
158
159   //--------------------------------------------------------------------------
160   public Link addLink(Link inLink)
161   {
162      addSubtag(inLink);
163
164      return inLink;
165   }
166
167   //--------------------------------------------------------------------------
168   public Link addLink(CharSequence inURL)
169   {
170      Link link = new Link(inURL);
171      addSubtag(link);
172
173      return link;
174   }
175
176   //--------------------------------------------------------------------------
177   public Link addLink(CharSequence inURL, String inContent)
178   {
179      Link link = new Link(inURL, inContent);
180      addSubtag(link);
181
182      return link;
183   }
184
185   //--------------------------------------------------------------------------
186   public Link addLink(CharSequence inURL, HTMLTag inContent)
187   {
188      Link link = new Link(inURL, inContent);
189      addSubtag(link);
190
191      return link;
192   }
193
194   //--------------------------------------------------------------------------
195   public Pre br()
196   {
197      HTMLUtil.br(this);
198      return this;
199   }
200
201   //--------------------------------------------------------------------------
202   public Pre br(int inNumber)
203   {
204      HTMLUtil.br(this, inNumber);
205      return this;
206   }
207
208   //--------------------------------------------------------------------------
209   public Pre hr()
210   {
211      HTMLUtil.hr(this);
212      return this;
213   }
214
215   //--------------------------------------------------------------------------
216   public Pre hr(String inWidth)
217   {
218      HTMLUtil.hr(this, inWidth);
219      return this;
220   }
221
222
223   //--------------------------------------------------------------------------
224   public Pre setClass(String inValue)
225   {
226      setAttribute(HTML.CLASS, inValue);
227
228      return this;
229   }
230
231        
232   // Overrides for HTMLTag setters to allow method chaining.
233
234   //--------------------------------------------------------------------------
235   @Override
236   public Pre setId(String inValue)
237   {
238      return (Pre) super.setId(inValue);
239   }
240
241   //--------------------------------------------------------------------------
242   @Override
243   public Pre setStyle(CharSequence inValue)
244   {
245      return (Pre) super.setStyle(inValue);
246   }
247
248   //--------------------------------------------------------------------------
249   @Override
250   public Pre addStyle(String inValue)
251   {
252      return (Pre) super.addStyle(inValue);
253   }
254
255   // Overrides for HTMLTagWithCoreEvents setters to allow method chaining.
256
257   //--------------------------------------------------------------------------
258   @Override
259   public Pre setOnClick(String inValue)
260   {
261      return (Pre) super.setOnClick(inValue);
262   }
263
264   //--------------------------------------------------------------------------
265   @Override
266   public Pre setOnDblClick(String inValue)
267   {
268      return (Pre) super.setOnDblClick(inValue);
269   }
270
271   //--------------------------------------------------------------------------
272   @Override
273   public Pre setOnMouseDown(String inValue)
274   {
275      return (Pre) super.setOnMouseDown(inValue);
276   }
277
278   //--------------------------------------------------------------------------
279   @Override
280   public Pre setOnMouseMove(String inValue)
281   {
282      return (Pre) super.setOnMouseMove(inValue);
283   }
284
285   //--------------------------------------------------------------------------
286   @Override
287   public Pre setOnMouseOut(String inValue)
288   {
289      return (Pre) super.setOnMouseOut(inValue);
290   }
291
292   //--------------------------------------------------------------------------
293   @Override
294   public Pre setOnMouseOver(String inValue)
295   {
296      return (Pre) super.setOnMouseOver(inValue);
297   }
298
299   //--------------------------------------------------------------------------
300   @Override
301   public Pre setOnMouseUp(String inValue)
302   {
303      return (Pre) super.setOnMouseUp(inValue);
304   }
305
306   //--------------------------------------------------------------------------
307   @Override
308   public Pre setOnKeyDown(String inValue)
309   {
310      return (Pre) super.setOnKeyDown(inValue);
311   }
312
313   //--------------------------------------------------------------------------
314   @Override
315   public Pre setOnKeyPress(String inValue)
316   {
317      return (Pre) super.setOnKeyPress(inValue);
318   }
319
320   //--------------------------------------------------------------------------
321   @Override
322   public Pre setOnKeyUp(String inValue)
323   {
324      return (Pre) super.setOnKeyUp(inValue);
325   }
326}