/******************************************************************************* * Copyright (c) 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.wst.html.core.contentmodel; import java.util.Collection; import java.util.Iterator; import java.util.Vector; import org.eclipse.wst.common.contentmodel.CMNamedNodeMap; import org.eclipse.wst.html.core.HTML40Namespace; /** * P. */ final class HedP extends HedInlineContainer { private static Collection terminators = null; /** */ public HedP(ElementCollection collection) { super(HTML40Namespace.ElementName.P, collection); correctionType = CORRECT_EMPTY; layoutType = LAYOUT_BLOCK; omitType = OMIT_END; } /** * Create all attribute declarations. * This method is called once in the constructor of the super class. * The P element may have the following attributes: * * * * * * * * * * * * *
NAMETYPEUSAGEDEFAULT (INITIAL) VALUEMEMO
%attrs;----
%align;----
*

%align; means align (left|center|right|justify) #IMPLIED. * Unfortunately, this align is different from one in * IMG or TABLE. So, the attribute declaration * of align should be localy created and it shouldn't be registered * in a HCMDocImpl instance.

*

However, %align is used in sevaral times. I wouldn't write same code * in many times. So, I add a new utility method into CMUtil * to create the attribute declaration.

*
* @see com.ibm.sed.contentmodel.html.HTMLElemDeclImpl */ protected void createAttributeDeclarations() { if (attributes != null) return; // already created. if (attributeCollection == null) return; // fatal attributes = new CMNamedNodeMapImpl(); // %attrs; attributeCollection.getAttrs(attributes); // align HTMLAttrDeclImpl adec = AttributeCollection.createAlignForParagraph(); attributes.putNamedItem(HTML40Namespace.ATTR_NAME_ALIGN, adec); } /** */ public CMNamedNodeMap getProhibitedAncestors() { if (prohibitedAncestors != null) return prohibitedAncestors; String[] names = {HTML40Namespace.ElementName.DIR, HTML40Namespace.ElementName.MENU}; prohibitedAncestors = elementCollection.getDeclarations(names); return prohibitedAncestors; } /** * Return names of terminators. * P has terminators. * @return java.util.Iterator */ protected Iterator getTerminators() { if (terminators != null) return terminators.iterator(); //<