Java Code Examples for net.sf.jasperreports.engine.JasperPrint#getDefaultStyleProvider()

The following examples show how to use net.sf.jasperreports.engine.JasperPrint#getDefaultStyleProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRPrintEllipseFactory.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object createObject(Attributes atts)
{
	JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

	JRBasePrintEllipse ellipse = new JRBasePrintEllipse(jasperPrint.getDefaultStyleProvider());
	
	return ellipse;
}
 
Example 2
Source File: JRPrintFrameFactory.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object createObject(Attributes attributes)
{
	JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

	return new JRBasePrintFrame(jasperPrint.getDefaultStyleProvider());		
}
 
Example 3
Source File: JRGenericPrintElementFactory.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object createObject(Attributes arg0) throws Exception
{
	JasperPrint jasperPrint = (JasperPrint) digester.peek(digester.getCount() - 2);
	JRBaseGenericPrintElement element = new JRBaseGenericPrintElement(
			jasperPrint.getDefaultStyleProvider());
	return element;
}
 
Example 4
Source File: JRPrintLineFactory.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object createObject(Attributes atts)
{
	JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

	JRBasePrintLine line = new JRBasePrintLine(jasperPrint.getDefaultStyleProvider());

	LineDirectionEnum direction = LineDirectionEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_direction));
	if (direction != null)
	{
		line.setDirection(direction);
	}

	return line;
}
 
Example 5
Source File: JRPrintRectangleFactory.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object createObject(Attributes atts)
{
	JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

	JRBasePrintRectangle rectangle = new JRBasePrintRectangle(jasperPrint.getDefaultStyleProvider());
	
	String radius = atts.getValue(JRXmlConstants.ATTRIBUTE_radius);
	if (radius != null && radius.length() > 0)
	{
		rectangle.setRadius(Integer.valueOf(radius));
	}

	return rectangle;
}
 
Example 6
Source File: JRPrintImageFactory.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Object createObject(Attributes atts)
{
	JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

	JRBasePrintImage image = new JRBasePrintImage(jasperPrint.getDefaultStyleProvider());

	// get image attributes
	ScaleImageEnum scaleImage = ScaleImageEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_scaleImage));
	if (scaleImage != null)
	{
		image.setScaleImage(scaleImage);
	}

	RotationEnum rotation = RotationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_rotation));
	if (rotation != null)
	{
		image.setRotation(rotation);
	}

	HorizontalImageAlignEnum horizontalImageAlign = HorizontalImageAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_hAlign));
	if (horizontalImageAlign != null)
	{
		image.setHorizontalImageAlign(horizontalImageAlign);
	}

	VerticalImageAlignEnum verticalImageAlign = VerticalImageAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_vAlign));
	if (verticalImageAlign != null)
	{
		image.setVerticalImageAlign(verticalImageAlign);
	}

	OnErrorTypeEnum onErrorType = OnErrorTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_onErrorType));
	if (onErrorType != null)
	{
		image.setOnErrorType(onErrorType);
	}

	image.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
	image.setLinkTarget(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTarget));
	image.setAnchorName(atts.getValue(JRXmlConstants.ATTRIBUTE_anchorName));
	image.setHyperlinkReference(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkReference));
	image.setHyperlinkAnchor(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkAnchor));
	
	String hyperlinkPage = atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkPage);
	if (hyperlinkPage != null)
	{
		image.setHyperlinkPage(Integer.valueOf(hyperlinkPage));
	}
	
	image.setHyperlinkTooltip(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTooltip));

	String bookmarkLevelAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_bookmarkLevel);
	if (bookmarkLevelAttr != null)
	{
		image.setBookmarkLevel(Integer.parseInt(bookmarkLevelAttr));
	}
	
	String isLazy = atts.getValue(JRXmlConstants.ATTRIBUTE_isLazy);
	if (isLazy != null && isLazy.length() > 0)
	{
		//we use a resource renderer just to pass the value of isLazy flag to image source factory
		image.setRenderer(ResourceRenderer.getInstance("", Boolean.valueOf(isLazy)));
	}

	return image;
}