org.bs.mdi
Interface MainWindow

All Superinterfaces:
Window
All Known Implementing Classes:
SwingMainWindow

public interface MainWindow
extends Window

An interface for main window implementations.


Field Summary
static int ERROR
           
static int INFO
           
static int QUESTION
           
static int WARNING
           
 
Method Summary
 DocumentWindow createDocumentWindow()
          Creates a new document window.
 List getDocumentWindows()
          Gets a list of all currently opened document windows.
 ProgressMonitor getProgressMonitor()
          Gets the default progress monitor for this main window.
 void printDocument()
          Prints the current document.
 void setBusy(boolean busy)
          Sets the busy flag.
 void setStatus(String status)
          Sets the statusbar text.
 int showDialog(int type, Window window, String message, String[] choices, int defaultChoice)
          Displays a dialog box.
 String showFileOpenDialog(FileFormat[] formats)
          Shows a file open dialog for the given file formats.
 String showFileSaveDialog(FileFormat[] formats, String initialName)
          Shows a file save dialog for the given file formats.
 void showMessage(int type, Window window, String message)
          Displays a message box.
 void showPrintPreview()
          Shows a print preview dialog for the current document.
 void showPrintSetup()
          Shows a dialog allowing the user to setup printing options.
 
Methods inherited from interface org.bs.mdi.Window
close, getTitle, hide, repaint, setTitle, show
 

Field Detail

QUESTION

public static final int QUESTION
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

WARNING

public static final int WARNING
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values
Method Detail

createDocumentWindow

public DocumentWindow createDocumentWindow()
Creates a new document window.

Returns:
a new document window

getDocumentWindows

public List getDocumentWindows()
Gets a list of all currently opened document windows.

Returns:
a list of document windows

showFileOpenDialog

public String showFileOpenDialog(FileFormat[] formats)
Shows a file open dialog for the given file formats.

Parameters:
formats - the file formats which are used to setup the file filters
Returns:
the selected filename, or null in case of error

showFileSaveDialog

public String showFileSaveDialog(FileFormat[] formats,
                                 String initialName)
Shows a file save dialog for the given file formats.

Parameters:
formats - the file formats which are used to setup the file filters
initialName - the initial file name
Returns:
the selected filename, or null in case of error

showMessage

public void showMessage(int type,
                        Window window,
                        String message)
Displays a message box. The given message is shown on the screen and the user has only the option to confirm the message (by clicking an "OK"-Button, for example).

Parameters:
type - the type: QUESTION, INFO, WARNING or ERROR,
window - the window which this message concerns, or null if it concerns the entire application.
message - the message to be displayed (note: the message is not automatically translated by passing it to Application.tr(java.lang.String))

showDialog

public int showDialog(int type,
                      Window window,
                      String message,
                      String[] choices,
                      int defaultChoice)
Displays a dialog box. The given message is shown on the screen and the user can choose between several options to react on the event. The options may be displayed as clickable buttons, for example.

Parameters:
type - the type: QUESTION, INFO, WARNING or ERROR,
window - the document window which this message concerns, or null if it concerns the entire application.
message - the message to be displayed (note: the message is not automatically translated by passing it to Application.tr(java.lang.String))
choices - the choices to be presented to the user (note: the options are - unlike the message - translated by passing it to Application.tr(java.lang.String))
defaultChoice - the index of the default choice
Returns:
the index of the chosen option

showPrintSetup

public void showPrintSetup()
Shows a dialog allowing the user to setup printing options.


showPrintPreview

public void showPrintPreview()
Shows a print preview dialog for the current document.


printDocument

public void printDocument()
Prints the current document. The implementation may display a printing dialog before the print job is actually created.


setStatus

public void setStatus(String status)
Sets the statusbar text.

Parameters:
status - the statusbar text

setBusy

public void setBusy(boolean busy)
Sets the busy flag. The main window may for example show an hourglass mouse cursor to give the user the indication that the program is busy now.

Parameters:
busy - true if the busy indication should be enabled, false otherwise

getProgressMonitor

public ProgressMonitor getProgressMonitor()
Gets the default progress monitor for this main window. This progress monitor is responsible for giving the user some feedback about the tasks which your application is currently performing.

Returns:
the default progress monitor