Class VSColumnHeader

All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, ICustomDataProvider, IGProp<GProp<?>[]>, IPatternOwner, IPropCnr, IVSComponent, IVSComponentListener, IVSComponentState, IVSMessageComponent, Cloneable
Direct Known Subclasses:
EditorVSColumnHeader

public class VSColumnHeader extends VSComponent implements IVSMessageComponent, IPatternOwner
The VirtualSpace Column Header property class holds the property name, value and optionally has a parent and/or property listener(s).
Author:
Christopher Mindus
  • Field Details

    • EMPTY_LISTENERS

      public static final IVSColumnListener[] EMPTY_LISTENERS
      Empty list of listeners.
    • EMPTY_CELLS

      public static final VSField[] EMPTY_CELLS
      Empty cells.
  • Constructor Details

    • VSColumnHeader

      public VSColumnHeader()
      Creates a VirtualSpace Column Header property with the specified name with a null value.
    • VSColumnHeader

      public VSColumnHeader(Atom propertyAtom)
      Creates a VirtualSpace Column Header property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
  • Method Details

    • clone

      public VSColumnHeader clone()
      Clones the VirtualSpace Column Header.
      Overrides:
      clone in class VSComponent
    • getComponentIsHidden

      public String getComponentIsHidden()
      Gets the focus message for "Component is hidden" but for the component in question.
      Specified by:
      getComponentIsHidden in class VSComponent
    • getComponentIsDisabled

      public String getComponentIsDisabled()
      Gets the focus message for "Component is hidden" but for the component in question.
      Specified by:
      getComponentIsDisabled in class VSComponent
    • shouldIgnoreFocusFromUI

      public boolean shouldIgnoreFocusFromUI()
      Checks if this component should ignore focus requests from the UI. This component is still focusable programmatically, but not from the UI.
      Specified by:
      shouldIgnoreFocusFromUI in interface IVSComponent
      Returns:
      true to ignore focus from UI, false for default processing.
    • getActors

      public FieldActors getActors()
      Gets the field actors container.
      Returns:
      The field actors for this field if the field is located in the VirtualSpace or in a VirtualSpace group, otherwise the table column field actors if inside a table.
    • createFieldActors

      protected FieldActors createFieldActors()
      Creates a new instance of the field actors, overridden for the Editor.
    • addPredefinedProps

      protected void addPredefinedProps() throws PropException
      Adds the predefined properties for this container. This method is called once just after construction of the property container and sometimes population of it.

      The method should add properties to create or get reference to using the maybeAddProp method. When the PropCnr instance is cloned, the method getPredefinedProps() is called in order for the subclass to be able to retrieve the new instances to these properties, if stored in instance variables.

      Overrides:
      addPredefinedProps in class PropCnr
      Throws:
      PropException - for property exceptions.
    • getPredefinedProps

      protected void getPredefinedProps()
      Gets potential references to predefined properties for this container. This method is called once just after cloning of the property container.

      The method should get reference to using the getProp(...) methods. This allows the subclass to be able to retrieve the new instances to the properties created during addPredefinedProps() if stored in instance variables.

      Overrides:
      getPredefinedProps in class PropCnr
    • onParentStateChanged

      public void onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean stateValue)
      Invokes the parent state notification function for the component.
      Specified by:
      onParentStateChanged in interface IVSComponentListener
      Parameters:
      parent - The parent who's state was changed.
      state - The state that changed.
      stateValue - The new state value.
    • addListener

      public boolean addListener(IVSColumnListener listener)
      Adds a new listener to the VS table column.
      Parameters:
      listener - The listener for VS table column events.
      Returns:
      true for success, false if the listener already is added.
    • removeListener

      public boolean removeListener(IVSColumnListener listener)
      Removes a listener from the VS table column.
      Parameters:
      listener - The existing listener for VS table column events.
      Returns:
      true for success, false if the listener has not been added.
    • onListenerChanged

      protected void onListenerChanged(IVSColumnListener listener)
      Called when a listener is added or removed. This method is overridden by the Designer to update connections.
    • getColumnListeners

      public IVSColumnListener[] getColumnListeners()
      Gets the listeners of the VS table column events.
      Returns:
      A cached array of listeners for the value, retrieved without synchronization if possible.
    • createEmptyValue

      public Value createEmptyValue()
      Creates an empty Value for the column type. It is null if null is allowed, otherwise the default value depending on the column value type. If column value type is unassigned (can only happen in the Designer), a String is the fall-back type.
      Returns:
      A Value instance, never null (although the Value instance itself may be a null Value).
    • createUninitializedField

      public VSField createUninitializedField()
      Creates a new UNNAMED uninitialized field.
    • createUninitializedField

      public VSField createUninitializedField(Atom fieldName)
      Creates a new uninitialized field.
      Parameters:
      fieldName - The field name.
    • createEmptyField

      public VSField createEmptyField()
      Creates an empty field for this column, depending on defined types, null attributes, etc. If the column value type is not set, a default String field value is used. If null is not allowed for the column, a default value of the value type is set.
      Returns:
      A new UNNAMED field property.
    • createEmptyField

      public VSField createEmptyField(Atom fieldName)
      Creates an empty field for this column, depending on defined types, null attributes, etc. If the column value type is not set, a default String field value is used. If null is not allowed for the column, a default value of the value type is set.
      Parameters:
      fieldName - The field name.
      Returns:
      A new field property.
    • getColumnIndex

      public int getColumnIndex()
      Gets the column index of this column header in the table.
      Returns:
      The column index, or -1 if the column header is not inside a table.
    • getValueTypeString

      public String getValueTypeString()
      Gets the value type string of the column.
      Returns:
      The String type as Enum.name(), or "<undefined>" if not defined.
    • getValueType

      public Value.Type getValueType()
      Gets the value type of the column.
      Specified by:
      getValueType in interface IPatternOwner
      Returns:
      The type as Value.T_* values, or -1 if not defined.
    • isValueTypeValid

      public boolean isValueTypeValid()
      Verifies if the value type is defined and valid.
      Returns:
      true if valid, false otherwise.
    • setNullAllowed

      public boolean setNullAllowed(boolean isNullable)
      Sets the column nullable flag.
      Parameters:
      isNullable - The nullable flag.
      Returns:
      true for changed, false for no change.
    • isNullAllowed

      public boolean isNullAllowed()
      Checks if the column is nullable.
      Returns:
      The nullable flag, true by default.
    • getPatternProp

      public PatternProp getPatternProp()
      Gets the pattern property.
      Specified by:
      getPatternProp in interface IPatternOwner
      Returns:
      The pattern property, or null for none.
    • getPattern

      public String getPattern()
      Gets the pattern used by the value formatter. This method will resolve the pattern if the pattern PlainKString contains tags.
      Returns:
      The pattern, null for none.
    • getPatternPlainKString

      public PlainKString getPatternPlainKString()
      Gets the pattern used by the value formatter.
      Returns:
      The pattern, null for none.
    • getTable

      public VSTable getTable()
      Gets the table of the header.
      Returns:
      The VirtualSpace Table instance, or null if header is not added to a table.
    • setCells

      public int setCells(VSCellData[] cells)
      Sets an entire column of cells at once. The table is adjusted to fit the column cell height if it increases the amount of rows. Conversion of cell data is done for each value to match the value type defined in the column.

      Failure will occur if the column value type is not defined.

      Parameters:
      cells - The cells to set.
      Returns:
      The count of successful cells set. Logging is done for failures.
    • getCells

      public VSField[] getCells()
      Gets the cells of the column in the table.

      If empty cells (i.e. null or not present) are encountered in the column, an empty cells is created without atom name (atom name is null).

      Returns:
      An array of cells.