qflib 0.98.0

de.qfs.lib.gui
Class MultiPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--de.qfs.lib.gui.MultiPane
All Implemented Interfaces:
javax.accessibility.Accessible, Configurable, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class MultiPane
extends javax.swing.JPanel
implements Configurable, java.beans.PropertyChangeListener

A MultiPane is very similar to a JSplitPane and is implemented with the help of one.

It adds to the JSplitPane API methods for displaying either one of the two components or both.

MultiPane implements the Configurable interface. The state saved is the location of the JSplitPane divider and the showing state, i.e. whether one or both of the components are shown.

Version:
$Revision: 1.12 $
Author:
Gregor Schmid
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int HORIZONTAL
          Use a horizontal layout for the components.
static int SHOW_BOTH
          Indicates that both components are shown.
static int SHOW_FIRST
          Indicates that only the first component is shown.
static int SHOW_SECOND
          Indicates that only the second component is shown.
static int VERTICAL
          Use a vertical layout for the components.
 
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
MultiPane(int orientation)
          Create a new MultiPane with a name of "MultiPane", a default divider location of 0.5 and a default showing state of SHOW_BOTH.
MultiPane(int orientation, java.awt.Component firstComponent, java.awt.Component secondComponent)
          Create a new MultiPane with a name of "MultiPane", a default divider location of 0.5 and a default showing state of SHOW_BOTH.
MultiPane(java.lang.String name, int orientation, java.awt.Component firstComponent, java.awt.Component secondComponent, double divider, int show)
          Create a new MultiPane.
MultiPane(java.lang.String name, int orientation, java.awt.Component firstComponent, java.awt.Component secondComponent, int divider, int show)
          Create a new MultiPane.
 
Method Summary
 void addMultiPaneListener(MultiPaneListener listener)
          Add a MultiPaneListener to the MultiPane.
 java.lang.String getConfigurableName()
          Get the receiver's configuration name.
 java.util.Properties getConfigurableState()
          Get the Configurable's state.
 java.awt.Component getFirstComponent()
          Get the top/left component of the MultiPane.
 java.awt.Component getSecondComponent()
          Get the bottom/right component of the MultiPane.
 int getShowing()
          Get the current showing state of the MultiPane, one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.
 javax.swing.JSplitPane getSplitPane()
          Get the JSplitPane used internally by the MultiPane.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Notify the MultiPane of a change in the JSplitPane.
 void registrationChanged(Configuration config, java.lang.String name, boolean registered, boolean valuesKept)
          This callback is used to notify the Configurable whenever it is registered with or unregistered from the Configuration, so it can decide whether to notify the Configuration when its state changes.
 void removeMultiPaneListener(MultiPaneListener listener)
          Remove a MultiPaneListener from the MultiPane.
 void setConfigurableName(java.lang.String name)
          Set the receiver's configuration name.
 void setConfigurableState(java.util.Properties state)
          Set the Configurable's state.
 void setFirstComponent(java.awt.Component first)
          Set the top/left component of the MultiPane.
 void setSecondComponent(java.awt.Component second)
          Set the bottom/right component of the MultiPane.
 void setShowing(int show)
          Set which component(s) to display.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, 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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHOW_BOTH

public static final int SHOW_BOTH
Indicates that both components are shown.

SHOW_FIRST

public static final int SHOW_FIRST
Indicates that only the first component is shown.

SHOW_SECOND

public static final int SHOW_SECOND
Indicates that only the second component is shown.

HORIZONTAL

public static final int HORIZONTAL
Use a horizontal layout for the components.

VERTICAL

public static final int VERTICAL
Use a vertical layout for the components.
Constructor Detail

MultiPane

public MultiPane(int orientation)
Create a new MultiPane with a name of "MultiPane", a default divider location of 0.5 and a default showing state of SHOW_BOTH.
Parameters:
orientation - The orientation, one of HORIZONTAL or VERTICAL
Throws:
java.lang.IllegalArgumentException - If the show parameter is not one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.

MultiPane

public MultiPane(int orientation,
                 java.awt.Component firstComponent,
                 java.awt.Component secondComponent)
Create a new MultiPane with a name of "MultiPane", a default divider location of 0.5 and a default showing state of SHOW_BOTH.
Parameters:
orientation - The orientation, one of HORIZONTAL or VERTICAL
firstComponent - The top/left Component.
secondComponent - The bottom/right Component.
Throws:
java.lang.IllegalArgumentException - If the show parameter is not one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.

MultiPane

public MultiPane(java.lang.String name,
                 int orientation,
                 java.awt.Component firstComponent,
                 java.awt.Component secondComponent,
                 int divider,
                 int show)
          throws java.lang.IllegalArgumentException
Create a new MultiPane.
Parameters:
name - The Configurable name.
orientation - The orientation, one of HORIZONTAL or VERTICAL
firstComponent - The top/left Component.
secondComponent - The bottom/right Component.
divider - The default divider location.
show - The initial display as in setShowing.
Throws:
java.lang.IllegalArgumentException - If the show parameter is not one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.

MultiPane

public MultiPane(java.lang.String name,
                 int orientation,
                 java.awt.Component firstComponent,
                 java.awt.Component secondComponent,
                 double divider,
                 int show)
          throws java.lang.IllegalArgumentException
Create a new MultiPane.
Parameters:
name - The Configurable name.
orientation - The orientation, one of HORIZONTAL or VERTICAL
firstComponent - The top/left Component.
secondComponent - The bottom/right Component.
divider - The default divider location.
show - The initial display as in setShowing.
Throws:
java.lang.IllegalArgumentException - If the show parameter is not one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.
Method Detail

getSplitPane

public javax.swing.JSplitPane getSplitPane()
Get the JSplitPane used internally by the MultiPane.
Returns:
The internal JSplitPane.

getShowing

public final int getShowing()
Get the current showing state of the MultiPane, one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.
Returns:
The current showing state.

setShowing

public void setShowing(int show)
                throws java.lang.IllegalArgumentException
Set which component(s) to display. Must be one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.
Parameters:
show - The new showing state.
Throws:
java.lang.IllegalArgumentException - If the show parameter is not one of SHOW_BOTH, SHOW_FIRST or SHOW_SECOND.

getFirstComponent

public final java.awt.Component getFirstComponent()
Get the top/left component of the MultiPane.
Returns:
The top/left component.

setFirstComponent

public final void setFirstComponent(java.awt.Component first)
Set the top/left component of the MultiPane.
Parameters:
first - The new top/left component.

getSecondComponent

public final java.awt.Component getSecondComponent()
Get the bottom/right component of the MultiPane.
Returns:
The bottom/right component.

setSecondComponent

public final void setSecondComponent(java.awt.Component second)
Set the bottom/right component of the MultiPane.
Parameters:
second - The new bottom/right component.

addMultiPaneListener

public void addMultiPaneListener(MultiPaneListener listener)
Add a MultiPaneListener to the MultiPane.
Parameters:
listener - The MultiPaneListener to add.

removeMultiPaneListener

public void removeMultiPaneListener(MultiPaneListener listener)
Remove a MultiPaneListener from the MultiPane.
Parameters:
listener - The MultiPaneListener to remove.

getConfigurableName

public final java.lang.String getConfigurableName()
Get the receiver's configuration name.
Specified by:
getConfigurableName in interface Configurable
Returns:
The receiver's configuration name.

setConfigurableName

public final void setConfigurableName(java.lang.String name)
Set the receiver's configuration name.
Specified by:
setConfigurableName in interface Configurable
Parameters:
name - The name to set.

getConfigurableState

public java.util.Properties getConfigurableState()
Get the Configurable's state. It is composed of the location of the JSplitPane divider and the showing state.
Specified by:
getConfigurableState in interface Configurable
Returns:
The state of the MultiPane.

setConfigurableState

public void setConfigurableState(java.util.Properties state)
Set the Configurable's state.
Specified by:
setConfigurableState in interface Configurable
Following copied from interface: de.qfs.lib.config.Configurable
Parameters:
state - The state to set.

registrationChanged

public void registrationChanged(Configuration config,
                                java.lang.String name,
                                boolean registered,
                                boolean valuesKept)
This callback is used to notify the Configurable whenever it is registered with or unregistered from the Configuration, so it can decide whether to notify the Configuration when its state changes.
Specified by:
registrationChanged in interface Configurable
Parameters:
config - The affected Configuration.
name - The registration name of the Configurable which may be different from the Configurable's name.
registered - True if the Configurable was just registered, false if it was unregistered.
valuesKept - Whether the Configurable's values were kept, if it was just unregistered.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Notify the MultiPane of a change in the JSplitPane.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
e - The event containing the details of the change.

qflib 0.98.0