de.caff.maze
Interface SystemAccess

All Superinterfaces:
DataStorage
All Known Implementing Classes:
ApplicationSystemAccess, JnlpSystemAccess, NullSystemAccess

interface SystemAccess
extends DataStorage

Allow access to the underlying system for storage of persisitent data, file access and printing. This class abstracts between running as an Application, an Applet or via Java WebStart.

 

Nested Class Summary
static class SystemAccess.FileType
          Just a file extension and the resource for a description of the type it defines.
 
Field Summary
static SystemAccess.FileType IMAGE_FILE_TYPE
          The file extensions for images.
static SystemAccess.FileType MAZE_FILE_TYPE
          The file type of mazes files.
 
Method Summary
 byte[] getUserFileContent(SystemAccess.FileType filetype)
          Get the contents of a user selected file.
 boolean print(java.awt.print.Printable printable)
          Print the given printable.
 boolean saveUserFileContent(byte[] content, SystemAccess.FileType filetype)
          Save a byte array into a user selected file.
 void setMainFrame(javax.swing.JFrame frame)
          Sets the main frame of the application.
 
Methods inherited from interface de.caff.maze.DataStorage
getBoolean, getColor, getDouble, getInt, getLong, getString, hasKey, setBoolean, setColor, setDouble, setInt, setLong, setString, storePersistentData
 

Field Detail

MAZE_FILE_TYPE

static final SystemAccess.FileType MAZE_FILE_TYPE
The file type of mazes files.


IMAGE_FILE_TYPE

static final SystemAccess.FileType IMAGE_FILE_TYPE
The file extensions for images.

Method Detail

print

boolean print(java.awt.print.Printable printable)
Print the given printable.

Parameters:
printable - printable to be printed
Returns:
true: printing was successful, false: printing failed or was canceled

getUserFileContent

byte[] getUserFileContent(SystemAccess.FileType filetype)
                          throws java.io.IOException
Get the contents of a user selected file.

Throws:
java.io.IOException - on errors during file access
Parameters:
filetype - type of file to be used
Returns:
byte array or null if the user canceled the operation

saveUserFileContent

boolean saveUserFileContent(byte[] content,
                            SystemAccess.FileType filetype)
                            throws java.io.IOException
Save a byte array into a user selected file.

Throws:
java.io.IOException - on errors during file access
Parameters:
content - the content of the file
filetype - type of file to be used
Returns:
true if the user saved the file, false otherwise

setMainFrame

void setMainFrame(javax.swing.JFrame frame)
Sets the main frame of the application. This is useful for centering dialogs.

Parameters:
frame - application's main frame