public class SaveableObject extends LiveObject
Modifier and Type | Field and Description |
---|---|
MenuItem |
chosenMenuItem |
static int |
ExitAction |
static int |
NewAction |
static int |
OpenAction |
static int |
SaveAction |
String |
textEncoderName |
Constructor and Description |
---|
SaveableObject() |
Modifier and Type | Method and Description |
---|---|
void |
Exit_action(Editor ed) |
protected void |
fileExceptionOccured(int whichFileAction,
Exception e,
FileSaver saver)
This will be called if an exception occured during processing of a File action.
|
protected FileSaver |
getFileSaver(Editor ed) |
void |
New_action(Editor ed) |
void |
newObject()
This is used to reset the Object to a "new" state.
|
void |
Open_action(Editor ed) |
protected void |
openedFrom(File opened)
This is called after a successful open.
|
void |
openObject(File source)
This is used to retrieve the Object state from a File.
|
void |
Save_action(Editor ed) |
void |
Save_As_action(Editor ed) |
protected void |
savedTo(File saved)
This is called after a successful save.
|
void |
saveObject(File destination)
This is used to save the Object state.
|
boolean |
tryOpen(Object source,
Editor ed)
This attempts to open a file to load this object.
|
boolean |
tryOpen(Object source,
Editor ed,
boolean showOpenIfFailed,
boolean showException)
This attempts to open a file to load this object.
|
action, action, addMeToPanel, addObjectToPanel, addToPanel, editorCanExit, enableEditorScrolling, fieldChanged, fieldChanged, fieldEvent, getEditor, getEditorScroller, getIcon, getName, input, isNamed, liveMain, main, makeNewEditor, menuItemSelected, prepareMainPanel, runAsApp, setToEditor, willBeSetToEditor
getParentObject, getParentObject, setParentObject
decode, decoded, decoded, decodeFields, decodeFields, encode, encoded, encoded, encodeFields, encodeFields, textDecode, textEncode
_getFieldType, _getSetField, cache, compareTo, copied, copyFrom, equals, getCopy, getDeclaredField, getDeclaredFieldValue, getMyFieldList, getNew
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compareTo
textDecode, textEncode
public MenuItem chosenMenuItem
public String textEncoderName
public static final int NewAction
public static final int OpenAction
public static final int SaveAction
public static final int ExitAction
public void newObject()
public void saveObject(File destination) throws IOException
IOException
public void openObject(File source) throws IOException
IOException
protected void fileExceptionOccured(int whichFileAction, Exception e, FileSaver saver)
whichFileAction
- one of NewAction, OpenAction, SaveAction.e
- The exception that occured.public void New_action(Editor ed)
public void Save_action(Editor ed)
public void Save_As_action(Editor ed)
public void Open_action(Editor ed)
public void Exit_action(Editor ed)
protected void savedTo(File saved)
saved
- The File the object was saved to.protected void openedFrom(File opened)
saved
- The File the object was saved to.public boolean tryOpen(Object source, Editor ed, boolean showOpenIfFailed, boolean showException)
source
- The File object or file name String.ed
- The editor used to edit the SaveableObject.showOpenIfFailed
- If this is true then the FileSaver associated with the editor (if any)
will be displayed to attempt to open a new File instead.showException
- If this is true then the full file open error will be displayed if an
error occured opening the file.