ilog.views.diagrammer.project
Class IlvDiagrammerProject

java.lang.Object
  extended by ilog.views.diagrammer.project.IlvDiagrammerProject

public class IlvDiagrammerProject
extends Object

A Diagrammer project is the logical grouping of a Diagrammer data source and a style sheet.

See Also:
IlvDiagrammer, IlvDiagrammerDataSource

Field Summary
static String longDescription
          The name of the predefined project property that holds a longer description of the project.
static String shortDescription
          The name of the predefined project property that holds a short description of the project.
static String suffix
          The suffix for Diagrammer project files (".idpr" ).
 
Constructor Summary
IlvDiagrammerProject()
          Creates a new Diagrammer project.
IlvDiagrammerProject(URL url)
          Reads a Diagrammer project from an XML file.
 
Method Summary
 void addStyleSheet(URL styleSheet)
          Adds a cascading style sheet to this Diagrammer project.
 IlvDiagrammerDataSource getDataSource()
          Returns the data source of this Diagrammer project.
 URL getProjectURL()
          Returns the URL of the XML description file that this project was read from or written to.
 Object getProperty(File dir, String key)
          Returns a specific property of this Diagrammer project in the default Locale.
 Object getProperty(String key)
          Returns a property of this Diagrammer project for the default Locale.
 Object getProperty(String key, Locale locale)
          Returns a property of this Diagrammer project, such as its description, the author's name, the creation date, etc.
 URL getStyleSheet()
          Returns the first style sheet of this Diagrammer project.
 URL[] getStyleSheets()
          Returns all the cascaded style sheets of this Diagrammer project.
 void read(URL url)
          Reads the project description from a URL.
 void removeStyleSheet(URL styleSheet)
          Removes a cascading style sheet from this Diagrammer project.
 void setDataSource(IlvDiagrammerDataSource dataSource)
          Sets the data source of this Diagrammer project.
 void setStyleSheet(URL styleSheet)
          Sets the first style sheet of this Diagrammer project, and removes all the other style sheets.
 void write(URL url)
          Writes the project description to a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suffix

public static String suffix
The suffix for Diagrammer project files (".idpr" ).


shortDescription

public static final String shortDescription
The name of the predefined project property that holds a short description of the project. The short description is intended to be displayed in a combo box, for example.

See Also:
Constant Field Values

longDescription

public static final String longDescription
The name of the predefined project property that holds a longer description of the project. The long description is intended to be displayed in a multiline text area or label, and can contain HTML text.

See Also:
Constant Field Values
Constructor Detail

IlvDiagrammerProject

public IlvDiagrammerProject()
Creates a new Diagrammer project. The data source and the style sheet are initially set to null.


IlvDiagrammerProject

public IlvDiagrammerProject(URL url)
                     throws IlvDiagrammerException
Reads a Diagrammer project from an XML file.

Parameters:
url - The URL of the file containing the XML description of the project.
Throws:
IlvDiagrammerException - If an exception occurred while reading the project file.
Method Detail

setStyleSheet

public void setStyleSheet(URL styleSheet)
Sets the first style sheet of this Diagrammer project, and removes all the other style sheets.

Parameters:
styleSheet - The new style sheet.

getStyleSheet

public URL getStyleSheet()
Returns the first style sheet of this Diagrammer project.

Returns:
first style sheet url

addStyleSheet

public void addStyleSheet(URL styleSheet)
Adds a cascading style sheet to this Diagrammer project.

Parameters:
styleSheet - The style sheet to add.

removeStyleSheet

public void removeStyleSheet(URL styleSheet)
Removes a cascading style sheet from this Diagrammer project.

Parameters:
styleSheet - The style sheet to remove.

getStyleSheets

public URL[] getStyleSheets()
Returns all the cascaded style sheets of this Diagrammer project.

Returns:
style sheet urls

getDataSource

public IlvDiagrammerDataSource getDataSource()
Returns the data source of this Diagrammer project.

Returns:
data source

setDataSource

public void setDataSource(IlvDiagrammerDataSource dataSource)
Sets the data source of this Diagrammer project.

Parameters:
dataSource - The new data source.

getProperty

public Object getProperty(String key,
                          Locale locale)
Returns a property of this Diagrammer project, such as its description, the author's name, the creation date, etc.

Properties are localized, and are retrieved from property files located "next to" the project file. For example, a project saved in the description file file:/somewhere/exampleProject.xml will read its properties from the property files file:/somewhere/exampleProject[_<locale>].properties, where [_<locale>] is the suffix for the specified Locale, as explained in java.util.ResourceBundle. So, with a French locale, the property file would be file:/somewhere/exampleProject_fr.properties or file:/somewhere/exampleProject_fr_FR.properties. The default property file would be file:/somewhere/exampleProject.properties.

Parameters:
key - The name of the property to retrieve.
locale - The Locale for which the property is to be retrieved.
Returns:
The value of the property, or null if the property is not defined or if no property file could be found for this project and the specified Locale.

getProperty

public Object getProperty(String key)
Returns a property of this Diagrammer project for the default Locale. This method simply calls getProperty(key, Locale.getDefault()).

Parameters:
key - The name of the property to retrieve.
Returns:
The value of the property, or null if the property is not defined or if no property file could be found for this project and the default Locale.

getProperty

public Object getProperty(File dir,
                          String key)
Returns a specific property of this Diagrammer project in the default Locale. It looks for the bundle in dir.

Parameters:
dir - The bundle directory.
key - The name of the property to retrieve.
Returns:
The value of the property, or null in the following cases:
  • The property is not defined.
  • No property file could be found for this project in the default Locale.
Since:
JViews 8.1

getProjectURL

public URL getProjectURL()
Returns the URL of the XML description file that this project was read from or written to.

Returns:
project URL

read

public void read(URL url)
          throws IlvDiagrammerException
Reads the project description from a URL.

Parameters:
url - The project URL.
Throws:
IlvDiagrammerException - If an error occurred while reading the project description.

write

public void write(URL url)
           throws IlvDiagrammerException
Writes the project description to a URL.

Parameters:
url - The project URL.
Throws:
IlvDiagrammerException - If an error occurred while writing the project description.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.