SalesPoint v3.3 API

sale
Interface Display

All Known Implementing Classes:
JDisplayDialog, JDisplayFrame, JInternalDisplay, JTabDisplay, MultiWindow.DesktopFrame, MultiWindow.DisplayFrame, MultiWindow.TabbedFrame, NullDisplay

public interface Display

An abstract display that can display Form- and MenuSheets.

Displays are used to hide concrete user interface implementation details from the application developer. Together with FormSheets and MenuSheets they provide a complete abstraction from concrete user interfaces. Whatever the concrete user interface looks like, Displays, Form- and MenuSheets will always be handled in the same way by the application.

At any given point of time there may be up to one FormSheet and up to one MenuSheet set on a given Display. The Display interface offers methods to set and close these Form- and MenuSheets. as well as a restricted set of events that can be used to keep up to date with the current state of the display.

Since:
v2.0
Author:
Steffen Zschaler

Method Summary
 void addFormSheetListener(FormSheetListener fsl)
          Registers a FormSheetListener to be informed when a FormSheet is set or closed.
 void closeFormSheet()
          Closes the current FormSheet.
 Rectangle getBounds()
          Returns currently set size and position of the display
 FormSheet getFormSheet()
          Returns the FormSheet that is currently attached to the display.
 MenuSheet getMenuSheet()
          Returns the MenuSheet that is currently attached to the display.
 boolean isUseableDisplay()
          Returns true to indicate that this is a display that can be used normally.
 void load(ObjectInputStream ois)
          Restores the display from a stream.
 void popUpFormSheet(FormSheet fs)
          Shows a FormSheet, but do not close the current FormSheet.
 void removeFormSheetListener(FormSheetListener fsl)
          Unregisters a FormSheetListener to be informed when a FormSheet is set or closed.
 void save(ObjectOutputStream oos)
          Writes the display to a stream.
 void setBounds(Rectangle r)
          Sets size an position of the display.
 void setFormSheet(FormSheet fs)
          Sets and displays a FormSheet.
 void setMenuSheet(MenuSheet ms)
          Sets and displays a MenuSheet.
 void toFront()
          Brings the display to front, i.e. activates it.
 

Method Detail

setFormSheet

void setFormSheet(FormSheet fs)
                  throws InterruptedException
Sets and displays a FormSheet.

This method should attach a FormSheetContainer as the FormSheet's display, get the FormSheet's caption, component and button bar and render them. The entire peer creation should be synchronized using FormSheet.getComponentLock() and FormSheet.getButtonsLock(), so as not to loose any events.

If fs.waitResponse() returns true, setFormSheet() should block, until the FormSheet is closed by a matching call to a closeFormSheet() method.

If a FormSheet is already being displayed, setFormSheet() should cancel this FormSheet prior to setting the new FormSheet.

Parameters:
fs - the FormSheet to be displayed.
Throws:
InterruptedException - if an interrupt occured while waiting for the FormSheet to be closed.
Override:
Always

getFormSheet

FormSheet getFormSheet()
Returns the FormSheet that is currently attached to the display.


closeFormSheet

void closeFormSheet()
Closes the current FormSheet. It is up to the display whether the FormSheet will be cancelled or just closed normally.

Override:
Always

popUpFormSheet

void popUpFormSheet(FormSheet fs)
                    throws InterruptedException
Shows a FormSheet, but do not close the current FormSheet. This method will normally pop up an extra JDisplayDialog that has the FormSheet set.

This method should attach a FormSheetContainer as the FormSheet's display, get the FormSheet's caption, component and button bar and render them. The entire peer creation should be synchronized using FormSheet.getComponentLock() and FormSheet.getButtonsLock(), so as not to loose any events.

If fs.waitResponse() returns true, popUpFormSheet() should block, until the FormSheet is closed by a matching call to a closeFormSheet() method.

If a FormSheet is already being displayed, popUpFormSheet() must not close this FormSheet prior to setting the new FormSheet.

Parameters:
fs - the FormSheet to be displayed.
Throws:
InterruptedException - if an interrupt occured while waiting for the FormSheet to be closed.
Override:
Always

setMenuSheet

void setMenuSheet(MenuSheet ms)
Sets and displays a MenuSheet.

If a MenuSheet is already being displayed, setMenuSheet() should remove this MenuSheet prior to setting the new MenuSheet.

Parameters:
ms - the MenuSheet to be displayed. null is a valid value and should result in the current MenuSheet being closed.
Override:
Always

getMenuSheet

MenuSheet getMenuSheet()
Returns the MenuSheet that is currently attached to the display.


isUseableDisplay

boolean isUseableDisplay()
Returns true to indicate that this is a display that can be used normally. The only subclass that is actually allowed to return false is NullDisplay.

Override:
Always

setBounds

void setBounds(Rectangle r)
Sets size an position of the display.

Parameters:
r - the Rectangle that contains the size and position information.
Override:
Always

getBounds

Rectangle getBounds()
Returns currently set size and position of the display


addFormSheetListener

void addFormSheetListener(FormSheetListener fsl)
Registers a FormSheetListener to be informed when a FormSheet is set or closed.

Parameters:
fsl - the FormSheetListener to be registered.
Override:
Always

removeFormSheetListener

void removeFormSheetListener(FormSheetListener fsl)
Unregisters a FormSheetListener to be informed when a FormSheet is set or closed.

Parameters:
fsl - the FormSheetListener to be unregistered.
Override:
Always

toFront

void toFront()
Brings the display to front, i.e. activates it.

Override:
Always

load

void load(ObjectInputStream ois)
          throws IOException,
                 ClassNotFoundException
Restores the display from a stream.

As displays should not be serialized when making the Shop persistent, they cannot be normally deserialized. Instead they should individually read the attributes they previously saved. The attributes must be read in the same order they have previously been writtn.

Attention: The current class that has been written by the save() method must not be read here!

Example:
 FormSheet fsCurrent = (FormSheet)ois.readObject();
 MenuSheet msCurrent = (MenuSheet)ois.readObject();
 ...
 

Parameters:
ois - the stream to read attributes from
Throws:
IOException
ClassNotFoundException
Override:
Always

save

void save(ObjectOutputStream oos)
          throws IOException
Writes the display to a stream.

Displays should not be serialized as a whole. Instead use this method to individually write all attributes of the display to the stream.

Attention: The very first attribute to be written must be the display's class!

Example:
 oos.writeObject(getClass());
 oos.writeObject(fsCurrent); //current FormSheet
 oos.writeObject(msCurrent); //current MenuSheet
 ...
 

Parameters:
oos - the stream to write attributes to
Throws:
IOException
ClassNotFoundException
Override:
Always

SalesPoint v3.3 API