001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /* $Id: TableCaption.java 554104 2007-07-07 01:07:10Z adelmelle $ */
019:
020: package org.apache.fop.fo.flow;
021:
022: // XML
023: import org.xml.sax.Locator;
024:
025: import org.apache.fop.apps.FOPException;
026: import org.apache.fop.datatypes.Length;
027: import org.apache.fop.fo.FONode;
028: import org.apache.fop.fo.FObj;
029: import org.apache.fop.fo.PropertyList;
030: import org.apache.fop.fo.ValidationException;
031: import org.apache.fop.fo.properties.CommonAccessibility;
032: import org.apache.fop.fo.properties.CommonAural;
033: import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
034: import org.apache.fop.fo.properties.CommonRelativePosition;
035: import org.apache.fop.fo.properties.KeepProperty;
036: import org.apache.fop.fo.properties.LengthRangeProperty;
037:
038: /**
039: * Class modelling the fo:table-caption object.
040: * @todo needs implementation
041: */
042: public class TableCaption extends FObj {
043: // The value of properties relevant for fo:table-caption.
044: private CommonAccessibility commonAccessibility;
045: private CommonBorderPaddingBackground commonBorderPaddingBackground;
046: // Unused but valid items, commented out for performance:
047: // private CommonAural commonAural;
048: // private CommonRelativePosition commonRelativePosition;
049: // private LengthRangeProperty blockProgressionDimension;
050: // private Length height;
051: // private LengthRangeProperty inlineProgressionDimension;
052: // private int intrusionDisplace;
053: // private KeepProperty keepTogether;
054: // private Length width;
055: // End of property values
056:
057: /** used for FO validation */
058: private boolean blockItemFound = false;
059:
060: static boolean notImplementedWarningGiven = false;
061:
062: /**
063: * @param parent FONode that is the parent of this object
064: */
065: public TableCaption(FONode parent) {
066: super (parent);
067:
068: if (!notImplementedWarningGiven) {
069: log.warn("fo:table-caption is not yet implemented.");
070: notImplementedWarningGiven = true;
071: }
072: }
073:
074: /**
075: * @see org.apache.fop.fo.FObj#bind(PropertyList)
076: */
077: public void bind(PropertyList pList) throws FOPException {
078: super .bind(pList);
079: commonAccessibility = pList.getAccessibilityProps();
080: commonBorderPaddingBackground = pList
081: .getBorderPaddingBackgroundProps();
082: }
083:
084: /**
085: * @return the Common Border, Padding, and Background Properties.
086: */
087: public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
088: return commonBorderPaddingBackground;
089: }
090:
091: /**
092: * Make sure content model satisfied, if so then tell the
093: * FOEventHandler that we are at the end of the flow.
094: * @see org.apache.fop.fo.FONode#endOfNode
095: */
096: protected void endOfNode() throws FOPException {
097: if (firstChild == null) {
098: missingChildElementError("marker* (%block;)");
099: }
100: }
101:
102: /**
103: * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
104: * XSL Content Model: marker* (%block;)
105: */
106: protected void validateChildNode(Locator loc, String nsURI,
107: String localName) throws ValidationException {
108: if (FO_URI.equals(nsURI) && localName.equals("marker")) {
109: if (blockItemFound) {
110: nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
111: }
112: } else if (!isBlockItem(nsURI, localName)) {
113: invalidChildError(loc, nsURI, localName);
114: } else {
115: blockItemFound = true;
116: }
117: }
118:
119: /** @see org.apache.fop.fo.FONode#getLocalName() */
120: public String getLocalName() {
121: return "table-caption";
122: }
123:
124: /**
125: * @see org.apache.fop.fo.FObj#getNameId()
126: */
127: public int getNameId() {
128: return FO_TABLE_CAPTION;
129: }
130: }
|