org.eclipse.birt.report.model.api
Class ModuleHandle

java.lang.Object
  extended byorg.eclipse.birt.report.model.api.DesignElementHandle
      extended byorg.eclipse.birt.report.model.api.ModuleHandle
All Implemented Interfaces:
org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel, IModuleModel
Direct Known Subclasses:
LibraryHandle, ReportDesignHandle

public abstract class ModuleHandle
extends DesignElementHandle
implements IModuleModel

Abstract module handle which provides the common functionalities of report design and library.

Content Item Description
Code Modules Global scripts that apply to the report as a whole.
Parameters A list of Parameter elements that describe the data that the user can enter when running the report.
Data Sources The connections used by the report.
Data Sets Data sets defined in the design.
Color Palette A set of custom color names as part of the design.
Styles User-defined styles used to format elements in the report. Each style must have a unique name within the set of styles for this report.
Page Setup The layout of the master pages within the report.
Components Reusable report items defined in this design. Report items can extend these items. Defines a "private library" for this design.
Translations The list of externalized messages specifically for this report.
Images A list of images embedded in this report.


Field Summary
 
Fields inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
module
 
Fields inherited from interface org.eclipse.birt.report.model.api.core.IModuleModel
AUTHOR_PROP, BASE_PROP, COLOR_PALETTE_PROP, COMPONENT_SLOT, CONFIG_VARS_PROP, CREATED_BY_PROP, DATA_SET_SLOT, DATA_SOURCE_SLOT, DESCRIPTION_ID_PROP, DESCRIPTION_PROP, HELP_GUIDE_PROP, IMAGES_PROP, INCLUDE_RESOURCE_PROP, INCLUDE_SCRIPTS_PROP, INITIALIZE_METHOD, LIBRARIES_PROP, PAGE_SLOT, PARAMETER_SLOT, PROPERTY_BINDINGS_PROP, STYLE_SLOT, THEME_PROP, TITLE_ID_PROP, TITLE_PROP, UNITS_PROP
 
Fields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
COMMENTS_PROP, CUSTOM_XML_PROP, DISPLAY_NAME_ID_PROP, DISPLAY_NAME_PROP, EVENT_HANDLER_CLASS_PROP, EXTENDS_PROP, FULL_LABEL, ID_SUFFIX, NAME_PROP, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP
 
Constructor Summary
ModuleHandle(org.eclipse.birt.report.model.core.Module module)
          Constructs one module handle with the given module element.
 
Method Summary
 void addAttributeListener(IAttributeListener listener)
          Adds one attribute listener.
 void addConfigVariable(ConfigVariable configVar)
          Adds a new config variable.
 void addDisposeListener(IDisposeListener listener)
          Adds one dispose listener.
 void addImage(EmbeddedImage image)
          Adds a new embedded image.
 void addTranslation(java.lang.String resourceKey, java.lang.String locale, java.lang.String text)
          Adds a new translation to the design.
 void addValidationListener(IValidationListener listener)
          Adds the validation listener, which implements IValidationListener.
 void checkReport()
          Checks this whole report.
 void close()
          Closes the design.
 java.util.Iterator configVariablesIterator()
          Returns the iterator over all config variables.
 java.util.Iterator customColorsIterator()
          Returns the iterator over all structures of color palette.
 void drop()
          Drops this element from the design.
 void dropAndClear()
          Drops this element from the design.
 void dropConfigVariable(java.lang.String name)
          Deprecated.  
 void dropImage(java.util.List images)
          Drops an embedded image handle list from the design.
 void dropImage(java.lang.String name)
          Deprecated.  
 void dropLibrary(LibraryHandle library)
          Drops the given library from the included libraries of this design file.
 void dropLibraryAndBreakExtends(LibraryHandle library)
          Drops the given library from the design and break all the parent/child relationships.
 void dropTranslation(java.lang.String resourceKey, java.lang.String locale)
          Drops a translation from the design.
 CascadingParameterGroupHandle findCascadingParameterGroup(java.lang.String groupName)
          Returns a cascading parameter group handle with the given group name
 CustomColor findColor(java.lang.String name)
          Finds the custom color with the given name.
 ConfigVariable findConfigVariable(java.lang.String name)
          Finds the config variable with the given name.
 DataSetHandle findDataSet(java.lang.String name)
          Finds a data set by name in this module and the included modules.
 DataSourceHandle findDataSource(java.lang.String name)
          Finds a data source by name in this module and the included modules.
 DesignElementHandle findElement(java.lang.String name)
          Finds a named element in the name space in this module and the included moduled.
 EmbeddedImage findImage(java.lang.String name)
          Finds the image with the given name.
 MasterPageHandle findMasterPage(java.lang.String name)
          Finds a master page by name in this module and the included modules.
 SharedStyleHandle findNativeStyle(java.lang.String name)
          Finds a style by its name in this module.
 ParameterHandle findParameter(java.lang.String name)
          Finds a parameter by name in this module and the included modules.
 java.net.URL findResource(java.lang.String fileName, int fileType)
          Returns the URL object if the file with fileName exists.
 SharedStyleHandle findStyle(java.lang.String name)
          Finds a style by its name in this module and the included modules.
 TemplateDataSetHandle findTemplateDataSet(java.lang.String name)
          Finds a template data set by name in this module and the included modules.
 ThemeHandle findTheme(java.lang.String name)
          Finds a theme by its name in this module and the included modules.
abstract  java.util.List getAllBookmarks()
          Gets all bookmarks defined in this module.
 java.util.List getAllDataSets()
          Returns all data set handles that this modules and the included modules contain.
 java.util.List getAllDataSources()
          Returns all data source handles that this modules and the included modules contain.
 java.util.List getAllImages()
          Returns the list of embedded images, including the one from libraries.
 java.util.List getAllLibraries()
          Returns the libraries this report design includes directly or indirectly.
 java.util.List getAllPages()
          Returns all page handles that this modules and the included modules contain.
 java.util.List getAllParameters()
          Returns all parameter handles that this modules and the included modules contain.
 java.util.List getAllStyles()
          Returns all style element handles that this modules and the included modules contain.
 java.util.List getAllThemes()
          Returns all theme element handles that this modules and the included modules contain.
 java.lang.String getAuthor()
          Returns the name of the author of the design report.
 CommandStack getCommandStack()
          Returns the command stack that manages undo/redo operations for the design.
 SlotHandle getComponents()
          Returns a slot handle to work with the top-level components within the report.
 java.lang.String getCreatedBy()
          Returns the name of the tool that created the design.
 SlotHandle getDataSets()
          Returns a slot handle to work with the data sets within the report.
 SlotHandle getDataSources()
          Returns a slot handle to work with the data sources within the report.
 java.lang.String getDefaultUnits()
          Returns the default units for the design.
 java.lang.String getDescription()
          Returns the static description for the module.
 java.lang.String getDescriptionKey()
          Returns the resource key of the static description of the module.
 java.lang.String getDisplayDescription()
          Returns the localized description for the module.
 org.eclipse.birt.report.model.core.DesignElement getElement()
          Returns the element to which this handle is attached.
 DesignElementHandle getElementByID(long id)
          Finds the handle to an element by a given element ID.
 java.util.List getErrorList()
          Returns a list containing errors during parsing the design file.
 java.lang.String getFileName()
          Returns the file name of the design.
 java.util.List getFlattenParameters()
          Returns the flatten Parameters/ParameterGroups of the design.
 java.lang.String getHelpGuide()
          Returns an external file that provides help information for the report.
 java.lang.String getIncludeResource()
          Get the base name of the customer-defined resource bundle.
 java.lang.String getInitialize()
          Returns the script called when the report starts executing.
 java.util.List getLibraries()
          Returns the libraries this report design includes directly.
protected  java.util.List getLibraries(int level)
          Returns included libaries this report design includes directly or indirectly within the given depth.
 LibraryHandle getLibrary(java.lang.String namespace)
          Returns the library handle with the given namespace.
 SlotHandle getMasterPages()
          Returns a slot handle to work with the master pages within the report.
 java.lang.String getMessage(java.lang.String resourceKey)
          Finds user-defined messages for the current thread's locale.
 java.lang.String getMessage(java.lang.String resourceKey, java.util.Locale locale)
          Finds user-defined messages for the given locale.
 java.util.List getMessageKeys()
          Return a list of user-defined message keys.
 SlotHandle getParameters()
          Returns a slot handle to work with the top-level parameters and parameter groups within the report.
 SlotHandle getStyles()
          Returns a slot handle to work with the styles within the report.
 ThemeHandle getTheme()
          Returns the refresh rate when viewing the report.
 TranslationHandle getTranslation(java.lang.String resourceKey, java.lang.String locale)
          Gets a handle to deal with a translation.
 java.lang.String[] getTranslationKeys()
          Returns a string array containing all the resource keys of user-defined translations for the report.
 java.util.List getTranslations()
          Gets a list of translation defined on the report.
 java.util.List getVisibleDataSets()
          Returns data set handles that are visible to this modules.
 java.util.List getVisibleDataSources()
          Returns data source handles that are visible to this modules.
 java.util.List getWarningList()
          Returns a list containing warnings during parsing the design file.
 java.util.Iterator imagesIterator()
          Returns the iterator over all embedded images of this module instance.
abstract  void importCssStyles(CssStyleSheetHandle stylesheet, java.util.List selectedStyles)
          Imports the selected styles in a CssStyleSheetHandle to the module.
 java.util.Iterator includeLibrariesIterator()
          Returns the iterator over all included libraries.
 void includeLibrary(java.lang.String libraryFileName, java.lang.String namespace)
          Includes one library with the given library file name.
 boolean isInclude(LibraryHandle library)
          Checks whether there is an included library in this module, which has the same absolute path as that of the given library.
 boolean isReadOnly()
          Returns whether this module is read-only.
 boolean needsSave()
          Determines if the design has changed since it was last read from, or written to, the file.
 void onSave()
          Calls to inform a save is successful.
 CssStyleSheetHandle openCssStyleSheet(java.io.InputStream is)
          Gets the result style sheet with given file name of an external CSS2 resource.
 CssStyleSheetHandle openCssStyleSheet(java.lang.String fileName)
          Gets the result style sheet with given file name of an external CSS2 resource.
 boolean removeAttributeListener(IAttributeListener listener)
          Removes one attribute listener.
 boolean removeDisposeListener(IDisposeListener listener)
          Removes one dispose listener.
 boolean removeValidationListener(IValidationListener listener)
          Removes a given validation listener.
 void rename(DesignElementHandle elementHandle)
          Checks the element name in name space of this report.
 void rename(EmbeddedImage image)
          Checks the name of the embedded image in this report.
 void replaceConfigVariable(ConfigVariable oldVar, ConfigVariable newVar)
          Replaces the old config variable with the new one.
 void replaceImage(EmbeddedImage oldVar, EmbeddedImage newVar)
          Replaces the old embedded image with the new one.
 void save()
          Saves the module to an existing file name.
 void saveAs(java.lang.String newName)
          Saves the design to the file name provided.
 void serialize(java.io.OutputStream out)
          Writes the report design to the given output stream.
 void setAuthor(java.lang.String author)
          Sets the name of the author of the design report.
 void setCreatedBy(java.lang.String toolName)
          Returns the name of the tool that created the design.
 void setDefaultUnits(java.lang.String units)
          Sets the default units for the design.
 void setDescription(java.lang.String description)
          Sets the description of the module.
 void setDescriptionKey(java.lang.String resourceKey)
          Sets the resource key of the static description of the module.
 void setFileName(java.lang.String newName)
          Sets the design file name.
 void setHelpGuide(java.lang.String helpGuide)
          Sets an external file that provides help information for the report.
 void setIncludeResource(java.lang.String baseName)
          Set the base name of the customer-defined resource bundle.
 void setInitialize(java.lang.String value)
          Sets the script called when the report starts executing.
 void setTheme(ThemeHandle theme)
          Sets the theme to a report.
 void setThemeName(java.lang.String themeName)
          Sets the theme to a report.
 void shiftLibrary(LibraryHandle library, int toPosn)
          Shifts the library to new position.
 
Methods inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
addElement, addElement, addListener, addUserPropertyDefn, canContain, canContain, canDrop, canEdit, canTransformToTemplate, clearAllProperties, clearContents, clearProperty, clientsIterator, copy, copyPropertyTo, createTemplateElement, derivedIterator, doSort, dropUserPropertyDefn, findContentSlot, getBooleanProperty, getChoices, getColorProperty, getContainer, getContainerSlotHandle, getDefn, getDesign, getDesignHandle, getDimensionProperty, getDisplayLabel, getDisplayLabel, getDisplayProperty, getEffectiveModule, getElementFactory, getElementProperty, getEventHandlerClass, getExtends, getFactoryPropertyHandle, getFloatProperty, getFontProperty, getID, getIntProperty, getListProperty, getMethods, getModule, getModuleHandle, getName, getNumberProperty, getPrivateStyle, getProperty, getPropertyBinding, getPropertyDefn, getPropertyHandle, getPropertyIterator, getQualifiedName, getRoot, getSemanticErrors, getSlot, getStringProperty, getStyle, getUserProperties, getUserPropertyDefnHandle, getXPath, hasLocalProperties, hasSemanticError, isTemplateParameterValue, isValid, localize, moveTo, removeListener, revertToReportItem, revertToTemplate, semanticCheck, setEventHandlerClass, setExtends, setExtendsElement, setExtendsName, setFloatProperty, setIntProperty, setName, setNumberProperty, setProperties, setProperty, setPropertyBinding, setStringProperty, setStyle, setStyleElement, setStyleName, setValid, showError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleHandle

public ModuleHandle(org.eclipse.birt.report.model.core.Module module)
Constructs one module handle with the given module element.

Parameters:
module - module
Method Detail

addConfigVariable

public void addConfigVariable(ConfigVariable configVar)
                       throws SemanticException
Adds a new config variable.

Parameters:
configVar - the config variable
Throws:
SemanticException - if the name is empty or the same name exists.

addImage

public void addImage(EmbeddedImage image)
              throws SemanticException
Adds a new embedded image.

Parameters:
image - the image to add
Throws:
SemanticException - if the name is empty, type is invalid, or the same name exists.

rename

public void rename(EmbeddedImage image)
Checks the name of the embedded image in this report. If duplicate, get a unique name and rename it.

Parameters:
image - the embedded image whose name is need to check

addTranslation

public void addTranslation(java.lang.String resourceKey,
                           java.lang.String locale,
                           java.lang.String text)
                    throws CustomMsgException
Adds a new translation to the design.

Parameters:
resourceKey - resource key for the message
locale - the string value of a locale for the translation. Locale should be in java-defined format( en, en-US, zh_CN, etc.)
text - translated text for the locale
Throws:
CustomMsgException - if the resource key is duplicate or missing, or locale is not a valid format.
See Also:
getTranslation(String, String)

addValidationListener

public void addValidationListener(IValidationListener listener)
Adds the validation listener, which implements IValidationListener. A listener receives notifications each time an element is validated.

Parameters:
listener - the validation listener.

checkReport

public void checkReport()
Checks this whole report. Only one ValidationEvent will be sent, which contains all error information of this check.


close

public void close()
Closes the design. The report design handle is no longer valid after closing the design. This method will send notifications instance of DisposeEvent to all the dispose listeners registered in the module.


configVariablesIterator

public java.util.Iterator configVariablesIterator()
Returns the iterator over all config variables. Each one is the instance of ConfigVariableHandle.

Note: The configure variable in library file will be hidden if the one with the same name appears in design file.

Returns:
the iterator over all config variables.
See Also:
ConfigVariableHandle

customColorsIterator

public java.util.Iterator customColorsIterator()
Returns the iterator over all structures of color palette. Each one is the instance of CustomColorHandle

Returns:
the iterator over all structures of color palette.
See Also:
CustomColorHandle

dropConfigVariable

public void dropConfigVariable(java.lang.String name)
                        throws SemanticException
Deprecated.  

Drops a config variable.

Parameters:
name - config variable name
Throws:
SemanticException - if no config variable is found.

dropImage

public void dropImage(java.util.List images)
               throws SemanticException
Drops an embedded image handle list from the design. Each one in the list is the instance of EmbeddedImageHandle.

Parameters:
images - the image handle list to remove
Throws:
SemanticException - if any image in the list is not found.

dropImage

public void dropImage(java.lang.String name)
               throws SemanticException
Deprecated.  

Drops an embedded image from the design.

Parameters:
name - the image name
Throws:
SemanticException - if the image is not found.

dropTranslation

public void dropTranslation(java.lang.String resourceKey,
                            java.lang.String locale)
                     throws CustomMsgException
Drops a translation from the design.

Parameters:
resourceKey - resource key of the message in which this translation saves.
locale - the string value of the locale for a translation. Locale should be in java-defined format( en, en-US, zh_CN, etc.)
Throws:
CustomMsgException - if resourceKey is null.
See Also:
getTranslation(String, String)

findDataSet

public DataSetHandle findDataSet(java.lang.String name)
Finds a data set by name in this module and the included modules.

Parameters:
name - name of the data set
Returns:
a handle to the data set, or null if the data set is not found

findTemplateDataSet

public TemplateDataSetHandle findTemplateDataSet(java.lang.String name)
Finds a template data set by name in this module and the included modules.

Parameters:
name - name of the data set
Returns:
a handle to the template data set, or null if the data set is not found

findDataSource

public DataSourceHandle findDataSource(java.lang.String name)
Finds a data source by name in this module and the included modules.

Parameters:
name - name of the data source
Returns:
a handle to the data source, or null if the data source is not found

findElement

public DesignElementHandle findElement(java.lang.String name)
Finds a named element in the name space in this module and the included moduled.

Parameters:
name - the name of the element to find
Returns:
a handle to the element, or null if the element was not found.

findImage

public EmbeddedImage findImage(java.lang.String name)
Finds the image with the given name.

Parameters:
name - the image name
Returns:
embedded image with the given name. Return null, if not found.

findConfigVariable

public ConfigVariable findConfigVariable(java.lang.String name)
Finds the config variable with the given name.

Parameters:
name - the variable name
Returns:
the config variable with the given name. Return null, if not found.

findColor

public CustomColor findColor(java.lang.String name)
Finds the custom color with the given name.

Parameters:
name - the color name
Returns:
the custom color with the given name. Return null if it's not found.

findMasterPage

public MasterPageHandle findMasterPage(java.lang.String name)
Finds a master page by name in this module and the included modules.

Parameters:
name - the name of the master page
Returns:
a handle to the master page, or null if the page is not found

findParameter

public ParameterHandle findParameter(java.lang.String name)
Finds a parameter by name in this module and the included modules.

Parameters:
name - the name of the parameter
Returns:
a handle to the parameter, or null if the parameter is not found

findNativeStyle

public SharedStyleHandle findNativeStyle(java.lang.String name)
Finds a style by its name in this module. The style with the same name, which is defined the included module, will never be returned.

Parameters:
name - name of the style
Returns:
a handle to the style, or null if the style is not found

findStyle

public SharedStyleHandle findStyle(java.lang.String name)
Finds a style by its name in this module and the included modules.

Parameters:
name - name of the style
Returns:
a handle to the style, or null if the style is not found

findTheme

public ThemeHandle findTheme(java.lang.String name)
Finds a theme by its name in this module and the included modules.

Parameters:
name - name of the style
Returns:
a handle to the style, or null if the style is not found

getAuthor

public java.lang.String getAuthor()
Returns the name of the author of the design report.

Returns:
the name of the author.

getCommandStack

public CommandStack getCommandStack()
Returns the command stack that manages undo/redo operations for the design.

Returns:
a command stack
See Also:
CommandStack

getComponents

public SlotHandle getComponents()
Returns a slot handle to work with the top-level components within the report.

Returns:
A handle for working with the components.

getCreatedBy

public java.lang.String getCreatedBy()
Returns the name of the tool that created the design.

Returns:
the name of the tool

getDataSets

public SlotHandle getDataSets()
Returns a slot handle to work with the data sets within the report. Note that the order of the data sets within the slot is unimportant.

Returns:
A handle for working with the data sets.

getDataSources

public SlotHandle getDataSources()
Returns a slot handle to work with the data sources within the report. Note that the order of the data sources within the slot is unimportant.

Returns:
A handle for working with the data sources.

getDefaultUnits

public java.lang.String getDefaultUnits()
Returns the default units for the design. These are the units that are used for dimensions that don't explicitly specify units.

Returns:
the default units for the design.
See Also:
DimensionValue

setDefaultUnits

public void setDefaultUnits(java.lang.String units)
                     throws SemanticException
Sets the default units for the design. These are the units that are used for dimensions that don't explicitly specify units.

For a report design, it allows the following constants that defined in DesignChoiceConstants:

Parameters:
units - the default units for the design.
Throws:
SemanticException - if the input unit is not one of allowed.
See Also:
DimensionValue

getElement

public org.eclipse.birt.report.model.core.DesignElement getElement()
Description copied from class: DesignElementHandle
Returns the element to which this handle is attached.

Specified by:
getElement in class DesignElementHandle
Returns:
The attached element. Will be null if the handle is not attached.

getElementByID

public DesignElementHandle getElementByID(long id)
Finds the handle to an element by a given element ID. Returns null if the ID is not valid, or if this session does not use IDs.

Parameters:
id - ID of the element to find
Returns:
A handle to the element, or null if the element was not found or this session does not use IDs.

getErrorList

public java.util.List getErrorList()
Returns a list containing errors during parsing the design file.

Returns:
a list containing parsing errors. Each element in the list is ErrorDetail.
See Also:
ErrorDetail

getFileName

public java.lang.String getFileName()
Returns the file name of the design. This is the name of the file from which the design was read, or the name to which the design was last written.

Returns:
the file name

getFlattenParameters

public java.util.List getFlattenParameters()
Returns the flatten Parameters/ParameterGroups of the design. This method put all Parameters and ParameterGroups into a list then return it. The return list is sorted by on the display name of the parameters.

Returns:
the sorted, flatten parameters and parameter groups.

getHelpGuide

public java.lang.String getHelpGuide()
Returns an external file that provides help information for the report.

Returns:
the name of an external file

getInitialize

public java.lang.String getInitialize()
Returns the script called when the report starts executing.

Returns:
the script called when the report starts executing

getMasterPages

public SlotHandle getMasterPages()
Returns a slot handle to work with the master pages within the report. Note that the order of the master pages within the slot is unimportant.

Returns:
A handle for working with the master pages.

getMessage

public java.lang.String getMessage(java.lang.String resourceKey)
Finds user-defined messages for the current thread's locale.

Parameters:
resourceKey - Resource key of the user-defined message.
Returns:
the corresponding locale-dependent messages. Return null if resoueceKey is blank.
See Also:
getMessage(String, Locale)

getMessage

public java.lang.String getMessage(java.lang.String resourceKey,
                                   java.util.Locale locale)
Finds user-defined messages for the given locale.

First we look up in the report itself, then look into the referenced message file. Each search uses a reduced form of Java locale-driven search algorithm: Language&Country, language, default.

Parameters:
resourceKey - Resource key of the user defined message.
locale - locale of message, if the input locale is null, the locale for the current thread will be used instead.
Returns:
the corresponding locale-dependent messages. Return null if resoueceKey is blank.

getMessageKeys

public java.util.List getMessageKeys()
Return a list of user-defined message keys. The list contained resource keys defined in the report itself and the keys defined in the referenced message files for the current thread's locale. The list returned contains no duplicate keys.

Returns:
a list of user-defined message keys.

getParameters

public SlotHandle getParameters()
Returns a slot handle to work with the top-level parameters and parameter groups within the report. The order that the items appear within the slot determines the order in which they appear in the "requester" UI.

Returns:
A handle for working with the parameters and parameter groups.

findCascadingParameterGroup

public CascadingParameterGroupHandle findCascadingParameterGroup(java.lang.String groupName)
Returns a cascading parameter group handle with the given group name

Parameters:
groupName - name of the cascading parameter group.
Returns:
a handle to the cascading parameter group. Returns null if the cascading group with the given name is not found.

getStyles

public SlotHandle getStyles()
Returns a slot handle to work with the styles within the report. Note that the order of the styles within the slot is unimportant.

Returns:
A handle for working with the styles.

getTranslation

public TranslationHandle getTranslation(java.lang.String resourceKey,
                                        java.lang.String locale)
Gets a handle to deal with a translation. A translation is identified by its resourceKey and locale.

Parameters:
resourceKey - the resource key
locale - the locale information
Returns:
corresponding TranslationHandle. Or return null if the translation is not found in the design.
See Also:
TranslationHandle

getTranslationKeys

public java.lang.String[] getTranslationKeys()
Returns a string array containing all the resource keys of user-defined translations for the report.

Returns:
a string array containing message resource keys, return null if there is no messages defined in the design.

getTranslations

public java.util.List getTranslations()
Gets a list of translation defined on the report. The content of the list is the corresponding TranslationHandle.

Returns:
a list containing TranslationHandles defined on the report or null if the design has no any translations.
See Also:
TranslationHandle

getWarningList

public java.util.List getWarningList()
Returns a list containing warnings during parsing the design file.

Returns:
a list containing parsing warnings. Each element in the list is ErrorDetail.
See Also:
ErrorDetail

imagesIterator

public java.util.Iterator imagesIterator()
Returns the iterator over all embedded images of this module instance. Each one is the instance of EmbeddedImageHandle

Returns:
the iterator over all embedded images.
See Also:
EmbeddedImageHandle

getAllImages

public java.util.List getAllImages()
Returns the list of embedded images, including the one from libraries. Each one is the instance of EmbeddedImageHandle

Returns:
the list of embedded images.
See Also:
EmbeddedImageHandle

needsSave

public boolean needsSave()
Determines if the design has changed since it was last read from, or written to, the file. The dirty state reflects the action of the command stack. If the user saves the design and then changes it, the design is dirty. If the user then undoes the change, the design is no longer dirty.

Returns:
true if the design has changed since the last load or save; false if it has not changed.

onSave

public void onSave()
Calls to inform a save is successful. Must be called after a successful completion of a save done using serialize.


removeValidationListener

public boolean removeValidationListener(IValidationListener listener)
Removes a given validation listener. If the listener not registered, then the request is silently ignored.

Parameters:
listener - the listener to de-register
Returns:
true if listener is sucessfully removed. Otherwise false.

rename

public void rename(DesignElementHandle elementHandle)
Checks the element name in name space of this report.

Parameters:
elementHandle - the element handle whose name is need to check.

replaceConfigVariable

public void replaceConfigVariable(ConfigVariable oldVar,
                                  ConfigVariable newVar)
                           throws SemanticException
Replaces the old config variable with the new one.

Parameters:
oldVar - the old config variable
newVar - the new config variable
Throws:
SemanticException - if the old config variable is not found or the name of new one is empty.

replaceImage

public void replaceImage(EmbeddedImage oldVar,
                         EmbeddedImage newVar)
                  throws SemanticException
Replaces the old embedded image with the new one.

Parameters:
oldVar - the old embedded image
newVar - the new embedded image
Throws:
SemanticException - if the old image is not found or the name of new one is empty.

save

public void save()
          throws java.io.IOException
Saves the module to an existing file name. Call this only when the file name has been set.

Throws:
java.io.IOException - if the file cannot be saved on the storage
See Also:
saveAs(String)

saveAs

public void saveAs(java.lang.String newName)
            throws java.io.IOException
Saves the design to the file name provided. The file name is saved in the design, and subsequent calls to save( ) will save to this new name.

Parameters:
newName - the new file name
Throws:
java.io.IOException - if the file cannot be saved
See Also:
save()

serialize

public void serialize(java.io.OutputStream out)
               throws java.io.IOException
Writes the report design to the given output stream. The caller must call onSave if the save succeeds.

Parameters:
out - the output stream to which the design is written.
Throws:
java.io.IOException - if the file cannot be written to the output stream successfully.

setAuthor

public void setAuthor(java.lang.String author)
Sets the name of the author of the design report.

Parameters:
author - the name of the author.

setCreatedBy

public void setCreatedBy(java.lang.String toolName)
Returns the name of the tool that created the design.

Parameters:
toolName - the name of the tool

setFileName

public void setFileName(java.lang.String newName)
Sets the design file name. This method will send notifications instance of AttributeEvent to all the attribute listeners registered in the module.

Parameters:
newName - the new file name. It may contain the relative/absolute path information. This name must include the file name with the filename extension.

setHelpGuide

public void setHelpGuide(java.lang.String helpGuide)
Sets an external file that provides help information for the report.

Parameters:
helpGuide - the name of an external file

setInitialize

public void setInitialize(java.lang.String value)
Sets the script called when the report starts executing.

Parameters:
value - the script to set.

getAllStyles

public java.util.List getAllStyles()
Returns all style element handles that this modules and the included modules contain.

Returns:
all style element handles that this modules and the included modules contain.

getAllThemes

public java.util.List getAllThemes()
Returns all theme element handles that this modules and the included modules contain.

Returns:
all theme element handles that this modules and the included modules contain.

getAllDataSources

public java.util.List getAllDataSources()
Returns all data source handles that this modules and the included modules contain.

Returns:
all data source handles that this modules and the included modules contain.

getVisibleDataSources

public java.util.List getVisibleDataSources()
Returns data source handles that are visible to this modules.

Returns:
data source handles that are visible to this modules.

getAllDataSets

public java.util.List getAllDataSets()
Returns all data set handles that this modules and the included modules contain.

Returns:
all data set handles that this modules and the included modules contain.

getVisibleDataSets

public java.util.List getVisibleDataSets()
Returns data set handles that are visible to this modules.

Returns:
data set handles that are visible to this modules.

getAllPages

public java.util.List getAllPages()
Returns all page handles that this modules and the included modules contain.

Returns:
all page handles that this modules and the included modules contain.

getAllParameters

public java.util.List getAllParameters()
Returns all parameter handles that this modules and the included modules contain.

Returns:
all parameter handles that this modules and the included modules contain.

getAllLibraries

public java.util.List getAllLibraries()
Returns the libraries this report design includes directly or indirectly. Each in the returned list is the instance of LibraryHandle.

Returns:
the libraries this report design includes directly or indirectly.

getLibraries

protected java.util.List getLibraries(int level)
Returns included libaries this report design includes directly or indirectly within the given depth.

Parameters:
level - the given depth
Returns:
list of libraries.

getLibraries

public java.util.List getLibraries()
Returns the libraries this report design includes directly. Each in the returned list is the instance of LibraryHandle.

Returns:
the libraries this report design includes directly.

getLibrary

public LibraryHandle getLibrary(java.lang.String namespace)
Returns the library handle with the given namespace.

Parameters:
namespace - the library namespace
Returns:
the library handle with the given namespace

shiftLibrary

public void shiftLibrary(LibraryHandle library,
                         int toPosn)
                  throws SemanticException
Shifts the library to new position. This method might affect the style reference, because the library order is changed.

Parameters:
library - the library to shift
toPosn - the new position
Throws:
SemanticException - if error is encountered when shifting

isReadOnly

public boolean isReadOnly()
Returns whether this module is read-only.

Returns:
true, if this module is read-only. Otherwise, return false.

includeLibrariesIterator

public java.util.Iterator includeLibrariesIterator()
Returns the iterator over all included libraries. Each one is the instance of IncludeLibraryHandle

Returns:
the iterator over all included libraries.
See Also:
IncludedLibraryHandle

includeLibrary

public void includeLibrary(java.lang.String libraryFileName,
                           java.lang.String namespace)
                    throws DesignFileException,
                           SemanticException
Includes one library with the given library file name. The new library will be appended to the library list.

Parameters:
libraryFileName - library file name
namespace - library namespace
Throws:
DesignFileException - if the library file is not found, or has fatal error.
SemanticException - if error is encountered when handling IncludeLibrary structure list.

dropLibrary

public void dropLibrary(LibraryHandle library)
                 throws SemanticException
Drops the given library from the included libraries of this design file.

Parameters:
library - the library to drop
Throws:
SemanticException - if error is encountered when handling IncludeLibrary structure list. Or it maybe because that the given library is not found in the design. Or that the library has descedents in the current module

dropLibraryAndBreakExtends

public void dropLibraryAndBreakExtends(LibraryHandle library)
                                throws SemanticException
Drops the given library from the design and break all the parent/child relationships. All child element will be localized in the module.

Parameters:
library - the given library to drop
Throws:
SemanticException - if errors occured when drop the library.It may be because that the library is not found in the design or that some elements can not be localized properly.

addAttributeListener

public void addAttributeListener(IAttributeListener listener)
Adds one attribute listener. The duplicate listener will not be added.

Parameters:
listener - the attribute listener to add

removeAttributeListener

public boolean removeAttributeListener(IAttributeListener listener)
Removes one attribute listener. If the listener not registered, then the request is silently ignored.

Parameters:
listener - the attribute listener to remove
Returns:
true if listener is successfully removed. Otherwise false.

addDisposeListener

public void addDisposeListener(IDisposeListener listener)
Adds one dispose listener. The duplicate listener will not be added.

Parameters:
listener - the dispose listener to add

removeDisposeListener

public boolean removeDisposeListener(IDisposeListener listener)
Removes one dispose listener. If the listener not registered, then the request is silently ignored.

Parameters:
listener - the dispose listener to remove
Returns:
true if listener is successfully removed. Otherwise false.

drop

public void drop()
          throws SemanticException
Description copied from class: DesignElementHandle
Drops this element from the design. Removes the element from its container and name space, if any.

Note: If this element is referenceable, the property referring it will be unresolved.

Overrides:
drop in class DesignElementHandle
Throws:
SemanticException - if this element has no container or the element cannot be dropped.
See Also:
SlotHandle, DesignElementHandle.dropAndClear()

dropAndClear

public void dropAndClear()
                  throws SemanticException
Description copied from class: DesignElementHandle
Drops this element from the design. Removes the element from its container and name space, if any.

Note: If this element is referenceable, the property referring it will be set null.

Overrides:
dropAndClear in class DesignElementHandle
Throws:
SemanticException - if this element has no container or the element cannot be dropped.
See Also:
SlotHandle, DesignElementHandle.drop()

getIncludeResource

public java.lang.String getIncludeResource()
Get the base name of the customer-defined resource bundle.

Returns:
the base name of the customer-defined resource bundle.

setIncludeResource

public void setIncludeResource(java.lang.String baseName)
Set the base name of the customer-defined resource bundle. The name is a common base name, e.g: "myMessage" without the Language_Country suffix, then the message file family can be "myMessage_en.properties", "myMessage_zh_CN.properties" etc. The message file is stored in the same folder as the design file.

Parameters:
baseName - common base name of the customer-defined resource bundle.

findResource

public java.net.URL findResource(java.lang.String fileName,
                                 int fileType)
Returns the URL object if the file with fileName exists. This method takes the following search steps:

Parameters:
fileName - file name to search
fileType - file type. The value should be one of:
  • IResourceLocator.IMAGE
  • IResourceLocator.LIBRARY
Any invalid value will be treated as IResourceLocator.IMAGE.
Returns:
the URL object if the file with fileName is found, or null otherwise.

openCssStyleSheet

public CssStyleSheetHandle openCssStyleSheet(java.lang.String fileName)
                                      throws StyleSheetException
Gets the result style sheet with given file name of an external CSS2 resource.

Parameters:
fileName - the file name of the external CSS resource
Returns:
the CssStyleSheetHandle if the external resource is successfully loaded
Throws:
StyleSheetException - thrown if the resource is not found, or there are syntax errors in the resource

openCssStyleSheet

public CssStyleSheetHandle openCssStyleSheet(java.io.InputStream is)
                                      throws StyleSheetException
Gets the result style sheet with given file name of an external CSS2 resource.

Parameters:
is - the input stream of the resource
Returns:
the CssStyleSheetHandle if the external resource is successfully loaded
Throws:
StyleSheetException - thrown if the resource is not found, or there are syntax errors in the resource

importCssStyles

public abstract void importCssStyles(CssStyleSheetHandle stylesheet,
                                     java.util.List selectedStyles)
Imports the selected styles in a CssStyleSheetHandle to the module. Each in the list is instance of SharedStyleHandle .If any style selected has a duplicate name with that of one style already existing in the report design, this method will rename it and then add it to the design.

Parameters:
stylesheet - the style sheet handle that contains all the selected styles
selectedStyles - the selected style list

setThemeName

public void setThemeName(java.lang.String themeName)
                  throws SemanticException
Sets the theme to a report.

Parameters:
themeName - the name of the theme
Throws:
SemanticException

getTheme

public ThemeHandle getTheme()
Returns the refresh rate when viewing the report.

Returns:
the refresh rate

setTheme

public void setTheme(ThemeHandle theme)
              throws SemanticException
Sets the theme to a report.

Parameters:
theme - the theme instance
Throws:
SemanticException

isInclude

public boolean isInclude(LibraryHandle library)
Checks whether there is an included library in this module, which has the same absolute path as that of the given library.

Parameters:
library - the library to check
Returns:
true if there is an included library in this module, which has the same absolute path as that the given library, otherwise false

getDescription

public java.lang.String getDescription()
Returns the static description for the module.

Returns:
the static description to display

getDisplayDescription

public java.lang.String getDisplayDescription()
Returns the localized description for the module. If the localized description for the description resource key is found, it will be returned. Otherwise, the static description will be returned.

Returns:
the localized description for the module

setDescription

public void setDescription(java.lang.String description)
                    throws SemanticException
Sets the description of the module. Sets the static description itself. If the module is to be externalized, then set the description ID separately.

Parameters:
description - the new description for the module
Throws:
SemanticException - if the property is locked.

getDescriptionKey

public java.lang.String getDescriptionKey()
Returns the resource key of the static description of the module.

Returns:
the resource key of the static description

setDescriptionKey

public void setDescriptionKey(java.lang.String resourceKey)
                       throws SemanticException
Sets the resource key of the static description of the module.

Parameters:
resourceKey - the resource key of the static description
Throws:
SemanticException - if the resource key property is locked.

getAllBookmarks

public abstract java.util.List getAllBookmarks()
Gets all bookmarks defined in this module.

Returns:
All bookmarks defined in this module.


Copyright © 2005 Actuate Corp. All rights reserved.