Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ProducerContext.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright 2005 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.visual;
  18. import java.io.File;
  19. import javax.xml.transform.Templates;
  20. import javax.xml.transform.TransformerFactory;
  21. /**
  22. * Context object for the bitmap production.
  23. */
  24. public class ProducerContext {
  25. private TransformerFactory tFactory;
  26. private Templates templates;
  27. private int resolution;
  28. private File targetDir;
  29. /**
  30. * @return the TransformerFactory to be used.
  31. */
  32. public TransformerFactory getTransformerFactory() {
  33. if (tFactory == null) {
  34. tFactory = TransformerFactory.newInstance();
  35. }
  36. return tFactory;
  37. }
  38. /**
  39. * @return the requested bitmap resolution in dpi for all bitmaps.
  40. */
  41. public int getResolution() {
  42. return resolution;
  43. }
  44. /**
  45. * Sets the requested bitmap resolution in dpi for all bitmaps.
  46. * @param resolution the resolution in dpi
  47. */
  48. public void setResolution(int resolution) {
  49. this.resolution = resolution;
  50. }
  51. /**
  52. * @return the XSLT stylesheet to preprocess the input files with.
  53. */
  54. public Templates getTemplates() {
  55. return templates;
  56. }
  57. /**
  58. * Sets an optional XSLT stylesheet which is used to preprocess all input files with.
  59. * @param templates the XSLT stylesheet
  60. */
  61. public void setTemplates(Templates templates) {
  62. this.templates = templates;
  63. }
  64. /**
  65. * @return the target directory for all produced bitmaps
  66. */
  67. public File getTargetDir() {
  68. return targetDir;
  69. }
  70. /**
  71. * Sets the target directory for all produced bitmaps.
  72. * @param targetDir the target directory
  73. */
  74. public void setTargetDir(File targetDir) {
  75. this.targetDir = targetDir;
  76. }
  77. }