KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > FOElementMapping


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id: FOElementMapping.java 442282 2006-09-11 18:24:35Z jeremias $ */
19
20 package org.apache.fop.fo;
21
22 // Java
23
import java.util.HashMap JavaDoc;
24
25 import org.apache.fop.util.QName;
26
27 /**
28  * Element mapping class for all XSL-FO elements.
29  */

30 public class FOElementMapping extends ElementMapping {
31     
32     /** The XSL-FO namespace URI */
33     public static final String JavaDoc URI = "http://www.w3.org/1999/XSL/Format";
34
35     /**
36      * Basic constructor; inititializes the namespace URI for the fo: namespace
37      */

38     public FOElementMapping() {
39         namespaceURI = URI;
40     }
41
42     /**
43      * Initializes the collection of valid objects for the fo: namespace
44      */

45     protected void initialize() {
46         if (foObjs == null) {
47             foObjs = new HashMap JavaDoc();
48
49             // Declarations and Pagination and Layout Formatting Objects
50
foObjs.put("root", new RootMaker());
51             foObjs.put("declarations", new DeclarationsMaker());
52             foObjs.put("color-profile", new ColorProfileMaker());
53             foObjs.put("bookmark-tree", new BookmarkTreeMaker());
54             foObjs.put("bookmark", new BookmarkMaker());
55             foObjs.put("bookmark-title", new BookmarkTitleMaker());
56 // foObjs.put("page-sequence-wrapper", new PageSequenceWrapperMaker());
57
foObjs.put("page-sequence", new PageSequenceMaker());
58             foObjs.put("layout-master-set", new LayoutMasterSetMaker());
59             foObjs.put("page-sequence-master",
60                            new PageSequenceMasterMaker());
61             foObjs.put("single-page-master-reference",
62                            new SinglePageMasterReferenceMaker());
63             foObjs.put("repeatable-page-master-reference",
64                            new RepeatablePageMasterReferenceMaker());
65             foObjs.put("repeatable-page-master-alternatives",
66                            new RepeatablePageMasterAlternativesMaker());
67             foObjs.put("conditional-page-master-reference",
68                            new ConditionalPageMasterReferenceMaker());
69             foObjs.put("simple-page-master",
70                            new SimplePageMasterMaker());
71             foObjs.put("region-body", new RegionBodyMaker());
72             foObjs.put("region-before", new RegionBeforeMaker());
73             foObjs.put("region-after", new RegionAfterMaker());
74             foObjs.put("region-start", new RegionStartMaker());
75             foObjs.put("region-end", new RegionEndMaker());
76             foObjs.put("flow", new FlowMaker());
77             foObjs.put("static-content", new StaticContentMaker());
78             foObjs.put("title", new TitleMaker());
79
80             // Block-level Formatting Objects
81
foObjs.put("block", new BlockMaker());
82             foObjs.put("block-container", new BlockContainerMaker());
83
84             // Inline-level Formatting Objects
85
foObjs.put("bidi-override", new BidiOverrideMaker());
86             foObjs.put("character",
87                            new CharacterMaker());
88             foObjs.put("initial-property-set",
89                            new InitialPropertySetMaker());
90             foObjs.put("external-graphic", new ExternalGraphicMaker());
91             foObjs.put("instream-foreign-object",
92                            new InstreamForeignObjectMaker());
93             foObjs.put("inline", new InlineMaker());
94             foObjs.put("inline-container", new InlineContainerMaker());
95             foObjs.put("leader", new LeaderMaker());
96             foObjs.put("page-number", new PageNumberMaker());
97             foObjs.put("page-number-citation",
98                            new PageNumberCitationMaker());
99             foObjs.put("page-number-citation-last",
100                     new PageNumberCitationLastMaker());
101
102             // Formatting Objects for Tables
103
foObjs.put("table-and-caption", new TableAndCaptionMaker());
104             foObjs.put("table", new TableMaker());
105             foObjs.put("table-column", new TableColumnMaker());
106             foObjs.put("table-caption", new TableCaptionMaker());
107             foObjs.put("table-header", new TableHeaderMaker());
108             foObjs.put("table-footer", new TableFooterMaker());
109             foObjs.put("table-body", new TableBodyMaker());
110             foObjs.put("table-row", new TableRowMaker());
111             foObjs.put("table-cell", new TableCellMaker());
112
113             // Formatting Objects for Lists
114
foObjs.put("list-block", new ListBlockMaker());
115             foObjs.put("list-item", new ListItemMaker());
116             foObjs.put("list-item-body", new ListItemBodyMaker());
117             foObjs.put("list-item-label", new ListItemLabelMaker());
118
119             // Dynamic Effects: Link and Multi Formatting Objects
120
foObjs.put("basic-link", new BasicLinkMaker());
121             foObjs.put("multi-switch", new MultiSwitchMaker());
122             foObjs.put("multi-case", new MultiCaseMaker());
123             foObjs.put("multi-toggle", new MultiToggleMaker());
124             foObjs.put("multi-properties", new MultiPropertiesMaker());
125             foObjs.put("multi-property-set",
126                            new MultiPropertySetMaker());
127
128             // Out-of-Line Formatting Objects
129
foObjs.put("float",
130                            new FloatMaker());
131             foObjs.put("footnote", new FootnoteMaker());
132             foObjs.put("footnote-body", new FootnoteBodyMaker());
133
134             // Other Formatting Objects
135
foObjs.put("wrapper", new WrapperMaker());
136             foObjs.put("marker", new MarkerMaker());
137             foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
138         }
139     }
140
141     /** @see org.apache.fop.fo.ElementMapping#getStandardPrefix() */
142     public String JavaDoc getStandardPrefix() {
143         return "fo";
144     }
145     
146     /** @see org.apache.fop.fo.ElementMapping#isAttributeProperty(org.apache.fop.util.QName) */
147     public boolean isAttributeProperty(QName attributeName) {
148         return true; //All XSL-FO attributes are to be converted to properties.
149
}
150     
151     static class RootMaker extends ElementMapping.Maker {
152         public FONode make(FONode parent) {
153             return new org.apache.fop.fo.pagination.Root(parent);
154         }
155     }
156
157     static class DeclarationsMaker extends ElementMapping.Maker {
158         public FONode make(FONode parent) {
159             return new org.apache.fop.fo.pagination.Declarations(parent);
160         }
161     }
162
163     static class ColorProfileMaker extends ElementMapping.Maker {
164         public FONode make(FONode parent) {
165             return new org.apache.fop.fo.pagination.ColorProfile(parent);
166         }
167     }
168
169     static class BookmarkTreeMaker extends ElementMapping.Maker {
170         public FONode make(FONode parent) {
171             return new org.apache.fop.fo.pagination.bookmarks.BookmarkTree(parent);
172         }
173     }
174
175     static class BookmarkMaker extends ElementMapping.Maker {
176         public FONode make(FONode parent) {
177             return new org.apache.fop.fo.pagination.bookmarks.Bookmark(parent);
178         }
179     }
180
181     static class BookmarkTitleMaker extends ElementMapping.Maker {
182         public FONode make(FONode parent) {
183             return new org.apache.fop.fo.pagination.bookmarks.BookmarkTitle(parent);
184         }
185     }
186
187     static class PageSequenceWrapperMaker extends ElementMapping.Maker {
188         public FONode make(FONode parent) {
189             return new org.apache.fop.fo.pagination.PageSequenceWrapper(parent);
190         }
191     }
192
193     static class PageSequenceMaker extends ElementMapping.Maker {
194         public FONode make(FONode parent) {
195             return new org.apache.fop.fo.pagination.PageSequence(parent);
196         }
197     }
198
199     static class LayoutMasterSetMaker extends ElementMapping.Maker {
200         public FONode make(FONode parent) {
201             return new org.apache.fop.fo.pagination.LayoutMasterSet(parent);
202         }
203     }
204
205     static class PageSequenceMasterMaker extends ElementMapping.Maker {
206         public FONode make(FONode parent) {
207             return new org.apache.fop.fo.pagination.PageSequenceMaster(parent);
208         }
209     }
210
211     static class SinglePageMasterReferenceMaker extends ElementMapping.Maker {
212         public FONode make(FONode parent) {
213             return new org.apache.fop.fo.pagination.SinglePageMasterReference(parent);
214         }
215     }
216
217     static class RepeatablePageMasterReferenceMaker extends ElementMapping.Maker {
218         public FONode make(FONode parent) {
219             return new org.apache.fop.fo.pagination.RepeatablePageMasterReference(parent);
220         }
221     }
222
223     static class RepeatablePageMasterAlternativesMaker extends ElementMapping.Maker {
224         public FONode make(FONode parent) {
225             return new org.apache.fop.fo.pagination.RepeatablePageMasterAlternatives(parent);
226         }
227     }
228
229     static class ConditionalPageMasterReferenceMaker extends ElementMapping.Maker {
230         public FONode make(FONode parent) {
231             return new org.apache.fop.fo.pagination.ConditionalPageMasterReference(parent);
232         }
233     }
234
235     static class SimplePageMasterMaker extends ElementMapping.Maker {
236         public FONode make(FONode parent) {
237             return new org.apache.fop.fo.pagination.SimplePageMaster(parent);
238         }
239     }
240
241     static class RegionBodyMaker extends ElementMapping.Maker {
242         public FONode make(FONode parent) {
243             return new org.apache.fop.fo.pagination.RegionBody(parent);
244         }
245     }
246
247     static class RegionBeforeMaker extends ElementMapping.Maker {
248         public FONode make(FONode parent) {
249             return new org.apache.fop.fo.pagination.RegionBefore(parent);
250         }
251     }
252
253     static class RegionAfterMaker extends ElementMapping.Maker {
254         public FONode make(FONode parent) {
255             return new org.apache.fop.fo.pagination.RegionAfter(parent);
256         }
257     }
258
259     static class RegionStartMaker extends ElementMapping.Maker {
260         public FONode make(FONode parent) {
261             return new org.apache.fop.fo.pagination.RegionStart(parent);
262         }
263     }
264
265     static class RegionEndMaker extends ElementMapping.Maker {
266         public FONode make(FONode parent) {
267             return new org.apache.fop.fo.pagination.RegionEnd(parent);
268         }
269     }
270
271     static class FlowMaker extends ElementMapping.Maker {
272         public FONode make(FONode parent) {
273             return new org.apache.fop.fo.pagination.Flow(parent);
274         }
275     }
276
277     static class StaticContentMaker extends ElementMapping.Maker {
278         public FONode make(FONode parent) {
279             return new org.apache.fop.fo.pagination.StaticContent(parent);
280         }
281     }
282
283     static class TitleMaker extends ElementMapping.Maker {
284         public FONode make(FONode parent) {
285             return new org.apache.fop.fo.pagination.Title(parent);
286         }
287     }
288
289     static class BlockMaker extends ElementMapping.Maker {
290         public FONode make(FONode parent) {
291             return new org.apache.fop.fo.flow.Block(parent);
292         }
293     }
294
295     static class BlockContainerMaker extends ElementMapping.Maker {
296         public FONode make(FONode parent) {
297             return new org.apache.fop.fo.flow.BlockContainer(parent);
298         }
299     }
300
301     static class BidiOverrideMaker extends ElementMapping.Maker {
302         public FONode make(FONode parent) {
303             return new org.apache.fop.fo.flow.BidiOverride(parent);
304         }
305     }
306
307     static class CharacterMaker extends ElementMapping.Maker {
308         public FONode make(FONode parent) {
309             return new org.apache.fop.fo.flow.Character(parent);
310         }
311     }
312
313     static class InitialPropertySetMaker extends ElementMapping.Maker {
314         public FONode make(FONode parent) {
315             return new org.apache.fop.fo.flow.InitialPropertySet(parent);
316         }
317     }
318
319     static class ExternalGraphicMaker extends ElementMapping.Maker {
320         public FONode make(FONode parent) {
321             return new org.apache.fop.fo.flow.ExternalGraphic(parent);
322         }
323     }
324
325     static class InstreamForeignObjectMaker extends ElementMapping.Maker {
326         public FONode make(FONode parent) {
327             return new org.apache.fop.fo.flow.InstreamForeignObject(parent);
328         }
329     }
330
331     static class InlineMaker extends ElementMapping.Maker {
332         public FONode make(FONode parent) {
333             return new org.apache.fop.fo.flow.Inline(parent);
334         }
335     }
336
337     static class InlineContainerMaker extends ElementMapping.Maker {
338         public FONode make(FONode parent) {
339             return new org.apache.fop.fo.flow.InlineContainer(parent);
340         }
341     }
342
343     static class LeaderMaker extends ElementMapping.Maker {
344         public FONode make(FONode parent) {
345             return new org.apache.fop.fo.flow.Leader(parent);
346         }
347     }
348
349     static class PageNumberMaker extends ElementMapping.Maker {
350         public FONode make(FONode parent) {
351             return new org.apache.fop.fo.flow.PageNumber(parent);
352         }
353     }
354
355     static class PageNumberCitationMaker extends ElementMapping.Maker {
356         public FONode make(FONode parent) {
357             return new org.apache.fop.fo.flow.PageNumberCitation(parent);
358         }
359     }
360
361     static class PageNumberCitationLastMaker extends ElementMapping.Maker {
362         public FONode make(FONode parent) {
363             return new org.apache.fop.fo.flow.PageNumberCitationLast(parent);
364         }
365     }
366     
367     static class TableAndCaptionMaker extends ElementMapping.Maker {
368         public FONode make(FONode parent) {
369             return new org.apache.fop.fo.flow.TableAndCaption(parent);
370         }
371     }
372
373     static class TableMaker extends ElementMapping.Maker {
374         public FONode make(FONode parent) {
375             return new org.apache.fop.fo.flow.Table(parent);
376         }
377     }
378
379     static class TableColumnMaker extends ElementMapping.Maker {
380         public FONode make(FONode parent) {
381             return new org.apache.fop.fo.flow.TableColumn(parent);
382         }
383     }
384
385     static class TableCaptionMaker extends ElementMapping.Maker {
386         public FONode make(FONode parent) {
387             return new org.apache.fop.fo.flow.TableCaption(parent);
388         }
389     }
390
391     static class TableBodyMaker extends ElementMapping.Maker {
392         public FONode make(FONode parent) {
393             return new org.apache.fop.fo.flow.TableBody(parent);
394         }
395     }
396
397     static class TableHeaderMaker extends ElementMapping.Maker {
398         public FONode make(FONode parent) {
399             return new org.apache.fop.fo.flow.TableHeader(parent);
400         }
401     }
402
403     static class TableFooterMaker extends ElementMapping.Maker {
404         public FONode make(FONode parent) {
405             return new org.apache.fop.fo.flow.TableFooter(parent);
406         }
407     }
408
409     static class TableRowMaker extends ElementMapping.Maker {
410         public FONode make(FONode parent) {
411             return new org.apache.fop.fo.flow.TableRow(parent);
412         }
413     }
414
415     static class TableCellMaker extends ElementMapping.Maker {
416         public FONode make(FONode parent) {
417             return new org.apache.fop.fo.flow.TableCell(parent);
418         }
419     }
420
421     static class ListBlockMaker extends ElementMapping.Maker {
422         public FONode make(FONode parent) {
423             return new org.apache.fop.fo.flow.ListBlock(parent);
424         }
425     }
426
427     static class ListItemMaker extends ElementMapping.Maker {
428         public FONode make(FONode parent) {
429             return new org.apache.fop.fo.flow.ListItem(parent);
430         }
431     }
432
433     static class ListItemBodyMaker extends ElementMapping.Maker {
434         public FONode make(FONode parent) {
435             return new org.apache.fop.fo.flow.ListItemBody(parent);
436         }
437     }
438
439     static class ListItemLabelMaker extends ElementMapping.Maker {
440         public FONode make(FONode parent) {
441             return new org.apache.fop.fo.flow.ListItemLabel(parent);
442         }
443     }
444
445     static class BasicLinkMaker extends ElementMapping.Maker {
446         public FONode make(FONode parent) {
447             return new org.apache.fop.fo.flow.BasicLink(parent);
448         }
449     }
450
451     static class MultiSwitchMaker extends ElementMapping.Maker {
452         public FONode make(FONode parent) {
453             return new org.apache.fop.fo.flow.MultiSwitch(parent);
454         }
455     }
456
457     static class MultiCaseMaker extends ElementMapping.Maker {
458         public FONode make(FONode parent) {
459             return new org.apache.fop.fo.flow.MultiCase(parent);
460         }
461     }
462
463     static class MultiToggleMaker extends ElementMapping.Maker {
464         public FONode make(FONode parent) {
465             return new org.apache.fop.fo.flow.MultiToggle(parent);
466         }
467     }
468
469     static class MultiPropertiesMaker extends ElementMapping.Maker {
470         public FONode make(FONode parent) {
471             return new org.apache.fop.fo.flow.MultiProperties(parent);
472         }
473     }
474
475     static class MultiPropertySetMaker extends ElementMapping.Maker {
476         public FONode make(FONode parent) {
477             return new org.apache.fop.fo.flow.MultiPropertySet(parent);
478         }
479     }
480
481     static class FloatMaker extends ElementMapping.Maker {
482         public FONode make(FONode parent) {
483             return new org.apache.fop.fo.flow.Float(parent);
484         }
485     }
486
487     static class FootnoteMaker extends ElementMapping.Maker {
488         public FONode make(FONode parent) {
489             return new org.apache.fop.fo.flow.Footnote(parent);
490         }
491     }
492
493     static class FootnoteBodyMaker extends ElementMapping.Maker {
494         public FONode make(FONode parent) {
495             return new org.apache.fop.fo.flow.FootnoteBody(parent);
496         }
497     }
498
499     static class WrapperMaker extends ElementMapping.Maker {
500         public FONode make(FONode parent) {
501             return new org.apache.fop.fo.flow.Wrapper(parent);
502         }
503     }
504
505     static class MarkerMaker extends ElementMapping.Maker {
506         public FONode make(FONode parent) {
507             return new org.apache.fop.fo.flow.Marker(parent);
508         }
509     }
510
511     static class RetrieveMarkerMaker extends ElementMapping.Maker {
512         public FONode make(FONode parent) {
513             return new org.apache.fop.fo.flow.RetrieveMarker(parent);
514         }
515     }
516 }
517
Popular Tags