Class ModuleHandleImpl
- All Implemented Interfaces:
IModuleModel
,org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
- Direct Known Subclasses:
ModuleHandle
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
FieldsModifier and TypeFieldDescriptionprotected boolean
The flag indicates that whether the initialization is finished.Fields inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
module
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, NEW_HANDLER_ON_EACH_EVENT_PROP, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROP
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, SCRIPTLIBS_PROP, SUBJECT_PROP, THEME_PROP, TITLE_ID_PROP, TITLE_PROP, UNITS_PROP
-
Constructor Summary
ConstructorsConstructorDescriptionModuleHandleImpl
(org.eclipse.birt.report.model.core.Module module) Constructs one module handle with the given module element. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addAttributeListener
(IAttributeListener listener) Adds one attribute listener.void
addConfigVariable
(ConfigVariable configVar) Adds a new config variable.final void
addDisposeListener
(IDisposeListener listener) Adds one dispose listener.void
addImage
(EmbeddedImage image) Adds a new embedded image.final void
addIncludeScript
(IncludeScript includeScript) Adds include script.final void
Adds one resource change listener.final void
addScriptLib
(ScriptLib scriptLib) Add script libvoid
addTranslation
(String resourceKey, String locale, String text) Adds a new translation to the design.final void
addValidationListener
(IValidationListener listener) Adds the validation listener, which implementsIValidationListener
.final void
Checks this whole report.void
Checks the report if it is set in options.final void
close()
Closes the design.final Iterator
Returns the iterator over all configuration variables.final IDesignElement
copy()
Deeply clones the current design element which is wrapped by the handle.final Iterator
Returns the iterator over all structures of color palette.final void
drop()
Drops this element from the design.final void
Removes all script libs.final void
Drops this element from the design.void
dropConfigVariable
(String name) Deprecated.void
Deprecated.void
Drops an embedded image handle list from the design.final void
dropIncludeScript
(IncludeScript includeScript) Removes the given included script.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.final void
dropScriptLib
(ScriptLib scriptLib) Removes special script lib.final void
dropScriptLib
(ScriptLibHandle scriptLibHandle) Removes special script lib handle.void
dropTranslation
(String resourceKey, String locale) Drops a translation from the design.findCascadingParameterGroup
(String groupName) Returns a cascading parameter group handle with the given group namefinal CustomColor
Finds the custom color with the given name.final ConfigVariable
findConfigVariable
(String name) Finds the config variable with the given name.final CubeHandle
Finds a cube element by name in this module and the included modules.final DataSetHandle
findDataSet
(String name) Finds a data set by name in this module and the included modules.final DataSourceHandle
findDataSource
(String name) Finds a data source by name in this module and the included modules.final DimensionHandle
findDimension
(String name) Finds a dimension element by name in this module and the included modules.final DesignElementHandle
findElement
(String name) Finds a named element in the name space in this module and the included moduled.final EmbeddedImage
Finds the image with the given name.final JointDataSetHandle
findJointDataSet
(String name) Finds a joint data set by name in this module and the included modules.final LevelHandle
Finds a cube element by name in this module and the included modules.final LibraryHandle
findLibrary
(String fileName) Returns the library handle with the given file name.final MasterPageHandle
findMasterPage
(String name) Finds a master page by name in this module and the included modules.final SharedStyleHandle
findNativeStyle
(String name) Finds a style by its name in this module.final ParameterHandle
findParameter
(String name) Finds a parameter by name in this module and the included modules.final ReportItemThemeHandle
findReportItemTheme
(String name) Finds a report item theme by its name in this module and its included libraries.final URL
findResource
(String fileName, int fileType) Returns theURL
object if the file withfileName
exists.final URL
findResource
(String fileName, int fileType, Map appContext) Returns theURL
object if the file withfileName
exists.final ScriptLib
findScriptLib
(String name) Gets script lib though namefinal SharedStyleHandle
Finds a style by its name in this module and the included modules.final TemplateDataSetHandle
findTemplateDataSet
(String name) Finds a template data set by name in this module and the included modules.final ThemeHandle
Finds a theme by its name in this module and the included modules.protected List
generateHandleList
(List elementList) Generates a list of element handles according to the given element list.final List
Returns all cube handles that this modules and the included modules contain.final List
Returns all data set handles that this modules and the included modules contain.final List
Returns all data source handles that this modules and the included modules contain.final List
Returns the list of embedded images, including the one from libraries.final List
Gets all included scripts.final List
Returns the libraries this report design includes directly or indirectly.Returns all page handles that this modules and the included modules contain.final List
Returns all parameter handles that this modules.final List
Returns all script libs.Gets all the shared dimensions defined or accessed by this module.Returns all style element handles that this modules and the included modules contain.final String
Returns the name of the author of the design report.final CommandStack
Returns the command stack that manages undo/redo operations for the design.final String
Gets comments property value.Returns a slot handle to work with the top-level components within the report.final String
Returns the name of the tool that created the design.abstract SlotHandle
getCubes()
Gets the slot handle to work with all cube elements within the report.Returns a slot handle to work with the data sets within the report.Returns a slot handle to work with the data sources within the report.final String
Returns the default units for the design.final String
Returns the static description for the module.final String
Returns the resource key of the static description of the module.final String
Returns the localized description for the module.final org.eclipse.birt.report.model.core.DesignElement
Returns the element to which this handle is attached.final DesignElementHandle
getElementByID
(long id) Finds the handle to an element by a given element ID.final List
Returns a list containing errors during parsing the design file.final String
Returns the encoding of the design/library file.final String
Returns the file name of the design.Returns the flatten Parameters/ParameterGroups of the design.final String
Returns an external file that provides help information for the report.final String
Get the base name of the customer-defined resource bundle.final String
Returns the script called when the report starts executing.final List
Returns the libraries this report design includes directly.protected final List
getLibraries
(int level) Returns included libaries this report design includes directly or indirectly within the given depth.final LibraryHandle
getLibrary
(String namespace) Returns the library handle with the given namespace.final int
looks up line number of the element\property\structure, in xml source with given xPaht.final int
getLineNoByID
(long id) Deprecated.Returns a slot handle to work with the master pages within the report.final String
getMessage
(String resourceKey) Finds user-defined messages for the current thread's locale.final String
getMessage
(String resourceKey, com.ibm.icu.util.ULocale locale) Finds user-defined messages for the given locale.final String
getMessage
(String resourceKey, Locale locale) Finds user-defined messages for the given locale.final List
Return a list of user-defined message keys.protected final List
getNativeStructureList
(String propName) Returns the structures which are defined locally in the current module.Gets the options set in the module.Returns a slot handle to work with the top-level parameters and parameter groups within the report.Returns parameters and parameter groups on the module.final String
Gets the resource folder set in this module.Returns a slot handle to work with the styles within the report.final String
Gets the subject of the module.final String
Gets symbolic name of this module if defined.final URL
Returns the system id of the module.final ThemeHandle
getTheme()
Returns the refresh rate when viewing the report.final String
getTitle()
Gets the title property value.final String
Gets the title key.final TranslationHandle
getTranslation
(String resourceKey, String locale) Gets a handle to deal with a translation.final String[]
Returns a string array containing all the resource keys of user-defined translations for the report.final List
Gets a list of translation defined on the report.final String
Returns the version for the opened design file.final List
Returns cube handles that are visible to this modules.final List
Returns data set handles that are visible to this modules.final List
Returns data source handles that are visible to this modules.final List
Returns the embedded images which are defined on the module itself.protected List<ModuleHandleImpl>
getVisibleModules
(int level) Gets the visible modules.getVisibleReportItemThemes
(int level, String type) Returns report item theme handles according the input level.getVisibleThemes
(int level) Returns theme handles according the input level.final List
Returns a list containing warnings during parsing the design file.Returns the iterator over all embedded images of this module instance.void
importCssStyles
(CssStyleSheetHandle stylesheet, List selectedStyles) Imports the selected styles in aCssStyleSheetHandle
to the module.Returns the iterator over all included libraries.void
includeLibrary
(String libraryFileName, String namespace) Includes one library with the given library file name.final Iterator
Returns the iterator over all included scripts.final void
initializeModule
(Map properties) Initializes the report design when it is just created.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.final boolean
Returns whether this module is read-only.final boolean
Determines if the design has changed since it was last read from, or written to, the file.final void
onSave()
Calls to inform a save is successful.Gets the result style sheet with given file name of an external CSS2 resource.openCssStyleSheet
(String fileName) Gets the result style sheet with given file name of an external CSS2 resource.void
Reloads all libraries this module included.void
reloadLibrary
(String reloadPath) Reloads the library with the given library file path.void
reloadLibrary
(LibraryHandle libraryToReload) Reloads the library with the given library file path.final boolean
removeAttributeListener
(IAttributeListener listener) Removes one attribute listener.final boolean
removeDisposeListener
(IDisposeListener listener) Removes one dispose listener.final boolean
Removes one resource change listener.final boolean
removeValidationListener
(IValidationListener listener) Removes a given validation listener.final void
rename
(DesignElementHandle elementHandle) Checks the element name in name space of this report.void
rename
(DesignElementHandle containerHandle, DesignElementHandle elementHandle) Checks element name is unique in container.final 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.final void
save()
Saves the module to an existing file name.final void
Saves the design to the file name provided.final Iterator
Returns the iterator over all script libs.final void
serialize
(OutputStream out) Writes the report design to the given output stream.final void
Sets the name of the author of the design report.final void
setComments
(String comments) Sets the comments value.final void
setCreatedBy
(String toolName) Returns the name of the tool that created the design.final void
setDefaultUnits
(String units) Sets the default units for the design.final void
setDescription
(String description) Sets the description of the module.final void
setDescriptionKey
(String resourceKey) Sets the resource key of the static description of the module.final void
setFileName
(String newName) Sets the design file name.final void
setHelpGuide
(String helpGuide) Sets an external file that provides help information for the report.final void
setIncludeResource
(String baseName) Set the base name of the customer-defined resource bundle.final void
setIncludeResources
(List<String> baseNameList) Set the list of base name of the customer-defined resource bundles.final void
setInitialize
(String value) Sets the script called when the report starts executing.void
setOptions
(Map options) Sets options to the module.final void
setResourceFolder
(String resourceFolder) Sets the resource folder for this module.final void
setSubject
(String subject) Sets the subject of the module.final void
setSymbolicName
(String symbolicName) Sets symbolic name of this module.void
setTheme
(ThemeHandle theme) Sets the theme to a report.void
setThemeName
(String themeName) Sets the theme to a report.final void
Sets the title value.final void
setTitleKey
(String titleKey) Sets the title key.final void
shifIncludeScripts
(int sourceIndex, int destIndex) Shifts included script from source position to destination position.void
shiftLibrary
(LibraryHandle library, int toPosn) Shifts the library to new position.final void
shiftScriptLibs
(int sourceIndex, int destIndex) Shifts jar file from source position to destination position.protected final List
sortVisibleElements
(List nameSpaceList, int level) Sorts visible elements.Methods inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
add, add, addElement, addElement, addListener, addUserPropertyDefn, cachePropertyHandles, canContain, canContain, canContain, canContain, canDrop, canEdit, canTransformToTemplate, clearAllProperties, clearContents, clearProperty, clientsIterator, copyPropertyTo, createTemplateElement, derivedIterator, doSort, drop, drop, dropAndClear, dropAndClear, dropUserPropertyDefn, findContentSlot, getBooleanProperty, getChoices, getColorProperty, getContainer, getContainerPropertyHandle, getContainerSlotHandle, getContent, getContentCount, getContents, getDefn, getDesign, getDesignHandle, getDimensionProperty, getDisplayLabel, getDisplayLabel, getDisplayProperty, getEffectiveModule, getElementFactory, getElementProperty, getEventHandlerClass, getExpressionProperty, getExtends, getExternalizedValue, getExternalizedValue, getExternalizedValue, getFactoryElementHandle, getFactoryPropertyHandle, getFloatProperty, getFontProperty, getFullName, getHostViewHandle, getID, getIndex, getIntProperty, getListProperty, getListProperty, getMethods, getModule, getModuleHandle, getName, getNumberProperty, getPrivateStyle, getProperty, getPropertyBinding, getPropertyBindingExpression, getPropertyBindings, getPropertyDefn, getPropertyHandle, getPropertyIterator, getQualifiedName, getRoot, getSemanticErrors, getSlot, getStringProperty, getStyle, getTagType, getUserProperties, getUserPropertyDefnHandle, getXPath, hasLocalProperties, hasSemanticError, initializeSlotHandles, isDirectionRTL, isInTemplateParameter, isTemplateParameterValue, isValid, localize, move, move, moveTo, moveTo, moveTo, moveTo, newHandlerOnEachEvent, paste, paste, paste, paste, removeListener, revertToReportItem, revertToTemplate, semanticCheck, setBooleanProperty, setEncryption, setEventHandlerClass, setExpressionProperty, setExtends, setExtendsElement, setExtendsName, setFloatProperty, setIntProperty, setName, setNewHandlerOnEachEvent, setNumberProperty, setProperties, setProperty, setPropertyBinding, setPropertyBinding, setStringProperty, setStyle, setStyleElement, setStyleName, setValid, shift, showError, slotsIterator
-
Field Details
-
isInitialized
protected boolean isInitializedThe 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
Adds a new config variable.- Parameters:
configVar
- the config variable- Throws:
SemanticException
- if the name is empty or the same name exists.
-
addImage
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
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 messagelocale
- 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
Adds the validation listener, which implementsIValidationListener
. 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 oneValidationEvent
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 ofDisposeEvent
to all the dispose listeners registered in the module. -
getNativeStructureList
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
Returns the iterator over all configuration variables. Each one is the instance ofConfigVariableHandle
.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
Returns the iterator over all structures of color palette. Each one is the instance ofCustomColorHandle
- Returns:
- the iterator over all structures of color palette.
- See Also:
-
dropConfigVariable
Deprecated.Drops a config variable.- Parameters:
name
- config variable name- Throws:
SemanticException
- if no config variable is found.
-
dropImage
Drops an embedded image handle list from the design. Each one in the list is the instance ofEmbeddedImageHandle
.- Parameters:
images
- the image handle list to remove- Throws:
SemanticException
- if any image in the list is not found.
-
dropImage
Deprecated.Drops an embedded image from the design.- Parameters:
name
- the image name- Throws:
SemanticException
- if the image is not found.
-
dropTranslation
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
- ifresourceKey
isnull
.- See Also:
-
findDataSet
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Returns the name of the author of the design report.- Returns:
- the name of the author.
-
getSubject
Gets the subject of the module.- Returns:
- the subject of the module.
-
setSubject
Sets the subject of the module.- Parameters:
subject
- the subject of the module.- Throws:
SemanticException
-
getComments
Gets comments property value.- Returns:
- the comments property value.
-
setComments
Sets the comments value.- Parameters:
comments
- the comments.- Throws:
SemanticException
-
getCommandStack
Returns the command stack that manages undo/redo operations for the design.- Returns:
- a command stack
- See Also:
-
getComponents
Returns a slot handle to work with the top-level components within the report.- Returns:
- A handle for working with the components.
-
getCreatedBy
Returns the name of the tool that created the design.- Returns:
- the name of the tool
-
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
Gets the slot handle to work with all cube elements within the report.- Returns:
- cube slot handle
-
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
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
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 classDesignElementHandle
- Returns:
- The attached element. Will be null if the handle is not attached.
-
getElementByID
Finds the handle to an element by a given element ID. Returnsnull
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
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
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
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
Returns an external file that provides help information for the report.- Returns:
- the name of an external file
-
getInitialize
Returns the script called when the report starts executing.- Returns:
- the script called when the report starts executing
-
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
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
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 inputlocale
isnull
, the locale for the current thread will be used instead.- Returns:
- the corresponding locale-dependent messages. Return
null
if resoueceKey is blank.
-
getMessage
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 inputlocale
isnull
, the locale for the current thread will be used instead.- Returns:
- the corresponding locale-dependent messages. Return
null
if resoueceKey is blank.
-
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
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
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
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
Gets a handle to deal with a translation. A translation is identified by its resourceKey and locale.- Parameters:
resourceKey
- the resource keylocale
- the locale information- Returns:
- corresponding
TranslationHandle
. Or returnnull
if the translation is not found in the design. - See Also:
-
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
Gets a list of translation defined on the report. The content of the list is the correspondingTranslationHandle
.- Returns:
- a list containing TranslationHandles defined on the report or
null
if the design has no any translations. - See Also:
-
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
Returns the iterator over all embedded images of this module instance. Each one is the instance ofEmbeddedImageHandle
- Returns:
- the iterator over all embedded images.
- See Also:
-
getAllImages
Returns the list of embedded images, including the one from libraries. Each one is the instance ofEmbeddedImageHandle
- 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 usingserialize
. -
removeValidationListener
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
iflistener
is sucessfully removed. Otherwisefalse
.
-
rename
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
Checks element name is unique in container.- Parameters:
containerHandle
- container of elementelementHandle
- 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 variablenewVar
- the new config variable- Throws:
SemanticException
- if the old config variable is not found or the name of new one is empty.
-
replaceImage
Replaces the old embedded image with the new one.- Parameters:
oldVar
- the old embedded imagenewVar
- the new embedded image- Throws:
SemanticException
- if the old image is not found or the name of new one is empty.
-
save
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
Saves the design to the file name provided. The file name is saved in the design, and subsequent calls tosave( )
will save to this new name.- Parameters:
newName
- the new file name- Throws:
IOException
- if the file cannot be saved- See Also:
-
serialize
Writes the report design to the given output stream. The caller must callonSave
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
Sets the name of the author of the design report.- Parameters:
author
- the name of the author.
-
setCreatedBy
Returns the name of the tool that created the design.- Parameters:
toolName
- the name of the tool
-
setFileName
Sets the design file name. This method will send notifications instance ofAttributeEvent
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
Sets an external file that provides help information for the report.- Parameters:
helpGuide
- the name of an external file
-
setInitialize
Sets the script called when the report starts executing.- Parameters:
value
- the script to set.
-
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
Returns theme handles according the input level.- Parameters:
level
- anint
value, which should be the one defined inIVisibleLevelControl
.- Returns:
- theme handles according the input level
-
getVisibleReportItemThemes
Returns report item theme handles according the input level.- Parameters:
level
- anint
value, which should be the one defined inIVisibleLevelControl
.- Returns:
- theme handles according the input level
-
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
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
Returns data source handles that are visible to this modules.- Returns:
- data source handles that are visible to this modules.
-
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
Returns data set handles that are visible to this modules.- Returns:
- data set handles that are visible to this modules.
-
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
Returns cube handles that are visible to this modules.- Returns:
- cube handles that are visible to this modules.
-
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
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
Returns all parameter handles that this modules.- Returns:
- all parameter handles that this modules.
-
getAllLibraries
Returns the libraries this report design includes directly or indirectly. Each in the returned list is the instance ofLibraryHandle
.- Returns:
- the libraries this report design includes directly or indirectly.
-
getLibraries
Returns included libaries this report design includes directly or indirectly within the given depth.- Parameters:
level
- the given depth- Returns:
- list of libraries.
-
getLibraries
Returns the libraries this report design includes directly. Each in the returned list is the instance ofLibraryHandle
.- Returns:
- the libraries this report design includes directly.
-
getLibrary
Returns the library handle with the given namespace.- Parameters:
namespace
- the library namespace- Returns:
- the library handle with the given namespace
-
findLibrary
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
Shifts the library to new position. This method might affect the style reference, because the library order is changed.- Parameters:
library
- the library to shifttoPosn
- 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
Returns the iterator over all included libraries. Each one is the instance ofIncludeLibraryHandle
- 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 namenamespace
- library namespace- Throws:
DesignFileException
- if the library file is not found, or has fatal error.SemanticException
- if error is encountered when handlingIncludeLibrary
structure list.
-
dropLibrary
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 handlingIncludeLibrary
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 handlingIncludeLibrary
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 moduleDesignFileException
- if the library file is not found, or has fatal error.
-
reloadLibraries
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
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 handlingIncludeLibrary
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 moduleDesignFileException
- if the library file is not found, or has fatal error.
-
dropLibraryAndBreakExtends
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
Adds one attribute listener. The duplicate listener will not be added.- Parameters:
listener
- the attribute listener to add
-
removeAttributeListener
Removes one attribute listener. If the listener not registered, then the request is silently ignored.- Parameters:
listener
- the attribute listener to remove- Returns:
true
iflistener
is successfully removed. Otherwisefalse
.
-
addDisposeListener
Adds one dispose listener. The duplicate listener will not be added.- Parameters:
listener
- the dispose listener to add
-
addResourceChangeListener
Adds one resource change listener. The duplicate listener will not be added.- Parameters:
listener
- the resource change listener to add
-
removeDisposeListener
Removes one dispose listener. If the listener not registered, then the request is silently ignored.- Parameters:
listener
- the dispose listener to remove- Returns:
true
iflistener
is successfully removed. Otherwisefalse
.
-
removeResourceChangeListener
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
iflistener
is successfully removed. Otherwisefalse
.
-
drop
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 classDesignElementHandle
- Throws:
SemanticException
- if this element has no container or the element cannot be dropped.- See Also:
-
dropAndClear
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 classDesignElementHandle
- Throws:
SemanticException
- if this element has no container or the element cannot be dropped.- See Also:
-
getIncludeResource
Get the base name of the customer-defined resource bundle.- Returns:
- the base name of the customer-defined resource bundle.
-
getIncludeResources
- Returns:
-
setIncludeResource
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
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
Returns theURL
object if the file withfileName
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
- Search file taking
- Parameters:
fileName
- file name to searchfileType
- file type. The value should be one of:IResourceLocator.IMAGE
IResourceLocator.LIBRARY
IResourceLocator.MESSAGEFILE
IResourceLocator.IMAGE
.- Returns:
- the
URL
object if the file withfileName
is found, or null otherwise.
- Search file with the file locator (
-
findResource
Returns theURL
object if the file withfileName
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
- Search file taking
- Parameters:
fileName
- file name to searchfileType
- file type. The value should be one of:IResourceLocator.IMAGE
IResourceLocator.LIBRARY
IResourceLocator.MESSAGEFILE
IResourceLocator.IMAGE
.appContext
- The map containing the user's information- Returns:
- the
URL
object if the file withfileName
is found, or null otherwise.
- Search file with the file locator (
-
openCssStyleSheet
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
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
Imports the selected styles in aCssStyleSheetHandle
to the module. Each in the list is instance ofSharedStyleHandle
.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 stylesselectedStyles
- the selected style list
-
setThemeName
Sets the theme to a report.- Parameters:
themeName
- the name of the theme- Throws:
SemanticException
-
getTheme
Returns the refresh rate when viewing the report.- Returns:
- the refresh rate
-
setTheme
Sets the theme to a report.- Parameters:
theme
- the theme instance- Throws:
SemanticException
-
isInclude
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
Returns the static description for the module.- Returns:
- the static description to display
-
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
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
Returns the resource key of the static description of the module.- Returns:
- the resource key of the static description
-
setDescriptionKey
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
Gets the title property value.- Returns:
- the title property value.
-
setTitle
Sets the title value.- Parameters:
title
- the title.- Throws:
SemanticException
-
getTitleKey
Gets the title key.- Returns:
- the title key.
-
setTitleKey
Sets the title key.- Parameters:
titleKey
- the title key.- Throws:
SemanticException
-
initializeModule
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
Returns the encoding of the design/library file. Currently, BIRT only support UnicodeUtil.SIGNATURE_UTF_8.- Returns:
- the encoding of the file
-
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
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
Returns the system id of the module. It is the URL path of the module.- Returns:
- the system id of the module
-
dropScriptLib
Removes special script lib.- Parameters:
scriptLib
- script lib- Throws:
SemanticException
-
dropIncludeScript
Removes the given included script.- Parameters:
includeScript
- the included script- Throws:
SemanticException
-
dropScriptLib
Removes special script lib handle.- Parameters:
scriptLibHandle
- script lib handle- Throws:
SemanticException
-
dropAllScriptLibs
Removes all script libs.- Throws:
SemanticException
-
scriptLibsIterator
Returns the iterator over all script libs. Each one is the instance ofScriptLibHandle
.- Returns:
- the iterator over script libs.
- See Also:
-
getAllScriptLibs
Returns all script libs.- Returns:
- list which structure is
ScriptLibHandle
-
findScriptLib
Gets script lib though name- Parameters:
name
- name of script lib- Returns:
- script lib
-
shiftScriptLibs
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 tonewPosn
with the value 1, the sequence becomes B, A, C.- Parameters:
sourceIndex
- source position. The range issourceIndex >= 0 && sourceIndex < list.size()
destIndex
- destination position.The range isdestIndex >= 0 && destIndex < list.size()
- Throws:
SemanticException
-
shifIncludeScripts
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 tonewPosn
with the value 1, the sequence becomes B, A, C.- Parameters:
sourceIndex
- source position. The range issourceIndex >= 0 && sourceIndex < list.size()
destIndex
- destination position.The range isdestIndex >= 0 && destIndex < list.size()
- Throws:
SemanticException
-
addScriptLib
Add script lib- Parameters:
scriptLib
- script lib- Throws:
SemanticException
-
addIncludeScript
Adds include script.- Parameters:
includeScript
- the include script- Throws:
SemanticException
-
setResourceFolder
Sets the resource folder for this module.- Parameters:
resourceFolder
- the folder to set
-
getResourceFolder
Gets the resource folder set in this module.- Returns:
- the resource folder set in this module
-
getLineNoByID
Deprecated.new method seegetLineNo(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
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
Returns the version for the opened design file. If the report/library is newly created, the version isnull
. 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
Returns the iterator over all included scripts. Each one is the instance ofIncludeScriptHandle
- Returns:
- the iterator over all included scripts.
- See Also:
-
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
Description copied from class:DesignElementHandle
Deeply clones the current design element which is wrapped by the handle.- Overrides:
copy
in classDesignElementHandle
- Returns:
- the copy of the design element
-
sortVisibleElements
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 spacelevel
- level- Returns:
- the list contains sorted design elements.
-
getVisibleModules
Gets the visible modules.- Parameters:
level
-- Returns:
-
generateHandleList
Generates a list of element handles according to the given element list. Each content in the return list is generated useelement.getHandle( Module )
- Parameters:
elementList
- a list of elements.- Returns:
- a list of element handles.
-
checkReportIfNecessary
public void checkReportIfNecessary()Checks the report if it is set in options. -
setOptions
Sets options to the module.- Parameters:
options
-
-
getOptions
Gets the options set in the module.- Returns:
-
getLineNo(Object)