nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 2 | * Copyright (c) 2004, 2005 IBM Corporation and others. |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 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 |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 7 | * |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 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; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 12 | |
| 13 | |
| 14 | |
david_williams | 4ad020f | 2005-04-18 08:00:30 +0000 | [diff] [blame] | 15 | import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace; |
david_williams | c06c86f | 2005-03-18 18:23:41 +0000 | [diff] [blame] | 16 | import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; |
| 17 | import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup; |
| 18 | import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * for FRAMESET. |
| 22 | * ((FRAMESET | FRAME)+ & NOFRAMES?) |
| 23 | */ |
| 24 | final 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 | } |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 93 | } |