You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BookmarkTitle.java 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. /* $Id $ */
  18. package org.apache.fop.fo.pagination.bookmarks;
  19. import org.xml.sax.Locator;
  20. import org.apache.fop.fo.FObj;
  21. import org.apache.fop.fo.FONode;
  22. import org.apache.fop.fo.PropertyList;
  23. import org.apache.fop.fo.ValidationException;
  24. /**
  25. * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_bookmark-title">
  26. * <code>fo:bookmark-title</code></a> object, first introduced in the
  27. * XSL 1.1 WD.
  28. */
  29. public class BookmarkTitle extends FObj {
  30. private String title = "";
  31. /**
  32. * Create a new BookmarkTitle object that is a child
  33. * of the given {@link FONode}.
  34. *
  35. * @param parent the {@link FONode} parent
  36. */
  37. public BookmarkTitle(FONode parent) {
  38. super(parent);
  39. }
  40. /**
  41. * Add the characters to this BookmarkTitle.
  42. * The text data inside the BookmarkTitle xml element
  43. * is used for the BookmarkTitle string.
  44. *
  45. * @param data the character data
  46. * @param start the start position in the data array
  47. * @param length the length of the character array
  48. * @param locator location in fo source file.
  49. */
  50. protected void addCharacters(char[] data, int start, int length,
  51. PropertyList pList,
  52. Locator locator) {
  53. title += new String(data, start, length);
  54. }
  55. /**
  56. * {@inheritDoc}
  57. * <br>XSL/FOP: empty
  58. */
  59. protected void validateChildNode(Locator loc, String nsURI, String localName)
  60. throws ValidationException {
  61. if (FO_URI.equals(nsURI)) {
  62. invalidChildError(loc, nsURI, localName);
  63. }
  64. }
  65. /**
  66. * Get the title for this BookmarkTitle.
  67. *
  68. * @return the bookmark title
  69. */
  70. public String getTitle() {
  71. return title;
  72. }
  73. /** {@inheritDoc} */
  74. public String getLocalName() {
  75. return "bookmark-title";
  76. }
  77. /**
  78. * {@inheritDoc}
  79. * @return {@link org.apache.fop.fo.Constants#FO_BOOKMARK_TITLE}
  80. */
  81. public int getNameId() {
  82. return FO_BOOKMARK_TITLE;
  83. }
  84. }