dsto.dfc.swing.forms
Class PopupFormEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by dsto.dfc.swing.forms.AbstractFormEditorComponent
                  extended by dsto.dfc.swing.forms.PopupFormEditor
All Implemented Interfaces:
FormEditor, ImageObserver, MenuContainer, Customizer, Serializable

public class PopupFormEditor
extends AbstractFormEditorComponent

Wrapper editor into which can be plugged an 'inline' editor which is displayed to the left of a '...' button, which shows a secondary 'popup' editor in a form dialog. To use in visual designer, drop inline and popup editors outside of panel, then set inlineEditor and popupEditor properties.

Version:
$Revision$
Author:
Matthew
See Also:
AbstractPopupEditor, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  dsto.dfc.swing.forms.PopupFormEditor.PopupDialog activeDialog
           
static int ALIGN_CENTER_CLIENT
           
static int ALIGN_CENTER_SCREEN
           
static int ALIGN_NONE
           
protected  int dialogAlignment
           
static int EXPAND_BOTH
           
static int EXPAND_HORIZONTAL
           
static int EXPAND_NONE
           
static int EXPAND_VERTICAL
           
protected  int expandInlineEditor
           
protected  FormEditor inlineEditor
           
protected  dsto.dfc.swing.forms.PopupFormEditor.Listener listener
           
protected  JButton popupButton
           
protected  FormEditor popupEditor
           
protected  boolean popupInScrollPane
           
protected  boolean popupModal
           
 
Fields inherited from class dsto.dfc.swing.forms.AbstractFormEditorComponent
description
 
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
PopupFormEditor()
           
PopupFormEditor(FormEditor inlineEditor, FormEditor popupEditor)
           
 
Method Summary
 void commitEdits()
          Default implementation does nothing.
protected  JScrollPane createScrollPane(Component popupComponent)
          Create a scroll pane to wrap the popup editor.
 int getDialogAlignment()
           
 Object getEditorValue()
          Get the current value from the form editor.
 int getExpandInlineEditor()
           
 FormEditor getInlineEditor()
           
 JButton getPopupButton()
          The "..." button that shows the popup editor.
 FormEditor getPopupEditor()
           
 boolean isDirectEdit()
          True if the editor directly edits the value passed in with setValue ().
 boolean isPopupInScrollPane()
           
 boolean isPopupModal()
           
 void requestFocus()
           
 void setDialogAlignment(int newValue)
          Set the alignment for the dialog containing the popup editor.
 void setEditorDescription(String newValue)
           
 void setEditorValue(Object value)
          Sets the value to be displayed/edited by the form editor.
 void setEnabled(boolean enabled)
          Sets the inline editor and the popup editor to be enabled or disabled.
 void setExpandInlineEditor(int mode)
          Set how the inlineEditor will be sized when extra space is available.
 void setFont(Font font)
           
 void setInlineEditor(FormEditor newValue)
           
 void setPopupEditor(FormEditor newValue)
           
 void setPopupInScrollPane(boolean newValue)
          If true, popup editor will be placed into a scroll pane when shown.
 void setPopupModal(boolean newValue)
          If true, popup editor will be in a modal dialog (the default).
 void showPopup()
          Show the popup editor.
 void updateUI()
           
 
Methods inherited from class dsto.dfc.swing.forms.AbstractFormEditorComponent
addFormEditorListener, fireEditComitted, fireEditCommitRequested, fireEditCommitted, getEditorComponent, getEditorDescription, getPreferredValueType, removeFormEditorListener, setObject
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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
 
Methods inherited from interface java.beans.Customizer
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

EXPAND_NONE

public static final int EXPAND_NONE
See Also:
Constant Field Values

EXPAND_HORIZONTAL

public static final int EXPAND_HORIZONTAL
See Also:
Constant Field Values

EXPAND_VERTICAL

public static final int EXPAND_VERTICAL
See Also:
Constant Field Values

EXPAND_BOTH

public static final int EXPAND_BOTH
See Also:
Constant Field Values

ALIGN_CENTER_CLIENT

public static final int ALIGN_CENTER_CLIENT
See Also:
Constant Field Values

ALIGN_CENTER_SCREEN

public static final int ALIGN_CENTER_SCREEN
See Also:
Constant Field Values

ALIGN_NONE

public static final int ALIGN_NONE
See Also:
Constant Field Values

inlineEditor

protected FormEditor inlineEditor

popupEditor

protected FormEditor popupEditor

popupButton

protected JButton popupButton

expandInlineEditor

protected int expandInlineEditor

popupInScrollPane

protected boolean popupInScrollPane

popupModal

protected boolean popupModal

dialogAlignment

protected int dialogAlignment

activeDialog

protected dsto.dfc.swing.forms.PopupFormEditor.PopupDialog activeDialog

listener

protected dsto.dfc.swing.forms.PopupFormEditor.Listener listener
Constructor Detail

PopupFormEditor

public PopupFormEditor()

PopupFormEditor

public PopupFormEditor(FormEditor inlineEditor,
                       FormEditor popupEditor)
Method Detail

updateUI

public void updateUI()
Overrides:
updateUI in class JComponent

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

setEditorDescription

public void setEditorDescription(String newValue)
Overrides:
setEditorDescription in class AbstractFormEditorComponent

setFont

public void setFont(Font font)
Overrides:
setFont in class JComponent

getPopupButton

public JButton getPopupButton()
The "..." button that shows the popup editor.


isPopupInScrollPane

public boolean isPopupInScrollPane()

setPopupInScrollPane

public void setPopupInScrollPane(boolean newValue)
If true, popup editor will be placed into a scroll pane when shown.


isPopupModal

public boolean isPopupModal()

setPopupModal

public void setPopupModal(boolean newValue)
If true, popup editor will be in a modal dialog (the default).


setDialogAlignment

public void setDialogAlignment(int newValue)
Set the alignment for the dialog containing the popup editor.

Parameters:
newValue - The new alignment: of ALIGN_CENTER_CLIENT (center the dialog inside the client), ALIGN_CENTER_SCREEN (center the dialog in the screen) or ALIGN_NONE (no centering).

getDialogAlignment

public int getDialogAlignment()

setInlineEditor

public void setInlineEditor(FormEditor newValue)

getInlineEditor

public FormEditor getInlineEditor()

setPopupEditor

public void setPopupEditor(FormEditor newValue)

getPopupEditor

public FormEditor getPopupEditor()

setExpandInlineEditor

public void setExpandInlineEditor(int mode)
Set how the inlineEditor will be sized when extra space is available.

Parameters:
mode - The expansion mode (one of the EXPAND_* constants).

getExpandInlineEditor

public int getExpandInlineEditor()

showPopup

public void showPopup()
Show the popup editor.


createScrollPane

protected JScrollPane createScrollPane(Component popupComponent)
Create a scroll pane to wrap the popup editor. Subclasses may override this to customize the scroll pane settings. The default tries to set a reasonable preferred size based on the popup component's preferred size.


setEnabled

public void setEnabled(boolean enabled)
Sets the inline editor and the popup editor to be enabled or disabled.

Overrides:
setEnabled in class JComponent

isDirectEdit

public boolean isDirectEdit()
Description copied from interface: FormEditor
True if the editor directly edits the value passed in with setValue (). If false, the parent editor will be reponsible for retrieving the value from the editor and storing it.

Specified by:
isDirectEdit in interface FormEditor
Specified by:
isDirectEdit in class AbstractFormEditorComponent

setEditorValue

public void setEditorValue(Object value)
                    throws IllegalFormatException
Description copied from interface: FormEditor
Sets the value to be displayed/edited by the form editor.

Specified by:
setEditorValue in interface FormEditor
Specified by:
setEditorValue in class AbstractFormEditorComponent
Parameters:
value - The value to display.
Throws:
IllegalFormatException - if the value was not in the correct format for display by this editor. The source specified by the exception should be this FormEditor instance or a child.

getEditorValue

public Object getEditorValue()
                      throws IllegalFormatException
Description copied from interface: FormEditor
Get the current value from the form editor. At least one call to setValue () must be made beforehand.

Specified by:
getEditorValue in interface FormEditor
Specified by:
getEditorValue in class AbstractFormEditorComponent
Throws:
IllegalFormatException

commitEdits

public void commitEdits()
Description copied from class: AbstractFormEditorComponent
Default implementation does nothing.

Specified by:
commitEdits in interface FormEditor
Overrides:
commitEdits in class AbstractFormEditorComponent


Copyright © 2008 Commonwealth of Australia