org.openswing.swing.mdi.client
Class InternalFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JInternalFrame
                  extended byorg.openswing.swing.mdi.client.InternalFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
Direct Known Subclasses:
TipInternalFrame

public class InternalFrame
extends javax.swing.JInternalFrame

Title: OpenSwing Framework

Description: Base Internal Frame: to use together with MDI Frame. You can set this internal frame as modal, by means of setModal() method BUT ONLY AFTER invoking MDIFrame.add() method, i.e. after internal frame is already visible.

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

Nested Class Summary
 
Nested classes inherited from class javax.swing.JInternalFrame
javax.swing.JInternalFrame.JDesktopIcon
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JInternalFrame
CONTENT_PANE_PROPERTY, FRAME_ICON_PROPERTY, GLASS_PANE_PROPERTY, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY, LAYERED_PANE_PROPERTY, MENU_BAR_PROPERTY, ROOT_PANE_PROPERTY, TITLE_PROPERTY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
InternalFrame()
          Costructor.
 
Method Summary
 java.util.ArrayList checkComponents()
           
 void closeFrame()
          This method is called when this window will be closed.
 javax.swing.JInternalFrame getOwner()
           
 boolean isAskBeforeClose()
           
 boolean isHideTitleBar()
          Define if title bar must be hidden or showed
 boolean isModal()
           
 boolean isUniqueInstance()
           
 InternalFrame popFrame(InternalFrame frame)
          Remove a child window from this.
 void pushFrame(InternalFrame frame)
          Add a child window to this.
 boolean saveChanges()
          Callback method invoked by "closeFrame" when internal frame contains changes and the user selects "yes" option on dialog about saving changes: If this method is not ovverrided, then "closeFrame" will attempt to automatically save each changed objects (Form, Grid, TreePanel) and this automation could be incorrect, in case of multiple objects to save in a specific order, if this is the case, then "saveChanges" method should be overrided, in order to specify a custom saving strategy.
 void setAskBeforeClose(boolean askBeforeClose)
          Used when this window will be closed: if this flag is set to true then a warning dialog will be showed before close the window to ask if it must be close
 void setHideTitleBar(boolean hideTitleBar)
          Define if title bar must be hidden or showed
 void setIconifiable(boolean iconifiable)
          Iconify this internal frame.
 void setModal(boolean modal)
          Define this internal frame as modal.
 void setOwner(javax.swing.JInternalFrame owner)
          Set the internal frame owner; used in case of modal internal frame.
 void setParentFrame(InternalFrame parentFrame)
          Create a link between this window and the parent window.
 void setUniqueInstance(boolean uniqueInstance)
          Define whether this window can be opened more times or only one instance can be created per time.
 void startModal()
           
 void stopModal()
           
 
Methods inherited from class javax.swing.JInternalFrame
addInternalFrameListener, dispose, doDefaultCloseAction, getAccessibleContext, getContentPane, getDefaultCloseOperation, getDesktopIcon, getDesktopPane, getFocusCycleRootAncestor, getFocusOwner, getFrameIcon, getGlassPane, getInternalFrameListeners, getJMenuBar, getLayer, getLayeredPane, getMenuBar, getMostRecentFocusOwner, getNormalBounds, getRootPane, getTitle, getUI, getUIClassID, getWarningString, hide, isClosable, isClosed, isFocusCycleRoot, isIcon, isIconifiable, isMaximizable, isMaximum, isResizable, isSelected, moveToBack, moveToFront, pack, remove, removeInternalFrameListener, reshape, restoreSubcomponentFocus, setClosable, setClosed, setContentPane, setDefaultCloseOperation, setDesktopIcon, setFocusCycleRoot, setFrameIcon, setGlassPane, setIcon, setJMenuBar, setLayer, setLayer, setLayeredPane, setLayout, setMaximizable, setMaximum, setMenuBar, setNormalBounds, setResizable, setSelected, setTitle, setUI, show, toBack, toFront, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InternalFrame

public InternalFrame()
Costructor.

Method Detail

setParentFrame

public final void setParentFrame(InternalFrame parentFrame)
Create a link between this window and the parent window.


checkComponents

public final java.util.ArrayList checkComponents()
Returns:
list of TreePanel/GridControl/Form objects within this that is in insert/edit mode and that contain changes, an empty list otherwise

saveChanges

public boolean saveChanges()
Callback method invoked by "closeFrame" when internal frame contains changes and the user selects "yes" option on dialog about saving changes: If this method is not ovverrided, then "closeFrame" will attempt to automatically save each changed objects (Form, Grid, TreePanel) and this automation could be incorrect, in case of multiple objects to save in a specific order, if this is the case, then "saveChanges" method should be overrided, in order to specify a custom saving strategy.

Returns:
true if changes has been correctly saved, false otherwise, i.e. some error occours on saving data, so frame must NOT be closed; as default dehavior it throws an exception: UnsupportedOperationException, i.e. closeFrame method automatically attempts to save changes

closeFrame

public final void closeFrame()
                      throws java.beans.PropertyVetoException
This method is called when this window will be closed. The first method calle is beforeCloseFrame; if this will return false then the closing window operation will be interrupted.

Throws:
java.beans.PropertyVetoException

popFrame

public final InternalFrame popFrame(InternalFrame frame)
Remove a child window from this. It's called by closeFrame.

Parameters:
frame - child window to remove

pushFrame

public final void pushFrame(InternalFrame frame)
Add a child window to this.

Parameters:
frame - child window to add

isAskBeforeClose

public final boolean isAskBeforeClose()
Returns:
used when this window will be closed: if this flag is set to true then a warning dialog will be showed before close the window to ask if it must be close

setAskBeforeClose

public final void setAskBeforeClose(boolean askBeforeClose)
Used when this window will be closed: if this flag is set to true then a warning dialog will be showed before close the window to ask if it must be close

Parameters:
askBeforeClose - true to show a warning dialog before close the window to ask if it must be close

isHideTitleBar

public final boolean isHideTitleBar()
Define if title bar must be hidden or showed


setHideTitleBar

public final void setHideTitleBar(boolean hideTitleBar)
Define if title bar must be hidden or showed

Parameters:
hideTitleBar - flag used to hide/show title bar; true to hide title bar; false to show it

getOwner

public final javax.swing.JInternalFrame getOwner()
Returns:
internal frame owner; used in case of modal internal frame

setOwner

public final void setOwner(javax.swing.JInternalFrame owner)
Set the internal frame owner; used in case of modal internal frame.

Parameters:
owner - internal frame owner

setModal

public final void setModal(boolean modal)
Define this internal frame as modal. IMPORTANT NOTE: do not call this method before showing this frame, but only AFTER MDIFrame.add() invokation.

Parameters:
modal - true to set this internal frame as modal, false otherwise

isModal

public final boolean isModal()
Returns:
true whether this internal frame as modal, false otherwise

setIconifiable

public final void setIconifiable(boolean iconifiable)
Iconify this internal frame. Please do not call this method for modal internal frames!

Parameters:
iconifiable - true to iconify internal frame

startModal

public void startModal()

stopModal

public void stopModal()

isUniqueInstance

public final boolean isUniqueInstance()
Returns:
used to define whether this window can be opened more times or only one instance can be created per time

setUniqueInstance

public final void setUniqueInstance(boolean uniqueInstance)
Define whether this window can be opened more times or only one instance can be created per time. Default value: false, i.e. any number of instances of this window can be created.

Parameters:
uniqueInstance - true only one instance of this window will be opened per time, false otherwise