01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26: package com.sun.perseus.model;
27:
28: import com.sun.perseus.util.SVGConstants;
29:
30: import com.sun.perseus.j2d.RenderGraphics;
31:
32: /**
33: * <code>Defs</code> are used as placeholders where proxied <tt>ModelNode</tt>
34: * can be stored for reference by <tt>ElementNodeProxy</tt> instances.
35: * <br />
36: * Note that according to the SVG 1.1 DTD, <tt><defs></tt> should be
37: * <tt>StructureNode</tt>.
38: * However, we should not apply <tt>GraphicsNode</tt> and
39: * <tt>TextNode</tt> properties on <tt><defs></tt> as it
40: * is useless: <tt><defs></tt> content is never rendered directly,
41: * so properties set on defs are _never_ inherited by <tt><defs></tt>
42: * children. Therefore, having defs support graphics and text properties is
43: * an oversight in the SVG Tiny specification.
44: *
45: * Note: There is a JDTS test failure when defs extends ElementNode instead of
46: * StructureNode. This is caused by the fact that in that case it breaks
47: * an inheritance chain from a child to defs's parent.
48: *
49: * @version $Id: Defs.java,v 1.3 2006/04/21 06:36:16 st125089 Exp $
50: */
51: public class Defs extends StructureNode {
52: /**
53: * Constructor.
54: *
55: * @param ownerDocument this element's owner <code>DocumentNode</code>
56: */
57: public Defs(final DocumentNode ownerDocument) {
58: super (ownerDocument);
59:
60: // do not render this node
61: canRenderState |= CAN_RENDER_RENDERABLE_BIT;
62: }
63:
64: /**
65: * @return the SVGConstants.SVG_DEFS_TAG value
66: */
67: public String getLocalName() {
68: return SVGConstants.SVG_DEFS_TAG;
69: }
70:
71: /**
72: * Used by <code>DocumentNode</code> to create a new instance from
73: * a prototype <code>Defs</code>.
74: *
75: * @param doc the <code>DocumentNode</code> for which a new node is
76: * should be created.
77: * @return a new <code>DefsNode</code> for the requested document.
78: */
79: public ElementNode newInstance(final DocumentNode doc) {
80: return new Defs(doc);
81: }
82: }
|