blob: 03da4b4128a3d03af5b567937ab1043adc5ba41e [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
amywu923ee602007-04-10 18:32:07 +00002 * Copyright (c) 2004, 2005 IBM Corporation and others.
nitind958d79a2004-11-23 19:23:00 +00003 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
amywu923ee602007-04-10 18:32:07 +00007 *
nitind958d79a2004-11-23 19:23:00 +00008 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams56777022005-04-11 06:21:55 +000011package org.eclipse.wst.html.core.internal.contentmodel;
nitind958d79a2004-11-23 19:23:00 +000012
13
14
david_williams4ad020f2005-04-18 08:00:30 +000015import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace;
david_williamsc06c86f2005-03-18 18:23:41 +000016import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
17import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup;
18import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
nitind958d79a2004-11-23 19:23:00 +000019
20/**
21 * for FRAMESET.
22 * ((FRAMESET | FRAME)+ & NOFRAMES?)
23 */
24final class CtdFrameset extends ComplexTypeDefinition {
25
26 /**
27 * @param elementCollection ElementCollection
28 */
29 public CtdFrameset(ElementCollection elementCollection) {
30 super(elementCollection);
31 primaryCandidateName = HTML40Namespace.ElementName.FRAME;
32 }
33
34 /**
35 * ((FRAMESET | FRAME)+ & NOFRAMES?).
36 * --> ((FRAMESET | FRAME)+ & (NOFRAMES)?)
37 */
38 protected void createContent() {
39 if (content != null)
40 return; // already created.
41 if (collection == null)
42 return;
43
44 // ( & )
45 content = new CMGroupImpl(CMGroup.ALL, 1, 1);
46
47 // ( | )+
48 CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
49 if (group == null)
50 return;
51 content.appendChild(group);
52
53 // FRAMESET
54 CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAMESET);
55 if (dec != null)
56 group.appendChild(dec);
57 // FRAME
58 dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAME);
59 if (dec != null)
60 group.appendChild(dec);
61
62 // ( )?
63 group = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
64 if (group == null)
65 return;
66 content.appendChild(group);
67
68 // NOFRAMES
69 dec = collection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
70 if (dec != null)
71 group.appendChild(dec);
72 }
73
74 /**
75 * ((FRAMESET | FRAME)+ & NOFRAMES?)
76 * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
77 * those are defined in CMElementDeclaration.
78 */
79 public int getContentType() {
80 return CMElementDeclaration.ELEMENT;
81 }
82
83 /**
84 * Name of complex type definition.
85 * Each singleton must know its own name.
86 * All names should be defined in
87 * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
88 * @return java.lang.String
89 */
90 public String getTypeName() {
91 return ComplexTypeDefinitionFactory.CTYPE_FRAMESET;
92 }
amywu923ee602007-04-10 18:32:07 +000093}