|
||||||||||
![]() |
FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--ilog.views.prototypes.IlvPrototypeLibrary
The class IlvPrototypeLibrary is used to organize, load, and save
prototypes.
A prototype library contains a set of prototypes. All the prototypes used in an application are identified by the name of the library to which they belong and by their name. This identification is unique.
Prototype libraries can be automatically loaded when an ILOG JViews
file containing prototype instances is read. This means that an application which
just loads panels will not need to use the IlvPrototypeLibrary
class directly.
To load a prototype explicitly, you can use the getPrototype method
as shown below:
IlvPrototype proto =
IlvPrototypeLibrary.getPrototype("mylib", "myproto");
Prototype libraries are saved to normal ILOG JViews files.
Library files are searched using a path that you can define with the
addToPath method.
The other methods of the class are intended to be used by applications that need to define new prototypes and prototype libraries.
IlvPrototype| Constructor Summary | |
IlvPrototypeLibrary(IlvInputStream in)
Reads a prototype library from a stream. |
|
IlvPrototypeLibrary(String name)
Creates a new prototype library with the specified name. |
|
| Method Summary | |
void |
addPrototype(IlvPrototype prototype)
Adds a prototype to this library. |
static void |
addToPath(String dirname)
Adds a directory to the path used to locate prototypes. |
static void |
addToPath(URL url)
Adds a URL to the path used to locate prototypes. |
static Enumeration |
getAllLibraries()
Returns all the prototype libraries currently loaded or created. |
static IlvPrototypeLibrary |
getLibrary(String libName)
Loads a prototype library. |
String |
getName()
Returns the name of this library. |
static URL[] |
getPath()
Returns the path used to locate prototype library files. |
IlvPrototype |
getPrototype(String protoName)
Gets the prototype whose name is specified. |
static IlvPrototype |
getPrototype(String prototypeURL,
Class jarClass)
Reads a prototype from a URL, or from a JAR archive. |
static IlvPrototype |
getPrototype(String libName,
String protoName)
Loads a prototype from a library name and a prototype name. |
Enumeration |
getPrototypes()
Returns the prototypes that this library contains. |
URL |
getURL()
Returns the location from which the library was loaded. |
static IlvPrototypeLibrary[] |
read(String filename)
Reads the prototype libraries contained in an ILOG JViews formatted file. |
static IlvPrototypeLibrary[] |
read(URL url)
Reads the prototype libraries contained in an ILOG JViews formatted file. |
static IlvPrototypeLibrary |
readCPP(String filename)
Reads a prototype library from an ILOG Views formatted file ( .ipl). |
static IlvPrototypeLibrary |
readCPP(URL url)
Reads a prototype library from an ILOG Views formatted file ( .ipl). |
static void |
registerEditor(IlvPrototypeLibraryEditor editor)
Registers an IlvPrototypeLibraryEditor. |
void |
removePrototype(IlvPrototype prototype)
Removes a prototype from this library. |
void |
replacePrototype(IlvPrototype oldPrototype,
IlvPrototype prototype)
Replaces a prototype of this library with a new one. |
void |
setName(String name)
Changes the name of this prototype library. |
void |
setURL(URL url)
Sets the location from which the library was loaded. |
void |
write(IlvOutputStream out)
Writes this prototype library to an output stream. |
void |
write(String filename)
Writes a prototype library to a specified file. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public IlvPrototypeLibrary(String name)
name - the name of the new library.
public IlvPrototypeLibrary(IlvInputStream in)
throws IlvReadFileException
in - the input stream.| Method Detail |
public void write(IlvOutputStream out)
throws IOException
IlvPersistentObject interface, but it
should not be called directly by applications.out - the output stream.public String getName()
public void setName(String name)
name - the new library name.public void addPrototype(IlvPrototype prototype)
prototype - the prototype to be added.public void removePrototype(IlvPrototype prototype)
prototype - the prototype to be removed.
public void replacePrototype(IlvPrototype oldPrototype,
IlvPrototype prototype)
oldPrototype - the prototype to replace.prototype - the new prototype to add instead
of oldPrototype.public Enumeration getPrototypes()
IlvPrototype objects.getPrototype(java.lang.String, java.lang.String)
public static IlvPrototypeLibrary[] read(URL url)
throws IOException,
IlvReadFileException
This method is intended to be used by GUI editors.
Other applications will normally use the getLibrary
or getPrototype methods to fetch prototypes.
url - the location of the library file to be loaded.getPrototype(java.lang.String, java.lang.String),
getLibrary(java.lang.String)
public static IlvPrototypeLibrary[] read(String filename)
throws IOException,
IlvReadFileException
This method creates a URL from the specified file name
and calls read(URL).
filename - the file name.read(java.net.URL)
public static IlvPrototypeLibrary readCPP(URL url)
throws IOException,
IlvReadFileException
.ipl).
This method is intended to be used by GUI editors.
Other applications will normally use the getLibrary
or getPrototype methods to fetch prototypes.
url - the location of the .ipl library file to be loaded.getPrototype(java.lang.String, java.lang.String),
getLibrary(java.lang.String)
public static IlvPrototypeLibrary readCPP(String filename)
throws IOException,
IlvReadFileException
.ipl).
This method creates a URL from the specified file name
and calls readCPP(URL).
filename - the file name.read(java.net.URL)
public void write(String filename)
throws IOException
filename - the file where the library will be saved.
public static IlvPrototypeLibrary getLibrary(String libName)
throws IlvReadFileException
If the prototype library specified is not already loaded,
its file is searched for in the prototype search path
(for details, see the addToPath methods).
The prototype library file has the .ilv extension
(libName.ivl) and is located in the
directory or in the subdirectory indicated in the path
(for example, libName/libName.ivl).
If the file of the prototype library is found, it is read with
the read method, and all the prototypes
contained in the file are stored in the library.
This method can also load ILOG Views (C++) prototype libraries
(.ipl files). If no ILOG JViews file is found for
a given prototype library, an ILOG Views file is searched for using
the same procedure.
libName - the name of the prototype library.addToPath(java.net.URL),
addToPath(java.lang.String)
public static IlvPrototype getPrototype(String libName,
String protoName)
throws IlvReadFileException
If required, this method calls getLibrary to load the library.
Then it calls getPrototype to
get the prototype specified.
libName - the name of the prototype library.protoName - the name of the prototype.public IlvPrototype getPrototype(String protoName)
protoName - the name of the prototype.null
if it does not exist or if it could not be loaded.public static void addToPath(URL url)
url - the URL to be added to the prototype access path.
public static void addToPath(String dirname)
throws MalformedURLException
dirname - the directory to be added to the prototype access path.
The directory name must end with a path separator (slash or
backslash).public static URL[] getPath()
public static void registerEditor(IlvPrototypeLibraryEditor editor)
IlvPrototypeLibraryEditor. This object
will be notified every time a new prototype library is loaded.
This method is intended to be used by GUI editors.
editor - the new IlvPrototypeLibraryEditor object
to be registered.IlvPrototypeLibraryEditorpublic URL getURL()
public void setURL(URL url)
public static Enumeration getAllLibraries()
IlvPrototypeLibrary
objects.
public static IlvPrototype getPrototype(String prototypeURL,
Class jarClass)
throws MalformedURLException,
IlvReadFileException,
IOException
The URL is of the form
http://host/dir/library.ivl#proto,
where library.ivl
is the name of the prototype library file, and proto
is the name of the prototype. If the prototype name is omitted,
the first prototype of the library is returned. If the URL
is a relative URL with a protocol of "file" and
if jarClass is not null, the method tries to find
the library in the JAR archive from which the class was loaded.
If the prototype library has already been loaded, it is not reloaded.
prototypeURL - A URL of the form
http://host/dir/library.ivl#proto.jarClass - The class used to find the library in a JAR.
|
||||||||||
![]() |
FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||