Class UITitlePane

All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, IComponent, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IUIComp, IUIContainer, IUIContextMenuOwner, IUIFocusComp, IUIBooleanSelectionComp, IUISelectionComp, IUIHTMLTextComponent, IUITextComponent, IVSComponentListener, IVSComponentState, IVSFieldListener, IVSGenericComponentListener, Cloneable
Direct Known Subclasses:
EUITitlePane

public class UITitlePane extends UIContainer implements IUIHTMLTextComponent, IUIBooleanSelectionComp
Title pane UI container: a foldable group box. A frame with a title bar at the top and the content below it, folded and unfolded by the user from the title bar (a click, Enter or Space) when it is collapsible, and by the server at any time.

The open state is the property open (absent = open), which is the selection of this component: a change fires @OnUISelection once, at the moment the state changes. When the component is connected to a VirtualSpace field ($vsField), the field holds the open state as a Boolean: true when open, false when folded; the field must be of the value type Boolean (the Designer verifies it). The title of the bar is setTitle(String).

Author:
Christopher Mindus
  • Field Details

    • PN_SELECTED

      public static final String PN_SELECTED
      Property name: selected BoolProp.
      See Also:
    • SELECTED_ATOM

      public static final Atom SELECTED_ATOM
      Property atom: selected BoolProp.
  • Constructor Details

    • UITitlePane

      public UITitlePane()
      Creates the container without name with a null value.
    • UITitlePane

      public UITitlePane(Atom propertyAtom)
      Creates the container with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • UITitlePane

      public UITitlePane(Atom propertyAtom, GProp<?>[] properties) throws PropException
      Creates the container with the specified name and properties.
      Parameters:
      propertyAtom - the property atom.
      properties - the property array value for the UIPanel.
      Throws:
      PropException - when properties are not correctly defined.
  • Method Details

    • clone

      public UITitlePane clone()
      Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.

      Cloning is used for "virtualization" of a property tree in the server. Client property classes will therefore throw CloneNotSupportedException.

      Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set. All children properties are also (deep) cloned.

      Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!

      Overrides:
      clone in class UIContainer
    • getSelectionPropAtom

      public Atom getSelectionPropAtom()
      Returns the selection property atom for verification of selection changes.

      This method is used by the framework in UIComp to fire selection events when the property value changes.

      Specified by:
      getSelectionPropAtom in interface IUISelectionComp
      Returns:
      The atom of the selection property.
    • getSelectionListenerHandler

      public GenericListener<IUISelectionListener> getSelectionListenerHandler(boolean doCreate)
      Returns the generic selection listener.
      Specified by:
      getSelectionListenerHandler in interface IUISelectionComp
      Parameters:
      doCreate - Create the listener handler if it doesn't exist, false not to.
      Returns:
      The selection listener handler, or null if not created.
    • getDeviceType

      public final int getDeviceType()
      Gets the device type: -1=mobile, 0=both, 1=desktop.
      Specified by:
      getDeviceType in interface IUIComp
      Overrides:
      getDeviceType in class UIContainer
    • isMobileContextMenuSupported

      public boolean isMobileContextMenuSupported()
      Returns if the component can show the context menu in mobile mode.
      Specified by:
      isMobileContextMenuSupported in interface IUIContextMenuOwner
      Overrides:
      isMobileContextMenuSupported in class UIContainer
      Returns:
      Title pane component supports context menus for mobile.
    • hasImplicitAlignFillX

      public boolean hasImplicitAlignFillX()
      Returns if the component has implicit component horizontal fill.
      Overrides:
      hasImplicitAlignFillX in class UIContainer
      Returns:
      Always true: true means component will always fill the space in X.
    • hasImplicitAlignFillY

      public boolean hasImplicitAlignFillY()
      Returns if the component has implicit component vertical fill.

      A group box has the height of its title bar and its content, the title bar alone when folded: it never fills the space in Y, whereas it always fills the space in X.

      Overrides:
      hasImplicitAlignFillY in class UIContainer
      Returns:
      Always false.
    • getSelectionType

      public int getSelectionType()
      Gets the selection type of the component.

      Note: selection state for the title pane is the same as the opened or unfolded container.

      Specified by:
      getSelectionType in interface IUISelectionComp
      Returns:
      A value indicating the selection capability as the SELECTION_TYPE_* values define.
    • isSelected

      public boolean isSelected()
      Returns the selection state.
      Specified by:
      isSelected in interface IUIBooleanSelectionComp
      Specified by:
      isSelected in interface IUISelectionComp
      Returns:
      true if selected, false if unselected.
    • isUnselected

      public boolean isUnselected()
      Returns if the selection is not set.

      Note: selection state for the title pane is the same as the opened or unfolded container.

      Specified by:
      isUnselected in interface IUIBooleanSelectionComp
      Returns:
      true if unselected, false if selected.
    • isON

      public boolean isON()
      Returns if the selection is "on".

      Note: selection state for the title pane is the same as the opened or unfolded container.

      Specified by:
      isON in interface IUIBooleanSelectionComp
      Returns:
      true if on, false if off.
    • isOFF

      public boolean isOFF()
      Returns if the selection is "off".

      Note: selection state for the title pane is the same as the opened or unfolded container.

      Specified by:
      isOFF in interface IUIBooleanSelectionComp
      Returns:
      true if off, false if on.
    • setSelection

      public boolean setSelection(boolean isSelected)
      Sets the selection.

      Note: selection state for the title pane is the same as the opened or unfolded container.

      The program may fold a pane that is not collapsible (collapsable false): the user then has no way to unfold it, which is the program's choice.

      Specified by:
      setSelection in interface IUIBooleanSelectionComp
      Parameters:
      isSelected - The selected state.
      Returns:
      true if state is changed, false for no change.
    • getSelection

      public BooleanSelection getSelection()
      Gets the current selection of the component.

      Note: selection state for the title pane is the same as the opened or unfolded container.

      Specified by:
      getSelection in interface IUISelectionComp
      Returns:
      The current selection of the component.
    • onSelectionChanged

      protected void onSelectionChanged(GEvent event)
      Method called when the selection of the component changed due to a property change (value changed, property added or removed): the open state is set to the VirtualSpace field, if any.
      Overrides:
      onSelectionChanged in class UIContainer
      Parameters:
      event - The event that causes the selection change.
    • setOpenStateToVSField

      public int setOpenStateToVSField(VSField field)
      Sets the open state of this pane to its VirtualSpace field: true when open, false when folded.
      Parameters:
      field - The VS field that will be updated, null for none.
      Returns:
      1 for update completed, 0 for nothing done and -1 for error occurred.
    • onValueChanged

      public void onValueChanged(VSField field, Value value, GProp<?> trigger, IPostEventProcessing postProcessing)
      Called when the field value is set: the pane is unfolded when the field is true, folded when it is false; a null value leaves the pane as it is.
      Specified by:
      onValueChanged in interface IVSFieldListener
      Overrides:
      onValueChanged in class UIComp
      Parameters:
      field - The VS field.
      value - The value, never null, but value.isNull() could be true.
      trigger - The trigger property that may be null.
      postProcessing - Post-processing instance.
    • setTitle

      public boolean setTitle(String str)
      Sets the title of the pane: the text of its title bar, shown whatever the tooltip says. The text set with UIComp.setText(String) is not shown by the pane.
      Overrides:
      setTitle in class UIComp
      Parameters:
      str - The title.
      Returns:
      true for value changed, false for no change.
    • setTitle

      public boolean setTitle(KString str)
      Sets the title of the pane: the text of its title bar, shown whatever the tooltip says.
      Overrides:
      setTitle in class UIComp
      Parameters:
      str - The KString title.
      Returns:
      true for value changed, false for no change.
    • setTitle

      public boolean setTitle(PlainKString str)
      Sets the title of the pane: the text of its title bar, shown whatever the tooltip says.
      Overrides:
      setTitle in class UIComp
      Parameters:
      str - The plain KString title.
      Returns:
      true for value changed, false for no change.
    • onPrepare

      protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, List<Throwable> errors) throws PropException
      Called when the application is being prepared. The order of onPrepare calls is always parent first, the children. The method is called twice, first time with isPostCall set to false, then a second time with true.
      Overrides:
      onPrepare in class UIComp
      Parameters:
      appOwner - The application owner.
      moduleOwner - The Module owner.
      isPostCall - Flag indicating this is a post-call.
      errors - A list of errors that occurred but did not cause an abort.
      Throws:
      PropException - For property errors during the application preparation to need to abort.
    • getOnUISelectionMethod

      public Method getOnUISelectionMethod()
      Returns the method to use for onUISelection notifications that is attached to this selection component. The method name is not important, but must have the annotation and signature:

      @OnUISelection(name = "some/property")
      public void onUISelection(UISelectionEvent event)

      Specified by:
      getOnUISelectionMethod in interface IUISelectionComp
      Returns:
      The method, or null if none is registered.