001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026: package com.sun.perseus.builder;
027:
028: import com.sun.perseus.model.Anchor;
029: import com.sun.perseus.model.Animate;
030: import com.sun.perseus.model.AnimateMotion;
031: import com.sun.perseus.model.AnimateTransform; // import com.sun.perseus.model.Audio;
032: import com.sun.perseus.model.Defs;
033: import com.sun.perseus.model.DocumentNode;
034: import com.sun.perseus.model.Ellipse;
035: import com.sun.perseus.model.Font;
036: import com.sun.perseus.model.FontFace;
037: import com.sun.perseus.model.Glyph;
038: import com.sun.perseus.model.Group;
039: import com.sun.perseus.model.HKern;
040: import com.sun.perseus.model.ImageNode;
041: import com.sun.perseus.model.Line;
042: import com.sun.perseus.model.LinearGradient;
043: import com.sun.perseus.model.RadialGradient;
044: import com.sun.perseus.model.Rect;
045: import com.sun.perseus.model.Set;
046: import com.sun.perseus.model.SolidColor;
047: import com.sun.perseus.model.SVG;
048: import com.sun.perseus.model.ShapeNode;
049: import com.sun.perseus.model.Stop;
050: import com.sun.perseus.model.StrictElement;
051: import com.sun.perseus.model.Switch;
052: import com.sun.perseus.model.Symbol;
053: import com.sun.perseus.model.Text;
054: import com.sun.perseus.model.TimedElementNode; // import com.sun.perseus.model.TSpan;
055: import com.sun.perseus.model.Use;
056:
057: import com.sun.perseus.util.SVGConstants;
058:
059: import java.util.Vector;
060:
061: /**
062: * This ModelFactory implementation is initialized with all the handlers
063: * necessary to handle SVG Tiny 1.1 content.
064: *
065: * @version $Id: SVGTinyModelFactory.java,v 1.5 2006/04/21 06:36:12 st125089 Exp $
066: */
067: public class SVGTinyModelFactory {
068: /**
069: * List of required attributes for foreignObject.
070: */
071: public static final String[] FOREIGN_OBJECT_REQUIRED_ATTRIBUTES = {
072: SVGConstants.SVG_WIDTH_ATTRIBUTE,
073: SVGConstants.SVG_HEIGHT_ATTRIBUTE };
074:
075: /**
076: * @param doc the document for which the prototypes are built.
077: * @return a Vector with all the prototypes for SVG Tiny content.
078: */
079: public static Vector getPrototypes(final DocumentNode doc) {
080: Vector v = new Vector();
081:
082: //
083: // == Structure Module =================================================
084: //
085: v.addElement(new SVG(doc));
086: v.addElement(new Group(doc));
087: v.addElement(new Use(doc));
088: v.addElement(new Defs(doc));
089: v.addElement(new ImageNode(doc));
090: v.addElement(new Switch(doc));
091: v.addElement(new Symbol(doc));
092:
093: //
094: // == Shape Module =====================================================
095: //
096: v.addElement(new ShapeNode(doc, SVGConstants.SVG_PATH_TAG));
097: v.addElement(new Rect(doc));
098: v.addElement(new Line(doc));
099: v.addElement(new Ellipse(doc));
100: v.addElement(new Ellipse(doc, true)); // <circle>
101: v.addElement(new ShapeNode(doc, SVGConstants.SVG_POLYGON_TAG));
102: v.addElement(new ShapeNode(doc, SVGConstants.SVG_POLYLINE_TAG));
103:
104: //
105: // == Text Module ======================================================
106: //
107: v.addElement(new Text(doc));
108: // v.addElement(new TSpan(doc));
109:
110: //
111: // == Font Module ======================================================
112: //
113: v.addElement(new Font(doc));
114: v.addElement(new FontFace(doc));
115: v.addElement(new Glyph(doc));
116: v
117: .addElement(new Glyph(doc,
118: SVGConstants.SVG_MISSING_GLYPH_TAG));
119: v.addElement(new HKern(doc));
120:
121: //
122: // == Hyperlinking Module ==============================================
123: //
124: v.addElement(new Anchor(doc));
125:
126: //
127: // == Animation Module =================================================
128: //
129: v.addElement(new Animate(doc));
130: v.addElement(new AnimateMotion(doc));
131: v.addElement(new Set(doc));
132: v.addElement(new AnimateTransform(doc));
133: v.addElement(new Animate(doc,
134: SVGConstants.SVG_ANIMATE_COLOR_TAG));
135:
136: //
137: // == SolidColor Module ================================================
138: //
139: v.addElement(new SolidColor(doc));
140:
141: //
142: // == Gradient Module ================================================
143: //
144: v.addElement(new LinearGradient(doc));
145: v.addElement(new RadialGradient(doc));
146: v.addElement(new Stop(doc));
147:
148: //
149: // == Extensibility Module =========================================
150: //
151: v.addElement(new StrictElement(doc,
152: SVGConstants.SVG_FOREIGN_OBJECT_TAG,
153: SVGConstants.SVG_NAMESPACE_URI,
154: FOREIGN_OBJECT_REQUIRED_ATTRIBUTES, null));
155: //
156: // == Medial Module ================================================
157: //
158: // v.addElement(new Audio(doc));
159:
160: return v;
161: }
162: }
|