blob: b1e0a5496ca4ee7506a8c8fd086f916b791b786a [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * 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
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams56777022005-04-11 06:21:55 +000011package org.eclipse.wst.html.core.internal.contentmodel.chtml;
nitind958d79a2004-11-23 19:23:00 +000012
13
14
david_williamsc06c86f2005-03-18 18:23:41 +000015import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
16import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup;
17import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
nitind958d79a2004-11-23 19:23:00 +000018
19/**
20 * OPTION container.
21 * (OPTION)+
22 */
23final class CtdOptionContainer extends ComplexTypeDefinition {
24
25 /**
26 * @param elementCollection ElementCollection
27 */
28 public CtdOptionContainer(ElementCollection elementCollection) {
29 super(elementCollection);
30 primaryCandidateName = CHTMLNamespace.ElementName.OPTION;
31 }
32
33 /**
34 * (OPTION)+.
35 */
36 protected void createContent() {
37 if (content != null)
38 return; // already created.
39 if (collection == null)
40 return;
41
42 // ( )+
43 content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
44 // OPTION
45 CMNode dec = collection.getNamedItem(CHTMLNamespace.ElementName.OPTION);
46 if (dec != null)
47 content.appendChild(dec);
48 }
49
50 /**
51 * (OPTION)+
52 * @return int; Should be one of ANY, EMPTY, ELEMENT, MIXED, PCDATA, CDATA,
53 * those are defined in CMElementDeclaration.
54 */
55 public int getContentType() {
56 return CMElementDeclaration.ELEMENT;
57 }
58
59 /**
60 * Name of complex type definition.
61 * Each singleton must know its own name.
62 * All names should be defined in
63 * {@link <code>ComplexTypeDefinitionFactory</code>} as constants.<br>
64 * @return java.lang.String
65 */
66 public String getTypeName() {
67 return ComplexTypeDefinitionFactory.CTYPE_OPTION_CONTAINER;
68 }
69}