SalesPoint v3.3 API

sale.multiwindow
Class JTabDisplay

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by sale.multiwindow.JTabDisplay
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Display
Direct Known Subclasses:
MultiWindow.TabbedFrame

public class JTabDisplay
extends JPanel
implements Display

A JPanel that can be used as tab and display Form- and MenuSheets. It needs a JTabbedPane to be displayed upon.

The panel 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.

This panel cannot display MenuSheets. Instead MenuSheets will be merged into the ShopFrame.

Attention: This class is not meant to be serialized. See load() and store() for details.

Since:
v3.1
Author:
Andreas Bartho
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ListenerHelper m_lhListeners
          The list of listeners.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JTabDisplay(JTabbedPane jtp)
          Creates a new JTabDisplay.
 
Method Summary
 void addFormSheetListener(FormSheetListener fsl)
          Adds a listener to receive notification on the JTabbedDisplay's FormSheet.
 void closeFormSheet()
          Closes the current FormSheet.
 void closeFormSheet(FormSheet fs)
          Closes 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)
          Fires an event to all FormSheetListeners indicating that a FormSheet was removed from this display.
protected  void fireFormSheetSet(FormSheet fs)
          Fires 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.
 FormSheet getFormSheet()
          Returns the FormSheet that is currently attached to the display.
 MenuSheet getMenuSheet()
          Returns the MenuSheet that is currently attached to the display.
 String getPrimaryTitle()
           
 String getSecondaryTitle()
           
 JTabbedPane getTabbedPane()
          Returns the JTabbedPane on which this FormSheet is displayed.
 String getTitle()
           
 boolean isUseableDisplay()
          Returns true to indicate this is a useable display.
 void load(ObjectInputStream ois)
          Restore this display frame from data in the given input stream.
 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 onMenuSheetSet(MenuSheet ms)
          Actions to be taken when the MenuSheet has changed.
 void popUpFormSheet(FormSheet fs)
          Opens a fresh JDisplayDialog and display the FormSheet in it.
 void removeFormSheetListener(FormSheetListener fsl)
          Removes a listener to receive notification on the JTabbedDisplay's FormSheet.
 void save(ObjectOutputStream oos)
          Saves this display frame to the given output stream.
 void setDisplayTitle()
           
 void setFormSheet(FormSheet fs)
          Set and display a FormSheet.
 void setMenuSheet(MenuSheet ms)
          Sets and displays a MenuSheet.
 void setPrimaryTitle(String sPrimaryTitle)
           
 void setSecondaryTitle(String sSecondaryTitle)
           
 void toFront()
          Activates the tab which contains this display.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sale.Display
getBounds, setBounds
 

Field Detail

m_lhListeners

protected ListenerHelper m_lhListeners
The list of listeners.

Constructor Detail

JTabDisplay

public JTabDisplay(JTabbedPane jtp)
Creates a new JTabDisplay.

Parameters:
jtp - the JTabbedPane on which this Display should be displayed.
Method Detail

getTabbedPane

public JTabbedPane getTabbedPane()
Returns the JTabbedPane on which this FormSheet is displayed.


toFront

public void toFront()
Activates the tab which contains this display.

Specified by:
toFront in interface Display

save

public void save(ObjectOutputStream oos)
          throws IOException
Saves 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.

Specified by:
save in interface Display
Parameters:
oos - the stream to write attributes to
Throws:
IOException
Override:
Sometimes Override this method whenever you added attributes that need to be saved when making the Shop persistent. Should be overridden along with load().

load

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

Specified by:
load in interface Display
Parameters:
ois - the stream to read attributes from
Throws:
IOException
ClassNotFoundException

setPrimaryTitle

public void setPrimaryTitle(String sPrimaryTitle)

getPrimaryTitle

public String getPrimaryTitle()

setSecondaryTitle

public void setSecondaryTitle(String sSecondaryTitle)

getSecondaryTitle

public String getSecondaryTitle()

getTitle

public String getTitle()

setDisplayTitle

public void setDisplayTitle()

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.

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.
Override:
Always

getFormSheet

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

Specified by:
getFormSheet in interface Display

closeFormSheet

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

Specified by:
closeFormSheet in interface Display
Override:
Always

popUpFormSheet

public void popUpFormSheet(FormSheet fs)
                    throws InterruptedException
Opens a fresh JDisplayDialog and display the FormSheet in it.

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

setMenuSheet

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

The MenuSheet cannot be set on the JTabDisplay itself as it is merely an extended JPanel. Instead the Shop window is used.

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

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.
Override:
Always

onMenuSheetSet

public void onMenuSheetSet(MenuSheet ms)
Actions to be taken when the MenuSheet has changed. Does nothing by default.

Parameters:
ms - the MenuSheet that has been set.

getMenuSheet

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

Specified by:
getMenuSheet in interface Display

isUseableDisplay

public boolean isUseableDisplay()
Returns true to indicate this is a useable display.

Specified by:
isUseableDisplay in interface Display
Override:
Never

addFormSheetListener

public void addFormSheetListener(FormSheetListener fsl)
Adds a listener to receive notification on the JTabbedDisplay's FormSheet.

Specified by:
addFormSheetListener in interface Display
Parameters:
fsl - the FormSheetListener to be registered.
Override:
Never

removeFormSheetListener

public void removeFormSheetListener(FormSheetListener fsl)
Removes a listener to receive notification on the JTabbedDisplay's FormSheet.

Specified by:
removeFormSheetListener in interface Display
Parameters:
fsl - the FormSheetListener to be unregistered.
Override:
Never

fireFormSheetSet

protected void fireFormSheetSet(FormSheet fs)
Fires 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.

Parameters:
fs - the FormSheet that was set
Override:
Never

fireFormSheetRemoved

protected void fireFormSheetRemoved(FormSheet fs,
                                    boolean fExplicit)
Fires an event to all FormSheetListeners indicating that a FormSheet was removed from this display.

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)
Override:
Never

closeFormSheet

public void closeFormSheet(FormSheet fs)
Closes 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().

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

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

onFormSheetCaptionChanged

public void onFormSheetCaptionChanged(FormSheet fs,
                                      String sNewCaption)
Notification event informing about a change of a FormSheet's caption.

Parameters:
fs - the FormSheet whose caption changed.
sNewCaption - the new caption of the FormSheet.
Override:
Always

onFormSheetComponentChanged

public void onFormSheetComponentChanged(FormSheet fs,
                                        JComponent jcmpNew)
Notification event informing about a change of a FormSheet's component.

Parameters:
fs - the FormSheet whose component changed.
jcmpNew - the new component of the FormSheet.
Override:
Always

onFormSheetButtonAdded

public void onFormSheetButtonAdded(FormSheet fs,
                                   FormSheet.FormButton fb)
Notification event informing that a button was added to the FormSheet's button bar.

Parameters:
fs - the FormSheet whose button bar changed.
fb - the button that was added to the FormSheet.
Override:
Always

onFormSheetButtonRemoved

public void onFormSheetButtonRemoved(FormSheet fs,
                                     FormSheet.FormButton fb)
Notification event informing that a button was removed from the FormSheet's button bar.

Parameters:
fs - the FormSheet whose button bar changed.
fb - the button that was removed from the FormSheet.
Override:
Always

onFormSheetButtonsCleared

public void onFormSheetButtonsCleared(FormSheet fs)
Notification event informing that all buttons were removed from a FormSheet's button bar.

Parameters:
fs - the FormSheet whose button bar was cleared.
Override:
Always

SalesPoint v3.3 API