public class FormLoader
extends java.lang.Object
FormCreator
to create Swing component instances.
The separation of the file loading and the component creation into two classes
(FormLoader
and FormCreator
) enables you to cache the form model
in memory. Using FormCreator
it's possible to create multiple instances
of a form from one form model.
Modifier and Type | Method and Description |
---|---|
static FormModel |
load(java.io.File file)
Loads a form model from the specified file.
|
static FormModel |
load(java.io.InputStream in)
Loads a form model from the given input stream.
|
static FormModel |
load(java.io.InputStream in,
java.lang.ClassLoader classLoader)
Loads a form model from the given input stream.
|
static FormModel |
load(java.lang.String resourceName)
Loads a form model from the specified resource using the default
class loader.
|
static FormModel |
load(java.lang.String resourceName,
java.lang.ClassLoader classLoader)
Loads a form model from the specified resource using the specified
class loader.
|
public static FormModel load(java.lang.String resourceName) throws java.lang.Exception
ClassLoader.getResourceAsStream(java.lang.String)
to locate and load the form file.resourceName
- The name of the resource containing a form
(e.g. "com/jformdesigner/examples/LoaderExample.jfd").java.lang.Exception
- See load(InputStream)
for details.public static FormModel load(java.lang.String resourceName, java.lang.ClassLoader classLoader) throws java.lang.Exception
ClassLoader.getResourceAsStream(java.lang.String)
to locate and load the form file.resourceName
- The name of the resource containing a form
(e.g. "com/jformdesigner/examples/LoaderExample.jfd").classLoader
- The class loader.java.lang.Exception
- See load(InputStream)
for details.public static FormModel load(java.io.File file) throws java.lang.Exception
file
- The file containing a form.java.lang.Exception
- See load(InputStream)
for details.public static FormModel load(java.io.InputStream in) throws java.lang.Exception
A BufferedInputStream
is used to improve performance.
in
- The input stream. Closed when this method returns.java.lang.IllegalArgumentException
- If the input stream is null
.java.io.IOException
- If an error occurred when reading from the input stream.SAXParseException
- If an error occurred when parsing the XML content.java.lang.ClassNotFoundException
- If a class used in the XML content is not found.java.lang.ClassCastException
- If the root object in the XML content is not a FormModel
.java.lang.Exception
- If an other error occurred when decoding the XML content.public static FormModel load(java.io.InputStream in, java.lang.ClassLoader classLoader) throws MultiException
A BufferedInputStream
is used to improve performance.
in
- The input stream. Closed when this method returns.classLoader
- The class loader used to load classes.java.lang.IllegalArgumentException
- If the input stream is null
.MultiException
- If a problem occurred when encoding the form model to XML.java.lang.ClassCastException
- If the root object in the XML content is not a FormModel
.Copyright (C) 2004-2017 FormDev Software GmbH. All rights reserved.