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.

Outline.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.extensions;
  8. import org.apache.fop.fo.FONode;
  9. import org.apache.fop.apps.FOPException;
  10. import java.util.*;
  11. import org.xml.sax.Attributes;
  12. public class Outline extends ExtensionObj {
  13. private Label label;
  14. private ArrayList outlines = new ArrayList();
  15. private String internalDestination;
  16. private String externalDestination;
  17. public Outline(FONode parent) {
  18. super(parent);
  19. }
  20. public void handleAttrs(Attributes attlist) throws FOPException {
  21. internalDestination =
  22. attlist.getValue("internal-destination");
  23. externalDestination =
  24. attlist.getValue("external-destination");
  25. if (externalDestination != null &&!externalDestination.equals("")) {
  26. getLogger().warn("fox:outline external-destination not supported currently.");
  27. }
  28. if (internalDestination == null || internalDestination.equals("")) {
  29. getLogger().warn("fox:outline requires an internal-destination.");
  30. }
  31. }
  32. protected void addChild(FONode obj) {
  33. if (obj instanceof Label) {
  34. label = (Label)obj;
  35. } else if (obj instanceof Outline) {
  36. outlines.add(obj);
  37. }
  38. }
  39. public BookmarkData getData() {
  40. BookmarkData data = new BookmarkData(internalDestination);
  41. data.setLabel(getLabel());
  42. for(int count = 0; count < outlines.size(); count++) {
  43. Outline out = (Outline)outlines.get(count);
  44. data.addSubData(out.getData());
  45. }
  46. return data;
  47. }
  48. public String getLabel() {
  49. return label == null ? "" : label.toString();
  50. }
  51. }