public class SessionHandle
extends java.lang.Object
A session can also provides the mechanism for specified file searching
algorithm. After get an new instance of SessionHandle, an algorithm of how to
search a file should be set by calling
if the default
resource locator is not the expected one.
setResourceLocator(IResourceLocator)
The default resource locator will search in the folder where the design file is located.
ResourceLocatorImpl
,
DesignSession
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.birt.report.model.core.DesignSession |
session
The implementation of the design session.
|
Constructor and Description |
---|
SessionHandle(java.util.Locale locale)
Deprecated.
to use ICU4J, this method is replaced by:
SessionHandle(ULocale locale)
|
SessionHandle(ULocale locale)
Constructs a handle for the session with the given locale.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates this session within a thread.
|
void |
addResourceChangeListener(IResourceChangeListener listener)
Adds one resource change listener.
|
void |
closeAll(boolean save)
Closes all open designs and libraires.
|
ReportDesignHandle |
createDesign()
Creates a new empty design.
|
ReportDesignHandle |
createDesign(java.lang.String fileName)
Creates a new design based on a file name.
|
ReportDesignHandle |
createDesign(java.lang.String fileName,
ModuleOption options)
Creates a new design based on the file name and the module options.
|
ReportDesignHandle |
createDesignFromTemplate(java.lang.String templateDesignName)
Creates a new design based on a template file.
|
ReportDesignHandle |
createDesignFromTemplate(java.lang.String templateDesignName,
java.io.InputStream is)
Creates a new design based a given template file name and input stream.
|
LibraryHandle |
createLibrary()
Creates a new empty library.
|
LibraryHandle |
createLibraryFromTemplate(java.lang.String templateLibraryName)
Creates a new library based on a template file.
|
void |
fireResourceChange(ResourceChangeEvent ev)
Informs this session some resources is changed.
|
java.lang.String |
getApplicationUnits()
Returns the current session (application) units.
|
static java.lang.String |
getBirtResourcePath()
Gets resource path.
|
int |
getColorFormat()
Returns the current application rgb color display preference.
|
StyleHandle |
getDefaultTOCStyle(java.lang.String name)
Gets default TOC Style.Heading 1 -> Heading 10.
|
java.lang.Object |
getDefaultValue(java.lang.String propName)
Gets the default value of the specified style property.
|
java.util.Locale |
getLocale()
Deprecated.
to use ICU4J, replaced by: public ULocale getLocale()
|
IAbsoluteFontSizeValueProvider |
getPredefinedFontSizeProvider()
Returns the provider instance which provides the absolute dimension value
of predefined font size choice.
|
java.lang.String |
getResourceFolder()
Gets the resource folder set in this session.
|
IResourceLocator |
getResourceLocator()
Returns the installed resource locator.
|
ULocale |
getULocale()
Returns the locale of the current session.
|
ReportDesignHandle |
openDesign(java.lang.String fileName)
Opens a design with the given the file name.
|
ReportDesignHandle |
openDesign(java.lang.String fileName,
java.io.InputStream is)
Opens a design given a stream to the design and the the file name of the
design.
|
ReportDesignHandle |
openDesign(java.lang.String fileName,
java.io.InputStream is,
ModuleOption options)
Opens a design given a stream to the design and the the file name of the
design.
|
ReportDesignHandle |
openDesign(java.lang.String fileName,
ModuleOption options)
Opens a design with the given the file name.
|
ReportDesignHandle |
openDesign(java.net.URL systemId,
java.io.InputStream is)
Opens a design given a stream to the design and the the file name of the
design.
|
ReportDesignHandle |
openDesign(java.net.URL systemId,
java.io.InputStream is,
ModuleOption options)
Opens a design given a stream to the design and the the file name of the
design.
|
LibraryHandle |
openLibrary(java.lang.String fileName)
Opens a library with the given the file name.
|
LibraryHandle |
openLibrary(java.lang.String fileName,
java.io.InputStream is)
Opens a library given a stream to the design and the the file name of the
design.
|
LibraryHandle |
openLibrary(java.lang.String fileName,
java.io.InputStream is,
ModuleOption options)
Opens a library given a stream to the design and the the file name of the
design.
|
LibraryHandle |
openLibrary(java.lang.String fileName,
ModuleOption options)
Opens a library with the given the file name.
|
LibraryHandle |
openLibrary(java.net.URL systemId,
java.io.InputStream is)
Opens a library with the given the file name.
|
LibraryHandle |
openLibrary(java.net.URL systemId,
java.io.InputStream is,
ModuleOption options)
Opens a library with the given the file name.
|
ModuleHandle |
openModule(java.lang.String fileName)
Opens a module regardless of the module type(library or report design).
|
ModuleHandle |
openModule(java.lang.String fileName,
java.io.InputStream is)
Opens a module regardless of the module type(library or report design).
|
ModuleHandle |
openModule(java.lang.String fileName,
java.io.InputStream is,
ModuleOption options)
Opens a module regardless of the module type(library or report design).
|
ModuleHandle |
openModule(java.lang.String fileName,
ModuleOption options)
Opens a module regardless of the module type(library or report design).
|
boolean |
removeResourceChangeListener(IResourceChangeListener listener)
Removes one resource change listener.
|
void |
saveAll()
Saves all designs and librariesthat need a save.
|
void |
setApplicationUnits(java.lang.String units)
Sets the units to be used by the application.
|
static void |
setBirtResourcePath(java.lang.String resourcePath)
Sets resource path.
|
void |
setColorFormat(int rgbFormat)
Sets the rgb color display preference to be used by the application.
|
void |
setDefaultValue(java.lang.String propName,
java.lang.Object value)
Sets the specified default value of style property.
|
void |
setResourceFolder(java.lang.String resourceFolder)
Sets the resource folder for this session.
|
void |
setResourceLocator(IResourceLocator locator)
Sets the resource locator for the specified file searching algorithm.
|
protected org.eclipse.birt.report.model.core.DesignSession session
public SessionHandle(java.util.Locale locale)
locale
- the user's locale. If null, then the system locale is assumed.public SessionHandle(ULocale locale)
locale
- the user's locale which is ULocale
. If null, then
the system locale is assumed.public static void setBirtResourcePath(java.lang.String resourcePath)
resourcePath
- the resource path to set. It must be an absolute path based on
file system and must present a dictory.public static java.lang.String getBirtResourcePath()
setBirtResourcePath(String)
public void activate()
public ModuleHandle openModule(java.lang.String fileName, java.io.InputStream is) throws DesignFileException
fileName
- name of the file to open.is
- stream to read the designDesignFileException
- If the file is not found, or the file contains fatal errors.public ModuleHandle openModule(java.lang.String fileName, java.io.InputStream is, ModuleOption options) throws DesignFileException
fileName
- name of the file to open.is
- stream to read the designoptions
- the options set for this moduleDesignFileException
- If the file is not found, or the file contains fatal errors.public ModuleHandle openModule(java.lang.String fileName) throws DesignFileException
fileName
- name of the file to open.DesignFileException
- If the file is not found, or the file contains fatal errors.public ModuleHandle openModule(java.lang.String fileName, ModuleOption options) throws DesignFileException
fileName
- name of the file to open.options
- the options set for this moduleDesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.lang.String fileName) throws DesignFileException
fileName
- name of the file to open. It may contain the relative/absolute
path information. This name must include the file name with
the filename extension.DesignFileException
- if the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.lang.String fileName, ModuleOption options) throws DesignFileException
fileName
- name of the file to open. It may contain the relative/absolute
path information. This name must include the file name with
the filename extension.options
- the options set for this moduleDesignFileException
- if the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.lang.String fileName, java.io.InputStream is) throws DesignFileException
fileName
- name of the file to open. If null
, the design
will be treated as a new design, and will be saved to a
different file. If not null
, it may contain the
relative/absolute path information. This name must include the
file name with the filename extension.is
- stream to read the designDesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.lang.String fileName, java.io.InputStream is, ModuleOption options) throws DesignFileException
fileName
- name of the file to open. If null
, the design
will be treated as a new design, and will be saved to a
different file. If not null
, it may contain the
relative/absolute path information. This name must include the
file name with the filename extension.is
- stream to read the designoptions
- options set for this moduleDesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.net.URL systemId, java.io.InputStream is) throws DesignFileException
systemId
- the uri where to find the relative sources for the report.
This url is treated as an absolute directory.is
- the input stream to read the designDesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle openDesign(java.net.URL systemId, java.io.InputStream is, ModuleOption options) throws DesignFileException
systemId
- the uri where to find the relative sources for the report.
This url is treated as an absolute directory.is
- the input stream to read the designoptions
- the options set for this moduleDesignFileException
- If the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.lang.String fileName) throws DesignFileException
fileName
- name of the file to open. This name must include the file name
with the filename extension.DesignFileException
- if the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.lang.String fileName, ModuleOption options) throws DesignFileException
fileName
- name of the file to open. This name must include the file name
with the filename extension.options
- the options set for this moduleDesignFileException
- if the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.lang.String fileName, java.io.InputStream is) throws DesignFileException
fileName
- name of the file to open. If null
, the library
will be treated as a new library, and will be saved to a
different file. If not null
, it may contain the
relative/absolute path information. This name must include the
file name with the filename extension.is
- the stream to read the libraryDesignFileException
- If the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.lang.String fileName, java.io.InputStream is, ModuleOption options) throws DesignFileException
fileName
- name of the file to open. If null
, the library
will be treated as a new library, and will be saved to a
different file. If not null
, it may contain the
relative/absolute path information. This name must include the
file name with the filename extension.is
- the stream to read the libraryoptions
- the options set for this moduleDesignFileException
- If the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.net.URL systemId, java.io.InputStream is) throws DesignFileException
systemId
- the uri where to find the relative sources for the library.
This url is treated as an absolute directory.is
- the input streamDesignFileException
- if the file is not found, or the file contains fatal errors.public LibraryHandle openLibrary(java.net.URL systemId, java.io.InputStream is, ModuleOption options) throws DesignFileException
systemId
- the uri where to find the relative sources for the library.
This url is treated as an absolute directory.is
- the input streamoptions
- the options set for this moduleDesignFileException
- if the file is not found, or the file contains fatal errors.public ReportDesignHandle createDesign(java.lang.String fileName)
fileName
- file name.public ReportDesignHandle createDesign(java.lang.String fileName, ModuleOption options)
fileName
- options
- public ReportDesignHandle createDesignFromTemplate(java.lang.String templateDesignName) throws DesignFileException
templateDesignName
- The name of the template for the design.DesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle createDesignFromTemplate(java.lang.String templateDesignName, java.io.InputStream is) throws DesignFileException
templateDesignName
- The name of the template for the design.DesignFileException
- If the file is not found, or the file contains fatal errors.public LibraryHandle createLibraryFromTemplate(java.lang.String templateLibraryName) throws DesignFileException
templateLibraryName
- The name of the template for the library.DesignFileException
- If the file is not found, or the file contains fatal errors.public ReportDesignHandle createDesign()
public LibraryHandle createLibrary()
public void saveAll() throws java.io.IOException
java.io.IOException
- if a save error occurspublic void closeAll(boolean save) throws java.io.IOException
save
- true
if designs are to be saved before closingjava.io.IOException
- if a save error occurspublic void setApplicationUnits(java.lang.String units) throws PropertyValueException
DesignChoiceConstants
and can
be one of:
UNITS_IN
UNITS_CM
UNITS_MM
UNITS_PT
UNITS_PC
units
- the units to set for the session -- applicationPropertyValueException
- if units
is not one of the aboveDimensionValue
public java.lang.String getApplicationUnits()
DesignChoiceConstants
and is one of:
UNITS_IN
UNITS_CM
UNITS_MM
UNITS_PT
UNITS_PC
setApplicationUnits(java.lang.String)
public void setColorFormat(int rgbFormat) throws PropertyValueException
ColorUtil
:
INT_FORMAT
HTML_FORMAT
JAVA_FORMAT
CSS_ABSOLUTE_FORMAT
CSS_RELATIVE_FORMAT
rgbFormat
- the rgb color display preference to set.PropertyValueException
- if rgbFormat
is not one of the above.ColorPropertyType
public int getColorFormat()
ColorUtil
:
INT_FORMAT
HTML_FORMAT
JAVA_FORMAT
CSS_ABSOLUTE_FORMAT
CSS_RELATIVE_FORMAT
setColorFormat(int)
public void setDefaultValue(java.lang.String propName, java.lang.Object value) throws PropertyValueException
propName
- style property namevalue
- default value to setPropertyValueException
- if value is invalid.public java.lang.Object getDefaultValue(java.lang.String propName)
propName
- style property namenull
.public void setResourceLocator(IResourceLocator locator)
locator
- the resource locator to be set.public IResourceLocator getResourceLocator()
public java.util.Locale getLocale()
public ULocale getULocale()
ULocale
.public void fireResourceChange(ResourceChangeEvent ev)
Current, only changes of library is supported.
ev
- the resource change event to firepublic void addResourceChangeListener(IResourceChangeListener listener)
listener
- the resource change listener to addpublic boolean removeResourceChangeListener(IResourceChangeListener listener)
listener
- the resource change listener to removetrue
if listener
is successfully
removed. Otherwise false
.public void setResourceFolder(java.lang.String resourceFolder)
resourceFolder
- the folder to setpublic java.lang.String getResourceFolder()
public StyleHandle getDefaultTOCStyle(java.lang.String name)
name
- style namepublic IAbsoluteFontSizeValueProvider getPredefinedFontSizeProvider()
FONT_SIZE_XX_SMALL
FONT_SIZE_X_SMALL
FONT_SIZE_SMALL
FONT_SIZE_MEDIUM
FONT_SIZE_LARGE
FONT_SIZE_X_LARGE
FONT_SIZE_XX_LARGE
IAbsoluteFontSizeValueProvider
Copyright © 2014 OpenText Corp. All rights reserved.