public class FormDialog extends JDialog implements FormWindow, ContainerListener
JDialog implementing FormWindow (and FormContainer).JDialog.AccessibleJDialogDialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeWindow.AccessibleAWTWindow, Window.TypeContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyaccessibleContext, rootPane, rootPaneCheckingEnabledDEFAULT_MODALITY_TYPEBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
FormDialog()
Creates a modeless FormDialog without a title and without a specified
owner.
|
FormDialog(boolean modal)
Creates a FormDialog without a title and without owner
with a given modality.
|
FormDialog(Window owner)
Creates a modeless dialog with an owner
Window
but without a title. |
FormDialog(Window owner,
boolean modal)
Creates a dialog without owner, with the specified title and modality.
|
FormDialog(Window owner,
String title,
boolean modal)
Creates a dialog with the specified title, owner
Window and
modality. |
FormDialog(Window owner,
String title,
Dialog.ModalityType modalityType)
Creates a dialog with the specified title, owner
Window and
modality. |
| Modifier and Type | Method and Description |
|---|---|
void |
addFormWrapListener(FormWrapListener l)
Adss a wrap listener which will be invoked
whenever the focus wraps in this window, i.e.
|
void |
alignLocation()
Aligns the location of this window in order not
to cover other windows (best as possible).
|
boolean |
areValuesChanged()
Checks whether the contents of some components in this or sub containers
have changed since the last
FormContainer.saveValues(). |
boolean |
checkAutoClose()
Checks if window should be autoclosed.
|
void |
componentAdded(ContainerEvent e) |
void |
componentRemoved(ContainerEvent e) |
protected FormComponentBinder |
createBinder()
Creates a binder for this form.
The default implementation invokes FormBindingFactory.createFormComponentBinder(this). |
void |
fireFormWrappedFocus(FormWrapEvent evt)
Fires all form wrap listeners for this window.
|
long |
getAutoClose()
Gets the autoclose timeout.
|
FormComponentBinder |
getBinder()
Gets the binder of this container.
|
void |
getFormValues()
Retrieves the values from all components in this container and
all sub containers.
Used to update the data from the view according to the data binding. |
String |
getHelpURL()
Gets the online-help URL.
|
boolean |
getKeepChangedValues()
Gets the behaviour for setFormValues().
|
Window |
getParentWindow()
Gets the parent window.
|
FormWindow |
getRelatedWindow()
Gets the related window.
Falls back to getOwner() if not set and owner is a formwindow. |
long |
getTimeOfLastValuesChanged()
Gets the system-time of last setFormValues() or triggerValuesChanged()
for this window in milliseconds.
|
TooltipDisplay |
getTooltipDisplay()
Gets the tooltip display for this window.
|
int |
getUIVersion()
Gets the look and feel version for this window.
|
void |
invalidateParentInfo()
Invalidates all container-relevant (cached) information
for the hierarchy of this container's parents.
For optimization purposes. |
boolean |
isAutoCloseable()
Returns whether this window is a candidate for autoClose-monitoring.
|
boolean |
isAutoPosition()
Returns whether auto position is enabled.
|
boolean |
isAutoUpdate()
Returns whether the auto-update feature is enabled.
|
boolean |
isBindable()
Determines whether this container is bindable.
|
boolean |
isChangeable()
Returns if this component is changeable.
|
boolean |
isHonourChangeable()
Returns whether this component should honour the changeable-attribute or not.
|
boolean |
isTriggerValuesChangedEnabled()
Determines whether triggering value changes is enabled.
|
void |
pack() |
void |
paint(Graphics g) |
protected void |
processWindowEvent(WindowEvent e) |
void |
removeFormWrapListener(FormWrapListener l)
Removes a form wrap listener.
|
void |
saveValues()
Sets a savepoint for all components in this container and
all sub containers.
|
void |
setAutoClose(long autoClose)
Set a timer to close the window automatically.
FormContainers use this feature to close after a certain time of inactivity and unchanged data. Note: autoClosing must be set before displaying the window (just like setModal()). |
void |
setAutoPosition(boolean flag)
Sets the autoposition feature.
Windows with this autoposition enabled will place themselves in a nice manner on the screen when displayed initially. |
void |
setAutoUpdate(boolean autoupdate)
Sets the auto-update feature for all components in this container and all sub containers.
|
void |
setBindable(boolean bindable)
Sets whether this container is bindable, i.e.
|
void |
setChangeable(boolean changeable)
Set the component to be changeable.
This is a unified abstraction and will be translated to setEditable or setEnabled, whatever is appropriate to this component. |
void |
setFormValues()
Sets the values in all form components in this container and all
sub containers.
Used to update the view from the data according to the data binding. |
void |
setFormValuesKeepChanged()
Sets the values in all unchanged form components in this container and
all sub containers.
All changed components are left untouched. |
void |
setHelpURL(String helpURL)
Sets the online-help URL.
If a help url is set for this container, a browser will be launched to show that url if there is no help url for the component the help was requested for. |
void |
setHonourChangeable(boolean flag)
Sets whether this component should honour the changeable-attribute or not.
The default is true. |
void |
setKeepChangedValues(boolean keepChanged)
Sets the behaviour of setFormValues() of FormContainers in this FormWindow.
|
void |
setRelatedWindow(FormWindow relatedWindow)
Sets the related FormWindow.
Related windows are somewhat similar to Owners, but they don't change fg/bg-behaviour of the window-manager. |
void |
setTimeOfLastValuesChanged(long millis)
Sets the system-time of last setFormValues() or triggerValuesChanged()
for this window in milliseconds.
|
void |
setTooltipDisplay(TooltipDisplay display)
Sets the tooltip display for this window.
If a tooltip display is set the component's tooltips will be displayed for each component receiving the keyboard focus (instead of popping up on mouse hover). |
void |
setTriggerValuesChangedEnabled(boolean enabled)
Enables triggering value changes.
Disabling this feature may be necessary for model-agnostic containers. |
void |
setUIVersion(int version)
Sets a version number for the current look and feel of this window.
|
void |
showHelp()
Displays online help for this container.
|
void |
triggerValuesChanged()
Signals that values in the components of the container may have changed.
|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBackaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTitle, setTitlepublic FormDialog(Window owner, String title, Dialog.ModalityType modalityType)
Window and
modality.owner - the Window from which the dialog is displayed or
null if this dialog has no ownertitle - the String to display in the dialog's
title bar or null if the dialog has no titlemodalityType - specifies whether dialog blocks input to other
windows when shown. null value and unsupported modality
types are equivalent to MODELESSJDialog.JDialog(java.awt.Window, java.lang.String, java.awt.Dialog.ModalityType)public FormDialog(Window owner, String title, boolean modal)
Window and
modality.owner - the Window from which the dialog is displayed or
null if this dialog has no ownertitle - the String to display in the dialog's
title bar or null if the dialog has no titlemodal - specifies whether dialog blocks user input to other top-level
windows when shown. If true, the modality type property is set to
DEFAULT_MODALITY_TYPE otherwise the dialog is modelesspublic FormDialog(Window owner, boolean modal)
owner - the Window from which the dialog is displayed or
null if this dialog has no ownermodal - specifies whether dialog blocks user input to other top-level
windows when shown. If true, the modality type property is set to
DEFAULT_MODALITY_TYPE otherwise the dialog is modelesspublic FormDialog(Window owner)
Window
but without a title.owner - the Window from which the dialog is displayed or
null if this dialog has no ownerpublic FormDialog(boolean modal)
modal - specifies whether dialog blocks user input to other top-level
windows when shown. If true, the modality type property is set to
DEFAULT_MODALITY_TYPE otherwise the dialog is modelessJDialog.JDialog()public FormDialog()
JDialog.JDialog()protected void processWindowEvent(WindowEvent e)
Overridden to allow FormUtilities keeping track of windows
processWindowEvent in class JDialogpublic void pack()
Overridden to autolocate window if possible.
public void paint(Graphics g)
Overridden in order to bring modal windows to front in case accidently covered by another window. This is the case whenever a modal dialog is not owned by the window covering it. It solves the problem of visually "freezing" an application because the user clicked on another window.
public void componentAdded(ContainerEvent e)
componentAdded in interface ContainerListenerpublic void componentRemoved(ContainerEvent e)
componentRemoved in interface ContainerListenerpublic Window getParentWindow()
FormContainergetParentWindow in interface FormContainerpublic void invalidateParentInfo()
FormContainerinvalidateParentInfo in interface FormContainerpublic void setAutoUpdate(boolean autoupdate)
FormContainersetAutoUpdate in interface FormContainerautoupdate - true if auto update the data (default), false if notFormComponent.setAutoUpdate(boolean)public boolean isAutoUpdate()
FormContainerisAutoUpdate in interface FormContainerFormComponent.isAutoUpdate()public void setFormValues()
FormContainersetFormValues in interface FormContainerpublic void setFormValuesKeepChanged()
FormContainersetFormValuesKeepChanged in interface FormContainerFormComponent.isValueChanged()public void getFormValues()
FormContainergetFormValues in interface FormContainerpublic void saveValues()
FormContainersaveValues in interface FormContainerFormComponent.saveValue()public boolean areValuesChanged()
FormContainerFormContainer.saveValues().
Notice that only components with (FormComponent.isTriggerValueChangedEnabled() == true)
will be checked.
areValuesChanged in interface FormContainerpublic void triggerValuesChanged()
FormContainertriggerValuesChanged in interface FormContainerpublic void setTriggerValuesChangedEnabled(boolean enabled)
FormContainersetTriggerValuesChangedEnabled in interface FormContainerenabled - true if invoke FormContainer.triggerValuesChanged() on each change (default), false if not.public boolean isTriggerValuesChangedEnabled()
FormContainerisTriggerValuesChangedEnabled in interface FormContainerFormContainer.triggerValuesChanged() on each change (default), false if not.public long getTimeOfLastValuesChanged()
FormWindowgetTimeOfLastValuesChanged in interface FormWindowpublic void setTimeOfLastValuesChanged(long millis)
FormWindowsetTimeOfLastValuesChanged in interface FormWindowmillis - the time of last values changedpublic void setChangeable(boolean changeable)
FormChangeablesetChangeable in interface FormChangeablechangeable - true the user can edit the data, false if show onlypublic boolean isChangeable()
FormChangeableisChangeable in interface FormChangeablepublic void setHelpURL(String helpURL)
FormContainersetHelpURL in interface FormContainerhelpURL - the help urlFormUtilities.openHelpURL(Component)public String getHelpURL()
FormContainergetHelpURL in interface FormContainerpublic void showHelp()
FormContainershowHelp in interface FormContainerpublic void setHonourChangeable(boolean flag)
FormChangeablesetHonourChangeable in interface FormChangeableflag - true if honour the changeable attribute, false if notpublic boolean isHonourChangeable()
FormChangeableisHonourChangeable in interface FormChangeablepublic void setRelatedWindow(FormWindow relatedWindow)
FormWindowsetRelatedWindow in interface FormWindowrelatedWindow - the related FormWindowpublic FormWindow getRelatedWindow()
FormWindowgetRelatedWindow in interface FormWindowpublic int getUIVersion()
FormWindowgetUIVersion in interface FormWindowpublic void setUIVersion(int version)
FormWindowsetUIVersion in interface FormWindowversion - the n-th look and feel versionpublic void setTooltipDisplay(TooltipDisplay display)
FormWindowsetTooltipDisplay in interface FormWindowdisplay - the tooltip display, null = none (default)public TooltipDisplay getTooltipDisplay()
FormWindowgetTooltipDisplay in interface FormWindowpublic void addFormWrapListener(FormWrapListener l)
FormWindowaddFormWrapListener in interface FormWindowl - the form wrap listenerFormFocusTraversalPolicypublic void removeFormWrapListener(FormWrapListener l)
FormWindowremoveFormWrapListener in interface FormWindowl - the listener to removepublic void fireFormWrappedFocus(FormWrapEvent evt)
FormWindowfireFormWrappedFocus in interface FormWindowevt - the form wrap eventpublic void setAutoPosition(boolean flag)
FormWindowsetAutoPosition in interface FormWindowflag - true to enable autoposition, false if not (default)public boolean isAutoPosition()
FormWindowisAutoPosition in interface FormWindowpublic void alignLocation()
FormWindowalignLocation in interface FormWindowpublic void setAutoClose(long autoClose)
FormWindowsetAutoClose in interface FormWindowautoClose - the time in milliseconds, 0 = no autoclosepublic long getAutoClose()
FormWindowgetAutoClose in interface FormWindowpublic boolean isAutoCloseable()
Modal dialogs are not autoCloseable().
isAutoCloseable in interface FormWindowpublic boolean checkAutoClose()
The default implementation returns true if the window is isAutoCloseable(), isVisible(), the time since the last change has elapsed and the formvalues were not changed.
checkAutoClose in interface FormWindowpublic void setKeepChangedValues(boolean keepChanged)
FormWindowsetKeepChangedValues in interface FormWindowkeepChanged - true if setFormValues() should NOT override values
changed by the user. The default is false.public boolean getKeepChangedValues()
FormWindowgetKeepChangedValues in interface FormWindowprotected FormComponentBinder createBinder()
FormBindingFactory.createFormComponentBinder(this).public FormComponentBinder getBinder()
FormContainergetBinder in interface FormContainerpublic void setBindable(boolean bindable)
FormContainerFormContainers are bindable by default.
setBindable in interface FormContainerbindable - true if bindable, else not eligible for the binding processpublic boolean isBindable()
FormContainerisBindable in interface FormContainerTentackle - a domain driven enterprise framework