net.sf.jasperreports.engine
Class JRSimpleTemplate

java.lang.Object
  extended by net.sf.jasperreports.engine.JRSimpleTemplate
All Implemented Interfaces:
java.io.Serializable, JRDefaultFontProvider, JRDefaultStyleProvider, JRTemplate

public class JRSimpleTemplate
extends java.lang.Object
implements JRTemplate, java.io.Serializable

Default JRTemplate implementation.

Version:
$Id: JRSimpleTemplate.java 3033 2009-08-27 11:46:22Z teodord $
Author:
Lucian Chirita ([email protected])
See Also:
Serialized Form

Constructor Summary
JRSimpleTemplate()
           
 
Method Summary
 void addIncludedTemplate(JRTemplateReference reference)
          Adds an included template.
 void addIncludedTemplate(java.lang.String templateLocation)
          Adds an included template.
 void addStyle(JRStyle style)
          Adds a style to the template.
protected  void checkExistingName(java.lang.String name)
           
 JRReportFont getDefaultFont()
          Returns a default font.
 JRStyle getDefaultStyle()
          Returns a default style.
 JRTemplateReference[] getIncludedTemplates()
          Returns the templates included/referenced by this template.
 JRStyle getStyle(java.lang.String name)
          Returns an included style by name.
 JRStyle[] getStyles()
          Returns the styles defined in this template.
protected  boolean nameMatches(JRStyle style, java.lang.String name)
           
 boolean removeIncludedTemplate(JRTemplateReference reference)
          Removes an included template.
 JRTemplateReference removeIncludedTemplate(java.lang.String location)
          Removes an included template.
 boolean removeStyle(JRStyle style)
          Removes an included style.
 JRStyle removeStyle(java.lang.String name)
          Removes an included style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRSimpleTemplate

public JRSimpleTemplate()
Method Detail

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

checkExistingName

protected void checkExistingName(java.lang.String name)
                          throws JRException
Throws:
JRException

nameMatches

protected boolean nameMatches(JRStyle style,
                              java.lang.String name)

getStyle

public JRStyle getStyle(java.lang.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(java.lang.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 interface JRTemplate
Returns:
the template styles

getDefaultStyle

public JRStyle getDefaultStyle()
Description copied from interface: JRDefaultStyleProvider
Returns a default style.

Specified by:
getDefaultStyle in interface JRDefaultStyleProvider

getDefaultFont

public JRReportFont getDefaultFont()
Description copied from interface: JRDefaultFontProvider
Returns a default font.

Specified by:
getDefaultFont in interface JRDefaultFontProvider

addIncludedTemplate

public void addIncludedTemplate(JRTemplateReference reference)
Adds an included template.

Parameters:
reference - the template reference
See Also:
getIncludedTemplates()

addIncludedTemplate

public void addIncludedTemplate(java.lang.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(java.lang.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 interface JRTemplate
Returns:
the included templates


Copyright © 2011. All Rights Reserved.