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
DefaultJRTemplate
implementation.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_DUPLICATE_TEMPLATE_STYLE
static String
PROPERTY_INCLUDED_TEMPLATES
static String
PROPERTY_STYLE
-
Constructor Summary
Constructors Constructor Description JRSimpleTemplate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIncludedTemplate(int index, JRTemplateReference reference)
Adds an included template.void
addIncludedTemplate(String templateLocation)
Adds an included template.void
addIncludedTemplate(JRTemplateReference reference)
Adds an included template.void
addStyle(int index, JRStyle style)
Adds a style to the template.void
addStyle(JRStyle style)
Adds a style to the template.protected void
checkExistingName(String name)
JRPropertyChangeSupport
getEventSupport()
Returns the property change support object for this instance.JRTemplateReference[]
getIncludedTemplates()
Returns the templates included/referenced by this template.List<JRTemplateReference>
getIncludedTemplatesList()
JRStyle
getStyle(String name)
Returns an included style by name.JRStyle[]
getStyles()
Returns the styles defined in this template.List<JRStyle>
getStylesList()
protected boolean
nameMatches(JRStyle style, String name)
JRTemplateReference
removeIncludedTemplate(String location)
Removes an included template.boolean
removeIncludedTemplate(JRTemplateReference reference)
Removes an included template.JRStyle
removeStyle(String name)
Removes an included style.boolean
removeStyle(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:JRChangeEventsSupport
Returns the property change support object for this instance.- Specified by:
getEventSupport
in 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 JRException
Adds 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
null
if not found
-
removeStyle
public boolean removeStyle(JRStyle style)
Removes an included style.- Parameters:
style
- the style to remove- Returns:
true
if 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
null
if not found
-
getStyles
public JRStyle[] getStyles()
Description copied from interface:JRTemplate
Returns the styles defined in this template.- Specified by:
getStyles
in 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:
true
if 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
null
if not found
-
getIncludedTemplates
public JRTemplateReference[] getIncludedTemplates()
Description copied from interface:JRTemplate
Returns the templates included/referenced by this template.- Specified by:
getIncludedTemplates
in interfaceJRTemplate
- Returns:
- the included templates
-
getIncludedTemplatesList
public List<JRTemplateReference> getIncludedTemplatesList()
-
-