de.esprit.appsuite.gui

## Class ToolFrame<C extends ApplicationContext>

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - java.awt.Window
      - - java.awt.Frame
        - - javax.swing.JFrame
          - - de.esprit.common.gui.ZFrame
            - - de.esprit.appsuite.gui.ToolFrame<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:
    AbstractLoginFrame, AbstractRecordFrame, ClientToolFrame, DBRecordListFrame, DBRecordTableFrame, TableEditFrame, TextEditorFrame

      public abstract class ToolFrame<C extends ApplicationContext>
      extends ZFrame
      implements ApplicationToolWindow<C>

  This is an applieable Frame that can be used similar to `ToolDialog`
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `javax.swing.JFrame.AccessibleJFrame`

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

      `java.awt.Frame.AccessibleAWTFrame`

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

      `accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled`

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

      `CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR`

    - ### 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, 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
    `ToolFrame(C ctx)`
    `ToolFrame(C ctx, NlsKey titleKey)`
    `ToolFrame(C ctx, NlsKey titleKey, java.awt.Component caller)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addApplyListener(ApplyEvent.Listener l)`
    `boolean` | `apply()` This method calls `doOnApply()` and in case of failure `doOnApplyError(Exception)`
    `void` | `cancel()` Cancels the Dialog.
    `void` | `clear()` Clears the content
    `void` | `close()` Makes the frame 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 `ToolDialog.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 frame is made invisible.
    `protected void` | `doOnPopup()` This method is called before a frame 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 caller of this frame to which the frame should align.
    `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 frame should be closed on apply - default is true
    `boolean` | `isLogDebug()`
    `boolean` | `isLogVerbose()`
    `protected void` | `locate()` Locates this frame 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 isPacked state
    `void` | `popup()` Pops up the frame to become 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()` Tells whether a Dialog has been cancelled.

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

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

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

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

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

      `addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated`

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

      `addPropertyChangeListener, 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, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocationByPlatform, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, 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, 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`

    - ### Methods inherited from interface java.awt.MenuContainer

      `getFont, postEvent`

- - ### Constructor Detail

    - #### ToolFrame

          public ToolFrame(C ctx)

    - #### ToolFrame

          public ToolFrame(C ctx,
                   NlsKey titleKey)

    - #### ToolFrame

          public ToolFrame(C ctx,
                   NlsKey titleKey,
                   java.awt.Component caller)

  - ### Method Detail

    - #### pack

          public void pack()

      Description copied from class: `ZFrame`
      Overridden to store the isPacked state
      Specified by:
        `pack` in interface `ToolWindow`
      Overrides:
        `pack` in class `ZFrame`

    - #### createButtonPanel

          protected ButtonPanel createButtonPanel()

      Returns the `ButtonPanel` to be filled with standard buttons

    - #### getApplicationContext

          public final C getApplicationContext()

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

    - #### createWindowAdapter

          protected ApplicationToolWindowAdapter createWindowAdapter()

      Overrides:
        `createWindowAdapter` in class `ZFrame`

    - #### getWindowAdapter

          protected final ApplicationToolWindowAdapter getWindowAdapter()

      Overrides:
        `getWindowAdapter` in class `ZFrame`

    - #### getCaller

          public final java.awt.Component getCaller()

      Returns the caller of this frame to which the frame should align.

    - #### 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 frame relative to its parent or, if specified relative to its calling component (usually a Button)

    - #### getPreferredWindowAlignment

          protected WindowAlignment getPreferredWindowAlignment()

    - #### popup

          public final void popup()

      Description copied from class: `ZFrame`
      Pops up the frame to become visible.
      Specified by:
        `popup` in interface `ToolWindow`
      Overrides:
        `popup` in class `ZFrame`

    - #### doOnPopup

          protected void doOnPopup()
                            throws java.lang.Exception

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

    - #### closeByIcon

          protected void closeByIcon()

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

    - #### close

          public final void close()

      Description copied from class: `ZFrame`
      Makes the frame invisible.
      Specified by:
        `close` in interface `Closeable`
      Overrides:
        `close` in class `ZFrame`

    - #### doOnClose

          protected boolean doOnClose()
                               throws java.lang.Exception

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

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

    - #### hasClearButton

          protected boolean hasClearButton()

      Defines whether a ClearButton should be displayed (default false). Note that the Clear button just calls the clear() 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.

    - #### isClosedOnApply

          protected boolean isClosedOnApply()

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

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

    - #### clear

          public void clear()

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

    - #### apply

          public final boolean apply()

      This method calls `doOnApply()` and in case of failure `doOnApplyError(Exception)`
      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 `ToolDialog.doOnApply()`. Maybe overridden to provide a custom error handling.

    - #### cancel

          public final void cancel()

      Description copied from interface: `Cancellable`
      Cancels the Dialog.
      Specified by:
        `cancel` in interface `Cancellable`

    - #### wasCancelled

          public final boolean wasCancelled()

      Description copied from interface: `Cancellable`
      Tells whether a Dialog has been cancelled.
      Specified by:
        `wasCancelled` in interface `Cancellable`

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

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