org.openswing.swing.mdi.client
Class MDIFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byorg.openswing.swing.mdi.client.MDIFrame
All Implemented Interfaces:
javax.accessibility.Accessible, BusyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class MDIFrame
extends javax.swing.JFrame
implements BusyListener

Title: OpenSwing Framework

Description: MDI Frame.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
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
MDIFrame(MDIController client)
          Contructor.
 
Method Summary
static void add(InternalFrame frame)
          Add an internal frame to the desktop pane and make it visible.
static void add(InternalFrame frame, boolean maximum)
          Add an internal frame to the desktop pane and make it visible and maximazed.
 javax.swing.JButton addButtonToToolBar(java.awt.Image image, java.lang.String tooltipText)
          Add a button to the toolbar (and show toolbar if not already done).
 javax.swing.JButton addButtonToToolBar(java.awt.Image image, java.lang.String tooltipText, java.lang.String buttonText)
          Add a button to the toolbar (and show toolbar if not already done).
 void addButtonToToolBar(javax.swing.JButton button)
          Add a button to the toolbar (and show toolbar if not already done).
 javax.swing.JButton addButtonToToolBar(java.lang.String imageName, java.lang.String tooltipText)
          Add a button to the toolbar (and show toolbar if not already done).
 javax.swing.JButton addButtonToToolBar(java.lang.String imageName, java.lang.String tooltipText, java.lang.String buttonText)
          Add a button to the toolbar (and show toolbar if not already done).
 void addSeparatorOnToolBar(java.awt.Dimension dim)
          Appends a separator of a specified size to the end of the tool bar.
 void addSeparatorToMenuBar(java.lang.String topFunctionId, java.lang.String bottomFunctionId)
          Add a separator between the top menu item identifier and bottom menu item identifier, ONLY IF they are both visible.
 void addSeparatorToToolBar()
          Appends a separator of default size to the end of the tool bar.
static void addStatusComponent(javax.swing.JComponent c)
          Add a new component to the status bar, from left to right.
static void addStatusComponent(java.lang.String name, javax.swing.JComponent c)
          Add a new component to the status bar, from left to right and identify it with the specified component name.
static ClientFacade getClientFacade()
           
static java.awt.Dimension getDesktopDimension()
           
static MDIFrame getInstance()
           
 javax.swing.JMenu getMenuFile()
           
 javax.swing.JMenu getMenuHelp()
           
 javax.swing.JMenuItem getMenuItem(java.lang.String functionId)
           
 int getProgressBarValue()
           
static InternalFrame getSelectedFrame()
           
static StatusBar getStatusBar()
           
static javax.swing.JComponent getStatusComponent(java.lang.String name)
           
static WindowMenu getWindowMenu()
           
 boolean isLocked()
           
 boolean isUniqueInstanceAlreadyOpened(InternalFrame frame)
           
 void menuFileChangeLanguage_actionPerformed(java.awt.event.ActionEvent e)
           
 void menuFileChangeUser_actionPerformed(java.awt.event.ActionEvent e)
           
 void menuFileExit_actionPerformed(java.awt.event.ActionEvent e)
           
 void menuHelpAbout_actionPerformed(java.awt.event.ActionEvent e)
           
 void setBorderPainterOnToolBar(boolean borderPainted)
          Sets the borderPainted property, which is true if the border should be painted.
 void setBusy(boolean busy)
          Start the progress bar.
 void setFloatableOnToolBar(boolean floatable)
          Sets the floatable property, which must be true for the user to move the tool bar.
 void setLocked(boolean locked)
           
 void setOrientationOnToolBar(int orientation)
          Sets the orientation of the tool bar.
 void setProgressBarValue(int progressBarValue)
          Set progress bar value.
 void setRolloverOnToolBar(boolean rollover)
          Sets the rollover state of this toolbar.
static void setStatusBar(java.lang.String text)
          Set status bar message.
 void windowClosed(javax.swing.JInternalFrame frame)
          Callback invoked by WindowMenu when closing an internal frame.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, 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.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

MDIFrame

public MDIFrame(MDIController client)
Contructor.

Parameters:
client - interface used to manage some MDI Frame settings
Method Detail

isLocked

public final boolean isLocked()
Returns:
true if menu window is locked false otherwise

setLocked

public final void setLocked(boolean locked)
Parameters:
locked - true if menu window is locked false otherwise

menuFileExit_actionPerformed

public void menuFileExit_actionPerformed(java.awt.event.ActionEvent e)

menuFileChangeUser_actionPerformed

public void menuFileChangeUser_actionPerformed(java.awt.event.ActionEvent e)

menuFileChangeLanguage_actionPerformed

public void menuFileChangeLanguage_actionPerformed(java.awt.event.ActionEvent e)

menuHelpAbout_actionPerformed

public void menuHelpAbout_actionPerformed(java.awt.event.ActionEvent e)

add

public static final void add(InternalFrame frame)
Add an internal frame to the desktop pane and make it visible.

Parameters:
frame - internal frame

add

public static final void add(InternalFrame frame,
                             boolean maximum)
Add an internal frame to the desktop pane and make it visible and maximazed.

Parameters:
frame - internal frame

getWindowMenu

public static WindowMenu getWindowMenu()
Returns:
window menu

getDesktopDimension

public static java.awt.Dimension getDesktopDimension()
Returns:
desktop pane dimension

setBusy

public final void setBusy(boolean busy)
Start the progress bar.

Specified by:
setBusy in interface BusyListener
Parameters:
busy - true to start progress bar, false to stop it

windowClosed

public final void windowClosed(javax.swing.JInternalFrame frame)
Callback invoked by WindowMenu when closing an internal frame.


setProgressBarValue

public final void setProgressBarValue(int progressBarValue)
Set progress bar value. Minimum value is 0 and maximum value is 15.

Parameters:
progressBarValue - value to set for the progress bar; if specified value is less than 0 then 0 is setted; if specified value is greater than 15 then it is set to 15.

getProgressBarValue

public final int getProgressBarValue()
Returns:
current value in progress bar; minimum value is 0 and maximum value is 15

getInstance

public static MDIFrame getInstance()
Returns:
this

getClientFacade

public static ClientFacade getClientFacade()
Returns:
client facade

getSelectedFrame

public static InternalFrame getSelectedFrame()
Returns:
internal frame currently selected

setStatusBar

public static final void setStatusBar(java.lang.String text)
Set status bar message.

Parameters:
text - message to view into the status bar

getStatusBar

public static final StatusBar getStatusBar()
Returns:
StatusBar object

addStatusComponent

public static final void addStatusComponent(javax.swing.JComponent c)
Add a new component to the status bar, from left to right. The component just added can be identitied by its "name" property (if specified).

Parameters:
c - component to add

addStatusComponent

public static final void addStatusComponent(java.lang.String name,
                                            javax.swing.JComponent c)
Add a new component to the status bar, from left to right and identify it with the specified component name.

Parameters:
name - component name, used to identify it
c - component to add

getStatusComponent

public static final javax.swing.JComponent getStatusComponent(java.lang.String name)
Parameters:
name - component name, used to identify it
Returns:
component identified by its name

getMenuHelp

public final javax.swing.JMenu getMenuHelp()
Returns:
JMenu object related to "Help" menu in the menu bar. This hook can be used to add other menu items to "Help" menu; new menu items can be added within MDIFrameController.afterMDIcreation() method

getMenuFile

public final javax.swing.JMenu getMenuFile()
Returns:
JMenu object related to "File" menu in the menu bar. This hook can be used to add other menu items to "File" menu; new menu items can be added within MDIFrameController.afterMDIcreation() method

getMenuItem

public final javax.swing.JMenuItem getMenuItem(java.lang.String functionId)
Parameters:
functionId - menu item identifier
Returns:
JMenuItem object, related to the specified functionId; null if there is not any JMenuItem having the specified functionId

addSeparatorToMenuBar

public final void addSeparatorToMenuBar(java.lang.String topFunctionId,
                                        java.lang.String bottomFunctionId)
Add a separator between the top menu item identifier and bottom menu item identifier, ONLY IF they are both visible.

Parameters:
topFunctionId - menu item identifier that is before the separator to add
bottomFunctionId - menu item identifier that is after the separator to add

addButtonToToolBar

public final void addButtonToToolBar(javax.swing.JButton button)
Add a button to the toolbar (and show toolbar if not already done).

Parameters:
button - button to add to the toolbar

addButtonToToolBar

public final javax.swing.JButton addButtonToToolBar(java.lang.String imageName,
                                                    java.lang.String tooltipText)
Add a button to the toolbar (and show toolbar if not already done).

Parameters:
imageName - name of the image to show within the button
tooltipText - tooltip text (it will be translated according to internationalization settings)
Returns:
button just created

addButtonToToolBar

public final javax.swing.JButton addButtonToToolBar(java.awt.Image image,
                                                    java.lang.String tooltipText)
Add a button to the toolbar (and show toolbar if not already done).

Parameters:
image - image to show within the button
tooltipText - tooltip text (it will be translated according to internationalization settings)
Returns:
button just created

addButtonToToolBar

public final javax.swing.JButton addButtonToToolBar(java.lang.String imageName,
                                                    java.lang.String tooltipText,
                                                    java.lang.String buttonText)
Add a button to the toolbar (and show toolbar if not already done).

Parameters:
imageName - name of the image to show within the button
tooltipText - tooltip text (it will be translated according to internationalization settings)
buttonText - button text to show within the button (it will be translated according to internationalization settings)
Returns:
button just created

addButtonToToolBar

public final javax.swing.JButton addButtonToToolBar(java.awt.Image image,
                                                    java.lang.String tooltipText,
                                                    java.lang.String buttonText)
Add a button to the toolbar (and show toolbar if not already done).

Parameters:
image - image to show within the button
tooltipText - tooltip text (it will be translated according to internationalization settings)
buttonText - button text to show within the button (it will be translated according to internationalization settings)
Returns:
button just created

addSeparatorToToolBar

public final void addSeparatorToToolBar()
Appends a separator of default size to the end of the tool bar. The default size is determined by the current look and feel.


addSeparatorOnToolBar

public final void addSeparatorOnToolBar(java.awt.Dimension dim)
Appends a separator of a specified size to the end of the tool bar.


setBorderPainterOnToolBar

public final void setBorderPainterOnToolBar(boolean borderPainted)
Sets the borderPainted property, which is true if the border should be painted. The default value for this property is true. Some look and feels might not implement painted borders; they will ignore this property.

See Also:
#isBorderPainted

setFloatableOnToolBar

public final void setFloatableOnToolBar(boolean floatable)
Sets the floatable property, which must be true for the user to move the tool bar. Typically, a floatable tool bar can be dragged into a different position within the same container or out into its own window. The default value of this property is true. Some look and feels might not implement floatable tool bars; they will ignore this property.

See Also:
#isFloatable

setOrientationOnToolBar

public final void setOrientationOnToolBar(int orientation)
Sets the orientation of the tool bar. The orientation must have either the value HORIZONTAL or VERTICAL. If orientation is an invalid value, an exception will be thrown.

Throws:
java.lang.IllegalArgumentException - if orientation is neither HORIZONTAL nor VERTICAL
See Also:
#getOrientation

setRolloverOnToolBar

public final void setRolloverOnToolBar(boolean rollover)
Sets the rollover state of this toolbar. If the rollover state is true then the border of the toolbar buttons will be drawn only when the mouse pointer hovers over them. The default value of this property is false.

The implementation of a look and feel may choose to ignore this property.

Parameters:
rollover - true for rollover toolbar buttons; otherwise false
Since:
1.4

isUniqueInstanceAlreadyOpened

public final boolean isUniqueInstanceAlreadyOpened(InternalFrame frame)
Returns:
true if the specified instance of internal frame is already opened, false otherwise