nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 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_williams | 5677702 | 2005-04-11 06:21:55 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.html.core.internal.contentmodel.chtml; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 12 | |
| 13 | |
| 14 | |
david_williams | c06c86f | 2005-03-18 18:23:41 +0000 | [diff] [blame] | 15 | import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; |
| 16 | import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup; |
| 17 | import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * OPTION container. |
| 21 | * (OPTION)+ |
| 22 | */ |
| 23 | final 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 | } |