KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > ElementTags


1 /*
2  * $Id: ElementTags.java 2748 2007-05-12 15:11:48Z blowagie $
3  * $Name$
4  *
5  * Copyright (c) 2001, 2002 Bruno Lowagie.
6  *
7  * The contents of this file are subject to the Mozilla Public License Version 1.1
8  * (the "License"); you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the License.
14  *
15  * The Original Code is 'iText, a free JAVA-PDF library'.
16  *
17  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
18  * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
19  * All Rights Reserved.
20  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
21  * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
22  *
23  * Contributor(s): all the names of the contributors are added in the source code
24  * where applicable.
25  *
26  * Alternatively, the contents of this file may be used under the terms of the
27  * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
28  * provisions of LGPL are applicable instead of those above. If you wish to
29  * allow use of your version of this file only under the terms of the LGPL
30  * License and not to allow others to use your version of this file under
31  * the MPL, indicate your decision by deleting the provisions above and
32  * replace them with the notice and other provisions required by the LGPL.
33  * If you do not delete the provisions above, a recipient may use your version
34  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Library General Public License as published by the Free Software Foundation;
39  * either version 2 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
43  * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
44  * details.
45  *
46  * If you didn't download this code from the following link, you should check if
47  * you aren't using an obsolete version:
48  * http://www.lowagie.com/iText/
49  */

50
51 package com.lowagie.text;
52
53 /**
54  * A class that contains all the possible tagnames and their attributes.
55  */

56
57 public class ElementTags {
58     
59     /** the root tag. */
60     public static final String JavaDoc ITEXT = "itext";
61     
62     /** attribute of the root and annotation tag (also a special tag within a chapter or section) */
63     public static final String JavaDoc TITLE = "title";
64     
65     /** attribute of the root tag */
66     public static final String JavaDoc SUBJECT = "subject";
67     
68     /** attribute of the root tag */
69     public static final String JavaDoc KEYWORDS = "keywords";
70     
71     /** attribute of the root tag */
72     public static final String JavaDoc AUTHOR = "author";
73     
74     /** attribute of the root tag */
75     public static final String JavaDoc CREATIONDATE = "creationdate";
76     
77     /** attribute of the root tag */
78     public static final String JavaDoc PRODUCER = "producer";
79     
80     // Chapters and Sections
81

82     /** the chapter tag */
83     public static final String JavaDoc CHAPTER = "chapter";
84     
85     /** the section tag */
86     public static final String JavaDoc SECTION = "section";
87     
88     /** attribute of section/chapter tag */
89     public static final String JavaDoc NUMBERDEPTH = "numberdepth";
90     
91     /** attribute of section/chapter tag */
92     public static final String JavaDoc DEPTH = "depth";
93     
94     /** attribute of section/chapter tag */
95     public static final String JavaDoc NUMBER = "number";
96     
97     /** attribute of section/chapter tag */
98     public static final String JavaDoc INDENT = "indent";
99     
100     /** attribute of chapter/section/paragraph/table/cell tag */
101     public static final String JavaDoc LEFT = "left";
102     
103     /** attribute of chapter/section/paragraph/table/cell tag */
104     public static final String JavaDoc RIGHT = "right";
105     
106     // Phrases, Anchors, Lists and Paragraphs
107

108     /** the phrase tag */
109     public static final String JavaDoc PHRASE = "phrase";
110     
111     /** the anchor tag */
112     public static final String JavaDoc ANCHOR = "anchor";
113     
114     /** the list tag */
115     public static final String JavaDoc LIST = "list";
116     
117     /** the listitem tag */
118     public static final String JavaDoc LISTITEM = "listitem";
119     
120     /** the paragraph tag */
121     public static final String JavaDoc PARAGRAPH = "paragraph";
122     
123     /** attribute of phrase/paragraph/cell tag */
124     public static final String JavaDoc LEADING = "leading";
125     
126     /** attribute of paragraph/image/table tag */
127     public static final String JavaDoc ALIGN = "align";
128     
129     /** attribute of paragraph */
130     public static final String JavaDoc KEEPTOGETHER = "keeptogether";
131     
132     /** attribute of anchor tag */
133     public static final String JavaDoc NAME = "name";
134     
135     /** attribute of anchor tag */
136     public static final String JavaDoc REFERENCE = "reference";
137     
138     /** attribute of list tag */
139     public static final String JavaDoc LISTSYMBOL = "listsymbol";
140     
141     /** attribute of list tag */
142     public static final String JavaDoc NUMBERED = "numbered";
143     
144     /** attribute of the list tag */
145     public static final String JavaDoc LETTERED = "lettered";
146
147     /** attribute of list tag */
148     public static final String JavaDoc FIRST = "first";
149     
150     /** attribute of list tag */
151     public static final String JavaDoc SYMBOLINDENT = "symbolindent";
152     
153     /** attribute of list tag */
154     public static final String JavaDoc INDENTATIONLEFT = "indentationleft";
155     
156     /** attribute of list tag */
157     public static final String JavaDoc INDENTATIONRIGHT = "indentationright";
158     
159     // Chunks
160

161     /** the chunk tag */
162     public static final String JavaDoc IGNORE = "ignore";
163     
164     /** the chunk tag */
165     public static final String JavaDoc ENTITY = "entity";
166     
167     /** the chunk tag */
168     public static final String JavaDoc ID = "id";
169     
170     /** the chunk tag */
171     public static final String JavaDoc CHUNK = "chunk";
172     
173     /** attribute of the chunk tag */
174     public static final String JavaDoc ENCODING = "encoding";
175     
176     /** attribute of the chunk tag */
177     public static final String JavaDoc EMBEDDED = "embedded";
178     
179     /** attribute of the chunk/table/cell tag */
180     public static final String JavaDoc COLOR = "color";
181     
182     /** attribute of the chunk/table/cell tag */
183     public static final String JavaDoc RED = "red";
184     
185     /** attribute of the chunk/table/cell tag */
186     public static final String JavaDoc GREEN = "green";
187     
188     /** attribute of the chunk/table/cell tag */
189     public static final String JavaDoc BLUE = "blue";
190     
191     /** attribute of the chunk tag */
192     public static final String JavaDoc SUBSUPSCRIPT = Chunk.SUBSUPSCRIPT.toLowerCase();
193     
194     /** attribute of the chunk tag */
195     public static final String JavaDoc LOCALGOTO = Chunk.LOCALGOTO.toLowerCase();
196     
197     /** attribute of the chunk tag */
198     public static final String JavaDoc REMOTEGOTO = Chunk.REMOTEGOTO.toLowerCase();
199     
200     /** attribute of the chunk tag */
201     public static final String JavaDoc LOCALDESTINATION = Chunk.LOCALDESTINATION.toLowerCase();
202     
203     /** attribute of the chunk tag */
204     public static final String JavaDoc GENERICTAG = Chunk.GENERICTAG.toLowerCase();
205     
206     // tables/cells
207

208     /** the table tag */
209     public static final String JavaDoc TABLE = "table";
210     
211     /** the cell tag */
212     public static final String JavaDoc ROW = "row";
213     
214     /** the cell tag */
215     public static final String JavaDoc CELL = "cell";
216     
217     /** attribute of the table tag */
218     public static final String JavaDoc COLUMNS = "columns";
219     
220     /** attribute of the table tag */
221     public static final String JavaDoc LASTHEADERROW = "lastHeaderRow";
222     
223     /** attribute of the table tag */
224     public static final String JavaDoc CELLPADDING = "cellpadding";
225     
226     /** attribute of the table tag */
227     public static final String JavaDoc CELLSPACING = "cellspacing";
228     
229     /** attribute of the table tag */
230     public static final String JavaDoc OFFSET = "offset";
231     
232     /** attribute of the table tag */
233     public static final String JavaDoc WIDTHS = "widths";
234     
235     /** attribute of the table tag */
236     public static final String JavaDoc TABLEFITSPAGE = "tablefitspage";
237     
238     /** attribute of the table tag */
239     public static final String JavaDoc CELLSFITPAGE = "cellsfitpage";
240
241     /** attribute of the table tag */
242     public static final String JavaDoc CONVERT2PDFP = "convert2pdfp";
243             
244     /** attribute of the cell tag */
245     public static final String JavaDoc HORIZONTALALIGN = "horizontalalign";
246     
247     /** attribute of the cell tag */
248     public static final String JavaDoc VERTICALALIGN = "verticalalign";
249     
250     /** attribute of the cell tag */
251     public static final String JavaDoc COLSPAN = "colspan";
252     
253     /** attribute of the cell tag */
254     public static final String JavaDoc ROWSPAN = "rowspan";
255     
256     /** attribute of the cell tag */
257     public static final String JavaDoc HEADER = "header";
258     
259     /** attribute of the cell tag */
260     public static final String JavaDoc NOWRAP = "nowrap";
261     
262     /** attribute of the table/cell tag */
263     public static final String JavaDoc BORDERWIDTH = "borderwidth";
264     
265     /** attribute of the table/cell tag */
266     public static final String JavaDoc TOP = "top";
267     
268     /** attribute of the table/cell tag */
269     public static final String JavaDoc BOTTOM = "bottom";
270     
271     /** attribute of the table/cell tag */
272     public static final String JavaDoc WIDTH = "width";
273     
274     /** attribute of the table/cell tag */
275     public static final String JavaDoc BORDERCOLOR = "bordercolor";
276     
277     /** attribute of the table/cell tag */
278     public static final String JavaDoc BACKGROUNDCOLOR = "backgroundcolor";
279     
280     /** attribute of the table/cell tag */
281     public static final String JavaDoc BGRED = "bgred";
282     
283     /** attribute of the table/cell tag */
284     public static final String JavaDoc BGGREEN = "bggreen";
285     
286     /** attribute of the table/cell tag */
287     public static final String JavaDoc BGBLUE = "bgblue";
288     
289     /** attribute of the table/cell tag */
290     public static final String JavaDoc GRAYFILL = "grayfill";
291     
292     // Misc
293

294     /** the image tag */
295     public static final String JavaDoc IMAGE = "image";
296     
297     /** attribute of the image and annotation tag */
298     public static final String JavaDoc URL = "url";
299     
300     /** attribute of the image tag */
301     public static final String JavaDoc UNDERLYING = "underlying";
302     
303     /** attribute of the image tag */
304     public static final String JavaDoc TEXTWRAP = "textwrap";
305     
306     /** attribute of the image tag */
307     public static final String JavaDoc ALT = "alt";
308     
309     /** attribute of the image tag */
310     public static final String JavaDoc ABSOLUTEX = "absolutex";
311     
312     /** attribute of the image tag */
313     public static final String JavaDoc ABSOLUTEY = "absolutey";
314     
315     /** attribute of the image tag */
316     public static final String JavaDoc PLAINWIDTH = "plainwidth";
317     
318     /** attribute of the image tag */
319     public static final String JavaDoc PLAINHEIGHT = "plainheight";
320     
321     /** attribute of the image tag */
322     public static final String JavaDoc SCALEDWIDTH = "scaledwidth";
323     
324     /** attribute of the image tag */
325     public static final String JavaDoc SCALEDHEIGHT = "scaledheight";
326     
327     /** attribute of the image tag */
328     public static final String JavaDoc ROTATION = "rotation";
329     
330     /** the newpage tag */
331     public static final String JavaDoc NEWPAGE = "newpage";
332     
333     /** the newpage tag */
334     public static final String JavaDoc NEWLINE = "newline";
335     
336     /** the annotation tag */
337     public static final String JavaDoc ANNOTATION = "annotation";
338     
339     /** attribute of the annotation tag */
340     public static final String JavaDoc FILE = "file";
341     
342     /** attribute of the annotation tag */
343     public static final String JavaDoc DESTINATION = "destination";
344     
345     /** attribute of the annotation tag */
346     public static final String JavaDoc PAGE = "page";
347     
348     /** attribute of the annotation tag */
349     public static final String JavaDoc NAMED = "named";
350     
351     /** attribute of the annotation tag */
352     public static final String JavaDoc APPLICATION = "application";
353     
354     /** attribute of the annotation tag */
355     public static final String JavaDoc PARAMETERS = "parameters";
356     
357     /** attribute of the annotation tag */
358     public static final String JavaDoc OPERATION = "operation";
359     
360     /** attribute of the annotation tag */
361     public static final String JavaDoc DEFAULTDIR = "defaultdir";
362     
363     /** attribute of the annotation tag */
364     public static final String JavaDoc LLX = "llx";
365     
366     /** attribute of the annotation tag */
367     public static final String JavaDoc LLY = "lly";
368     
369     /** attribute of the annotation tag */
370     public static final String JavaDoc URX = "urx";
371     
372     /** attribute of the annotation tag */
373     public static final String JavaDoc URY = "ury";
374     
375     /** attribute of the annotation tag */
376     public static final String JavaDoc CONTENT = "content";
377     
378     // alignment attribute values
379

380     /** the possible value of an alignment attribute */
381     public static final String JavaDoc ALIGN_LEFT = "Left";
382     
383     /** the possible value of an alignment attribute */
384     public static final String JavaDoc ALIGN_CENTER = "Center";
385     
386     /** the possible value of an alignment attribute */
387     public static final String JavaDoc ALIGN_RIGHT = "Right";
388     
389     /** the possible value of an alignment attribute */
390     public static final String JavaDoc ALIGN_JUSTIFIED = "Justify";
391     
392     /** the possible value of an alignment attribute */
393     public static final String JavaDoc ALIGN_JUSTIFIED_ALL = "JustifyAll";
394     
395     /** the possible value of an alignment attribute */
396     public static final String JavaDoc ALIGN_TOP = "Top";
397     
398     /** the possible value of an alignment attribute */
399     public static final String JavaDoc ALIGN_MIDDLE = "Middle";
400     
401     /** the possible value of an alignment attribute */
402     public static final String JavaDoc ALIGN_BOTTOM = "Bottom";
403     
404     /** the possible value of an alignment attribute */
405     public static final String JavaDoc ALIGN_BASELINE = "Baseline";
406     
407     /** the possible value of an alignment attribute */
408     public static final String JavaDoc DEFAULT = "Default";
409     
410     /** the possible value of an alignment attribute */
411     public static final String JavaDoc UNKNOWN = "unknown";
412     
413     /** the possible value of an alignment attribute */
414     public static final String JavaDoc FONT = "font";
415     
416     /** the possible value of an alignment attribute */
417     public static final String JavaDoc SIZE = "size";
418     
419     /** the possible value of an alignment attribute */
420     public static final String JavaDoc STYLE = "fontstyle";
421     
422     /** the possible value of a tag */
423     public static final String JavaDoc HORIZONTALRULE = "horizontalrule";
424
425     /** the possible value of a tag */
426     public static final String JavaDoc PAGE_SIZE = "pagesize";
427
428     /** the possible value of a tag */
429     public static final String JavaDoc ORIENTATION = "orientation";
430     
431     /** a possible list attribute */
432     public static final String JavaDoc ALIGN_INDENTATION_ITEMS = "alignindent";
433     
434     /** a possible list attribute */
435     public static final String JavaDoc AUTO_INDENT_ITEMS = "autoindent";
436     
437     /** a possible list attribute */
438     public static final String JavaDoc LOWERCASE = "lowercase";
439     
440     // methods
441

442     /**
443      * Translates the alignment value to a String value.
444      *
445      * @param alignment the alignment value
446      * @return the translated value
447      */

448     public static String JavaDoc getAlignment(int alignment) {
449         switch(alignment) {
450             case Element.ALIGN_LEFT:
451                 return ALIGN_LEFT;
452             case Element.ALIGN_CENTER:
453                 return ALIGN_CENTER;
454             case Element.ALIGN_RIGHT:
455                 return ALIGN_RIGHT;
456             case Element.ALIGN_JUSTIFIED:
457             case Element.ALIGN_JUSTIFIED_ALL:
458                 return ALIGN_JUSTIFIED;
459             case Element.ALIGN_TOP:
460                 return ALIGN_TOP;
461             case Element.ALIGN_MIDDLE:
462                 return ALIGN_MIDDLE;
463             case Element.ALIGN_BOTTOM:
464                 return ALIGN_BOTTOM;
465             case Element.ALIGN_BASELINE:
466                 return ALIGN_BASELINE;
467                 default:
468                     return DEFAULT;
469         }
470     }
471     
472     /**
473      * Translates a String value to an alignment value.
474      * (written by Norman Richards, integrated into iText by Bruno)
475      * @param alignment a String (one of the ALIGN_ constants of this class)
476      * @return an alignment value (one of the ALIGN_ constants of the Element interface)
477      */

478     public static int alignmentValue(String JavaDoc alignment) {
479         if (alignment == null) return Element.ALIGN_UNDEFINED;
480         if (ALIGN_CENTER.equalsIgnoreCase(alignment)) {
481             return Element.ALIGN_CENTER;
482         }
483         if (ALIGN_LEFT.equalsIgnoreCase(alignment)) {
484             return Element.ALIGN_LEFT;
485         }
486         if (ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
487             return Element.ALIGN_RIGHT;
488         }
489         if (ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
490             return Element.ALIGN_JUSTIFIED;
491         }
492         if (ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
493             return Element.ALIGN_JUSTIFIED_ALL;
494         }
495         if (ALIGN_TOP.equalsIgnoreCase(alignment)) {
496             return Element.ALIGN_TOP;
497         }
498         if (ALIGN_MIDDLE.equalsIgnoreCase(alignment)) {
499             return Element.ALIGN_MIDDLE;
500         }
501         if (ALIGN_BOTTOM.equalsIgnoreCase(alignment)) {
502             return Element.ALIGN_BOTTOM;
503         }
504         if (ALIGN_BASELINE.equalsIgnoreCase(alignment)) {
505             return Element.ALIGN_BASELINE;
506         }
507         return Element.ALIGN_UNDEFINED;
508     }
509 }
Popular Tags