Package mgui.interfaces.io
Class InterfaceIOType
java.lang.Object
mgui.interfaces.io.InterfaceIOType
- All Implemented Interfaces:
NamedObject
,TreeObject
,IconObject
public class InterfaceIOType extends java.lang.Object implements IconObject, NamedObject, TreeObject
Specifies an Input/Output interface object; e.g., file loaders or writers.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<InterfaceIODialogBox>
dialog
protected java.util.List<java.lang.String>
extensions
protected WildcardFileFilter
filter
protected java.lang.Class<InterfaceIO>
io
protected java.lang.String
label
protected java.lang.String
name
protected java.lang.Class<InterfaceIOOptions>
options
protected int
type
static int
TYPE_INPUT
static int
TYPE_OUTPUT
static int
TYPE_RANDOM
-
Constructor Summary
Constructors Constructor Description InterfaceIOType()
-
Method Summary
Modifier and Type Method Description void
addExtension(java.lang.String ext)
java.lang.Class<InterfaceIODialogBox>
getDialog()
InterfaceIODialogBox
getDialogInstance(javax.swing.JFrame frame, InterfaceIOPanel panel, InterfaceIOOptions options)
Returns an instance of the dialog box associated with this I/O type.java.util.List<java.lang.String>
getExtensions()
WildcardFileFilter
getFilter()
java.lang.Class<InterfaceIO>
getIO()
InterfaceIO
getIOInstance()
Returns a new instance of this type.java.lang.String
getLabel()
java.lang.String
getName()
Gets the name for this object.javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfaceIOOptions
getOptionsInstance()
Returns an instance ofInterfaceIOOptions
appropriate for this IO type.java.util.ArrayList<java.lang.Class<?>>
getSupportedObjects()
Returns a list of classes for objects which are supported by this I/O interfacejava.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.int
getType()
boolean
isCompatibleObject(InterfaceObject object)
Does this I/O type handle objects of typeobject
?boolean
isCompatibleOptions(InterfaceIOOptions options)
Determines whetheroptions
is compatible with this typeboolean
isCompatibleType(InterfaceIOType type)
Determines whether this type supports all of the objects supported bytype
boolean
isInput()
Is this input?boolean
isOutput()
Is this output?InterfaceTreeNode
issueTreeNode()
Issues a newInterfaceTreeNode
for this object.void
setDialog(java.lang.Class<InterfaceIODialogBox> dialog)
void
setFilter(WildcardFileFilter filter)
void
setIO(java.lang.Class<InterfaceIO> io)
void
setLabel(java.lang.String label)
void
setName(java.lang.String name)
Sets the name for this object.void
setOptions(java.lang.Class<InterfaceIOOptions> options)
void
setTreeNode(InterfaceTreeNode node)
Sets the children for this node'sInterfaceTreeNode
.void
setType(java.lang.String t)
java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
TYPE_INPUT
public static int TYPE_INPUT -
TYPE_OUTPUT
public static int TYPE_OUTPUT -
TYPE_RANDOM
public static int TYPE_RANDOM -
name
protected java.lang.String name -
label
protected java.lang.String label -
filter
-
io
-
dialog
-
options
-
type
protected int type -
extensions
protected java.util.List<java.lang.String> extensions
-
-
Constructor Details
-
InterfaceIOType
public InterfaceIOType()
-
-
Method Details
-
setType
public void setType(java.lang.String t) -
getType
public int getType() -
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
-
getIO
-
setIO
-
addExtension
public void addExtension(java.lang.String ext) -
getExtensions
public java.util.List<java.lang.String> getExtensions() -
setDialog
-
getDialog
-
getFilter
-
getLabel
public java.lang.String getLabel() -
setLabel
public void setLabel(java.lang.String label) -
setFilter
-
getDialogInstance
public InterfaceIODialogBox getDialogInstance(javax.swing.JFrame frame, InterfaceIOPanel panel, InterfaceIOOptions options)Returns an instance of the dialog box associated with this I/O type. If there is no associated dialog box, returnsnull
.- Parameters:
frame
-panel
-options
-- Returns:
-
getOptionsInstance
Returns an instance ofInterfaceIOOptions
appropriate for this IO type.- Returns:
-
setOptions
-
getIOInstance
Returns a new instance of this type.- Returns:
-
isInput
public boolean isInput()Is this input?- Returns:
-
isOutput
public boolean isOutput()Is this output?- Returns:
-
isCompatibleObject
Does this I/O type handle objects of typeobject
?- Parameters:
object
-- Returns:
-
isCompatibleType
Determines whether this type supports all of the objects supported bytype
- Parameters:
type
-- Returns:
-
isCompatibleOptions
Determines whetheroptions
is compatible with this type- Parameters:
options
-- Returns:
-
getSupportedObjects
public java.util.ArrayList<java.lang.Class<?>> getSupportedObjects()Returns a list of classes for objects which are supported by this I/O interface- Returns:
- See Also:
InterfaceIO
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
issueTreeNode
Description copied from interface:TreeObject
Issues a newInterfaceTreeNode
for this object. The object is responsible for maintaining, updating, and destroying the tree nodes it issues, or notifying containers -- i.e., parent trees -- of changes which require the tree nodes to be modified or destroyed.- Specified by:
issueTreeNode
in interfaceTreeObject
- Returns:
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Returns:
-