public class DefaultDisplayFactory
extends java.lang.Object
DefaultDisplayFactory
class contains methods
that provide a suitable default display for a given class.Constructor and Description |
---|
DefaultDisplayFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
addDirectory(java.lang.String directory)
Adds the specified directory to the list of directories in
which to look for image files.
|
static void |
addSuffix(java.lang.String suffix)
Adds the specified suffix to the list of image suffixes to look for.
|
static GridObjectDisplay |
getDefaultDisplay()
Returns a DefaultDisplay object.
|
static GridObjectDisplay |
getDefaultDisplay(java.lang.Class cls)
Returns a default display specific to the given class if there
is one.
|
static GridObjectDisplay |
getDefaultDisplay(java.lang.String className)
Returns a default display specific to the given class if there
is one.
|
protected static GridObjectDisplay |
getDisplayClass(java.lang.String fullClassName,
java.lang.String fullDispClassName)
Instantiates a display class named
fullDisplayClassName ,
if such a class exists. |
public static void addDirectory(java.lang.String directory)
directory
- name of directory in which to look for image
files, including separator that precedes a
filename (e.g., directory + imagefile
should be a valid name for a file in the
specified directory)public static void addSuffix(java.lang.String suffix)
suffix
- image suffix (e.g., "tiff")public static GridObjectDisplay getDefaultDisplay()
public static GridObjectDisplay getDefaultDisplay(java.lang.Class cls)
ClassNameDisplay
object if there is a
a ClassNameDisplay
class with a default
(no-parameter) constructor in package, in
the associated display package (package.display),
or in the unnamed default display
ScaledImageDisplay
object if there is a
an image file named ClassName.sfx in the jar
file or current directory (where sfx is one of
the following suffixes: gif, GIF, jpg, JPG, jpeg, JPEG,
or any added with the addSuffix
method)
If no default display specific to the given class is available,
this method returns null
.cls
- the class for which to find a default displaypublic static GridObjectDisplay getDefaultDisplay(java.lang.String className)
ClassNameDisplay
object if there is a
a ClassNameDisplay
class with a default
(no-parameter) constructor in package, in
an associated display package (package.display),
or in the unnamed default display
ScaledImageDisplay
object if there is a
an image file named ClassName.sfx in the jar
file, in the current directory, or in a directory specified
with the addDirectory
method, where sfx
is one of the following suffixes: gif, GIF, jpg, JPG, jpeg,
JPEG, or any added with the addSuffix
method)
If no default display specific to the given class is available,
this method returns null
.className
- the name of the class for which to find
a default displayprotected static GridObjectDisplay getDisplayClass(java.lang.String fullClassName, java.lang.String fullDispClassName) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
fullDisplayClassName
,
if such a class exists.fullClassName
- the name of the class being displayedfullDispClassName
- the name of the display class to createjava.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException