edu.jhu.ece.iacl.jist.pipeline.parameter
Class ParamFile

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipePort<T>
      extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel<java.io.File>
          extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamFile
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<ParamModel>
Direct Known Subclasses:
ParamExecutable, ParamObject, ParamSurfaceLocation

public class ParamFile
extends ParamModel<java.io.File>

File parameter used to store a file name with a particular file extension.

Author:
Blake Lucas

Nested Class Summary
static class ParamFile.DialogType
          The Enum DialogType.
 
Nested classes/interfaces inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
PipePort.PortListener, PipePort.type
 
Field Summary
protected  ParamFile.DialogType dialogType
          The dialog type.
protected  FileExtensionFilter extensionFilter
          The extension filter.
protected  java.io.File file
          The file.
protected  java.net.URI uri
          The URI.
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
cliTag, description, factory, hidden, label, loadAndSaveOnValidate, mandatory, shortLabel
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
connectible, gport, incomingConnectors, listeners, maxIncoming, maxOutgoing, outgoingConnectors, owner, portType, useWire
 
Constructor Summary
ParamFile(ParamFile.DialogType type)
          Construct parameter with specified restrictions.
ParamFile(java.lang.String name)
          Construct parameter for a mandatory file type.
ParamFile(java.lang.String name, FileExtensionFilter filter)
          Construct parameter for a mandatory file type.
ParamFile(java.lang.String name, java.io.File f, ParamFile.DialogType type)
          Construct parameter with specified restrictions.
ParamFile(java.lang.String name, ParamFile.DialogType type)
          Construct parameter with specified restrictions.
ParamFile(java.lang.String name, java.net.URI uri, ParamFile.DialogType type)
          Construct parameter with specified restrictions.
 
Method Summary
 void clean()
          Clean resources that maybe out-of-date with the system
 ParamFile clone()
          Clone object.
 int compareTo(ParamModel model)
          Compare two parameters based on their dialog types, extensionFilters, and mandatory fields F *.
 ParamFile.DialogType getDialogType()
          Get dialog type.
 FileExtensionFilter getExtensionFilter()
          Gets the extension filter.
 java.lang.String getHumanReadableDataType()
           
 java.net.URI getURI()
          Get uri location.
 java.io.File getValue()
          Get file location.
 java.lang.String getXMLValue()
           
 void init()
          Initialized data that could not be deserialized.
 boolean isCompatible(PipePort model)
          Returns true if port is compatible with this parameter's extension filter.
 java.lang.String probeDefaultValue()
           
 void replacePath(java.io.File originalDir, java.io.File replaceDir)
          Replace path in all file type objects with this path.
 void setExtensionFilter(FileExtensionFilter filter)
          Sets the extension filter.
 void setValue(java.io.File value)
          Set the file location for this parameter.
 void setValue(java.lang.String value)
          Set file location.
 void setValue(java.net.URI value)
          Set the uri location for this parameter.
 void setXMLValue(java.lang.String arg)
           
 java.lang.String toString()
          Get description of parameter.
static java.io.File translatePath(java.io.File f, java.io.File originalDir, java.io.File replaceDir)
           
 void validate()
          Validate that the specified file exists and meets all restrictions.
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
createMipavParameter, createTreeNode, dispose, equals, getCliTag, getDescription, getFactory, getInputView, getLabel, getName, getOutputView, getShortLabel, getView, hide, importMipavParameter, importParameter, isConnectible, isHidden, isMandatory, loadResources, loadResources, read, read, saveResources, setCliTag, setDescription, setFactory, setHidden, setInputView, setLabel, setLoadAndSaveOnValidate, setMandatory, setName, setOutputView, setShortLabel, toXML, write, write, writeAndFreeNow
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
addListener, disconnect, disconnect, disconnect, disconnect, getGraphPort, getIncomingConnector, getIncomingConnectors, getIncomingPorts, getListeners, getMaxIncoming, getMaxOutgoing, getOutgoingConnector, getOutgoingConnectors, getOutgoingPorts, getOwner, getPortType, isConnected, isConnectedTo, isInputPort, isOutputPort, notifyListenersOfConnection, notifyListenersOfDisconnection, removeAllListeners, removeListener, setConnectable, setGraphPort, setMaxIncoming, setMaxOutgoing, setOwner, setPortType, setUseConnector, usingConnector
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

extensionFilter

protected FileExtensionFilter extensionFilter
The extension filter.


dialogType

protected ParamFile.DialogType dialogType
The dialog type.


file

protected java.io.File file
The file.


uri

protected java.net.URI uri
The URI.

Constructor Detail

ParamFile

public ParamFile(ParamFile.DialogType type)
Construct parameter with specified restrictions.

Parameters:
type - directory or file dialog

ParamFile

public ParamFile(java.lang.String name)
Construct parameter for a mandatory file type.

Parameters:
name - parameter name

ParamFile

public ParamFile(java.lang.String name,
                 ParamFile.DialogType type)
Construct parameter with specified restrictions.

Parameters:
name - parameter name
type - directory or file dialog

ParamFile

public ParamFile(java.lang.String name,
                 java.io.File f,
                 ParamFile.DialogType type)
Construct parameter with specified restrictions.

Parameters:
name - parameter name
type - directory or file dialog
f - the file

ParamFile

public ParamFile(java.lang.String name,
                 java.net.URI uri,
                 ParamFile.DialogType type)
Construct parameter with specified restrictions.

Parameters:
name - parameter name
type - directory or file dialog
uri - the uri

ParamFile

public ParamFile(java.lang.String name,
                 FileExtensionFilter filter)
Construct parameter for a mandatory file type.

Parameters:
name - parameter name
filter - the filter
Method Detail

clone

public ParamFile clone()
Clone object.

Specified by:
clone in class ParamModel<java.io.File>
Returns:
the param file

compareTo

public int compareTo(ParamModel model)
Compare two parameters based on their dialog types, extensionFilters, and mandatory fields F *.

Specified by:
compareTo in interface java.lang.Comparable<ParamModel>
Overrides:
compareTo in class ParamModel<java.io.File>
Parameters:
model - the model
Returns:
the int

getDialogType

public ParamFile.DialogType getDialogType()
Get dialog type.

Returns:
the dialog type

getExtensionFilter

public FileExtensionFilter getExtensionFilter()
Gets the extension filter.

Returns:
the extension filter

getValue

public java.io.File getValue()
Get file location.

Specified by:
getValue in class ParamModel<java.io.File>
Returns:
file location

getURI

public java.net.URI getURI()
Get uri location.

Returns:
file location

init

public void init()
Description copied from class: PipePort
Initialized data that could not be deserialized.

Specified by:
init in class PipePort<java.io.File>

isCompatible

public boolean isCompatible(PipePort model)
Returns true if port is compatible with this parameter's extension filter.

Overrides:
isCompatible in class ParamModel<java.io.File>
Parameters:
model - the model
Returns:
true, if checks if is compatible

setExtensionFilter

public void setExtensionFilter(FileExtensionFilter filter)
Sets the extension filter.

Parameters:
filter - the new extension filter

setValue

public void setValue(java.io.File value)
Set the file location for this parameter. The file location can be specified as a File or a String.

Specified by:
setValue in class ParamModel<java.io.File>
Parameters:
value - parameter value

setValue

public void setValue(java.net.URI value)
Set the uri location for this parameter. The uri location can be

Parameters:
value - parameter value

setValue

public void setValue(java.lang.String value)
Set file location.

Parameters:
value - file location as string

toString

public java.lang.String toString()
Get description of parameter.

Specified by:
toString in class ParamModel<java.io.File>
Returns:
the string

validate

public void validate()
              throws InvalidParameterException
Validate that the specified file exists and meets all restrictions.

Specified by:
validate in class ParamModel<java.io.File>
Throws:
InvalidParameterException - parameter value does not meet value restrictions

clean

public void clean()
Description copied from class: ParamModel
Clean resources that maybe out-of-date with the system

Overrides:
clean in class ParamModel<java.io.File>

translatePath

public static java.io.File translatePath(java.io.File f,
                                         java.io.File originalDir,
                                         java.io.File replaceDir)

replacePath

public void replacePath(java.io.File originalDir,
                        java.io.File replaceDir)
Description copied from class: ParamModel
Replace path in all file type objects with this path. This is used for JUnit testing

Overrides:
replacePath in class ParamModel<java.io.File>

getHumanReadableDataType

public java.lang.String getHumanReadableDataType()
Specified by:
getHumanReadableDataType in class ParamModel<java.io.File>

getXMLValue

public java.lang.String getXMLValue()
Specified by:
getXMLValue in class ParamModel<java.io.File>

setXMLValue

public void setXMLValue(java.lang.String arg)
Specified by:
setXMLValue in class ParamModel<java.io.File>

probeDefaultValue

public java.lang.String probeDefaultValue()
Specified by:
probeDefaultValue in class ParamModel<java.io.File>