Class EnvController
java.lang.Object
|
+--EnvController
- public class EnvController
- extends java.lang.Object
Environment-Based Applications:
The EnvController
class implements the methods used by
the File menu defined in EnvApplFrame
.
- Version:
- 1 December 2002
- See Also:
EnvAppFrame
Method Summary |
void |
createNewEnv()
Creates a new empty environment and invokes the environment editor. |
void |
editEnv(Environment env)
Enables editing of the existing environment. |
protected void |
invokeEditor(Environment env)
Invokes the appropriate environment editor. |
void |
openFile()
Reads a new environment from a saved data file. |
void |
saveFile(Environment env)
Saves an environment to a data file. |
boolean |
supportsEnvEditing()
Indicates whether this controller supports environment editing. |
boolean |
supportsFileIO()
Indicates whether this controller supports file i/o. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parentFrame
protected EnvAppFrame parentFrame
createEnvDialog
protected CreateEnvDialog createEnvDialog
fileChooser
protected EnvFileChooser fileChooser
fileHandler
protected EnvDataFileHandler fileHandler
EnvController
public EnvController(EnvAppFrame frame,
EnvDataFileHandler fileHandler)
- Creates a new environment controller tied to the specified frame.
(Precondition: frame is not null. )
- Parameters:
frame
- the frame that uses this controllerfileHandler
- object that can read and write an environment;
null if this controller should not support file i/o
supportsFileIO
public boolean supportsFileIO()
- Indicates whether this controller supports file i/o.
- Returns:
true
if this controller was constructed with a
non-null environment data file handler
supportsEnvEditing
public boolean supportsEnvEditing()
- Indicates whether this controller supports environment editing.
Should only be redefined in subclasses that also redefine the
invokeEditor
method.
createNewEnv
public void createNewEnv()
- Creates a new empty environment and invokes the environment editor.
(Precondition:
supportsEnvEditing() == true
invokeEditor
protected void invokeEditor(Environment env)
- Invokes the appropriate environment editor. Should be redefined
in subclasses that support an environment editor to construct and
run the editor.
- Parameters:
env
- the environment to edit
editEnv
public void editEnv(Environment env)
- Enables editing of the existing environment. Subclasses that
support environment editing should ensure that the application
is not actively running and modifying the environment while
the environment is being edited. For example, if the parent
frame is an
ActiveEnvFrame
, the subclass should
call the frame's stop
method.
openFile
public void openFile()
- Reads a new environment from a saved data file. Gets file via
file chooser dialog, reads contents using the specified file handler.
On error, brings up dialog and continues using previous environment.
saveFile
public void saveFile(Environment env)
- Saves an environment to a data file.
- Parameters:
env
- the environment to save to the file
Copyright© 2003 Alyce Brady