KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > domimpl > HTMLElementBuilder


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 /*
22  * Created on Oct 8, 2005
23  */

24 package org.lobobrowser.html.domimpl;
25
26 import org.w3c.dom.html2.*;
27
28 public abstract class HTMLElementBuilder {
29     public final HTMLElement create(HTMLDocument document, String JavaDoc name) {
30         HTMLElementImpl element = this.build(name);
31         element.setOwnerDocument(document);
32         return element;
33     }
34     
35     protected abstract HTMLElementImpl build(String JavaDoc name);
36     
37     public static class Html extends HTMLElementBuilder {
38         public HTMLElementImpl build(String JavaDoc name) {
39             return new HTMLHtmlElementImpl(name);
40         }
41     }
42
43     public static class Title extends HTMLElementBuilder {
44         public HTMLElementImpl build(String JavaDoc name) {
45             return new HTMLTitleElementImpl(name);
46         }
47     }
48
49     public static class Base extends HTMLElementBuilder {
50         public HTMLElementImpl build(String JavaDoc name) {
51             return new HTMLBaseElementImpl(name);
52         }
53     }
54
55     public static class Body extends HTMLElementBuilder {
56         public HTMLElementImpl build(String JavaDoc name) {
57             return new HTMLBodyElementImpl(name);
58         }
59     }
60
61     public static class Span extends HTMLElementBuilder {
62         public HTMLElementImpl build(String JavaDoc name) {
63             return new HTMLSpanElementImpl(name);
64         }
65     }
66
67     public static class Script extends HTMLElementBuilder {
68         public HTMLElementImpl build(String JavaDoc name) {
69             return new HTMLScriptElementImpl(name);
70         }
71     }
72
73     public static class Img extends HTMLElementBuilder {
74         public HTMLElementImpl build(String JavaDoc name) {
75             return new HTMLImageElementImpl(name);
76         }
77     }
78
79     public static class Style extends HTMLElementBuilder {
80         public HTMLElementImpl build(String JavaDoc name) {
81             return new HTMLStyleElementImpl(name);
82         }
83     }
84
85     public static class Table extends HTMLElementBuilder {
86         public HTMLElementImpl build(String JavaDoc name) {
87             return new HTMLTableElementImpl(name);
88         }
89     }
90
91     public static class Td extends HTMLElementBuilder {
92         public HTMLElementImpl build(String JavaDoc name) {
93             return new HTMLTableCellElementImpl(name);
94         }
95     }
96
97     public static class Th extends HTMLElementBuilder {
98         public HTMLElementImpl build(String JavaDoc name) {
99             return new HTMLTableHeadElementImpl(name);
100         }
101     }
102
103     public static class Tr extends HTMLElementBuilder {
104         public HTMLElementImpl build(String JavaDoc name) {
105             return new HTMLTableRowElementImpl(name);
106         }
107     }
108     public static class Link extends HTMLElementBuilder {
109         public HTMLElementImpl build(String JavaDoc name) {
110             return new HTMLLinkElementImpl(name);
111         }
112     }
113     
114     public static class Anchor extends HTMLElementBuilder {
115         public HTMLElementImpl build(String JavaDoc name) {
116             return new HTMLLinkElementImpl(name);
117         }
118     }
119
120     public static class Form extends HTMLElementBuilder {
121         public HTMLElementImpl build(String JavaDoc name) {
122             return new HTMLFormElementImpl(name);
123         }
124     }
125
126     public static class Input extends HTMLElementBuilder {
127         public HTMLElementImpl build(String JavaDoc name) {
128             return new HTMLInputElementImpl(name);
129         }
130     }
131
132     public static class Button extends HTMLElementBuilder {
133         public HTMLElementImpl build(String JavaDoc name) {
134             return new HTMLButtonElementImpl(name);
135         }
136     }
137
138     public static class Textarea extends HTMLElementBuilder {
139         public HTMLElementImpl build(String JavaDoc name) {
140             return new HTMLTextAreaElementImpl(name);
141         }
142     }
143
144     public static class Select extends HTMLElementBuilder {
145         public HTMLElementImpl build(String JavaDoc name) {
146             return new HTMLSelectElementImpl(name);
147         }
148     }
149
150     public static class Option extends HTMLElementBuilder {
151         public HTMLElementImpl build(String JavaDoc name) {
152             return new HTMLOptionElementImpl(name);
153         }
154     }
155
156     public static class Frameset extends HTMLElementBuilder {
157         public HTMLElementImpl build(String JavaDoc name) {
158             return new HTMLFrameSetElementImpl(name);
159         }
160     }
161
162     public static class Frame extends HTMLElementBuilder {
163         public HTMLElementImpl build(String JavaDoc name) {
164             return new HTMLFrameElementImpl(name);
165         }
166     }
167
168     public static class Ul extends HTMLElementBuilder {
169         public HTMLElementImpl build(String JavaDoc name) {
170             return new HTMLUListElementImpl(name);
171         }
172     }
173
174     public static class Ol extends HTMLElementBuilder {
175         public HTMLElementImpl build(String JavaDoc name) {
176             return new HTMLOListElementImpl(name);
177         }
178     }
179
180     public static class Li extends HTMLElementBuilder {
181         public HTMLElementImpl build(String JavaDoc name) {
182             return new HTMLLIElementImpl(name);
183         }
184     }
185
186     public static class Pre extends HTMLElementBuilder {
187         public HTMLElementImpl build(String JavaDoc name) {
188             return new HTMLPreElementImpl(name);
189         }
190     }
191
192     public static class Div extends HTMLElementBuilder {
193         public HTMLElementImpl build(String JavaDoc name) {
194             return new HTMLDivElementImpl(name);
195         }
196     }
197
198     public static class Blockquote extends HTMLElementBuilder {
199         public HTMLElementImpl build(String JavaDoc name) {
200             return new HTMLBlockQuoteElementImpl(name);
201         }
202     }
203
204     public static class Hr extends HTMLElementBuilder {
205         public HTMLElementImpl build(String JavaDoc name) {
206             return new HTMLHRElementImpl(name);
207         }
208     }
209
210     public static class Br extends HTMLElementBuilder {
211         public HTMLElementImpl build(String JavaDoc name) {
212             return new HTMLBRElementImpl(name);
213         }
214     }
215
216     public static class P extends HTMLElementBuilder {
217         public HTMLElementImpl build(String JavaDoc name) {
218             return new HTMLPElementImpl(name);
219         }
220     }
221
222     public static class GenericMarkup extends HTMLElementBuilder {
223         public HTMLElementImpl build(String JavaDoc name) {
224             return new HTMLGenericMarkupElement(name);
225         }
226     }
227     
228     public static class HtmlObject extends HTMLElementBuilder {
229         public HTMLElementImpl build(String JavaDoc name) {
230             return new HTMLObjectElementImpl(name);
231         }
232     }
233
234     public static class Applet extends HTMLElementBuilder {
235         public HTMLElementImpl build(String JavaDoc name) {
236             return new HTMLAppletElementImpl(name);
237         }
238     }
239
240     public static class IFrame extends HTMLElementBuilder {
241         public HTMLElementImpl build(String JavaDoc name) {
242             return new HTMLIFrameElementImpl(name);
243         }
244     }
245
246     public static class BaseFont extends HTMLElementBuilder {
247         public HTMLElementImpl build(String JavaDoc name) {
248             return new HTMLBaseFontElementImpl(name);
249         }
250     }
251
252     public static class Font extends HTMLElementBuilder {
253         public HTMLElementImpl build(String JavaDoc name) {
254             return new HTMLFontElementImpl(name);
255         }
256     }
257
258     public static class Tt extends HTMLElementBuilder {
259         public HTMLElementImpl build(String JavaDoc name) {
260             return new HTMLMonospacedElementImpl(name);
261         }
262     }
263
264     public static class Code extends HTMLElementBuilder {
265         public HTMLElementImpl build(String JavaDoc name) {
266             return new HTMLMonospacedElementImpl(name);
267         }
268     }
269
270     public static class Heading extends HTMLElementBuilder {
271         public HTMLElementImpl build(String JavaDoc name) {
272             return new HTMLHeadingElementImpl(name);
273         }
274     }
275
276     public static class Small extends HTMLElementBuilder {
277         public HTMLElementImpl build(String JavaDoc name) {
278             return new HTMLFontSizeChangeElementImpl(name, -1);
279         }
280     }
281
282     public static class Big extends HTMLElementBuilder {
283         public HTMLElementImpl build(String JavaDoc name) {
284             return new HTMLFontSizeChangeElementImpl(name, +1);
285         }
286     }
287
288     public static class Em extends HTMLElementBuilder {
289         public HTMLElementImpl build(String JavaDoc name) {
290             return new HTMLEmElementImpl(name);
291         }
292     }
293
294     public static class Strong extends HTMLElementBuilder {
295         public HTMLElementImpl build(String JavaDoc name) {
296             return new HTMLStrongElementImpl(name);
297         }
298     }
299
300     public static class Underline extends HTMLElementBuilder {
301         public HTMLElementImpl build(String JavaDoc name) {
302             return new HTMLUnderlineElementImpl(name);
303         }
304     }
305     
306     public static class Strike extends HTMLElementBuilder {
307         public HTMLElementImpl build(String JavaDoc name) {
308             return new HTMLStrikeElementImpl(name);
309         }
310     }
311
312     public static class Center extends HTMLElementBuilder {
313         public HTMLElementImpl build(String JavaDoc name) {
314             return new HTMLCenterElementImpl(name);
315         }
316     }
317
318     public static class NonStandard extends HTMLElementBuilder {
319         public HTMLElementImpl build(String JavaDoc name) {
320             return new HTMLNonStandardElement(name);
321         }
322     }
323 }
324
Popular Tags