de.esprit.appsuite.database.dbgui.field

## Class AbstractLabelField

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JLabel
        - - de.esprit.appsuite.database.dbgui.field.AbstractLabelField

- All Implemented Interfaces:
    Field<java.lang.String>, Clearable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants
  Direct Known Subclasses:
    LabelField

      public abstract class AbstractLabelField
      extends javax.swing.JLabel
      implements Field<java.lang.String>

  This is the abstract base class for all label display fields. The LabelField is basically not editable and thus not really an input field. Anyway it implements the Field interface to ensure common behavior with the other fields (thus it can be placed into and managed by a FieldPanel).
  Author:
    Rainer Buesch
  See Also:
    `LabelField`, `FieldPanel`, Serialized Form

- - ### Nested Class Summary

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

      `javax.swing.JLabel.AccessibleJLabel`

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

      `labelFor`

    - ### 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 javax.swing.SwingConstants

      `BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

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

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractLabelField(NlsDatabaseKey nls)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the content
    `java.lang.String` | `createValue()` Not actually used
    `javax.swing.JLabel` | `getJLabel()` Returns a JLabel component labeled with the translated field name.
    `java.lang.String` | `getLabel()` Returns the translated name for the field.
    `java.lang.String` | `getName()` Returns the unique name of the field.
    `NlsDatabaseKey` | `getNlsKey()` Returns the translation key used to name this Field
    `java.awt.Dimension` | `getPreferredSize()` Overridden for correct initial sizing.
    `java.lang.String` | `getStringValue()` Returns the field value as a String - or an empty String if the field is empty.
    `java.awt.Component` | `getUnitComponent()` Returns the unit component for this field if one is set
    `java.lang.String` | `getValue()` Returns the field value as an Object - or null if the field is empty.
    `AbstractLabelField` | `getWidget()` Returns a JComponent that represents the layoutable GUI component.
    `boolean` | `inputEquals(boolean value)` Tests if the field input is equal to the given boolean value.
    `boolean` | `inputEquals(double value)` Tests if the field input is equal to the given double number.
    `boolean` | `inputEquals(int value)` Tests if the field input is equal to the given int number.
    `boolean` | `inputEquals(java.lang.Object o)` Tests if the field input is equal to the given object.
    `boolean` | `isEmpty()` Tests if the field has input.
    `boolean` | `isLocked()` Tells wasCancelled the field is locked for editing.
    `boolean` | `isNotNull()` Tells wasCancelled the field requires input.
    `boolean` | `isPrimaryKey()` Tells whether this field is (or is part of) the primary key.
    `boolean` | `isRecordTypeField()` Tells whether this field defines the record type (only valid for composed persistent objects).
    `boolean` | `isStretchableX()` Tells whether this field should fill all the horizontal space in it's container.
    `boolean` | `isStretchableY()` Tells whether this field should fill all the vertical space in it's container.
    `void` | `setInsertDefaultValue()` Requests the field to search for insert-default values in the 'insert_defaults' database table.
    `void` | `setLocked(boolean isLocked)` Locks the field for editing.
    `void` | `setModifyFlag(ModifyFlag flag)` Gives the field a reference to a ModifyFlag which is set if the field was edited.
    `void` | `setNotNull(boolean isNotNull)` Sets the field to not-null.
    `void` | `setPrimaryKey(boolean isPk)` Tells this field to be the primary key (affects input checking).
    `void` | `setStretchableX(boolean isStretchableX)` Tells whether this field should fill all the horizontal space in it's container.
    `void` | `setStretchableY(boolean isStretchableY)` Tells whether this field should fill all the vertical space in it's container.
    `void` | `setUnitComponent(java.awt.Component comp)` Sets the unit component for this field which is placed behind the field, when the field is added to a FieldPanel
    `void` | `setUnitString(java.lang.String unit)` Sets the unit string for this field which is placed as a JLabel behind the field, when the field is added to a FieldPanel
    `void` | `setValue(NlsKey str, java.lang.Object... args)`
    `void` | `setValue(java.lang.String str)` Sets the field value to the given object.
    `java.lang.String` | `toString()` Returns a string representation of the field typically it's unique name and it's current value.
    `java.lang.String` | `toString(java.lang.Object o)` Converts the object to a String according to the policy of the affected field component.
    `java.lang.String` | `toValue(java.lang.Object o)` Tries to convert any object value to the target data type of this field.

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

      `checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, 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, 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, paintComponent, 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, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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

    - #### AbstractLabelField

          public AbstractLabelField(NlsDatabaseKey nls)

  - ### Method Detail

    - #### getNlsKey

          public NlsDatabaseKey getNlsKey()

      Description copied from interface: `Field`
      Returns the translation key used to name this Field
      Specified by:
        `getNlsKey` in interface `Field<java.lang.String>`

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `Field`
      Returns the unique name of the field. Usually the name should identify a database field in the format `table.column`.
      Specified by:
        `getName` in interface `Field<java.lang.String>`
      Overrides:
        `getName` in class `java.awt.Component`

    - #### getLabel

          public java.lang.String getLabel()

      Description copied from interface: `Field`
      Returns the translated name for the field. Translation is done through the class DBTranslation where a match for the field name must be found.
      Specified by:
        `getLabel` in interface `Field<java.lang.String>`
      See Also:
        `Translation`

    - #### getUnitComponent

          public java.awt.Component getUnitComponent()

      Description copied from interface: `Field`
      Returns the unit component for this field if one is set
      Specified by:
        `getUnitComponent` in interface `Field<java.lang.String>`
      See Also:
        `Field.setUnitComponent(Component)`

    - #### setUnitComponent

          public void setUnitComponent(java.awt.Component comp)

      Description copied from interface: `Field`
      Sets the unit component for this field which is placed behind the field, when the field is added to a FieldPanel
      Specified by:
        `setUnitComponent` in interface `Field<java.lang.String>`

    - #### setUnitString

          public void setUnitString(java.lang.String unit)

      Description copied from interface: `Field`
      Sets the unit string for this field which is placed as a JLabel behind the field, when the field is added to a FieldPanel
      Specified by:
        `setUnitString` in interface `Field<java.lang.String>`
      See Also:
        `Field.setUnitComponent(Component)`

    - #### getPreferredSize

          public java.awt.Dimension getPreferredSize()

      Overridden for correct initial sizing. Note that the label may get it's text after construction.
      Overrides:
        `getPreferredSize` in class `javax.swing.JComponent`

    - #### getWidget

          public AbstractLabelField getWidget()

      Description copied from interface: `Field`
      Returns a JComponent that represents the layoutable GUI component.
      Specified by:
        `getWidget` in interface `Field<java.lang.String>`

    - #### setValue

          public void setValue(NlsKey str,
                      java.lang.Object... args)

    - #### setValue

          public void setValue(java.lang.String str)

      Description copied from interface: `Field`
      Sets the field value to the given object. The implementation may be very different in different classes.
      Specified by:
        `setValue` in interface `Field<java.lang.String>`

    - #### createValue

          public java.lang.String createValue()
                                       throws InvalidFieldInputException

      Not actually used
      Specified by:
        `createValue` in interface `Field<java.lang.String>`
      Throws:
        `InvalidFieldInputException` - If the input Object cannot be created due to a parsing error.

    - #### getValue

          public java.lang.String getValue()

      Description copied from interface: `Field`
      Returns the field value as an Object - or null if the field is empty.
      Specified by:
        `getValue` in interface `Field<java.lang.String>`

    - #### getStringValue

          public java.lang.String getStringValue()

      Description copied from interface: `Field`
      Returns the field value as a String - or an empty String if the field is empty.
      Specified by:
        `getStringValue` in interface `Field<java.lang.String>`

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `Field`
      Tests if the field has input.
      Specified by:
        `isEmpty` in interface `Field<java.lang.String>`

    - #### toString

          public java.lang.String toString(java.lang.Object o)

      Description copied from interface: `Field`
      Converts the object to a String according to the policy of the affected field component. This is important for DecimalField and DateField which eventually use localized strings. Note that this method must return an empty string if the object cannot be parsed.
      Specified by:
        `toString` in interface `Field<java.lang.String>`

    - #### getJLabel

          public javax.swing.JLabel getJLabel()

      Description copied from interface: `Field`
      Returns a JLabel component labeled with the translated field name.
      Specified by:
        `getJLabel` in interface `Field<java.lang.String>`

    - #### setNotNull

          public final void setNotNull(boolean isNotNull)

      Description copied from interface: `Field`
      Sets the field to not-null. This causes the field to show up with a yellow background for indicating to the user that a value must be entered. If no value is entered the input check with isInputValid() will fail.
      Specified by:
        `setNotNull` in interface `Field<java.lang.String>`

    - #### setLocked

          public final void setLocked(boolean isLocked)

      Description copied from interface: `Field`
      Locks the field for editing.
      Specified by:
        `setLocked` in interface `Field<java.lang.String>`

    - #### isLocked

          public final boolean isLocked()

      Description copied from interface: `Field`
      Tells wasCancelled the field is locked for editing.
      Specified by:
        `isLocked` in interface `Field<java.lang.String>`

    - #### isNotNull

          public final boolean isNotNull()

      Description copied from interface: `Field`
      Tells wasCancelled the field requires input.
      Specified by:
        `isNotNull` in interface `Field<java.lang.String>`

    - #### inputEquals

          public boolean inputEquals(java.lang.Object o)

      Description copied from interface: `Field`
      Tests if the field input is equal to the given object.
      Specified by:
        `inputEquals` in interface `Field<java.lang.String>`

    - #### inputEquals

          public boolean inputEquals(int value)

      Description copied from interface: `Field`
      Tests if the field input is equal to the given int number.
      Specified by:
        `inputEquals` in interface `Field<java.lang.String>`

    - #### inputEquals

          public boolean inputEquals(double value)

      Description copied from interface: `Field`
      Tests if the field input is equal to the given double number.
      Specified by:
        `inputEquals` in interface `Field<java.lang.String>`

    - #### inputEquals

          public boolean inputEquals(boolean value)

      Description copied from interface: `Field`
      Tests if the field input is equal to the given boolean value.
      Specified by:
        `inputEquals` in interface `Field<java.lang.String>`

    - #### toString

          public java.lang.String toString()

      Description copied from interface: `Field`
      Returns a string representation of the field typically it's unique name and it's current value.
      Specified by:
        `toString` in interface `Field<java.lang.String>`
      Overrides:
        `toString` in class `java.awt.Component`

    - #### clear

          public void clear()

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

    - #### setInsertDefaultValue

          public void setInsertDefaultValue()

      Description copied from interface: `Field`
      Requests the field to search for insert-default values in the 'insert_defaults' database table. The field uses its own name as a key for the lookup. If an insert-default value is found, it will be displayed as a default value in this field.
      Specified by:
        `setInsertDefaultValue` in interface `Field<java.lang.String>`

    - #### setModifyFlag

          public void setModifyFlag(ModifyFlag flag)

      Description copied from interface: `Field`
      Gives the field a reference to a ModifyFlag which is set if the field was edited.
      Specified by:
        `setModifyFlag` in interface `Field<java.lang.String>`

    - #### setPrimaryKey

          public void setPrimaryKey(boolean isPk)

      Description copied from interface: `Field`
      Tells this field to be the primary key (affects input checking).
      Specified by:
        `setPrimaryKey` in interface `Field<java.lang.String>`

    - #### isPrimaryKey

          public boolean isPrimaryKey()

      Description copied from interface: `Field`
      Tells whether this field is (or is part of) the primary key.
      Specified by:
        `isPrimaryKey` in interface `Field<java.lang.String>`

    - #### isRecordTypeField

          public boolean isRecordTypeField()

      Description copied from interface: `Field`
      Tells whether this field defines the record type (only valid for composed persistent objects).
      Specified by:
        `isRecordTypeField` in interface `Field<java.lang.String>`

    - #### isStretchableX

          public boolean isStretchableX()

      Description copied from interface: `Field`
      Tells whether this field should fill all the horizontal space in it's container.
      Specified by:
        `isStretchableX` in interface `Field<java.lang.String>`

    - #### isStretchableY

          public boolean isStretchableY()

      Description copied from interface: `Field`
      Tells whether this field should fill all the vertical space in it's container.
      Specified by:
        `isStretchableY` in interface `Field<java.lang.String>`

    - #### setStretchableX

          public void setStretchableX(boolean isStretchableX)

      Description copied from interface: `Field`
      Tells whether this field should fill all the horizontal space in it's container.
      Specified by:
        `setStretchableX` in interface `Field<java.lang.String>`

    - #### setStretchableY

          public void setStretchableY(boolean isStretchableY)

      Description copied from interface: `Field`
      Tells whether this field should fill all the vertical space in it's container.
      Specified by:
        `setStretchableY` in interface `Field<java.lang.String>`

    - #### toValue

          public java.lang.String toValue(java.lang.Object o)

      Description copied from interface: `Field`
      Tries to convert any object value to the target data type of this field. An `IllegalArgumentException` is thrown when the type is not supported by the field.
      Specified by:
        `toValue` in interface `Field<java.lang.String>`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.