SalesPoint Framework v3.0

sale.multiwindow
Class MultiWindow

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

public class MultiWindow
extends JFrame
implements ChangeListener, PropertyChangeListener

A MultiWindow is a JFrame capable of displaying contents in multiple frames.

Those frames can be displayed either as tabbed panels or as multiple internal frames on a javax.swing.JDesktopPane. The view mode can be chosen by client programs by calling the setViewMode(int) method or by the user using the "Window" menu.

To add a frame, you have to get a MultiWindowHandle (getNewHandle()) and set its FormSheet and MenuSheet. The display will be updated automatically.

Since:
v2.0
Version:
2.0 08/06/1999
Author:
Sven Matznick, Stephan Gambke
See Also:
Serialized Form

Inner Class Summary
static class MultiWindow.MultiWindowAction
          Special Actions are necessary for MultiWindow-MenuSheets in order for the serialization to work properly.
 
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
static String CASCADE_TAG
          Constant used as tag for the "Cascade" option.
static int MULTIFRAME
          Constant for the multiframe view mode.
static String MULTIWINDOW_MENU_TAG
          Constant used as tag for the MultiWindowMenu.
static int OVERLAPPED
          Constant for cascaded arrangement of the frames in multiframe view mode.
static String[] s_asViewModeTexts
          The texts describing the different view modes for purposes of the "Toggle View Mode" option.
static String s_sToggleViewPrefix
          The text that is used to create the "Toggle View Mode" option.
static String SEPARATOR_TAG
          Constant used as tag for the separator in the multi window menu.
static int TABBED
          Constant for the tabbed view mode.
static String TILE_HORIZ_TAG
          Constant used as tag for the "Tile horizontally" option.
static String TILE_VERT_TAG
          Constant used as tag for the "Tile vertically" option.
static int TILED_HORIZONTALLY
          Constant for horizontally tiled arrangement of the frames in multiframe view mode.
static int TILED_VERTICALLY
          Constant for vertically tiled arrangement of the frames in multiframe view mode.
static String TOGGLE_VIEW_TAG
          Constant used as tag for the "Toggle View Mode" menu option.
 
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
MultiWindow()
          Create a new MultiWindow without title and with the view mode initially set to MULTIFRAME.
MultiWindow(String sTitle)
          Create a new MultiWindow with the given title and with the view mode initially set to MULTIFRAME.
MultiWindow(String sTitle, int nViewMode)
          Create a new MultiWindow with the given title and view mode.
 
Method Summary
 void arrangeFrames(int nArrangement)
          Set the arrangement of the frames in the MultiWindow.
 void closeDisplay(Display dWhich)
          Closes the given display.
 MenuSheet getCurrentMenuSheet()
          Get the current global MenuSheet.
 int getHandleCount()
          Get the number of registered MultiWindowHandles.
 MenuSheet getMultiWindowMenuSheet()
          Return the MultiWindow management MenuSheet for this MultiWindow.
 Display getNewHandle()
          Returns a new Display and opens a new frame for it.
 Display getSelectedDisplay()
          Get the currently selected display.
 int getViewMode()
          Get the current view mode.
 int getVisibleHandleCount()
          Count all currently visible displays.
 Iterator iterator()
          Get all registered displays.
 void load(ObjectInputStream ois)
          Load the state of this MultiWindow from a stream.
 void makeInVisible(Display d)
          Remove the given display from the list of visible displays.
 void makeVisible(Display d)
          Add the given display to the list of visible displays.
 void makeVisible(List lmwhHandles, Display dSelected)
          Make visible the specified displays if they are members of this MultiWindow.
 void propertyChange(PropertyChangeEvent e)
          Implementation of the method in PropertyChangeListener.
 void save(ObjectOutputStream oos)
          Save the current state of the MultiWindow.
 void setDefaultMenuSheet()
          Sets the default MenuSheet.
 void setMenuSheet(MenuSheet msNewMenuSheet)
          Sets the given MenuSheet as a global MenuSheet in the MultiWindow.
 void setSelectedDisplay(Display d)
          Set the currently selected display.
 void setViewMode(int nViewMode)
          Set a new view mode.
 void stateChanged(ChangeEvent evt)
          Implementation of the method in ChangeListener.
protected  void transformToPane()
          Transform the MultiWindow to multiframe view.
protected  void transformToTab()
          Transforms the MultiWindow to tabbed view.
 
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, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, 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

MULTIFRAME

public static final int MULTIFRAME
Constant for the multiframe view mode. Should be used as parameter for setViewMode(int) and for recognizing the return values of getViewMode().

TABBED

public static final int TABBED
Constant for the tabbed view mode. Should be used as parameter for setViewMode(int) and for recognizing the return values of getViewMode().

OVERLAPPED

public static final int OVERLAPPED
Constant for cascaded arrangement of the frames in multiframe view mode. Should be used as parameter for arrangeFrames(int).

TILED_VERTICALLY

public static final int TILED_VERTICALLY
Constant for vertically tiled arrangement of the frames in multiframe view mode. Should be used as parameter for arrangeFrames(int).

TILED_HORIZONTALLY

public static final int TILED_HORIZONTALLY
Constant for horizontally tiled arrangement of the frames in multiframe view mode. Should be used as parameter for arrangeFrames(int).

MULTIWINDOW_MENU_TAG

public static final String MULTIWINDOW_MENU_TAG
Constant used as tag for the MultiWindowMenu. Use this constant to gain access to the menu and manipulate it.

TOGGLE_VIEW_TAG

public static final String TOGGLE_VIEW_TAG
Constant used as tag for the "Toggle View Mode" menu option. Use this constant to gain access to the menu and manipulate it.

SEPARATOR_TAG

public static final String SEPARATOR_TAG
Constant used as tag for the separator in the multi window menu. Use this constant to gain access to the menu and manipulate it.

CASCADE_TAG

public static final String CASCADE_TAG
Constant used as tag for the "Cascade" option. Use this constant to gain access to the menu and manipulate it.

TILE_HORIZ_TAG

public static final String TILE_HORIZ_TAG
Constant used as tag for the "Tile horizontally" option. Use this constant to gain access to the menu and manipulate it.

TILE_VERT_TAG

public static final String TILE_VERT_TAG
Constant used as tag for the "Tile vertically" option. Use this constant to gain access to the menu and manipulate it.

s_sToggleViewPrefix

public static String s_sToggleViewPrefix
The text that is used to create the "Toggle View Mode" option. Set this text before showing the MultiWindow to localize your MenuSheet.

s_asViewModeTexts

public static String[] s_asViewModeTexts
The texts describing the different view modes for purposes of the "Toggle View Mode" option. Set these texts before showing the MultiWindow to localize your MenuSheet.
Constructor Detail

MultiWindow

public MultiWindow()
Create a new MultiWindow without title and with the view mode initially set to MULTIFRAME.

MultiWindow

public MultiWindow(String sTitle)
Create a new MultiWindow with the given title and with the view mode initially set to MULTIFRAME.
Parameters:
sTitle - the title

MultiWindow

public MultiWindow(String sTitle,
                   int nViewMode)
Create a new MultiWindow with the given title and view mode.
Parameters:
sTitle - the title
nViewMode - the view mode
Method Detail

save

public void save(ObjectOutputStream oos)
          throws IOException
Save the current state of the MultiWindow.
Override:
Sometimes.
Override this method whenever you added attributes.
Parameters:
oos - the stream into which to save the state.
Throws:
IOException - if an error occurs while saving.

load

public void load(ObjectInputStream ois)
          throws IOException,
                 ClassNotFoundException
Load the state of this MultiWindow from a stream.
Override:
Sometimes.
Override this method whenever you added attributes.
Parameters:
ois - the input stream to restore the state from.
Throws:
IOException - if an error occurs while reading.
ClassNotFoundException - if an error occurs while reading.

getMultiWindowMenuSheet

public MenuSheet getMultiWindowMenuSheet()
Return the MultiWindow management MenuSheet for this MultiWindow.

The MultiWindow management MenuSheet contains the following items for managing the look of the MultiWindow:

Item text Item tag Item action Comments
Toggle view (MULTIFRAME/TABBED) TOGGLE_VIEW_TAG Toggle between multiframe and tabbed view. The text in the parantheses will give the type of view, that will be set when the user selects this item. You can define the three parts of this item's text in the following static attributes: s_sToggleViewPrefix and s_asViewModeTexts.
Separator SEPARATOR_TAG None.
Cascade CASCADE_TAG Cascade the internal frames. When in tabbed view mode, first change view mode.
Tile horizontally TILE_HORIZ_TAG Tile internal frames horizontally. When in tabbed view mode, first change view mode.
Tile vertically TILE_VERT_TAG Tile internal frames vertically. When in tabbed view mode, first change view mode.

You will find this MenuSheet in your Shop's MenuSheet, with a caption of "MultiWindow" and a tag of MULTIWINDOW_MENU_TAG. Please note that the MultiWindow will try to merge in the current display's MenuSheet before a MenuSheet with exactly this tag when in the tabbed view mode. So, if you remove the MultiWindow menu, make sure there will be a MenuSheetObject in the Shop's menu with that tag, or the MenuSheets will be merged to the end of the Shop's MenuSheet.

This method is used by setDefaultMenuSheet().

Override:
Sometimes.
Returns:
a MenuSheet representing the default MultiWindow menu

setDefaultMenuSheet

public void setDefaultMenuSheet()
Sets the default MenuSheet.

This method uses getMultiWindowMenuSheet() to get the MenuSheet to be set.

Override:
Never.

setMenuSheet

public void setMenuSheet(MenuSheet msNewMenuSheet)
Sets the given MenuSheet as a global MenuSheet in the MultiWindow.
Override:
Never.
Parameters:
msNewMenuSheet - the MenuSheet to be set

getCurrentMenuSheet

public MenuSheet getCurrentMenuSheet()
Get the current global MenuSheet.
Override:
Never.

getViewMode

public int getViewMode()
Get the current view mode.
Override:
Never.
Returns:
an int value representing the view mode
See Also:
TABBED, MULTIFRAME

setViewMode

public void setViewMode(int nViewMode)
Set a new view mode.
Override:
Never.
Parameters:
nViewMode - the view mode to be set
See Also:
TABBED, MULTIFRAME, arrangeFrames(int)

arrangeFrames

public void arrangeFrames(int nArrangement)
Set the arrangement of the frames in the MultiWindow.

If the MultiWindow is in multiframe mode, the new arrangement will be brought to effect at once. Otherwise it will be carried out the next time the view mode is changed to multiframe.

Override:
Never.
Parameters:
nArrangement - the new Arrangement

getNewHandle

public Display getNewHandle()
Returns a new Display and opens a new frame for it.

This Display is a MultiWindowHandle and may be casted for extended functionality. However, casting will break transparency and, thus, is usually not a good idea.

A FormSheet and a MenuSheet should be set soon since the new frame is opened immediately and would otherwise remain empty.

The display returned is initially invisible and must be made visible explicitly by calling one of the makeVisible() methods.

Override:
Never.
Returns:
a Display representing the new handle.
See Also:
makeVisible(sale.Display), makeVisible(java.util.List, sale.Display)

makeVisible

public void makeVisible(List lmwhHandles,
                        Display dSelected)
Make visible the specified displays if they are members of this MultiWindow.

All displays that are currently visible will become invisible prior to making the new set of displays visible.

Override:
Never.
Parameters:
lmwhHandles - the list of displays to be made visible.
dSelected - the Display that is to become the selected display. Must be contained in lmwhHandles.

makeVisible

public void makeVisible(Display d)
Add the given display to the list of visible displays. The given display will also become the selected display.
Override:
Never.
Parameters:
d - the display to become visible.

makeInVisible

public void makeInVisible(Display d)
Remove the given display from the list of visible displays.
Override:
Never.
Parameters:
d - the display to become invisible.

iterator

public Iterator iterator()
Get all registered displays.
Override:
Never.

getHandleCount

public int getHandleCount()
Get the number of registered MultiWindowHandles.
Override:
Never.

getVisibleHandleCount

public int getVisibleHandleCount()
Count all currently visible displays.
Override:
Never.

getSelectedDisplay

public Display getSelectedDisplay()
Get the currently selected display.
Override:
Never.

setSelectedDisplay

public void setSelectedDisplay(Display d)
Set the currently selected display.
Override:
Never.
Parameters:
d - the display to become selected. Must be visible.

transformToPane

protected void transformToPane()
Transform the MultiWindow to multiframe view.

Should not be called directly but rather via setViewMode(MULTIFRAME).

Override:
Never.

transformToTab

protected void transformToTab()
Transforms the MultiWindow to tabbed view.

Should not be called directly but rather via setViewMode(TABBED).

Override:
Never.

stateChanged

public void stateChanged(ChangeEvent evt)
Implementation of the method in ChangeListener.

ATTENTION: This method is public as an implementation detail and must not be called directly!

Override:
Never.
Specified by:
stateChanged in interface ChangeListener

propertyChange

public void propertyChange(PropertyChangeEvent e)
Implementation of the method in PropertyChangeListener.

ATTENTION: This method is public as an implementation detail and must not be called directly!

Override:
Never.
Specified by:
propertyChange in interface PropertyChangeListener

closeDisplay

public void closeDisplay(Display dWhich)
Closes the given display.

Additionally, any FormSheet that is still open on the display will be forced to close.

Override:
Never.
Parameters:
dWhich - the display to close

SalesPoint Framework v3.0