de.esprit.appsuite.gui

## Class ToolDialog<C extends ApplicationContext>

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - java.awt.Window
      - - java.awt.Dialog
        - - javax.swing.JDialog
          - - de.esprit.common.gui.ZDialog
            - - de.esprit.appsuite.gui.ToolDialog<C>

- All Implemented Interfaces:
    ApplicationToolWindow<C>, ApplicationObject<C>, Applieable, BorderLayoutConstants, Cancellable, Closeable, ToolWindow, SimpleLogSupport, Clearable, Dumpable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
  Direct Known Subclasses:
    AboutEspritDialog, AbstractCheckBoxOptionDialog, AbstractFieldDialog, AbstractNameInputDialog, AbstractPathEditDialog, AbstractRecordDialog, ActivityMonitorDialog, AppLaunchPrefsDialog, ArchiveConfigDialog, ClientToolDialog, ConfirmDialog, ConnectionLostDialog, DBRecordTableDialog, DefaultFieldEditor, DumpDialog, FileViewerDialog, FindStringDialog, InputFileChooserDialog, LoadMeterDialog, MemoryMonitorDialog, MessageDialog, OutputDirectoryChooserDialog, OutputFileChooserDialog, RadioButtonOptionDialog, RecordTypeChooserDialog, RootDirectoryChooserDialog, TaskManagerDialog, TextEditorDialog, WorkflowManagerDialog, WorkflowMonitorDialog

      public class ToolDialog<C extends ApplicationContext>
      extends ZDialog
      implements ApplicationToolWindow<C>

  This is the base class for all `Applieable` GUI dialogs. It provides default Apply-/Clear-/Close-/Cancel-buttons depending on which ones are configured by just overriding the according hasXXButton() methods to return true.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JDialog

      `javax.swing.JDialog.AccessibleJDialog`

    - ### Nested classes/interfaces inherited from class java.awt.Dialog

      `java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType`

    - ### Nested classes/interfaces inherited from class java.awt.Window

      `java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type`

    - ### 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.JDialog

      `accessibleContext, rootPane, rootPaneCheckingEnabled`

    - ### Fields inherited from class java.awt.Dialog

      `DEFAULT_MODALITY_TYPE`

    - ### Fields inherited from class java.awt.Component

      `BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface de.esprit.common.gui.comp.BorderLayoutConstants

      `CENTER, EAST, NORTH, SOUTH, WEST`

    - ### 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

    Constructors
    Constructor and Description
    `ToolDialog(C ctx)`
    `ToolDialog(C ctx, NlsKey nls)`
    `ToolDialog(C ctx, NlsKey nls, java.awt.Component caller)`
    `ToolDialog(C ctx, java.awt.Window parent)`
    `ToolDialog(C ctx, java.awt.Window parent, NlsKey nls)`
    `ToolDialog(C ctx, java.awt.Window parent, NlsKey nls, java.awt.Component caller)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addApplyListener(ApplyEvent.Listener l)`
    `boolean` | `apply()` This method calls performApplyAction() and in case of failure handleApplyError(e)
    `void` | `cancel()` Cancels the dialog and closes it.
    `void` | `clear()` Clears the content
    `void` | `close()` Just makes the dialog invisible.
    `protected void` | `closeByIcon()` Overridden to cancel the dialog
    `protected ButtonPanel` | `createButtonPanel()` Returns the `ButtonPanel` to be filled with standard buttons
    `protected ApplicationToolWindowAdapter` | `createWindowAdapter()`
    `protected void` | `doOnApply()` Should be overridden in order to provide an apply action
    `protected void` | `doOnApplyError(java.lang.Exception e)` Handles an exception raising from `doOnApply()`.
    `protected boolean` | `doOnCancel()` May be overridden if a special action should be done on cancellation.
    `protected boolean` | `doOnClose()` This method is called before this dialog is made invisible.
    `protected void` | `doOnPopup()` This method is called before a dialog is made visible.
    `C` | `getApplicationContext()`
    `Applier` | `getApplier()` Returns an ActionListener that calls the apply() method of this dialog.
    `ApplyAndCloseButton` | `getApplyAndCloseButton()`
    `ApplyButton` | `getApplyButton()`
    `ButtonPanel` | `getButtonPanel()`
    `java.awt.Component` | `getCaller()` Returns the component, if any, on which this dialog is aligned.
    `CancelButton` | `getCancelButton()`
    `ClearButton` | `getClearButton()`
    `CloseButton` | `getCloseButton()`
    `LogChannel` | `getLogChannel()`
    `protected WindowAlignment` | `getPreferredWindowAlignment()`
    `protected ApplicationToolWindowAdapter` | `getWindowAdapter()`
    `protected boolean` | `hasApplyAndCloseButton()` Defines whether an ApplyAndClose button should be displayed (default false).
    `protected boolean` | `hasApplyButton()` Defines whether an Apply button should be displayed (default false).
    `protected boolean` | `hasButtonPanel()` May be overridden to return false if no default button-panel is desired.
    `protected boolean` | `hasCancelButton()` Defines whether a Cancel button should be displayed (default false).
    `protected boolean` | `hasClearButton()` Defines whether a ClearButton should be displayed (default false).
    `protected boolean` | `hasCloseButton()` Defines whether a Close button should be displayed (default false).
    `protected boolean` | `isClosedOnApply()` Defines whether the dialog should be closed on apply - default is true
    `boolean` | `isLogDebug()`
    `boolean` | `isLogVerbose()`
    `protected void` | `locate()` Locates this dialog relative to its parent or, if specified relative to its calling component (usually a Button)
    `void` | `logDebug(java.lang.String message)`
    `void` | `logDump(java.lang.String message)`
    `void` | `logError(java.lang.String message)`
    `void` | `logError(java.lang.String message, java.lang.Exception e)`
    `void` | `logFatal(java.lang.String message, java.lang.Exception e)`
    `void` | `logInfo(java.lang.String message)`
    `void` | `logVerbose(java.lang.String message)`
    `void` | `logWarning(java.lang.String message)`
    `void` | `pack()` Overridden to store the minimum size for size control
    `void` | `popup()` Pops up the dialog to be visible.
    `void` | `removeApplyListener(ApplyEvent.Listener l)`
    `void` | `setDefaultButton(javax.swing.JButton button)`
    `void` | `setLogChannel(LogChannel logCh)`
    `void` | `setRelocateOnPopup(boolean isRelocateOnPopup)` Defines whether the Dialog is repositioned by calling `locate()` on each popup.
    `boolean` | `wasCancelled()` Returns true if the dialog was cancelled.

    - ### Methods inherited from class de.esprit.common.gui.ZDialog

      `dispose, getMinimumHeight, getMinimumWidth, isDisposeOnClose, isErrorAttachable, isLocated, isPacked, registerSubDialog, repack, setLocation, setLocationRelativeTo, setLocationRelativeTo, setLocationToCenter, setTitle, setVisible, shiftLocation, toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from class javax.swing.JDialog

      `addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update`

    - ### Methods inherited from class java.awt.Dialog

      `addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack`

    - ### Methods inherited from class java.awt.Window

      `addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, 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, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocationByPlatform, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront`

    - ### Methods inherited from class java.awt.Container

      `add, 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, validateTree`

    - ### Methods inherited from class java.awt.Component

      `action, 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, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.appsuite.gui.ApplicationToolWindow

      `getRootPane`

    - ### Methods inherited from interface de.esprit.common.gui.ToolWindow

      `getLocation, getMinimumHeight, getMinimumWidth, getSize, getTitle, getToolkit, isPacked, setLocation, setLocationRelativeTo, setMinimumSize, setPreferredSize, shiftLocation`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toDumpString, toString, toString`

- - ### Constructor Detail

    - #### ToolDialog

          public ToolDialog(C ctx)

    - #### ToolDialog

          public ToolDialog(C ctx,
                    NlsKey nls)

    - #### ToolDialog

          public ToolDialog(C ctx,
                    NlsKey nls,
                    java.awt.Component caller)

    - #### ToolDialog

          public ToolDialog(C ctx,
                    java.awt.Window parent)

    - #### ToolDialog

          public ToolDialog(C ctx,
                    java.awt.Window parent,
                    NlsKey nls)

    - #### ToolDialog

          public ToolDialog(C ctx,
                    java.awt.Window parent,
                    NlsKey nls,
                    java.awt.Component caller)

  - ### Method Detail

    - #### pack

          public void pack()

      Description copied from class: `ZDialog`
      Overridden to store the minimum size for size control
      Specified by:
        `pack` in interface `ToolWindow`
      Overrides:
        `pack` in class `ZDialog`

    - #### createButtonPanel

          protected ButtonPanel createButtonPanel()

      Returns the `ButtonPanel` to be filled with standard buttons

    - #### createWindowAdapter

          protected final ApplicationToolWindowAdapter createWindowAdapter()

      Overrides:
        `createWindowAdapter` in class `ZDialog`

    - #### getWindowAdapter

          protected final ApplicationToolWindowAdapter getWindowAdapter()

      Overrides:
        `getWindowAdapter` in class `ZDialog`

    - #### getApplicationContext

          public final C getApplicationContext()

      Specified by:
        `getApplicationContext` in interface `ApplicationObject<C extends ApplicationContext>`

    - #### getCaller

          public final java.awt.Component getCaller()

      Returns the component, if any, on which this dialog is aligned. This component is NOT the hook, but usually a button on which the dialog aligns.

    - #### setRelocateOnPopup

          public final void setRelocateOnPopup(boolean isRelocateOnPopup)

      Defines whether the Dialog is repositioned by calling `locate()` on each popup.
      Specified by:
        `setRelocateOnPopup` in interface `ApplicationToolWindow<C extends ApplicationContext>`

    - #### setDefaultButton

          public final void setDefaultButton(javax.swing.JButton button)

    - #### locate

          protected void locate()

      Locates this dialog relative to its parent or, if specified relative to its calling component (usually a Button)

    - #### getPreferredWindowAlignment

          protected WindowAlignment getPreferredWindowAlignment()

    - #### popup

          public final void popup()

      Pops up the dialog to be visible.
      Specified by:
        `popup` in interface `ToolWindow`
      Overrides:
        `popup` in class `ZDialog`

    - #### doOnPopup

          protected void doOnPopup()
                            throws java.lang.Exception

      This method is called before a dialog is made visible.
      Throws:
        `java.lang.Exception`

    - #### close

          public final void close()

      Description copied from class: `ZDialog`
      Just makes the dialog invisible.
      Specified by:
        `close` in interface `Closeable`
      Overrides:
        `close` in class `ZDialog`

    - #### doOnClose

          protected boolean doOnClose()
                               throws java.lang.Exception

      This method is called before this dialog is made invisible. Closing can be vetoed by returning false.
      Returns:
        true by default.
      Throws:
        `java.lang.Exception`

    - #### cancel

          public final void cancel()

      Cancels the dialog and closes it.
      Specified by:
        `cancel` in interface `Cancellable`
      See Also:
        `wasCancelled()`

    - #### closeByIcon

          protected void closeByIcon()

      Overridden to cancel the dialog
      Overrides:
        `closeByIcon` in class `ZDialog`

    - #### wasCancelled

          public final boolean wasCancelled()

      Returns true if the dialog was cancelled.
      Specified by:
        `wasCancelled` in interface `Cancellable`
      See Also:
        `cancel()`

    - #### apply

          public final boolean apply()

      This method calls performApplyAction() and in case of failure handleApplyError(e)
      Specified by:
        `apply` in interface `Applieable`

    - #### doOnApply

          protected void doOnApply()
                            throws java.lang.Exception

      Should be overridden in order to provide an apply action
      Throws:
        `java.lang.Exception`

    - #### doOnCancel

          protected boolean doOnCancel()

      May be overridden if a special action should be done on cancellation. If this method returns false no cancellation takes place.

    - #### doOnApplyError

          protected void doOnApplyError(java.lang.Exception e)

      Handles an exception raising from `doOnApply()`. Maybe overridden to provide a custom error handling.

    - #### clear

          public void clear()

      Description copied from interface: `Clearable`
      Clears the content
      Specified by:
        `clear` in interface `Clearable`

    - #### isClosedOnApply

          protected boolean isClosedOnApply()

      Defines whether the dialog should be closed on apply - default is true

    - #### getApplier

          public final Applier getApplier()

      Returns an ActionListener that calls the apply() method of this dialog. Very useful for attaching to text fields that should perform an apply() on pressing the ENTER key.

    - #### hasButtonPanel

          protected boolean hasButtonPanel()

      May be overridden to return false if no default button-panel is desired. In this case addButtons(JPanel) will not be called and the SOUTH area of the Dialog's ContentPane BorderLayout remains free to use for something else.

    - #### hasApplyAndCloseButton

          protected boolean hasApplyAndCloseButton()

      Defines whether an ApplyAndClose button should be displayed (default false).

    - #### hasCloseButton

          protected boolean hasCloseButton()

      Defines whether a Close button should be displayed (default false). Note that the Close button just calls the close() method.

    - #### hasApplyButton

          protected boolean hasApplyButton()

      Defines whether an Apply button should be displayed (default false). Note that the Apply button just calls the apply() method.

    - #### hasCancelButton

          protected boolean hasCancelButton()

      Defines whether a Cancel button should be displayed (default false). Note that the Cancel button just calls the cancel() method.

    - #### hasClearButton

          protected boolean hasClearButton()

      Defines whether a ClearButton should be displayed (default false). Note that the Clear button just calls the clear() method.

    - #### getApplyAndCloseButton

          public final ApplyAndCloseButton getApplyAndCloseButton()

    - #### getClearButton

          public final ClearButton getClearButton()

    - #### getCancelButton

          public final CancelButton getCancelButton()

    - #### getApplyButton

          public final ApplyButton getApplyButton()

    - #### getCloseButton

          public final CloseButton getCloseButton()

    - #### getButtonPanel

          public final ButtonPanel getButtonPanel()

    - #### addApplyListener

          public final void addApplyListener(ApplyEvent.Listener l)

    - #### removeApplyListener

          public final void removeApplyListener(ApplyEvent.Listener l)

    - #### logFatal

          public final void logFatal(java.lang.String message,
                      java.lang.Exception e)

      Specified by:
        `logFatal` in interface `SimpleLogSupport`

    - #### logError

          public final void logError(java.lang.String message,
                      java.lang.Exception e)

      Specified by:
        `logError` in interface `SimpleLogSupport`

    - #### logError

          public final void logError(java.lang.String message)

      Specified by:
        `logError` in interface `SimpleLogSupport`

    - #### logWarning

          public final void logWarning(java.lang.String message)

      Specified by:
        `logWarning` in interface `SimpleLogSupport`

    - #### logInfo

          public final void logInfo(java.lang.String message)

      Specified by:
        `logInfo` in interface `SimpleLogSupport`

    - #### logVerbose

          public final void logVerbose(java.lang.String message)

      Specified by:
        `logVerbose` in interface `SimpleLogSupport`

    - #### logDebug

          public final void logDebug(java.lang.String message)

      Specified by:
        `logDebug` in interface `SimpleLogSupport`

    - #### logDump

          public final void logDump(java.lang.String message)

      Specified by:
        `logDump` in interface `SimpleLogSupport`

    - #### getLogChannel

          public final LogChannel getLogChannel()

      Specified by:
        `getLogChannel` in interface `SimpleLogSupport`

    - #### setLogChannel

          public final void setLogChannel(LogChannel logCh)

      Specified by:
        `setLogChannel` in interface `SimpleLogSupport`

    - #### isLogDebug

          public final boolean isLogDebug()

      Specified by:
        `isLogDebug` in interface `SimpleLogSupport`

    - #### isLogVerbose

          public final boolean isLogVerbose()

      Specified by:
        `isLogVerbose` in interface `SimpleLogSupport`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.