com.isti.util.gui
Class PopPanelHost

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLayeredPane
                  extended by com.isti.util.gui.PopPanelHost
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class PopPanelHost
extends javax.swing.JLayeredPane

Class PopPanelHost manages a host panel that supports "popup"-panel functionality. The popup panel created is pseudo-modal, in that while no actual events are disabled, all of the components under the popup panel are prevented from receiving events. The popup panel is a child component of this panel, appears at its center, and is not movable. Only one popup panel may be displayed at a time. The PopPanelHost object should never have its layout manager changed or have components added directly to it--the object returned by 'getMainPanel()' should be used to hold the content and may have its layout manager changed. Support is provided for optional thread blocking while the popup is displayed, and for a component event to be generated when the popup is dismissed. The 'JOptionPane.showInternalMessageDialog()' function tries to provide the functionality of this class, but it only works in a 'JDesktopPane' object using a null layout manager.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
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
PopPanelHost()
          Creates a 'PopPanelHost' object.
PopPanelHost(boolean doubleBuffFlag)
          Creates a 'PopPanelHost' object.
 
Method Summary
 java.awt.Cursor getButtonCursor()
          Returns the last value sent to 'setButtonCursor()', or null if that function was never called.
 javax.swing.JPanel getMainPanel()
          Returns main content panel.
 boolean getPopButtonPressedFlag()
          Determines if the button on the displayed PopPanel was pressed (resulting in the PopPanel being closed).
 javax.swing.JPanel getPopupHostPanel()
          Returns popup host panel.
 boolean isPopupShowing()
          Returns true if a popup panel is currently showing.
 void removePopupPanel()
          Removes the currently displayed popup panel.
 void removePopupPanel(boolean removeNowFlag)
          Removes the currently displayed popup panel.
 void setButtonCursor(java.awt.Cursor buttonCursor)
          Sets the cursor to be used with buttons on the popup panel.
 void setLayout(java.awt.LayoutManager mgr)
          Override of 'setLayout()' method that throws a runtime exception if an attempt is made to change the layout on a 'PopPanelHost' object.
 void showPopupPanel(javax.swing.JPanel panel)
          Displays the given panel as a popup.
 void showPopupPanel(javax.swing.JPanel panel, boolean waitFlag, java.awt.event.ComponentListener cListener)
          Displays a generic popup panel with the given title and message.
 void showPopupPanel(java.lang.String message, java.lang.String title)
          Displays a popup panel with an "OK" button and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, boolean waitFlag)
          Displays a popup panel with an "OK" button.
 void showPopupPanel(java.lang.String message, java.lang.String title, boolean waitFlag, java.lang.String buttonText)
          Displays a popup panel.
 void showPopupPanel(java.lang.String message, java.lang.String title, java.awt.event.ComponentListener cListener)
          Displays a popup panel with an "OK" button and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth)
          Displays a popup panel with an "OK" button and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth, boolean waitFlag)
          Displays a popup panel with an "OK" button.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth, boolean waitFlag, java.lang.String buttonText)
          Displays a popup panel.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth, boolean waitFlag, java.lang.String buttonText, java.awt.event.ComponentListener cListener)
          Displays a generic popup panel with the given title and message.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth, java.awt.event.ComponentListener cListener)
          Displays a popup panel with an "OK" button and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, int popupCharWidth, java.lang.String buttonText, java.awt.event.ComponentListener cListener)
          Displays a popup panel and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, java.lang.String buttonText)
          Displays a popup panel and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, java.lang.String buttonText, java.awt.event.ComponentListener cListener)
          Displays a popup panel and returns immediately.
 void showPopupPanel(java.lang.String message, java.lang.String title, java.lang.String buttonText, int popupCharWidth)
          Displays a popup panel and returns immediately.
 
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
 
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, getBaseline, getBaselineResizeBehavior, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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
 

Constructor Detail

PopPanelHost

public PopPanelHost()
Creates a 'PopPanelHost' object.


PopPanelHost

public PopPanelHost(boolean doubleBuffFlag)
Creates a 'PopPanelHost' object.

Parameters:
doubleBuffFlag - if true then double-buffering is used.
Method Detail

getMainPanel

public javax.swing.JPanel getMainPanel()
Returns main content panel. User components should added to this panel.

Returns:
A handle to a JPanel object.

getPopupHostPanel

public javax.swing.JPanel getPopupHostPanel()
Returns popup host panel. Access to this panel is usually not necessary.

Returns:
A handle to a JPanel object.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title)
Displays a popup panel with an "OK" button and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth)
Displays a popup panel with an "OK" button and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           boolean waitFlag)
Displays a popup panel with an "OK" button.

Parameters:
message - message text for the panel.
title - title text for the panel.
waitFlag - if true then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth,
                           boolean waitFlag)
Displays a popup panel with an "OK" button.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
waitFlag - if true then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           java.awt.event.ComponentListener cListener)
Displays a popup panel with an "OK" button and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth,
                           java.awt.event.ComponentListener cListener)
Displays a popup panel with an "OK" button and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           java.lang.String buttonText)
Displays a popup panel and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           java.lang.String buttonText,
                           int popupCharWidth)
Displays a popup panel and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           boolean waitFlag,
                           java.lang.String buttonText)
Displays a popup panel.

Parameters:
message - message text for the panel.
title - title text for the panel.
waitFlag - if true then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth,
                           boolean waitFlag,
                           java.lang.String buttonText)
Displays a popup panel.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
waitFlag - if true then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           java.lang.String buttonText,
                           java.awt.event.ComponentListener cListener)
Displays a popup panel and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth,
                           java.lang.String buttonText,
                           java.awt.event.ComponentListener cListener)
Displays a popup panel and returns immediately.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

showPopupPanel

public void showPopupPanel(java.lang.String message,
                           java.lang.String title,
                           int popupCharWidth,
                           boolean waitFlag,
                           java.lang.String buttonText,
                           java.awt.event.ComponentListener cListener)
Displays a generic popup panel with the given title and message.

Parameters:
message - message text for the panel.
title - title text for the panel.
popupCharWidth - approximate width for the panel, measured in characters; or zero for an automatically generated character width.
waitFlag - if true then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.
buttonText - if not null then a string containing the text for the button; if null then no button is displayed.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

showPopupPanel

public void showPopupPanel(javax.swing.JPanel panel)
Displays the given panel as a popup. The given panel must have its own means of clearing itself, such as making itself hidden after an 'OK' button is pressed. A 'ComponentListener' is added to the given panel, which restores access to the main panel after the 'componentHidden()' method is called.

Parameters:
panel - the panel to display as a popup panel.

showPopupPanel

public void showPopupPanel(javax.swing.JPanel panel,
                           boolean waitFlag,
                           java.awt.event.ComponentListener cListener)
Displays a generic popup panel with the given title and message.

Parameters:
panel - the panel to display as a popup panel.
waitFlag - if true and the panel is a 'PopPanel' then the calling thread is blocked until the popup panel is dismissed; if false then this function returns immediately.
cListener - a 'ComponentListener' object that is attached to the popup panel such that its 'componentHidden()' method will be called after the popup is dismissed.

removePopupPanel

public void removePopupPanel()
Removes the currently displayed popup panel.


removePopupPanel

public void removePopupPanel(boolean removeNowFlag)
Removes the currently displayed popup panel.

Parameters:
removeNowFlag - if true then the actual work of removing the popup panel is performed immediately; otherwise it happens via the component-hidden event.

setButtonCursor

public void setButtonCursor(java.awt.Cursor buttonCursor)
Sets the cursor to be used with buttons on the popup panel.

Parameters:
buttonCursor - button cursor

getButtonCursor

public java.awt.Cursor getButtonCursor()
Returns the last value sent to 'setButtonCursor()', or null if that function was never called.

Returns:
the button cursor

isPopupShowing

public boolean isPopupShowing()
Returns true if a popup panel is currently showing.

Returns:
true if a popup panel is currently showing.

getPopButtonPressedFlag

public boolean getPopButtonPressedFlag()
Determines if the button on the displayed PopPanel was pressed (resulting in the PopPanel being closed).

Returns:
true if the button on the displayed PopPanel was pressed; false if not.

setLayout

public void setLayout(java.awt.LayoutManager mgr)
Override of 'setLayout()' method that throws a runtime exception if an attempt is made to change the layout on a 'PopPanelHost' object.

Overrides:
setLayout in class java.awt.Container
Parameters:
mgr - layout manager