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.

PDFAElementBridge.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.svg;
  18. import java.awt.geom.AffineTransform;
  19. import org.apache.batik.bridge.AbstractGraphicsNodeBridge;
  20. import org.apache.batik.bridge.BridgeContext;
  21. import org.apache.batik.gvt.GraphicsNode;
  22. import org.w3c.dom.Element;
  23. import org.w3c.dom.svg.SVGAElement;
  24. /**
  25. * Bridge class for the <a> element.
  26. *
  27. * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
  28. */
  29. public class PDFAElementBridge extends AbstractGraphicsNodeBridge {
  30. private AffineTransform transform;
  31. /**
  32. * Constructs a new bridge for the &lt;a> element.
  33. */
  34. public PDFAElementBridge() {
  35. }
  36. /**
  37. * Set the current transform of this element.
  38. * @param tf the transform
  39. */
  40. public void setCurrentTransform(AffineTransform tf) {
  41. transform = tf;
  42. }
  43. /**
  44. * Returns 'a'.
  45. * @return the name of this node
  46. */
  47. public String getLocalName() {
  48. return SVG_A_TAG;
  49. }
  50. /**
  51. * Creates a <tt>CompositeGraphicsNode</tt>.
  52. * @return a new PDFANode
  53. */
  54. protected GraphicsNode instantiateGraphicsNode() {
  55. return new PDFANode();
  56. }
  57. /**
  58. * Builds using the specified BridgeContext and element, the
  59. * specified graphics node.
  60. *
  61. * @param ctx the bridge context to use
  62. * @param e the element that describes the graphics node to build
  63. * @return node the new graphics node
  64. */
  65. public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
  66. PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e);
  67. aNode.setDestination(((SVGAElement)e).getHref().getBaseVal());
  68. aNode.setTransform(transform);
  69. return aNode;
  70. }
  71. /**
  72. * Returns true as the &lt;a> element is a container.
  73. * @return true if the a element is a container
  74. */
  75. public boolean isComposite() {
  76. return true;
  77. }
  78. }