de.esprit.appsuite.database.dbgui.field

## Class FieldPanel

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - de.esprit.common.gui.ZPanel
          - - de.esprit.common.gui.gridbag.GridBagPanel
            - - de.esprit.appsuite.database.dbgui.field.FieldPanel

- All Implemented Interfaces:
    GridBagConstants, Clearable, Dumpable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
  Direct Known Subclasses:
    ABOFieldPanel, AllFieldsPanel, CommandLineOptionPanel, GroupFieldPanel, RecordFieldPanel, UserFieldPanel

      public class FieldPanel
      extends GridBagPanel
      implements Clearable, Dumpable

  Special panel for convenient layouting and group-management of database fields. Note that the fields are automatically layouted and initialized.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `javax.swing.JPanel.AccessibleJPanel`

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

      `javax.swing.JComponent.AccessibleJComponent`

    - ### 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.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 de.esprit.common.gui.gridbag.GridBagConstants

      `BOTH, C, CENTER, E, EAST, HOR, HORIZONTAL, N, NE, NONE, NORTH, NORTHEAST, NORTHWEST, NW, REM, REMAINDER, S, SE, SOUTH, SOUTHEAST, SOUTHWEST, SW, VER, VERTICAL, W, WEST`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldPanel()` Creates an empty field panel.
    `FieldPanel(EditMode mode)`
    `FieldPanel(EditMode mode, Field... fields)`
    `FieldPanel(Field... fields)`
    `FieldPanel(NlsKey titleKey)`
    `FieldPanel(NlsKey titleKey, EditMode mode, Field... fields)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<F extends Field> F` | `addField(F field)` Adds a input Field to the internal field list.
    `void` | `checkInput()` Requests all fields to check their input.
    `void` | `checkInput(boolean withPK)` Same as `checkInput()` but allows to in/exclude checking of primary key fields.
    `void` | `clear()` Clears the content of all fields except of the primary key fields.
    `void` | `clearAll()` Clears the content of all fields including the primary key fields.
    `protected void` | `configureField(Field field)` Initializes the field such that all fields which want to be not-null are set to not-null and all fields which want to be locked are set to be locked.
    `protected java.awt.LayoutManager` | `createLayout()` Creates the layout manager for this container.
    `boolean` | `existsField(java.lang.String name)` Checks whether the field with the given name exists in the panel.
    `void` | `focusFirstField()` Requests the focus to be grabbed by the first field.
    `EditMode` | `getEditMode()`
    `Field` | `getField(int index)`
    `Field` | `getField(java.lang.String name)` Accesses the field by name - returns null if none was found.
    `int` | `getFieldCount()`
    `Field[]` | `getFields()` Returns the field array that is managed by this FieldPanel.
    `int` | `getMaxLabelWidth()` Returns the width of the biggest label.
    `ModifyFlag` | `getModifyFlag()` Returns the ModifyFlag assiociated to this fieldpanel.
    `boolean` | `hasInput()` Returns true when any of the fields is not empty.
    `boolean` | `isCreateMode()`
    `protected boolean` | `isFieldLocked(java.lang.String fieldName)` Defines which fields are to be configured as read-only fields.
    `protected boolean` | `isFieldNotNull(java.lang.String fieldName)` Defines which fields are to be configured as not-null fields.
    `protected boolean` | `isFieldVisible(java.lang.String fieldName)` Defines whether this field should be displayed in the fieldpanel.
    `boolean` | `isModified()` Tells wasCancelled the modify flag is set.
    `boolean` | `isSearchMode()`
    `boolean` | `isUpdateMode()`
    `void` | `layoutFields()` Performs the layout and initialization of the fields.
    `protected void` | `placeField(Field field, int y)` Places the field and it's field-label in the container.
    `void` | `setApplier(Applier applier)` Sets this Applier instance for all CharFields within this panel
    `void` | `setEditMode(EditMode mode)`
    `void` | `setFields(Field[] fields)` This method must be called once (and only once) on a FieldPanel instance in order to give it some fields to manage.
    `void` | `setInsertDefaultValues()` Requests all fields to lookup for their insert-default values.
    `void` | `setLocked(boolean state)` Sets the locked state (read-only) of all fields.
    `void` | `setModified(boolean state)` Sets the modify flag to the given state.
    `void` | `setModifyFlag(ModifyFlag flag)` Sets the ModifyFlag reference in all fields.
    `void` | `setNotNull(boolean state)` Sets all field to not-null.
    `void` | `setPrimaryKeysLocked(boolean state)` Sets the locked state (read-only) of all fields.
    `java.lang.String` | `toDumpString()` Returns a multi-line String that shows the values (name=value) of all important state variables of this object.
    `DumpString` | `toDumpString(DumpString s)` This method allows subclasses to add values to the existing DumpString of the superclass.
    `java.lang.String` | `toString()` Returns a single line String that shows the values of the most important state variables of this object.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.

    - ### Methods inherited from class de.esprit.common.gui.gridbag.GridBagPanel

      `alignFirstColumnsInSubPanels, getDefaultInsets, getFirstColumnMaxWidth, horizontalStretch, place, place, place, place, place, place, place, setDefaultInsets, setFirstColumnWidth, stretchX, stretchY, verticalStretch`

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

      `addBorder, contains, getTileIcon, insertBorder, paintComponent, setTileIcon, setTileIcon, setTitledBorder`

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

      `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

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

      `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, 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, 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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle`

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

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

- - ### Constructor Detail

    - #### FieldPanel

          public FieldPanel()

      Creates an empty field panel. You may use setFields(Field[]) in order to set the fields to be managed later.

    - #### FieldPanel

          public FieldPanel(NlsKey titleKey)

    - #### FieldPanel

          public FieldPanel(EditMode mode)

    - #### FieldPanel

          public FieldPanel(Field... fields)

    - #### FieldPanel

          public FieldPanel(NlsKey titleKey,
                    EditMode mode,
                    Field... fields)

    - #### FieldPanel

          public FieldPanel(EditMode mode,
                    Field... fields)

  - ### Method Detail

    - #### setApplier

          public void setApplier(Applier applier)

      Sets this Applier instance for all CharFields within this panel

    - #### setEditMode

          public void setEditMode(EditMode mode)

    - #### getEditMode

          public EditMode getEditMode()

    - #### isCreateMode

          public boolean isCreateMode()

    - #### isUpdateMode

          public boolean isUpdateMode()

    - #### isSearchMode

          public boolean isSearchMode()

    - #### createLayout

          protected java.awt.LayoutManager createLayout()

      Creates the layout manager for this container. By default a GridBagLayout is used

    - #### addField

          public <F extends Field> F addField(F field)

      Adds a input Field to the internal field list. Note that after having added fields the FieldPanel you must call layoutFields() in order to layout and initialize the fields.
      Returns:
        The added field
      See Also:
        `layoutFields()`

    - #### setFields

          public void setFields(Field[] fields)

      This method must be called once (and only once) on a FieldPanel instance in order to give it some fields to manage. It is called automatically by the constructor when the fiels are known at construction time. If the fields are not known at construction time it must be called later. Note that this method can only be called exactly once on a FieldPanel instance.

    - #### getFields

          public Field[] getFields()

      Returns the field array that is managed by this FieldPanel.

    - #### getField

          public Field getField(int index)

    - #### getFieldCount

          public int getFieldCount()

    - #### layoutFields

          public void layoutFields()

      Performs the layout and initialization of the fields. By default the fields are vertically aligned and each field has got a leading translated field label. This method is called automatically by setFields(Field[]).

      Note that if the fields have been added with addField(Field) then this method must be called once after all fields have been added.

      See Also:
        `setFields(Field[])`

    - #### configureField

          protected void configureField(Field field)

      Initializes the field such that all fields which want to be not-null are set to not-null and all fields which want to be locked are set to be locked. This method is called automatically by layoutFields().
      See Also:
        `layoutFields()`

    - #### placeField

          protected void placeField(Field field,
                        int y)

      Places the field and it's field-label in the container.

    - #### getMaxLabelWidth

          public int getMaxLabelWidth()

      Returns the width of the biggest label.

    - #### getField

          public Field getField(java.lang.String name)

      Accesses the field by name - returns null if none was found.

    - #### existsField

          public boolean existsField(java.lang.String name)

      Checks whether the field with the given name exists in the panel.

    - #### clear

          public void clear()

      Clears the content of all fields except of the primary key fields. Note: if the panel is in `isCreateMode()` the ModifyFlag is reset after clearing.
      Specified by:
        `clear` in interface `Clearable`

    - #### clearAll

          public void clearAll()

      Clears the content of all fields including the primary key fields.

    - #### checkInput

          public void checkInput()
                          throws java.lang.Exception

      Requests all fields to check their input. If any of the checks fails an error message dialog pops up to the user telling the reason for failure.
      Throws:
        `java.lang.Exception`

    - #### checkInput

          public void checkInput(boolean withPK)
                          throws java.lang.Exception

      Same as `checkInput()` but allows to in/exclude checking of primary key fields.
      Throws:
        `java.lang.Exception`

    - #### hasInput

          public boolean hasInput()

      Returns true when any of the fields is not empty.

    - #### setInsertDefaultValues

          public void setInsertDefaultValues()

      Requests all fields to lookup for their insert-default values.

    - #### setPrimaryKeysLocked

          public void setPrimaryKeysLocked(boolean state)

      Sets the locked state (read-only) of all fields.

    - #### setLocked

          public void setLocked(boolean state)

      Sets the locked state (read-only) of all fields.

    - #### setNotNull

          public void setNotNull(boolean state)

      Sets all field to not-null.

    - #### isFieldNotNull

          protected boolean isFieldNotNull(java.lang.String fieldName)

      Defines which fields are to be configured as not-null fields. Returns always true by default, but can to be overridden by subclasses as needed.

    - #### isFieldLocked

          protected boolean isFieldLocked(java.lang.String fieldName)

      Defines which fields are to be configured as read-only fields. Returns always true by default, but can to be overridden by subclasses as needed.

    - #### isFieldVisible

          protected boolean isFieldVisible(java.lang.String fieldName)

      Defines whether this field should be displayed in the fieldpanel. If this method returns false the field will not be layouted at all.

    - #### focusFirstField

          public void focusFirstField()

      Requests the focus to be grabbed by the first field.

    - #### setModifyFlag

          public void setModifyFlag(ModifyFlag flag)

      Sets the ModifyFlag reference in all fields.

    - #### getModifyFlag

          public ModifyFlag getModifyFlag()

      Returns the ModifyFlag assiociated to this fieldpanel. All fields have been automatically registered atd this flag.

    - #### setModified

          public void setModified(boolean state)

      Sets the modify flag to the given state.

    - #### isModified

          public boolean isModified()

      Tells wasCancelled the modify flag is set.

    - #### toString

          public java.lang.String toString()

      Description copied from interface: `Dumpable`
      Returns a single line String that shows the values of the most important state variables of this object. This is intentionally the same toString() method which is already provided by Object per se.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `java.awt.Component`

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`

    - #### toDumpString

          public java.lang.String toDumpString()

      Description copied from interface: `Dumpable`
      Returns a multi-line String that shows the values (name=value) of all important state variables of this object.
      Specified by:
        `toDumpString` in interface `Dumpable`

    - #### toDumpString

          public DumpString toDumpString(DumpString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing DumpString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toDumpString` in interface `Dumpable`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.