Class ModuleHandleImpl

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

public abstract class ModuleHandleImpl 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 Details

    • isInitialized

      protected boolean isInitialized
      The flag indicates that whether the initialization is finished.
  • Constructor Details

    • ModuleHandleImpl

      public ModuleHandleImpl(org.eclipse.birt.report.model.core.Module module)
      Constructs one module handle with the given module element.
      Parameters:
      module - module
  • Method Details

    • 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 final 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(String resourceKey, String locale, 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:
    • addValidationListener

      public final 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 final void checkReport()
      Checks this whole report. Only one ValidationEvent will be sent, which contains all error information of this check.
    • close

      public final 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.
    • getNativeStructureList

      protected final List getNativeStructureList(String propName)
      Returns the structures which are defined locally in the current module. This method will collect all structures from the current module file locally.
      Parameters:
      propName - name of the list property
      Returns:
      the structure list, each of which is the instance of StructureHandle
    • configVariablesIterator

      public final Iterator configVariablesIterator()
      Returns the iterator over all configuration 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 configuration variables.
      See Also:
    • customColorsIterator

      public final 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:
    • dropConfigVariable

      @Deprecated public void dropConfigVariable(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(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

      @Deprecated public void dropImage(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(String resourceKey, 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:
    • findDataSet

      public final DataSetHandle findDataSet(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
    • findJointDataSet

      public final JointDataSetHandle findJointDataSet(String name)
      Finds a joint data set by name in this module and the included modules.
      Parameters:
      name - name of the joint data set
      Returns:
      a handle to the joint data set, or null if the data set is not found
    • findTemplateDataSet

      public final TemplateDataSetHandle findTemplateDataSet(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 final DataSourceHandle findDataSource(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 final DesignElementHandle findElement(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.
    • findCube

      public final CubeHandle findCube(String name)
      Finds a cube element by name in this module and the included modules.
      Parameters:
      name - the element name
      Returns:
      the cube element handle, if found, otherwise null
    • findLevel

      public final LevelHandle findLevel(String name)
      Finds a cube element by name in this module and the included modules.
      Parameters:
      name - the element name, name must be Dimension name + "/" + level name.
      Returns:
      the cube element handle, if found, otherwise null
    • findDimension

      public final DimensionHandle findDimension(String name)
      Finds a dimension element by name in this module and the included modules.
      Parameters:
      name - name of the dimension to find
      Returns:
      the dimension handle if found, otherwise null
    • findImage

      public final EmbeddedImage findImage(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 final ConfigVariable findConfigVariable(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 final CustomColor findColor(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 final MasterPageHandle findMasterPage(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 final ParameterHandle findParameter(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 final SharedStyleHandle findNativeStyle(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 final SharedStyleHandle findStyle(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 final ThemeHandle findTheme(String name)
      Finds a theme by its name in this module and the included modules.
      Parameters:
      name - name of the theme
      Returns:
      a handle to the theme, or null if the theme is not found
    • findReportItemTheme

      public final ReportItemThemeHandle findReportItemTheme(String name)
      Finds a report item theme by its name in this module and its included libraries.
      Parameters:
      name - name of the report item theme
      Returns:
      a handle to the report item theme, or null if not found
    • getAuthor

      public final String getAuthor()
      Returns the name of the author of the design report.
      Returns:
      the name of the author.
    • getSubject

      public final String getSubject()
      Gets the subject of the module.
      Returns:
      the subject of the module.
    • setSubject

      public final void setSubject(String subject) throws SemanticException
      Sets the subject of the module.
      Parameters:
      subject - the subject of the module.
      Throws:
      SemanticException
    • getComments

      public final String getComments()
      Gets comments property value.
      Returns:
      the comments property value.
    • setComments

      public final void setComments(String comments) throws SemanticException
      Sets the comments value.
      Parameters:
      comments - the comments.
      Throws:
      SemanticException
    • getCommandStack

      public final CommandStack getCommandStack()
      Returns the command stack that manages undo/redo operations for the design.
      Returns:
      a command stack
      See Also:
    • 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 final 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.
    • getCubes

      public abstract SlotHandle getCubes()
      Gets the slot handle to work with all cube elements within the report.
      Returns:
      cube slot handle
    • 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 final 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:
    • setDefaultUnits

      public final void setDefaultUnits(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 :

      • UNITS_IN
      • UNITS_CM
      • UNITS_MM
      • UNITS_PT
      Parameters:
      units - the default units for the design.
      Throws:
      SemanticException - if the input unit is not one of allowed.
      See Also:
    • getElement

      public final 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 final 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 final 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:
    • getFileName

      public final 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 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 final String getHelpGuide()
      Returns an external file that provides help information for the report.
      Returns:
      the name of an external file
    • getInitialize

      public final 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 final String getMessage(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

      public final String getMessage(String resourceKey, 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.
    • getMessage

      public final String getMessage(String resourceKey, com.ibm.icu.util.ULocale 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 final 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 final CascadingParameterGroupHandle findCascadingParameterGroup(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 final TranslationHandle getTranslation(String resourceKey, 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:
    • getTranslationKeys

      public final 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 final 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:
    • getWarningList

      public final 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:
    • imagesIterator

      public 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:
    • getAllImages

      public final 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:
    • needsSave

      public final 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 final void onSave()
      Calls to inform a save is successful. Must be called after a successful completion of a save done using serialize.
    • removeValidationListener

      public final 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 final void rename(DesignElementHandle elementHandle)
      Checks the element name in name space of this report.
      • If the element name is required and duplicate name is found in name space, rename the element with a new unique name.
      • If the element name is not required, clear the name.
      Parameters:
      elementHandle - the element handle whose name is need to check.
    • rename

      public void rename(DesignElementHandle containerHandle, DesignElementHandle elementHandle)
      Checks element name is unique in container.
      Parameters:
      containerHandle - container of element
      elementHandle - element handle
    • 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 final void save() throws IOException
      Saves the module to an existing file name. Call this only when the file name has been set.
      Throws:
      IOException - if the file cannot be saved on the storage
      See Also:
    • saveAs

      public final void saveAs(String newName) throws 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:
      IOException - if the file cannot be saved
      See Also:
    • serialize

      public final void serialize(OutputStream out) throws 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:
      IOException - if the file cannot be written to the output stream successfully.
    • setAuthor

      public final void setAuthor(String author)
      Sets the name of the author of the design report.
      Parameters:
      author - the name of the author.
    • setCreatedBy

      public final void setCreatedBy(String toolName)
      Returns the name of the tool that created the design.
      Parameters:
      toolName - the name of the tool
    • setFileName

      public final void setFileName(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 final void setHelpGuide(String helpGuide)
      Sets an external file that provides help information for the report.
      Parameters:
      helpGuide - the name of an external file
    • setInitialize

      public final void setInitialize(String value)
      Sets the script called when the report starts executing.
      Parameters:
      value - the script to set.
    • getAllStyles

      public 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.
    • getVisibleThemes

      public List getVisibleThemes(int level)
      Returns theme handles according the input level.
      Parameters:
      level - an int value, which should be the one defined in IVisibleLevelControl.
      Returns:
      theme handles according the input level
    • getVisibleReportItemThemes

      public List<ReportItemThemeHandle> getVisibleReportItemThemes(int level, String type)
      Returns report item theme handles according the input level.
      Parameters:
      level - an int value, which should be the one defined in IVisibleLevelControl.
      Returns:
      theme handles according the input level
    • getParametersAndParameterGroups

      public List getParametersAndParameterGroups()
      Returns parameters and parameter groups on the module. Those parameters included in the parameter groups are not included in the return list.
      Returns:
      parameters and parameter groups
    • getAllDataSources

      public final 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 final List getVisibleDataSources()
      Returns data source handles that are visible to this modules.
      Returns:
      data source handles that are visible to this modules.
    • getAllDataSets

      public final 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 final List getVisibleDataSets()
      Returns data set handles that are visible to this modules.
      Returns:
      data set handles that are visible to this modules.
    • getAllCubes

      public final List getAllCubes()
      Returns all cube handles that this modules and the included modules contain.
      Returns:
      all cube handles that this modules and the included modules contain.
    • getVisibleCubes

      public final List getVisibleCubes()
      Returns cube handles that are visible to this modules.
      Returns:
      cube handles that are visible to this modules.
    • getVisibleImages

      public final List getVisibleImages()
      Returns the embedded images which are defined on the module itself. The embedded images defined in the included libraries will not be returned by this method.
      Returns:
      the local embedded image list.
    • getAllPages

      public 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 final List getAllParameters()
      Returns all parameter handles that this modules.
      Returns:
      all parameter handles that this modules.
    • getAllLibraries

      public final 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 final 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 final 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 final LibraryHandle getLibrary(String namespace)
      Returns the library handle with the given namespace.
      Parameters:
      namespace - the library namespace
      Returns:
      the library handle with the given namespace
    • findLibrary

      public final LibraryHandle findLibrary(String fileName)
      Returns the library handle with the given file name. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
      Parameters:
      fileName - the library file name. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
      Returns:
      the library handle with the given file name
    • 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 final boolean isReadOnly()
      Returns whether this module is read-only.
      Returns:
      true, if this module is read-only. Otherwise, return false.
    • includeLibrariesIterator

      public 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:
    • includeLibrary

      public void includeLibrary(String libraryFileName, 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
    • reloadLibrary

      public void reloadLibrary(LibraryHandle libraryToReload) throws SemanticException, DesignFileException
      Reloads the library with the given library file path. If the library already is included directly, reload it. If the library is not included, exception will be thrown.

      Call this method cautiously ONLY on the condition that the library file is REALLY changed outside. After reload successfully, the command stack is cleared.

      Parameters:
      libraryToReload - the library instance
      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
      DesignFileException - if the library file is not found, or has fatal error.
    • reloadLibraries

      public void reloadLibraries() throws SemanticException, DesignFileException
      Reloads all libraries this module included.

      Call this method cautiously ONLY on the condition that the library file is REALLY changed outside. After reload successfully, the command stack is cleared. reloadLibrary(LibraryHandle)

      Throws:
      SemanticException
      DesignFileException
    • reloadLibrary

      public void reloadLibrary(String reloadPath) throws SemanticException, DesignFileException
      Reloads the library with the given library file path. If the library already is included directly or indirectly(that is, the reload path could be the path of grandson of this module), reload it. If the library is not included, exception will be thrown.

      Call this method cautiously ONLY on the condition that the library file is REALLY changed outside. After reload successfully, the command stack is cleared.

      Parameters:
      reloadPath - this is supposed to be an absolute path, not in url form.
      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
      DesignFileException - if the library file is not found, or has fatal error.
    • 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 final void addAttributeListener(IAttributeListener listener)
      Adds one attribute listener. The duplicate listener will not be added.
      Parameters:
      listener - the attribute listener to add
    • removeAttributeListener

      public final 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 final void addDisposeListener(IDisposeListener listener)
      Adds one dispose listener. The duplicate listener will not be added.
      Parameters:
      listener - the dispose listener to add
    • addResourceChangeListener

      public final void addResourceChangeListener(IResourceChangeListener listener)
      Adds one resource change listener. The duplicate listener will not be added.
      Parameters:
      listener - the resource change listener to add
    • removeDisposeListener

      public final 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.
    • removeResourceChangeListener

      public final boolean removeResourceChangeListener(IResourceChangeListener listener)
      Removes one resource change listener. If the listener not registered, then the request is silently ignored.
      Parameters:
      listener - the resource change listener to remove
      Returns:
      true if listener is successfully removed. Otherwise false.
    • drop

      public final 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 referencable, 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:
    • dropAndClear

      public final 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 referencable, 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:
    • getIncludeResource

      public final String getIncludeResource()
      Get the base name of the customer-defined resource bundle.
      Returns:
      the base name of the customer-defined resource bundle.
    • getIncludeResources

      public final List<String> getIncludeResources()
      Returns:
    • setIncludeResource

      public final void setIncludeResource(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.
    • setIncludeResources

      public final void setIncludeResources(List<String> baseNameList)
      Set the list of base name of the customer-defined resource bundles. 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:
      baseNameList - list of the base name
    • findResource

      public final URL findResource(String fileName, int fileType)
      Returns the URL object if the file with fileName exists. This method takes the following search steps:
        If file type is MESSAGEFILE ,
      • Search file with the file locator ( IResourceLocator) in session. And Now just deal with relative file name.
          If file type is not MESSAGEFILE,
        • Search file taking fileName as absolute file name;
        • Search file taking fileName as relative file name and basing "base" property of report design;
        • Search file with the file locator (IResourceLocator ) in session
      Parameters:
      fileName - file name to search
      fileType - file type. The value should be one of:
      • IResourceLocator.IMAGE
      • IResourceLocator.LIBRARY
      • IResourceLocator.MESSAGEFILE
      Any invalid value will be treated as IResourceLocator.IMAGE.
      Returns:
      the URL object if the file with fileName is found, or null otherwise.
    • findResource

      public final URL findResource(String fileName, int fileType, Map appContext)
      Returns the URL object if the file with fileName exists. This method takes the following search steps:
        If file type is MESSAGEFILE ,
      • Search file with the file locator ( IResourceLocator) in session. And Now just deal with relative file name.
          If file type is not MESSAGEFILE,
        • Search file taking fileName as absolute file name;
        • Search file taking fileName as relative file name and basing "base" property of report design;
        • Search file with the file locator (IResourceLocator ) in session
      Parameters:
      fileName - file name to search
      fileType - file type. The value should be one of:
      • IResourceLocator.IMAGE
      • IResourceLocator.LIBRARY
      • IResourceLocator.MESSAGEFILE
      Any invalid value will be treated as IResourceLocator.IMAGE.
      appContext - The map containing the user's information
      Returns:
      the URL object if the file with fileName is found, or null otherwise.
    • openCssStyleSheet

      public CssStyleSheetHandle openCssStyleSheet(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(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 void importCssStyles(CssStyleSheetHandle stylesheet, 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(String themeName) throws SemanticException
      Sets the theme to a report.
      Parameters:
      themeName - the name of the theme
      Throws:
      SemanticException
    • getTheme

      public final 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 final 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 final String getDescription()
      Returns the static description for the module.
      Returns:
      the static description to display
    • getDisplayDescription

      public final 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 final void setDescription(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 final String getDescriptionKey()
      Returns the resource key of the static description of the module.
      Returns:
      the resource key of the static description
    • setDescriptionKey

      public final void setDescriptionKey(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.
    • getTitle

      public final String getTitle()
      Gets the title property value.
      Returns:
      the title property value.
    • setTitle

      public final void setTitle(String title) throws SemanticException
      Sets the title value.
      Parameters:
      title - the title.
      Throws:
      SemanticException
    • getTitleKey

      public final String getTitleKey()
      Gets the title key.
      Returns:
      the title key.
    • setTitleKey

      public final void setTitleKey(String titleKey) throws SemanticException
      Sets the title key.
      Parameters:
      titleKey - the title key.
      Throws:
      SemanticException
    • initializeModule

      public final void initializeModule(Map properties) throws SemanticException
      Initializes the report design when it is just created.

      Set the value to the properties on repot design element which need the initialize valuel. All initialize operations will not go into the command stack and can not be undo redo.

      Parameters:
      properties - the property name value pairs.Those properties in the map are which need to be initialized.
      Throws:
      SemanticException - SemamticException will throw out when the give properties map contians invlid property name or property value.
    • getFileEncoding

      public final String getFileEncoding()
      Returns the encoding of the design/library file. Currently, BIRT only support UnicodeUtil.SIGNATURE_UTF_8.
      Returns:
      the encoding of the file
    • getSymbolicName

      public final String getSymbolicName()
      Gets symbolic name of this module if defined. This property is needed when search resources in fragments. Usually it should be the plug-in id of the host plug-in.
      Returns:
      the symbolica name of this module
    • setSymbolicName

      public final void setSymbolicName(String symbolicName) throws SemanticException
      Sets symbolic name of this module. This property is needed when search resources in fragments. Usually it should be the plug-in id of the host plug-in.
      Parameters:
      symbolicName -
      Throws:
      SemanticException
    • getSystemId

      public final URL getSystemId()
      Returns the system id of the module. It is the URL path of the module.
      Returns:
      the system id of the module
    • dropScriptLib

      public final void dropScriptLib(ScriptLib scriptLib) throws SemanticException
      Removes special script lib.
      Parameters:
      scriptLib - script lib
      Throws:
      SemanticException
    • dropIncludeScript

      public final void dropIncludeScript(IncludeScript includeScript) throws SemanticException
      Removes the given included script.
      Parameters:
      includeScript - the included script
      Throws:
      SemanticException
    • dropScriptLib

      public final void dropScriptLib(ScriptLibHandle scriptLibHandle) throws SemanticException
      Removes special script lib handle.
      Parameters:
      scriptLibHandle - script lib handle
      Throws:
      SemanticException
    • dropAllScriptLibs

      public final void dropAllScriptLibs() throws SemanticException
      Removes all script libs.
      Throws:
      SemanticException
    • scriptLibsIterator

      public final Iterator scriptLibsIterator()
      Returns the iterator over all script libs. Each one is the instance of ScriptLibHandle.

      Returns:
      the iterator over script libs.
      See Also:
    • getAllScriptLibs

      public final List getAllScriptLibs()
      Returns all script libs.
      Returns:
      list which structure is ScriptLibHandle
    • findScriptLib

      public final ScriptLib findScriptLib(String name)
      Gets script lib though name
      Parameters:
      name - name of script lib
      Returns:
      script lib
    • shiftScriptLibs

      public final void shiftScriptLibs(int sourceIndex, int destIndex) throws SemanticException
      Shifts jar file from source position to destination position. For example, if a list has A, B, C scriptLib in order, when move A scriptLib to newPosn with the value 1, the sequence becomes B, A, C.
      Parameters:
      sourceIndex - source position. The range is sourceIndex >= 0 && sourceIndex < list.size()
      destIndex - destination position.The range is destIndex >= 0 && destIndex < list.size()
      Throws:
      SemanticException
    • shifIncludeScripts

      public final void shifIncludeScripts(int sourceIndex, int destIndex) throws SemanticException
      Shifts included script from source position to destination position. For example, if a list has A, B, C scriptLib in order, when move Am includeScript to newPosn with the value 1, the sequence becomes B, A, C.
      Parameters:
      sourceIndex - source position. The range is sourceIndex >= 0 && sourceIndex < list.size()
      destIndex - destination position.The range is destIndex >= 0 && destIndex < list.size()
      Throws:
      SemanticException
    • addScriptLib

      public final void addScriptLib(ScriptLib scriptLib) throws SemanticException
      Add script lib
      Parameters:
      scriptLib - script lib
      Throws:
      SemanticException
    • addIncludeScript

      public final void addIncludeScript(IncludeScript includeScript) throws SemanticException
      Adds include script.
      Parameters:
      includeScript - the include script
      Throws:
      SemanticException
    • setResourceFolder

      public final void setResourceFolder(String resourceFolder)
      Sets the resource folder for this module.
      Parameters:
      resourceFolder - the folder to set
    • getResourceFolder

      public final String getResourceFolder()
      Gets the resource folder set in this module.
      Returns:
      the resource folder set in this module
    • getLineNoByID

      @Deprecated public final int getLineNoByID(long id)
      Deprecated.
      new method see getLineNo(Object)
      Looks up line number of the element in xml source given an element ID. Returns 1 if no line number of the element exists with the given ID.
      Parameters:
      id - The id of the element to find.
      Returns:
      The line number of the element given the element id, or 1 if the element can't be found or if IDs are not enabled.
    • getLineNo

      public final int getLineNo(Object obj)
      looks up line number of the element\property\structure, in xml source with given xPaht. Returns 1 if there is no corresponding element\property\structure.
      Parameters:
      obj - The xPath of the element\property\structure, it should be unique in an report file.
      Returns:
      The line number of the element\property\structure, or 1 if corresponding item does not exist.
    • getVersion

      public final String getVersion()
      Returns the version for the opened design file. If the report/library is newly created, the version is null. Only the opened/saved report/library have the version information.

      Whenever the report/library is save, the version becomes DesignSchemaConstants.REPORT_VERSION . That is, the saved report/library always have the latest version.

      Returns:
      the design file version number
    • includeScriptsIterator

      public final Iterator includeScriptsIterator()
      Returns the iterator over all included scripts. Each one is the instance of IncludeScriptHandle
      Returns:
      the iterator over all included scripts.
      See Also:
    • getAllIncludeScripts

      public final List getAllIncludeScripts()
      Gets all included scripts. Includes those defined in the libraries.
      Returns:
      the list of included script. Each item is an instance of IncludeScriptHandle .
    • copy

      public final IDesignElement copy()
      Description copied from class: DesignElementHandle
      Deeply clones the current design element which is wrapped by the handle.
      Overrides:
      copy in class DesignElementHandle
      Returns:
      the copy of the design element
    • sortVisibleElements

      protected final List sortVisibleElements(List nameSpaceList, int level)
      Sorts visible elements. Check value in design handle and libraries and sort the sequence as list in slot handle.
      Parameters:
      nameSpaceList - the list contains elements from name space
      level - level
      Returns:
      the list contains sorted design elements.
    • getVisibleModules

      protected List<ModuleHandleImpl> getVisibleModules(int level)
      Gets the visible modules.
      Parameters:
      level -
      Returns:
    • generateHandleList

      protected List generateHandleList(List elementList)
      Generates a list of element handles according to the given element list. Each content in the return list is generated use element.getHandle( Module )
      Parameters:
      elementList - a list of elements.
      Returns:
      a list of element handles.
    • getAllSharedDimensions

      public List<DimensionHandle> getAllSharedDimensions()
      Gets all the shared dimensions defined or accessed by this module.
      Returns:
    • checkReportIfNecessary

      public void checkReportIfNecessary()
      Checks the report if it is set in options.
    • setOptions

      public void setOptions(Map options)
      Sets options to the module.
      Parameters:
      options -
    • getOptions

      public Map getOptions()
      Gets the options set in the module.
      Returns: