1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* $Id: PageSequenceWrapper.java 1296526 2012-03-03 00:18:45Z gadams $ */ 19 20 package org.apache.fop.fo.pagination; 21 22 import org.xml.sax.Locator; 23 24 import org.apache.fop.apps.FOPException; 25 import org.apache.fop.fo.FONode; 26 import org.apache.fop.fo.FObj; 27 import org.apache.fop.fo.PropertyList; 28 import org.apache.fop.fo.ValidationException; 29 30 /** 31 * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_page-sequence-wrapper"> 32 * <code>fo:page-sequence-wrapper</code></a> object, first introduced 33 * in the XSL 1.1 WD. 34 */ 35 public class PageSequenceWrapper extends FObj { 36 // The value of properties relevant for this FO 37 private String indexClass; 38 private String indexKey; 39 // End of property values 40 41 /** 42 * Create a PageSequenceWrapper instance that is a child of 43 * the given parent {@link FONode}. 44 * 45 * @param parent {@link FONode} that is the parent of this object 46 */ PageSequenceWrapper(FONode parent)47 public PageSequenceWrapper(FONode parent) { 48 super(parent); 49 } 50 51 /** {@inheritDoc} */ bind(PropertyList pList)52 public void bind(PropertyList pList) throws FOPException { 53 super.bind(pList); 54 indexClass = pList.get(PR_INDEX_CLASS).getString(); 55 indexKey = pList.get(PR_INDEX_KEY).getString(); 56 } 57 58 /** 59 * {@inheritDoc} 60 * <br>XSL/FOP: (bookmark+) 61 */ validateChildNode(Locator loc, String nsURI, String localName)62 protected void validateChildNode(Locator loc, String nsURI, String localName) 63 throws ValidationException { 64 if (FO_URI.equals(nsURI)) { 65 if (!(localName.equals("page-sequence") 66 || localName.equals("page-sequence-wrapper"))) { 67 invalidChildError(loc, nsURI, localName); 68 } 69 } 70 } 71 72 /** 73 * Get the value of the <code>index-class</code> property. 74 * @return the "index-class" property 75 */ getIndexClass()76 public String getIndexClass() { 77 return indexClass; 78 } 79 80 /** 81 * Get the value of the <code>index-key</code> property. 82 * @return the "index-key" property 83 */ getIndexKey()84 public String getIndexKey() { 85 return indexKey; 86 } 87 88 /** {@inheritDoc} */ getLocalName()89 public String getLocalName() { 90 return "page-sequence-wrapper"; 91 } 92 93 /** 94 * {@inheritDoc} 95 * @return {@link org.apache.fop.fo.Constants#FO_PAGE_SEQUENCE_WRAPPER} 96 */ getNameId()97 public int getNameId() { 98 return FO_PAGE_SEQUENCE_WRAPPER; 99 } 100 } 101 102