SalesPoint Framework v3.0

sale
Class JDisplayFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--sale.JDisplayFrame

public class JDisplayFrame
extends JFrame
implements Display

A JFrame that can display Form- and MenuSheets.

You can use this frame to pop up messages and dialogs in extra windows, while maintaining consistency with the rest of the GUI by using the familiar FormSheet look'n'feel.

The frame will display one FormSheet. Closing the frame using the systems menu or any other OS dependent gesture will result in a call to FormSheet.cancel() on the FormSheet.

Also, the frame may display a MenuSheet. It can therefore be used wherever a Display can be used.

Attention: This class is not meant to be serialized.

Since:
v3.0
Version:
3.0 12/01/2001
Author:
Steffen Zschaler, Thomas Medack
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
protected  ListenerHelper m_lhListeners
          The list of listeners.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
JDisplayFrame()
          Create a new JDisplayFrame.
 
Method Summary
 void addFormSheetListener(FormSheetListener fsl)
          Add a listener to receive notification on the JDisplayFrame's FormSheet.
 void closeFormSheet()
          Close the current FormSheet.
 void closeFormSheet(FormSheet fs)
          Close a FormSheet.
 void dispose()
          In addition to disposing of the peer resources, remove the FormSheet and the MenuSheet.
protected  void exitForm()
          Hook method called when the frame is about to be closed.
protected  void fireFormSheetRemoved(FormSheet fs, boolean fExplicit)
          Fire an event to all FormSheetListeners indicating that a FormSheet was removed from this display.
protected  void fireFormSheetSet(FormSheet fs)
          Fire an event to all FormSheetListeners indicating that a FormSheet was set on this display.
protected  void formSheetClosed()
          Hook method called when the FormSheet was closed.
 String getFrameTitlePrefix()
           
 String getTitle()
           
 boolean isUseableDisplay()
          Return true to indicate this is a useable display.
 void load(ObjectInputStream ois)
          Restore this display frame from data in the given input stream.
static void main(String[] args)
          JDisplayFrame test suite.
 void onFormSheetButtonAdded(FormSheet fs, FormSheet.FormButton fb)
          Notification event informing that a button was added to the FormSheet's button bar.
 void onFormSheetButtonRemoved(FormSheet fs, FormSheet.FormButton fb)
          Notification event informing that a button was removed from the FormSheet's button bar.
 void onFormSheetButtonsCleared(FormSheet fs)
          Notification event informing that all buttons were removed from a FormSheet's button bar.
 void onFormSheetCaptionChanged(FormSheet fs, String sNewCaption)
          Notification event informing about a change of a FormSheet's caption.
 void onFormSheetComponentChanged(FormSheet fs, JComponent jcmpNew)
          Notification event informing about a change of a FormSheet's component.
 void popUpFormSheet(FormSheet fs)
          Open a fresh JDisplayDialog and display the FormSheet in it.
 void removeFormSheetListener(FormSheetListener fsl)
          Remove a listener to receive notification on the JDisplayFrame's FormSheet.
 void save(ObjectOutputStream oos)
          Save this display frame to the given output stream.
 void setFormSheet(FormSheet fs)
          Set and display a FormSheet.
 void setFrameTitlePrefix(String sPrefix)
           
 void setMenuSheet(MenuSheet ms)
          Set and display a MenuSheet.
 void setTitle(String sTitle)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_lhListeners

protected ListenerHelper m_lhListeners
The list of listeners.
Constructor Detail

JDisplayFrame

public JDisplayFrame()
Create a new JDisplayFrame.
Method Detail

save

public void save(ObjectOutputStream oos)
          throws IOException
Save this display frame to the given output stream. The frame will only store information from which contents and layout can be restored later. The actual frame or any other Swing components will not be stored into the stream.

load

public void load(ObjectInputStream ois)
          throws IOException,
                 ClassNotFoundException
Restore this display frame from data in the given input stream.

setTitle

public void setTitle(String sTitle)
Overrides:
setTitle in class Frame

getTitle

public String getTitle()
Overrides:
getTitle in class Frame

setFrameTitlePrefix

public void setFrameTitlePrefix(String sPrefix)

getFrameTitlePrefix

public String getFrameTitlePrefix()

exitForm

protected void exitForm()
Hook method called when the frame is about to be closed.

By default cancels any FormSheet being currently displayed and closes the frame.


setFormSheet

public void setFormSheet(FormSheet fs)
                  throws InterruptedException
Set and display 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.

Override:
Always.
Specified by:
setFormSheet in interface Display
Parameters:
fs - the FormSheet to be displayed.
Throws:
InterruptedException - if an interrupt occured while waiting for the FormSheet to be closed.

closeFormSheet

public void closeFormSheet()
Close the current FormSheet. It is up to the display whether the FormSheet will be cancelled or just closed normally.
Override:
Always.
Specified by:
closeFormSheet in interface Display

popUpFormSheet

public void popUpFormSheet(FormSheet fs)
                    throws InterruptedException
Open a fresh JDisplayDialog and display the FormSheet in it.
Override:
Never.
Specified by:
popUpFormSheet in interface Display
Throws:
InterruptedException - if an interrupt occured while waiting for the FormSheet to be closed.

setMenuSheet

public void setMenuSheet(MenuSheet ms)
Set and display a MenuSheet.

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

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

isUseableDisplay

public boolean isUseableDisplay()
Return true to indicate this is a useable display.
Override:
Never.
Specified by:
isUseableDisplay in interface Display

addFormSheetListener

public void addFormSheetListener(FormSheetListener fsl)
Add a listener to receive notification on the JDisplayFrame's FormSheet.
Override:
Never.
Specified by:
addFormSheetListener in interface Display

removeFormSheetListener

public void removeFormSheetListener(FormSheetListener fsl)
Remove a listener to receive notification on the JDisplayFrame's FormSheet.
Override:
Never.
Specified by:
removeFormSheetListener in interface Display

fireFormSheetSet

protected void fireFormSheetSet(FormSheet fs)
Fire an event to all FormSheetListeners indicating that a FormSheet was set on this display. As FormSheet setting is always explicit, no extra parameter is necessary.
Override:
Never.
Parameters:
fs - the FormSheet that was set

fireFormSheetRemoved

protected void fireFormSheetRemoved(FormSheet fs,
                                    boolean fExplicit)
Fire an event to all FormSheetListeners indicating that a FormSheet was removed from this display.
Override:
Never.
Parameters:
fs - the FormSheet that was set
fExplicit - true, if the FormSheet was closed explicitly, i.e. either by a call to one of the closeFormSheet methods or by setFormSheet (null).
See Also:
closeFormSheet(), closeFormSheet(FormSheet), setFormSheet(sale.FormSheet)

closeFormSheet

public void closeFormSheet(FormSheet fs)
Close a FormSheet.

If a FormSheet is closed, by default, the JDisplayDialog containing it is also closed. You can, however, alter this behavior by overriding formSheetClosed().

Override:
Never.
Instead override formSheetClosed().
Parameters:
fs - the FormSheet to be closed.

formSheetClosed

protected void formSheetClosed()
Hook method called when the FormSheet was closed.
Override:
Sometimes.
The default implementation calls exitForm().

dispose

public void dispose()
In addition to disposing of the peer resources, remove the FormSheet and the MenuSheet.
Override:
Never.
Overrides:
dispose in class Window

onFormSheetCaptionChanged

public void onFormSheetCaptionChanged(FormSheet fs,
                                      String sNewCaption)
Notification event informing about a change of a FormSheet's caption.
Override:
Always.
Parameters:
fs - the FormSheet whose caption changed.
sNewCaption - the new caption of the FormSheet.

onFormSheetComponentChanged

public void onFormSheetComponentChanged(FormSheet fs,
                                        JComponent jcmpNew)
Notification event informing about a change of a FormSheet's component.
Override:
Always.
Parameters:
fs - the FormSheet whose component changed.
jcmpNew - the new component of the FormSheet.

onFormSheetButtonAdded

public void onFormSheetButtonAdded(FormSheet fs,
                                   FormSheet.FormButton fb)
Notification event informing that a button was added to the FormSheet's button bar.
Override:
Always.
Parameters:
fs - the FormSheet whose button bar changed.
fb - the button that was added to the FormSheet.

onFormSheetButtonRemoved

public void onFormSheetButtonRemoved(FormSheet fs,
                                     FormSheet.FormButton fb)
Notification event informing that a button was removed from the FormSheet's button bar.
Override:
Always.
Parameters:
fs - the FormSheet whose button bar changed.
fb - the button that was removed from the FormSheet.

onFormSheetButtonsCleared

public void onFormSheetButtonsCleared(FormSheet fs)
Notification event informing that all buttons were removed from a FormSheet's button bar.
Override:
Always.
Parameters:
fs - the FormSheet whose button bar was cleared.

main

public static void main(String[] args)
JDisplayFrame test suite.

SalesPoint Framework v3.0