|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.neu.ccs.gui.DisplayPanel
edu.neu.ccs.gui.FileView
A
for input of a filename that either represents
a path to an existing file
or a path to which a file could be written.
Provides a button that brings up a TypedViewJFileChooser
for easy choice of an existing file.
Fragile,
Serialized Form| Nested Class Summary | |
static class |
FileView.ExtensionFileFilter
A file filter that accepts all files with a specific extension. |
| Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
protected int |
align
Alignment of the browse button relative to the field. |
protected static FileFilter |
ALL_FILES_FILTER
File filter that accepts all files. |
protected JButton |
browse
Button that brings up the file chooser. |
static int |
DEFAULT_ALIGNMENT
Default alignment of browse button relative to field. |
static String |
DEFAULT_BUTTON_LABEL
Default button label text. |
static String |
DEFAULT_FILENAME
Default filename. |
protected TextFieldView |
field
Text field containing the currently selected filename. |
static String |
LAST_PATH
Bound property name for the last path property. |
protected static String |
lastPath
Path to which a FileView was last navigated. |
protected InputProperties |
properties
Property list for this view object. |
| Fields inherited from class edu.neu.ccs.gui.DisplayPanel |
background, codec, CODEC |
| Fields inherited from class javax.swing.JPanel |
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.gui.TypedView |
DATA_TYPE |
| Fields inherited from interface edu.neu.ccs.gui.Displayable |
DEFAULT_VIEW_STATE, VIEW_STATE |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
FileView()
Constructs a file view with the default initial filename and the default alignment. |
|
FileView(String name)
Constructs a file view with the given default filename and the default alignment. |
|
FileView(String name,
int align)
Constructs a file view with the given default filename and the given alignment value. |
|
| Method Summary | |
void |
addMalformedDataListener(MalformedDataListener l)
Registers the given MalformedDataListener
to receive MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value. |
File |
demandExistingFile()
Returns a File object
representing a path to an existing file. |
String |
demandExistingFilename()
Returns a String
representing a path to an existing file. |
File |
demandFile()
Returns a File object
representing a valid path for the file system. |
String |
demandFilename()
Returns a String
representing a valid path for the file system. |
Stringable |
demandObject()
Returns an XString representing
the currently selected path. |
protected void |
fireDataMalformed(MalformedDataEvent evt)
Delivers MalformedDataEvents
to registered listeners. |
int |
getAlignment()
Returns the value for the current alignment of the browse button relative to the editable field. |
protected JButton |
getBrowseButton()
Returns the browse button component for this view. |
Class |
getDataType()
Returns the XString class object. |
String |
getDefaultViewState(String data)
Returns the default path. |
InputProperties |
getInputProperties()
Returns the input properties for this view. |
String |
getLastPath()
Returns the path to which a file view last navigated. |
String |
getViewState()
Returns the currently selected path. |
protected String |
performRequest(boolean anyValid,
boolean mandatory)
Returns a String path that was either
input into the filename field directly,
selected using the file chooser brought up by browsing,
or selected using the file chooser brought up
as part of the error recovery strategy. |
void |
removeMalformedDataListener(MalformedDataListener l)
De-registers the given MalformedDataListener
from receiving MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value. |
File |
requestExistingFile()
Returns a File object
representing a path to an existing file. |
String |
requestExistingFilename()
Returns a String
representing a path to an existing file. |
File |
requestFile()
Returns a File object
representing a valid path for the file system. |
String |
requestFilename()
Returns a String
representing a valid path for the file system. |
Stringable |
requestObject()
Returns an XString representing
the currently selected path. |
void |
reset()
Resets the view state of this object to the default view state for this object. |
void |
setAlignment(int alignment)
Sets the alignment of the browse button relative to the filename field. |
void |
setDefaultViewState(String data)
Sets the default path to the given String. |
void |
setEnabled(boolean isEnabled)
Sets whether or not this object is enabled. |
void |
setInputProperties(InputProperties p)
Sets the input properties for this view to the provided input properties. |
void |
setLastPath(String path)
Sets the last navigated path to the given path. |
void |
setViewState(String data)
Sets the currently selected path to the given String. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.neu.ccs.gui.Displayable |
getDefaultViewState |
| Field Detail |
public static final String LAST_PATH
public static final String DEFAULT_FILENAME
public static final String DEFAULT_BUTTON_LABEL
public static final int DEFAULT_ALIGNMENT
protected static final FileFilter ALL_FILES_FILTER
protected static String lastPath
FileView was last navigated.
protected int align
protected TextFieldView field
protected JButton browse
protected InputProperties properties
| Constructor Detail |
public FileView()
FileView(String),
FileView(String, int)public FileView(String name)
name - the default filename for the viewFileView(),
FileView(String, int)
public FileView(String name,
int align)
name - the default filename for the viewalign - the alignment of the browse button
relative to the filename fieldFileView(),
FileView(String)| Method Detail |
public Stringable demandObject()
XString representing
the currently selected path.
The returned representation may not be a path
to an existing file, or may not be a valid filename at all.
demandObject in interface TypedViewStringable model objectdemandFile(),
demandExistingFile(),
demandFilename(),
demandExistingFilename(),
requestObject(),
TypedView
public Stringable requestObject()
throws CancelledException
XString representing
the currently selected path.
The returned representation may not be a path
to an existing file, or may not be a valid filename at all.
requestObject in interface TypedViewStringable model object
CancelledExceptionrequestFile(),
requestExistingFile(),
requestFilename(),
requestExistingFilename(),
demandObject(),
TypedViewpublic void setInputProperties(InputProperties p)
TypedViewSets the input properties for this view to the provided input properties.
If the given input properties list is null, the
property list for this view is set to the base property list
containing default property values.
setInputProperties in interface TypedViewp - the new input properties for the viewTypedView.getInputProperties()public InputProperties getInputProperties()
TypedView
getInputProperties in interface TypedViewTypedView.setInputProperties(InputProperties)public Class getDataType()
XString class object.
getDataType in interface TypedViewTypedViewpublic void setViewState(String data)
String.
The provided filename need not point to an existing file,
or represent a valid filename at all.
setViewState in interface DisplayablesetViewState in class DisplayPaneldata - the new selected pathgetViewState(),
Displayablepublic String getViewState()
getViewState in interface DisplayablegetViewState in class DisplayPanelsetViewState(String),
Displayablepublic void setDefaultViewState(String data)
String.
setDefaultViewState in interface DisplayablesetDefaultViewState in class DisplayPaneldata - the new default pathDisplayPanel.getDefaultViewState(),
reset(),
Displayablepublic String getDefaultViewState(String data)
setDefaultViewState(String),
reset()public void reset()
DisplayableResets the view state of this object to the default view state for this object.
Equivalent to: setViewState(getDefaultViewState()).
reset in interface Displayablereset in class DisplayPanelpublic void setEnabled(boolean isEnabled)
Displayable
setEnabled in interface DisplayablesetEnabled in class DisplayPanelisEnabled - whether or not this panel is to be enabledpublic void addMalformedDataListener(MalformedDataListener l)
FragileMalformedDataListener
to receive MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value.
addMalformedDataListener in interface Fragilel - the listener to registerFragile.removeMalformedDataListener(MalformedDataListener)public void removeMalformedDataListener(MalformedDataListener l)
FragileMalformedDataListener
from receiving MalformedDataEvents
when the view state data is found to be malformed and
when the view state data is returned to a well-formed
value.
removeMalformedDataListener in interface Fragilel - the listener to de-registerFragile.addMalformedDataListener(MalformedDataListener)public File demandExistingFile()
File object
representing a path to an existing file.
This method enforces the mandatory input model,
and uses a JFileChooser to implement
an error recovery strategy.
demandFile(),
demandExistingFilename(),
demandFilename(),
demandExistingFile(),
requestFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()public File demandFile()
File object
representing a valid path for the file system.
The returned File may or may not
point to an already existing file.
This method enforces the mandatory input model,
and uses a JFileChooser to implement
an error recovery strategy.
demandExistingFile(),
demandExistingFilename(),
demandFilename(),
demandExistingFile(),
requestFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()public String demandExistingFilename()
String
representing a path to an existing file.
This method enforces the mandatory input model,
and uses a JFileChooser to implement
an error recovery strategy.
demandExistingFile(),
demandFile(),
demandFilename(),
demandExistingFile(),
requestFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()public String demandFilename()
String
representing a valid path for the file system.
The returned path may or may not
point to an already existing file.
This method enforces the mandatory input model,
and uses a JFileChooser to implement
an error recovery strategy.
demandExistingFile(),
demandFile(),
demandExistingFilename(),
demandExistingFile(),
requestFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()
public File requestExistingFile()
throws CancelledException
File object
representing a path to an existing file.
This method enforces the optional input model,
and uses a dismissable JFileChooser
to implement an error recovery strategy.
CancelledExceptiondemandExistingFile(),
demandFile(),
demandExistingFilename(),
demandFilename(),
requestFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()
public File requestFile()
throws CancelledException
File object
representing a valid path for the file system.
The returned File may or may not
point to an already existing file.
This method enforces the optional input model,
and uses a dismissable JFileChooser
to implement an error recovery strategy.
CancelledExceptiondemandExistingFile(),
demandFile(),
demandExistingFilename(),
demandFilename(),
demandExistingFile(),
requestExistingFilename(),
requestFilename(),
demandObject(),
requestObject()
public String requestExistingFilename()
throws CancelledException
String
representing a path to an existing file.
This method enforces the optional input model,
and uses a dismissable JFileChooser
to implement an error recovery strategy.
CancelledExceptiondemandExistingFile(),
demandFile(),
demandExistingFilename(),
demandFilename(),
demandExistingFile(),
requestFile(),
requestFilename(),
demandObject(),
requestObject()
public String requestFilename()
throws CancelledException
String
representing a valid path for the file system.
The returned path may or may not
point to an already existing file.
This method enforces the optional input model,
and uses a dismissable JFileChooser
to implement an error recovery strategy.
CancelledExceptiondemandExistingFile(),
demandFile(),
demandExistingFilename(),
demandFilename(),
demandExistingFile(),
requestFile(),
requestExistingFilename(),
demandObject(),
requestObject()public void setAlignment(int alignment)
alignment - the new alignment of the browse button
relative to the filename fieldgetAlignment(),
JPTConstants.ABOVE,
JPTConstants.BELOW,
SwingConstants.LEFT,
SwingConstants.RIGHT,
JPTConstants.DEFAULTpublic int getAlignment()
setAlignment(int),
JPTConstants.ABOVE,
JPTConstants.BELOW,
SwingConstants.LEFT,
SwingConstants.RIGHT,
JPTConstants.DEFAULTpublic void setLastPath(String path)
path - the desired directory to start browsing ingetLastPath()public String getLastPath()
setLastPath(String)protected JButton getBrowseButton()
protected void fireDataMalformed(MalformedDataEvent evt)
MalformedDataEvents
to registered listeners.
evt - the MalformedDataEvent to deliveraddMalformedDataListener(MalformedDataListener),
removeMalformedDataListener(MalformedDataListener)
protected String performRequest(boolean anyValid,
boolean mandatory)
throws CancelledException
String path that was either
input into the filename field directly,
selected using the file chooser brought up by browsing,
or selected using the file chooser brought up
as part of the error recovery strategy.
anyValid - whether or not any valid filename is enoughmandatory - whether or not the operation is mandatory
CancelledException - if the user cancels the action
and the operation is not mandatorydemandFile(),
demandExistingFile(),
demandFilename(),
demandExistingFilename(),
requestFile(),
requestExistingFile(),
requestFilename(),
requestExistingFilename()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||