|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Frame javax.swing.JFrame sale.multiwindow.MultiWindow
A MultiWindow is a JFrame
capable managing all kinds of Displays
.
There are three view modes:
FRAME: | Displays are DisplayFrames , that is, every Display has its own window (JFrame) |
TAB: | Displays are TabbedFrames . The MultiWindow contains a row of tabs,
each of which is a Display |
DESKTOP: | Displays are DesktopFrames . These are Windows that can be moved within the
frame borders of the MultiWindow. (see JDesktopPane ) |
The view mode can be chosen by client programs by calling the setViewMode(int)
method or by the
user using the "MultiWindow" menu.
Displays can be added via the addSalesPointDisplay(SalesPoint)
method and removed with
#removeSalesPointDisplay(SalesPoint)
. When a display is added it will be saved until it is
explicitly closed
.
The displays will be updated automatically when FormSheets
or MenuSheets
are set.
Nested Class Summary | |
class |
MultiWindow.DesktopFrame
This class is actually used by MultiWindow to display SalesPoints in desktop view mode. |
class |
MultiWindow.DisplayFrame
This class is actually used by MultiWindow to display SalesPoints in window view mode. |
static class |
MultiWindow.MultiWindowAction
Special Actions are necessary for
MultiWindow -MenuSheets in order for the serialization to work
properly. |
class |
MultiWindow.TabbedFrame
This class is actually used by MultiWindow to display SalesPoints in tabbed view mode. |
Nested classes inherited from class javax.swing.JFrame |
JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
static String |
CASCADE_MENU_TAG
Constant used as tag for the "Cascade" option. |
static String |
DESKTOP_MENU_TAG
Constant used as tag for the "Desktop" menu option. |
static int |
DESKTOP_VIEW
Constant for the desktop view mode. |
protected String |
m_sMergeBefore
Contains the tag of the MultiWindow's MenuSheet, in front of which the active SalesPoint's MenuSheet should be merged when in tabbed 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 window or desktop view mode. |
static String |
SEPARATOR_TAG
Constant used as tag for the separator in the multi window menu. |
static String |
TABBED_MENU_TAG
Constant used as tag for the "Tabbed" menu option. |
static int |
TABBED_VIEW
Constant for the tabbed view mode. |
static String |
TILE_HORIZ_MENU_TAG
Constant used as tag for the "Tile horizontally" option. |
static String |
TILE_VERT_MENU_TAG
Constant used as tag for the "Tile vertically" option. |
static int |
TILED_HORIZONTALLY
Constant for horizontally tiled arrangement of the frames in window or desktop view mode. |
static int |
TILED_VERTICALLY
Constant for vertically tiled arrangement of the frames in window or desktop view mode. |
static String |
WINDOW_MENU_TAG
Constant used as tag for the "Window" menu option. |
static int |
WINDOW_VIEW
Constant for the window view mode. |
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, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, 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 |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MultiWindow(Shop sShop,
int nViewMode)
Creates a new MultiWindow for the given Shop and initializes the viewmode. |
Method Summary | |
protected void |
addAllDisplays()
Sets the displays of all open SalesPoints according to the current view mode. |
void |
addSalesPointDisplay(SalesPoint sp)
Opens a display for a SalesPoint according to the current view mode. |
void |
arrangeFrames(int nArrangement)
Sets the arrangement of the frames in the MultiWindow. |
void |
closeSalesPointDisplay(SalesPoint sp)
Closes a SalesPoint's display as #removeSalesPointDisplay(SalesPoint) does. |
protected JDesktopPane |
createDesktopPane()
Creates and returns the JPanel which is used as content pane in DESKTOP_VIEW view mode. |
protected JPanel |
createFramePane()
Creates and returns the JPanel which is used as content pane in WINDOW_VIEW view mode. |
protected IconTabbedPane |
createTabbedPane()
Creates and returns the IconTabbedPane which is used as content pane in TABBED_VIEW view mode. |
MenuSheet |
getCurrentMenuSheet()
Gets the current global MenuSheet. |
protected JDesktopPane |
getDesktopPane()
Returns the JDesktopPane to be added to the content pane in DESKTOP_VIEW view mode. |
protected JPanel |
getFramePane()
Returns the JPanel to be added to the content pane in WINDOW_VIEW view mode. |
MenuSheet |
getMultiWindowMenuSheet()
Returns the MultiWindow management MenuSheet for this MultiWindow. |
Display |
getNewInternalFrame(SalesPoint sp)
Creates and returns a new DesktopFrame for a SalesPoint. |
Display |
getNewTab(SalesPoint sp)
Creates and returns a new TabbedFame for a SalesPoint. |
Display |
getNewWindow(SalesPoint sp)
Creates and returns a new DisplayFrame for a SalesPoint. |
protected IconTabbedPane |
getTabbedPane()
Returns the IconTabbedPane to be added to the content pane in TABBED_VIEW view mode. |
int |
getViewMode()
Gets the current view mode. |
void |
load(ObjectInputStream ois)
Loads the state of the MultiWindow from a stream. |
protected void |
prepareNewContentPane(int viewMode)
Prepares the MultiWindow's content pane for a new view mode. |
protected void |
removeAllDisplays()
Closes the displays of all open SalesPoints. |
void |
save(ObjectOutputStream oos)
Saves 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. |
protected void |
setMergeBefore(String sMergeBefore)
Sets the value of m_sMergeBefore .
|
void |
setSecondMenuSheet(MenuSheet ms)
Merges the MultiWindow's MenuSheet with a second one. |
void |
setViewMode(int viewMode)
Sets a new view mode. |
void |
stateChanged(ChangeEvent evt)
Implementation of the method in ChangeListener .
|
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
protected String m_sMergeBefore
null
, so SalesPoint's menus appear behind all Shop's menus.
It is also possible to use setMergeBefore(String)
to change this variable's value.
setSecondMenuSheet(sale.MenuSheet)
public static final int WINDOW_VIEW
setViewMode(int)
and
for recognizing the return values of getViewMode()
.
public static final int TABBED_VIEW
setViewMode(int)
and
for recognizing the return values of getViewMode()
.
public static final int DESKTOP_VIEW
setViewMode(int)
and
for recognizing the return values of getViewMode()
.
public static final int OVERLAPPED
arrangeFrames(int)
.
public static final int TILED_VERTICALLY
arrangeFrames(int)
.
public static final int TILED_HORIZONTALLY
arrangeFrames(int)
.
public static final String MULTIWINDOW_MENU_TAG
public static final String WINDOW_MENU_TAG
public static final String TABBED_MENU_TAG
public static final String DESKTOP_MENU_TAG
public static final String SEPARATOR_TAG
public static final String CASCADE_MENU_TAG
public static final String TILE_HORIZ_MENU_TAG
public static final String TILE_VERT_MENU_TAG
Constructor Detail |
public MultiWindow(Shop sShop, int nViewMode)
Shop's frame title
.
sShop
- the Shop for which the MultiWindow is creatednViewMode
- the initial view modeMethod Detail |
public void save(ObjectOutputStream oos) throws IOException
oos
- the stream into which to save the state.
IOException
- if an error occurs while saving.public void load(ObjectInputStream ois) throws IOException, ClassNotFoundException
ois
- the input stream to restore the state from.
IOException
- if an error occurs while reading.
ClassNotFoundException
- if an error occurs while reading.public MenuSheet getMultiWindowMenuSheet()
The MultiWindow management MenuSheet contains the following items for managing the look of the MultiWindow:
Item text | Item tag | Item action | Comments |
---|---|---|---|
Window | WINDOW_MENU_TAG |
Change to Window view. Executes WindowAction . |
All SalesPoints will have their displays converted to DisplayFrames , i.e.
all SalesPoints are shown in a separate window. |
Tabbed | TABBED_MENU_TAG |
Change to Tab view. Executes TabAction . |
All SalesPoints will have their displays converted to TabbedFrames , i.e.
the MultiFrame will contain a row of tabs each of which displays a SalesPoint. The SalesPoint's
menus will be merged with the Shop's menu.See also setSecondMenuSheet(sale.MenuSheet)
|
Desktop | DESKTOP_MENU_TAG |
Change to Desktop view. Executes DesktopAction . |
All SalesPoints will have their displays converted to DesktopFrames ,
i.e. all SalesPoints are shown in a separate window. But in contrast to Window view mode the
SalesPoints cannot moved around the whole screen but only within the borders of the MultiWindow. |
Separator | SEPARATOR_TAG |
None. | |
Cascade | CASCADE_MENU_TAG |
Cascade the Displays. Is ignored in tabbed view mode. Executes CascadeAction . |
|
Tile horizontally | TILE_HORIZ_MENU_TAG |
Tile internal frames horizontally. Is ignored in tabbed view mode.
Executes TileHorizontallyAction . |
|
Tile vertically | TILE_VERT_MENU_TAG |
Tile internal frames vertically. Is ignored in tabbed view mode.
Executes TileVerticallyAction . |
This method is used by setDefaultMenuSheet()
.
Actions
are
not implemented as anonymous inner classes as this causes problems on serialization.
See MultiWindowAction
for details.
public void setDefaultMenuSheet()
This method uses getMultiWindowMenuSheet()
to get the MenuSheet to be set. The actual setting
of the MenuSheet is performed by setMenuSheet(sale.MenuSheet)
public void setMenuSheet(MenuSheet msNewMenuSheet)
msNewMenuSheet
- the MenuSheet to be setpublic void setSecondMenuSheet(MenuSheet ms)
The position of the inserted MenuSheet is
determined from the m_sMergeBefore
variable. The MultiWindow's very MenuSheet object will
not be changed, only the MenuSheet's view is altered.
This method is used to insert SalesPoint's MenuSheets into the MultiFrame's MenuSheet when in tabbed
view mode, because tabs cannot contain menus. The actual merging is done by
MenuSheet.mergePeers(sale.MenuSheet, java.lang.String)
.
ms
- The MenuSheet to be added.setMergeBefore(java.lang.String)
protected void setMergeBefore(String sMergeBefore)
m_sMergeBefore
.
This variable contains a menu tag, in front of which a second MenuSheet will be added when executing
setSecondMenuSheet(sale.MenuSheet)
sMergeBefore
- the menu's tag in front of which a second MenuSheet should be addedpublic MenuSheet getCurrentMenuSheet()
public int getViewMode()
WINDOW_VIEW
,
TABBED_VIEW
,
DESKTOP_VIEW
public void setViewMode(int viewMode)
When setting a new view mode, all open displays are closed, the MultiWindow's content pane is prepared for the new view mode and all displays that have been closed are converted and added according to the new view mode.
WINDOW_VIEW
,
TABBED_VIEW
,
DESKTOP_VIEW
protected void prepareNewContentPane(int viewMode)
In fact, not the content pane directly is set. Instead an appropriate JComponent is added to the content pane.
View mode | Set Component |
---|---|
WINDOW_VIEW | Adds the JComponent that is returned by getFramePane() , by default an empty JPanel. |
TABBED_VIEW | Adds the JComponent that is returned by getTabbedPane() , by default a
IconTabbedPane . |
DESKTOP_VIEW | Adds the JComponent that is returned by getDesktopPane() , by default a
JDesktopPane . |
viewMode
- the view mode to be preparedprotected IconTabbedPane getTabbedPane()
createTabbedPane()
instead.protected IconTabbedPane createTabbedPane()
protected JDesktopPane getDesktopPane()
createDesktopPane()
instead.protected JDesktopPane createDesktopPane()
protected JPanel getFramePane()
createFramePane()
instead.protected JPanel createFramePane()
protected void addAllDisplays()
This method iterates over the list of active SalesPoints (see Shop.getSalesPoints()
) and calls
addSalesPointDisplay(sale.SalesPoint)
for each one.
protected void removeAllDisplays()
This method iterates over the list of active SalesPoints (see Shop.getSalesPoints()
) and calls
#removeSalesPointDisplay
for each one.
public void addSalesPointDisplay(SalesPoint sp)
Depending on the view mode set, this method calls #addSalesPoint_Window
,
#addSalesPoint_Tab
or #addSalesPoint_InternalFrame
.
sp
- the SalesPoint for which to add a Display.public void closeSalesPointDisplay(SalesPoint sp)
#removeSalesPointDisplay(SalesPoint)
does. Additionally
all displays that have been saved for this SalesPoint will be deleted.
sp
- the SalesPoint for which to close the display.public void arrangeFrames(int nArrangement)
If in window or desktop viewing mode, the frames will be rearranged. In tabbed mode nothing happens.
nArrangement
- the new ArrangementOVERLAPPED
,
TILED_HORIZONTALLY
,
TILED_VERTICALLY
public Display getNewTab(SalesPoint sp)
TabbedFame
for a SalesPoint.
sp
- the SalesPoint for which to create the display
public Display getNewInternalFrame(SalesPoint sp)
DesktopFrame
for a SalesPoint.
sp
- the SalesPoint for which to create the display
public Display getNewWindow(SalesPoint sp)
DisplayFrame
for a SalesPoint.
sp
- the SalesPoint for which to create the display
public void stateChanged(ChangeEvent evt)
ChangeListener
.
This method is invoked when Tabs in tabbed mode are changed. This is to ensure that always the
correct second MenuSheet is set
.
ATTENTION: This method is public as an implementation detail and must not be called directly!
stateChanged
in interface ChangeListener
|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |