Package net.sf.jasperreports.engine
Class JRSimpleTemplate
- java.lang.Object
-
- net.sf.jasperreports.engine.JRSimpleTemplate
-
- All Implemented Interfaces:
Serializable,JRChangeEventsSupport,JRTemplate
public class JRSimpleTemplate extends Object implements JRTemplate, Serializable, JRChangeEventsSupport
DefaultJRTemplateimplementation.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_DUPLICATE_TEMPLATE_STYLEstatic StringPROPERTY_INCLUDED_TEMPLATESstatic StringPROPERTY_STYLE
-
Constructor Summary
Constructors Constructor Description JRSimpleTemplate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIncludedTemplate(int index, JRTemplateReference reference)Adds an included template.voidaddIncludedTemplate(String templateLocation)Adds an included template.voidaddIncludedTemplate(JRTemplateReference reference)Adds an included template.voidaddStyle(int index, JRStyle style)Adds a style to the template.voidaddStyle(JRStyle style)Adds a style to the template.protected voidcheckExistingName(String name)JRPropertyChangeSupportgetEventSupport()Returns the property change support object for this instance.JRTemplateReference[]getIncludedTemplates()Returns the templates included/referenced by this template.List<JRTemplateReference>getIncludedTemplatesList()JRStylegetStyle(String name)Returns an included style by name.JRStyle[]getStyles()Returns the styles defined in this template.List<JRStyle>getStylesList()protected booleannameMatches(JRStyle style, String name)JRTemplateReferenceremoveIncludedTemplate(String location)Removes an included template.booleanremoveIncludedTemplate(JRTemplateReference reference)Removes an included template.JRStyleremoveStyle(String name)Removes an included style.booleanremoveStyle(JRStyle style)Removes an included style.
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_TEMPLATE_STYLE
public static final String EXCEPTION_MESSAGE_KEY_DUPLICATE_TEMPLATE_STYLE
- See Also:
- Constant Field Values
-
PROPERTY_STYLE
public static final String PROPERTY_STYLE
- See Also:
- Constant Field Values
-
PROPERTY_INCLUDED_TEMPLATES
public static final String PROPERTY_INCLUDED_TEMPLATES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getEventSupport
public JRPropertyChangeSupport getEventSupport()
Description copied from interface:JRChangeEventsSupportReturns the property change support object for this instance.- Specified by:
getEventSupportin interfaceJRChangeEventsSupport- Returns:
- the property change support object for this instance
-
addStyle
public void addStyle(JRStyle style) throws JRException
Adds a style to the template.- Parameters:
style- the style to add- Throws:
JRException- when a style with the same name already exists
-
addStyle
public void addStyle(int index, JRStyle style) throws JRExceptionAdds a style to the template.- Parameters:
style- the style to add- Throws:
JRException- when a style with the same name already exists
-
checkExistingName
protected void checkExistingName(String name) throws JRException
- Throws:
JRException
-
getStyle
public JRStyle getStyle(String name)
Returns an included style by name.- Parameters:
name- the name of the style to be returned- Returns:
- the style having the specified name, or
nullif not found
-
removeStyle
public boolean removeStyle(JRStyle style)
Removes an included style.- Parameters:
style- the style to remove- Returns:
trueif and only if the style has been found and removed
-
removeStyle
public JRStyle removeStyle(String name)
Removes an included style.- Parameters:
name- the name of the style to be removed- Returns:
- the removed style, or
nullif not found
-
getStyles
public JRStyle[] getStyles()
Description copied from interface:JRTemplateReturns the styles defined in this template.- Specified by:
getStylesin interfaceJRTemplate- Returns:
- the template styles
-
addIncludedTemplate
public void addIncludedTemplate(int index, JRTemplateReference reference)Adds an included template.- Parameters:
reference- the template reference- See Also:
getIncludedTemplates()
-
addIncludedTemplate
public void addIncludedTemplate(JRTemplateReference reference)
Adds an included template.- Parameters:
reference- the template reference- See Also:
getIncludedTemplates()
-
addIncludedTemplate
public void addIncludedTemplate(String templateLocation)
Adds an included template.- Parameters:
templateLocation- the template location- See Also:
getIncludedTemplates()
-
removeIncludedTemplate
public boolean removeIncludedTemplate(JRTemplateReference reference)
Removes an included template.- Parameters:
reference- the template reference to remove- Returns:
trueif and only if the included template has been found and removed
-
removeIncludedTemplate
public JRTemplateReference removeIncludedTemplate(String location)
Removes an included template. The first template reference that matches the location is removed.- Parameters:
location- the location of the template to remove- Returns:
- the removed template reference, or
nullif not found
-
getIncludedTemplates
public JRTemplateReference[] getIncludedTemplates()
Description copied from interface:JRTemplateReturns the templates included/referenced by this template.- Specified by:
getIncludedTemplatesin interfaceJRTemplate- Returns:
- the included templates
-
getIncludedTemplatesList
public List<JRTemplateReference> getIncludedTemplatesList()
-
-