当前位置: 首页>>代码示例>>Java>>正文


Java JasperReportsContext类代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.JasperReportsContext的典型用法代码示例。如果您正苦于以下问题:Java JasperReportsContext类的具体用法?Java JasperReportsContext怎么用?Java JasperReportsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JasperReportsContext类属于net.sf.jasperreports.engine包,在下文中一共展示了JasperReportsContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ProcessDirector

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
public ProcessDirector(JasperReportsContext jasperReportsContext, ScriptManager scriptManager)
{
	JRPropertiesUtil properties = JRPropertiesUtil.getInstance(jasperReportsContext);
	this.phantomjsExecutablePath = properties.getProperty(PhantomJS.PROPERTY_PHANTOMJS_EXECUTABLE_PATH);
	this.processStartTimeout = properties.getIntegerProperty(PhantomJS.PROPERTY_PHANTOMJS_START_TIMEOUT, 
			PhantomJS.DEFAULT_PHANTOMJS_START_TIMEOUT);
	
	this.idlePingInterval = properties.getIntegerProperty(PhantomJS.PROPERTY_PHANTOMJS_IDLE_PING_INTERVAL, 
			PhantomJS.DEFAULT_PHANTOMJS_IDLE_PING_INTERVAL);
	
	this.requestTimeout = properties.getIntegerProperty(PhantomJS.PROPERTY_PHANTOMJS_REQUEST_TIMEOUT, 
			PhantomJS.DEFAULT_PHANTOMJS_REQUEST_TIMEOUT);
	
	this.scriptManager = scriptManager;
	
	if (this.phantomjsExecutablePath != null)
	{
		this.listenAddress = InetUtil.getIPv4Loopback();
		if (this.listenAddress == null)
		{
			log.error("Unable to determine an IPv4 loopback address");
		}
	}
	
	processPool = createProcessPool(properties);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:ProcessDirector.java

示例2: fill

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 * Fills a report.
 * <p/>
 * The data source used to fill the report is determined in the following way:
 * <ul>
 * 	<li>If a non-null value of the {@link net.sf.jasperreports.engine.JRParameter#REPORT_DATA_SOURCE REPORT_DATA_SOURCE}
 * has been specified, it will be used as data source.</li>
 * 	<li>Otherwise, if the report has a query then a data source will be created based on the query and connection
 * parameter values.</li>
 * 	<li>Otherwise, the report will be filled without a data source.</li>
 * </ul>
 * 
 * @param jasperReport the report
 * @param parameters the fill parameters
 * @return the filled report
 * @throws JRException
 */
public static JasperPrint fill(
	JasperReportsContext jasperReportsContext,
	JasperReport jasperReport, 
	Map<String,Object> parameters
	) throws JRException
{
	ReportFiller filler = createReportFiller(jasperReportsContext, jasperReport);

	try
	{
		JasperPrint jasperPrint = filler.fill(parameters);

		return jasperPrint;
	}
	catch (JRFillInterruptedException e)
	{
		throw 
			new JRException(
				EXCEPTION_MESSAGE_KEY_THREAD_INTERRUPTED,
				null,
				e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:41,代码来源:JRFiller.java

示例3: getData

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
@Override
public byte[] getData(JasperReportsContext jasperReportsContext) throws JRException
{
	ensureData(jasperReportsContext);
	
	if (svgText != null)
	{
		try
		{
			return svgText.getBytes("UTF-8");
		}
		catch (UnsupportedEncodingException e)
		{
			throw new JRRuntimeException(e);
		}
	}
	else
	{
		return svgData;
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:BatikRenderer.java

示例4: transformGenericElements

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 * Applies generic element transformers of a specific key to a filled report
 * by replacing generic elements with the transformed elements.
 * 
 * @param report the report
 * @param transformerExportKey the key used to resolve element transformers
 * @see GenericElementTransformer
 * @see GenericElementHandlerBundle#getHandler(String, String)
 */
public static void transformGenericElements(
	JasperReportsContext jasperReportsContext,
	JasperPrint report, 
	String transformerExportKey
	)
{
	TransformerContext transformerContext = new TransformerContext(jasperReportsContext, report);
	List<JRPrintPage> pages = report.getPages();
	for (Iterator<JRPrintPage> pageIt = pages.iterator(); pageIt.hasNext();)
	{
		JRPrintPage page = pageIt.next();
		transformElements(transformerContext, transformerExportKey, 
				page.getElements());
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:GenericElementReportTransformer.java

示例5: DocxTableHelper

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 * 
 */
protected DocxTableHelper(
	JasperReportsContext jasperReportsContext,
	Writer writer,
	CutsInfo xCuts,
	boolean pageBreak,
	PrintPageFormat pageFormat,
	JRPrintElementIndex frameIndex
	) 
{
	super(jasperReportsContext, writer);

	this.xCuts = xCuts;
	this.cellHelper = new DocxCellHelper(jasperReportsContext, writer);
	this.paragraphHelper = new DocxParagraphHelper(jasperReportsContext, writer, pageBreak);
	this.pageFormat = pageFormat;
	this.frameIndex = frameIndex;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:DocxTableHelper.java

示例6: initExcludeProperties

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
private void initExcludeProperties()
{
	JasperReportsContext context = jasperReportsContext == null 
			? DefaultJasperReportsContext.getInstance() : jasperReportsContext;
	List<PropertySuffix> excludeProperties = JRPropertiesUtil.getInstance(context).getProperties(
			PREFIX_EXCLUDE_PROPERTIES);
	
	excludePropertiesPattern = new ArrayList<Pattern>(excludeProperties.size());
	for (PropertySuffix propertySuffix : excludeProperties)
	{
		String regex = propertySuffix.getValue();
		Pattern pattern = Pattern.compile(regex);
		excludePropertiesPattern.add(pattern);
	}

	excludeUuids = JRPropertiesUtil.getInstance(context).getBooleanProperty(PROPERTY_EXCLUDE_UUIDS);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:JRXmlWriter.java

示例7: getDimension

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
@Override
public Dimension2D getDimension(JasperReportsContext jasperReportsContext)
{
	if (rotation != null) 
	{
		switch(rotation)
		{
			case LEFT:
			case RIGHT:
				return new Dimension((int)barcode.getSize().getHeight(),(int)barcode.getSize().getWidth());
			default:
				return barcode.getSize();
		}
	} else 
	{
		return barcode.getSize();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:BarbecueRendererImpl.java

示例8: getInstance

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 * @deprecated Replaced by {@link #SimpleFontFace(JasperReportsContext)} and {@link #setTtf(String)}.
 */
public static SimpleFontFace getInstance(JasperReportsContext jasperReportsContext, String fontName)
{
	SimpleFontFace fontFace = null;

	if (fontName != null)
	{
		fontFace = new SimpleFontFace(jasperReportsContext);
		fontFace.setTtf(fontName);
	}
	
	return fontFace;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:SimpleFontFace.java

示例9: setJasperReportsContext

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
@Override
protected void setJasperReportsContext(JasperReportsContext jasperReportsContext)
{
	super.setJasperReportsContext(jasperReportsContext);

	this.styleResolver = new StyleResolver(jasperReportsContext);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRBaseFiller.java

示例10: getExistingFiltersForField

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
private List<FieldFilter> getExistingFiltersForField(
	JasperReportsContext jasperReportsContext, 
	ReportContext reportContext, 
	String uuid, 
	String filterFieldName
	) 
{
	JasperDesignCache cache = JasperDesignCache.getInstance(jasperReportsContext, reportContext);
	FilterAction action = new FilterAction();
	action.init(jasperReportsContext, reportContext);
	CommandTarget target = action.getCommandTarget(UUID.fromString(uuid));
	List<FieldFilter> result = new ArrayList<FieldFilter>();
	if (target != null)
	{
		JasperDesign jasperDesign = cache.getJasperDesign(target.getUri());
		JRDesignDataset dataset = (JRDesignDataset)jasperDesign.getMainDataset();
		
		// get existing filter as JSON string
		String serializedFilters = "[]";
		JRPropertiesMap propertiesMap = dataset.getPropertiesMap();
		if (propertiesMap.getProperty(FilterCommand.DATASET_FILTER_PROPERTY) != null) {
			serializedFilters = propertiesMap.getProperty(FilterCommand.DATASET_FILTER_PROPERTY);
		}
		
		List<? extends DatasetFilter> existingFilters = JacksonUtil.getInstance(jasperReportsContext).loadList(serializedFilters, FieldFilter.class);
		if (existingFilters.size() > 0) {
			for (DatasetFilter filter: existingFilters) {
				if (((FieldFilter)filter).getField().equals(filterFieldName)) {
					result.add((FieldFilter)filter);
					break;
				}
			}
		}
	}
	
	return result;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:38,代码来源:SortElementJsonHandler.java

示例11: ParameterOverriddenResolver

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 *
 */
public ParameterOverriddenResolver(
	JasperReportsContext jasperReportsContext,
	JasperPrint jasperPrint,
	Map<net.sf.jasperreports.engine.JRExporterParameter, Object> parameters
	)
{
	this.propertiesUtil = JRPropertiesUtil.getInstance(jasperReportsContext);
	this.jasperPrint = jasperPrint;
	this.parameters = parameters;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:14,代码来源:ParameterOverriddenResolver.java

示例12: getAllFilterFactories

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
protected List<ExporterFilterFactory> getAllFilterFactories(JasperReportsContext jasperReportsContext, JasperPrint report) throws JRException
{
	List<JRPropertiesUtil.PropertySuffix> factoryProps = JRPropertiesUtil.getInstance(jasperReportsContext).getAllProperties(report, 
			PROPERTY_EXPORTER_FILTER_FACTORY_PREFIX);
	List<ExporterFilterFactory> factories = new ArrayList<ExporterFilterFactory>(factoryProps.size());
	for (Iterator<JRPropertiesUtil.PropertySuffix> it = factoryProps.iterator(); it.hasNext();)
	{
		JRPropertiesUtil.PropertySuffix prop = it.next();
		ExporterFilterFactory factory = getFilterFactory(prop.getValue());
		factories.add(factory);
	}
	return factories;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:14,代码来源:DefaultExporterFilterFactory.java

示例13: getInstance

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
/**
 * 
 */
public static HtmlFont getInstance(JasperReportsContext jasperReportsContext, String htmlFontId)
{
	int localeSeparatorPos = htmlFontId.lastIndexOf(LOCALE_SEPARATOR);
	String faceName = htmlFontId.substring(0, localeSeparatorPos);
	boolean isBold = false;
	boolean isItalic = false;
	if (faceName.endsWith("-Italic"))
	{
		faceName = faceName.substring(0, faceName.length() - "-Italic".length());
		isItalic = true;
	}
	if (faceName.endsWith("-Bold"))
	{
		faceName = faceName.substring(0, faceName.length() - "-Bold".length());
		isBold = true;
	}
	if (faceName.endsWith("-BoldItalic"))
	{
		faceName = faceName.substring(0, faceName.length() - "-BoldItalic".length());
		isItalic = true;
		isBold = true;
	}
	String localeCode = htmlFontId.substring(localeSeparatorPos + LOCALE_SEPARATOR.length());
	Locale locale = JRDataUtils.getLocale(localeCode);
	
	FontInfo fontInfo = FontUtil.getInstance(jasperReportsContext).getFontInfo(faceName, locale);

	return getInstance(locale, fontInfo, isBold, isItalic);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:33,代码来源:HtmlFont.java

示例14: setColumnValueData

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
private EditTextElementData setColumnValueData(Integer columnIndex, CommandTarget target, Map<String, Object> contextMap,
		JasperReportsContext jasperReportsContext, ReportContext reportContext, Locale locale) {
	EditTextElementData textElementData = new EditTextElementData();

	if (target != null){
		JRIdentifiable identifiable = target.getIdentifiable();
		JRDesignComponentElement componentElement = identifiable instanceof JRDesignComponentElement ? (JRDesignComponentElement)identifiable : null;
		StandardTable table = componentElement == null ? null : (StandardTable)componentElement.getComponent();

		List<BaseColumn> tableColumns = TableUtil.getAllColumns(table);

		if (columnIndex != null) {
			StandardColumn column = (StandardColumn) tableColumns.get(columnIndex);

			JRDesignTextField textElement = TableUtil.getCellElement(JRDesignTextField.class, column.getDetailCell(), true);

			if (textElement != null) {
				textElementData.setColumnIndex(columnIndex);
				JRDesignTextElement styledElement = resolveElementStyle(textElement, reportContext, target);
				HeaderToolbarElementUtils.copyTextElementStyle(textElementData, styledElement, locale);
			}
		}
	}
	contextMap.put("colValueData", JacksonUtil.getInstance(jasperReportsContext).getJsonString(textElementData));

	return textElementData;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:HeaderToolbarElementJsonHandler.java

示例15: performAction

import net.sf.jasperreports.engine.JasperReportsContext; //导入依赖的package包/类
@Override
public void performAction() throws ActionException {
	if (searchData != null && searchData.getSearchString() != null && searchData.getSearchString().length() > 0) {
		JasperReportsContext jasperReportsContext = getJasperReportsContext();
		ReportContext reportContext = getReportContext();

		JasperPrintAccessor jasperPrintAccessor = (JasperPrintAccessor) reportContext.getParameterValue(
				WebReportContext.REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR);

		JasperPrint jasperPrint = jasperPrintAccessor.getFinalJasperPrint();
		LuceneUtil luceneUtil = new LuceneUtil(jasperReportsContext, searchData.isCaseSensitive(), searchData.isWholeWordsOnly(), searchData.isRemoveAccents());

		try {
			SpansInfo spansInfo = luceneUtil.getSpansInfo(jasperPrint, searchData.getSearchString());
			reportContext.setParameterValue("net.sf.jasperreports.search.term.highlighter", spansInfo);

			ObjectMapper mapper = new ObjectMapper();
			ObjectNode result = mapper.createObjectNode();

			Map<String, Integer> hitTermsPerPage = spansInfo.getHitTermsPerPage();
			result.put("searchString", searchData.getSearchString());

			if (hitTermsPerPage.size() > 0) {
				ArrayNode arrayNode = mapper.createArrayNode();
				ObjectNode item;
				result.put("searchResults", arrayNode);
				for (Map.Entry<String, Integer> entry: hitTermsPerPage.entrySet()) {
					item = mapper.createObjectNode();
					item.put("page", Integer.parseInt(entry.getKey()) + 1);
					item.put("hitCount", entry.getValue()/spansInfo.getTermsPerQuery());
					arrayNode.add(item);
				}
			}
			reportContext.setParameterValue("net.sf.jasperreports.web.actions.result.json", result);

		} catch (Exception e) {
			throw new ActionException(e);
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:41,代码来源:SearchAction.java


注:本文中的net.sf.jasperreports.engine.JasperReportsContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。