net.sf.jasperreports.engine
Class JRSimpleTemplate

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

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

Default JRTemplate implementation.

Version:
$Id: JRSimpleTemplate.java 4595 2011-09-08 15:55:10Z teodord $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
See Also:
Serialized Form

Field Summary
static java.lang.String PROPERTY_INCLUDED_TEMPLATES
           
static java.lang.String PROPERTY_STYLE
           
 
Constructor Summary
JRSimpleTemplate()
           
 
Method Summary
 void addIncludedTemplate(int index, JRTemplateReference reference)
          Adds an included template.
 void addIncludedTemplate(JRTemplateReference reference)
          Adds an included template.
 void addIncludedTemplate(java.lang.String templateLocation)
          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(java.lang.String name)
           
 JRStyle getDefaultStyle()
          Returns a default style.
 JRPropertyChangeSupport getEventSupport()
          Returns the property change support object for this instance.
 JRTemplateReference[] getIncludedTemplates()
          Returns the templates included/referenced by this template.
 java.util.List<JRTemplateReference> getIncludedTemplatesList()
           
 JRStyle getStyle(java.lang.String name)
          Returns an included style by name.
 JRStyle[] getStyles()
          Returns the styles defined in this template.
 java.util.List<JRStyle> getStylesList()
           
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
 

Field Detail

PROPERTY_STYLE

public static final java.lang.String PROPERTY_STYLE
See Also:
Constant Field Values

PROPERTY_INCLUDED_TEMPLATES

public static final java.lang.String PROPERTY_INCLUDED_TEMPLATES
See Also:
Constant Field Values
Constructor Detail

JRSimpleTemplate

public JRSimpleTemplate()
Method Detail

getEventSupport

public JRPropertyChangeSupport getEventSupport()
Description copied from interface: JRChangeEventsSupport
Returns the property change support object for this instance.

Specified by:
getEventSupport in interface JRChangeEventsSupport
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(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

getStylesList

public java.util.List<JRStyle> getStylesList()

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

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(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

getIncludedTemplatesList

public java.util.List<JRTemplateReference> getIncludedTemplatesList()


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com