public class FileMenuActionHandler
extends java.lang.Object
FileMenuActionHandler
class implements the methods
used by the File menu defined in GridAppFrame
.GridAppFrame
Constructor and Description |
---|
FileMenuActionHandler(GridAppFrame frame,
GridDataFileHandler fileHandler)
Creates a new file menu action handler tied to the specified frame.
|
Modifier and Type | Method and Description |
---|---|
protected GridFileChooser |
createFileChooser()
Creates the file chooser.
|
protected GridCreationDialog |
createGridCreationDialog()
Creates a grid creation dialog.
|
void |
createNewGrid()
Creates a new empty grid and invokes the grid editor.
|
void |
editGrid()
Enables editing of the existing grid from the parent frame.
|
protected GridFileChooser |
getFileChooser()
Gets the file chooser dialog used previously (if any) or creates
a new one using the
createFileChooser method. |
protected GridDataFileHandler |
getFileHandler()
Gets the object that handles file i/o.
|
protected GridCreationDialog |
getGridCreationDialog()
Gets the dialog used previously (if any) for grid creation.
|
protected GridAppFrame |
getParentFrame()
Gets the frame containing the file menu associated with this handler.
|
protected void |
invokeEditor()
Invokes the appropriate grid editor to edit the grid from the
parent frame.
|
void |
openFile()
Reads a new grid from a saved data file.
|
void |
saveFile()
Saves the grid from the parent frame to a data file.
|
boolean |
supportsFileIO()
Indicates whether this action handler supports file i/o.
|
boolean |
supportsGridEditing()
Indicates whether this action handler supports grid editing.
|
public FileMenuActionHandler(GridAppFrame frame, GridDataFileHandler fileHandler)
frame
- the frame that uses this action handlerfileHandler
- object that can read and write a grid;
null if this handler should not support file i/oprotected GridAppFrame getParentFrame()
protected GridCreationDialog getGridCreationDialog()
protected GridCreationDialog createGridCreationDialog()
protected GridFileChooser getFileChooser()
createFileChooser
method.protected GridFileChooser createFileChooser()
protected GridDataFileHandler getFileHandler()
public boolean supportsFileIO()
true
if this action handler was constructed
with a non-null grid data file handlerpublic boolean supportsGridEditing()
invokeEditor
method.public void createNewGrid()
supportsGridEditing() == true
protected void invokeEditor()
public void editGrid()
SteppedGridAppFrame
, the subclass
should call the frame's stop
method.public void openFile()
public void saveFile()