001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * DefaultProcessingContext.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.layout.output;
030:
031: import java.io.File;
032:
033: import org.jfree.formula.DefaultFormulaContext;
034: import org.jfree.formula.FormulaContext;
035: import org.jfree.report.DefaultResourceBundleFactory;
036: import org.jfree.report.JFreeReportBoot;
037: import org.jfree.report.ResourceBundleFactory;
038: import org.jfree.report.function.ProcessingContext;
039: import org.jfree.report.layout.DefaultLayoutSupport;
040: import org.jfree.report.layout.LayoutSupport;
041: import org.jfree.resourceloader.ResourceKey;
042: import org.jfree.resourceloader.ResourceKeyCreationException;
043: import org.jfree.resourceloader.ResourceManager;
044: import org.jfree.util.Configuration;
045:
046: /**
047: * Creation-Date: 08.04.2007, 15:46:44
048: *
049: * @author Thomas Morgner
050: */
051: public class DefaultProcessingContext implements ProcessingContext {
052: private FormulaContext formulaContext;
053: private boolean prepareRun;
054: private LayoutSupport layoutSupport;
055: private int processingLevel;
056: private String exportDescriptor;
057: private ResourceBundleFactory resourceBundleFactory;
058: private Configuration configuration;
059: private int progressLevelCount;
060: private int progressLevel;
061: private ResourceManager resourceManager;
062: private ResourceKey contentBase;
063:
064: public DefaultProcessingContext()
065: throws ResourceKeyCreationException {
066: exportDescriptor = "undefined";
067: layoutSupport = new DefaultLayoutSupport(true, true);
068: resourceBundleFactory = new DefaultResourceBundleFactory();
069: configuration = JFreeReportBoot.getInstance().getGlobalConfig();
070: resourceManager = new ResourceManager();
071: resourceManager.registerDefaults();
072: contentBase = resourceManager.createKey(new File("."));
073: }
074:
075: public DefaultProcessingContext(final String exportDescriptor,
076: final LayoutSupport layoutSupport,
077: final ResourceBundleFactory resourceBundleFactory,
078: final Configuration configuration,
079: final ResourceManager resourceManager,
080: final ResourceKey contentBase) {
081: this .contentBase = contentBase;
082: this .resourceManager = resourceManager;
083: this .formulaContext = new DefaultFormulaContext();
084: this .exportDescriptor = exportDescriptor;
085: this .resourceBundleFactory = resourceBundleFactory;
086: this .configuration = configuration;
087: this .layoutSupport = layoutSupport;
088: }
089:
090: public ResourceManager getResourceManager() {
091: return resourceManager;
092: }
093:
094: public ResourceKey getContentBase() {
095: return contentBase;
096: }
097:
098: public int getProgressLevel() {
099: return progressLevel;
100: }
101:
102: public void setProgressLevel(final int progressLevel) {
103: this .progressLevel = progressLevel;
104: }
105:
106: public int getProgressLevelCount() {
107: return progressLevelCount;
108: }
109:
110: public void setProgressLevelCount(final int progressLevelCount) {
111: this .progressLevelCount = progressLevelCount;
112: }
113:
114: public void setProcessingLevel(final int processingLevel) {
115: this .processingLevel = processingLevel;
116: }
117:
118: public int getProcessingLevel() {
119: return processingLevel;
120: }
121:
122: public FormulaContext getFormulaContext() {
123: return formulaContext;
124: }
125:
126: public void setPrepareRun(final boolean prepareRun) {
127: this .prepareRun = prepareRun;
128: }
129:
130: public boolean isPrepareRun() {
131: return prepareRun;
132: }
133:
134: public String getExportDescriptor() {
135: return exportDescriptor;
136: }
137:
138: public LayoutSupport getLayoutSupport() {
139: return layoutSupport;
140: }
141:
142: public ResourceBundleFactory getResourceBundleFactory() {
143: return resourceBundleFactory;
144: }
145:
146: public Configuration getConfiguration() {
147: return configuration;
148: }
149: }
|