UI
Class GEVAFileProperty

java.lang.Object
  extended by UI.GEVAControl
      extended by UI.GEVAPropertyControl
          extended by UI.GEVAFileProperty
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.DocumentListener

public class GEVAFileProperty
extends GEVAPropertyControl
implements javax.swing.event.DocumentListener

Input that allows files or directories to be chosen

Author:
eliott bartley

Field Summary
static java.lang.String PP_ABSOLUTE
          Constructor params.
static java.lang.String PP_IGNORE_EXIST
          Constructor params.
static java.lang.String PP_MUST_EXIST
          Constructor params.
static java.lang.String PP_RELATIVE
          Constructor params.
static java.lang.String PT_FILE
          Constructor type.
static java.lang.String PT_FILE_OR_FOLDER
          Constructor type.
static java.lang.String PT_FOLDER
          Constructor type.
 
Fields inherited from class UI.GEVAPropertyControl
initial, params
 
Fields inherited from class UI.GEVAControl
comment, dirtyListener, name, parent, title, type
 
Constructor Summary
GEVAFileProperty(GEVADirtyListener dirtyListener, GEVAPropertyContainer parent, java.lang.String type, java.lang.String title, java.lang.String name, java.lang.String comment, java.lang.String initial, java.lang.String params)
          Create a text input and file browser button with file exists validation
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
 java.lang.String getAbsoluteText()
          Get the absolute path value regardless to whether this control displays in absolute or relative mode (which getText() would be affected by)
 java.awt.Component getComponent(int index)
          Abstract way for a container to know about its child's awt components.
 java.lang.String getText()
          Get the value of teh control, using a text string
 java.lang.String getWorkingPath()
           
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 boolean load(java.util.Properties properties)
          A control should override this to get its properties.
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 boolean save(java.util.Properties properties)
          A control should override this to set its properties.
 void setEnabled(boolean enabled)
          Make this control enabled or disabled.
 void setText(java.lang.String text)
          Set the value of the control, using a text string
 void setWorkingPath(java.lang.String workingPath)
          Make the path listed relative to a particular working path.
 boolean valid()
           
 void validate()
          Get this control to validate itself
 
Methods inherited from class UI.GEVAPropertyControl
addInvalidReason, countComponents, getParam, getParam, getParamBoolean, getParamBoolean, getParamDouble, getParamDouble, getParamEqual, getParamInt, getParamInt, resetInvalidReason, setVisible, setVisibleControlGroup
 
Methods inherited from class UI.GEVAControl
addActionListener, fireActionEvent, getComment, getComponent, getName, getParent, getTitle, getType, isType, removeActionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PT_FILE

public static java.lang.String PT_FILE
Constructor type. Accepts files only


PT_FOLDER

public static java.lang.String PT_FOLDER
Constructor type. Accepts folders only


PT_FILE_OR_FOLDER

public static java.lang.String PT_FILE_OR_FOLDER
Constructor type. Accepts files or folders


PP_RELATIVE

public static java.lang.String PP_RELATIVE
Constructor params. Path names are to be output as relative to working path (see setWorkingPath). This must be given as the second value in params (this is the default)


PP_ABSOLUTE

public static java.lang.String PP_ABSOLUTE
Constructor params. Path names are to be output as absolute. This must be given as the second value in params


PP_MUST_EXIST

public static java.lang.String PP_MUST_EXIST
Constructor params. No validation is done to see if the file or folder specified actually exists. This must be given as the third value in params (this is the default)


PP_IGNORE_EXIST

public static java.lang.String PP_IGNORE_EXIST
Constructor params. Validation is done to see if the file or folder specified actually exists. This must be given as the third value in params

Constructor Detail

GEVAFileProperty

public GEVAFileProperty(GEVADirtyListener dirtyListener,
                        GEVAPropertyContainer parent,
                        java.lang.String type,
                        java.lang.String title,
                        java.lang.String name,
                        java.lang.String comment,
                        java.lang.String initial,
                        java.lang.String params)
Create a text input and file browser button with file exists validation

Parameters:
dirtyListener - GUI that listens to dirty events
parent - Container for this control
type - Can be PP_FILE, PP_FOLDER or PP_FILE_OR_FOLDER and states what the
title - The title to show in the GUI of this control
name - The name used when saving this to the properties file
comment - A tooltip
initial - The initial value
params - "working_folder, absolute, mustExist, filter" where working_folder is a string of the root directory from which relative paths are resolved and defaults to the current directory if not speicified. absolute is a boolean which states whether the pathname will be output as a relative or absolute path (false or true respectively) (default false (relative)), mustExist is a boolean which states whether the result must be to an existing file or directory (default true (must exist)), and filter states the file types that are filtered, in the format "desc|ex1[;ex2;...][|desc2|ex21[;ex22;...][|...|...]]", e.g. "Pictures|jpeg;jpg;png;bmp|Videos|mpeg;mpg;avi". If no extension is given, e.g. "All files|", then all files are output for that filter
Method Detail

getText

public java.lang.String getText()
Description copied from class: GEVAControl
Get the value of teh control, using a text string

Specified by:
getText in class GEVAControl
Returns:
The value of the control in string format

getAbsoluteText

public java.lang.String getAbsoluteText()
Get the absolute path value regardless to whether this control displays in absolute or relative mode (which getText() would be affected by)


setText

public void setText(java.lang.String text)
Description copied from class: GEVAControl
Set the value of the control, using a text string

Specified by:
setText in class GEVAControl
Parameters:
text - The value to set

load

public boolean load(java.util.Properties properties)
Description copied from class: GEVAControl
A control should override this to get its properties.

Specified by:
load in class GEVAControl
Parameters:
properties - The properties of a loaded properties file

save

public boolean save(java.util.Properties properties)
Description copied from class: GEVAControl
A control should override this to set its properties. After all controls have had a chance to set the properties, the properties file will be written to by the caller

Specified by:
save in class GEVAControl
Parameters:
properties - The properties of a loaded properties file

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: GEVAControl
Make this control enabled or disabled.

Specified by:
setEnabled in class GEVAControl
Parameters:
enabled - true to enabled, false to disable

getComponent

public java.awt.Component getComponent(int index)
Description copied from class: GEVAControl
Abstract way for a container to know about its child's awt components.

Overrides:
getComponent in class GEVAPropertyControl
Parameters:
index - The index of the component to get
Returns:
The indexed awt component of the control

valid

public boolean valid()

validate

public void validate()
Description copied from class: GEVAControl
Get this control to validate itself

Specified by:
validate in class GEVAControl

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

setWorkingPath

public void setWorkingPath(java.lang.String workingPath)
Make the path listed relative to a particular working path. If working path is set to null, the path will be relative to the current directory.

Parameters:
workingPath -

getWorkingPath

public java.lang.String getWorkingPath()