Class UITabContainer

All Implemented Interfaces:
EventListener, IFocusComp, IMessageBox, IComponent, ICustomDataProvider, IGProp<GProp<?>[]>, IPropCnr, IUIComp, IUIContainer, IUIContextMenuOwner, IUIFocusComp, IUIGroupSeparator, IUIAnimatedSingleIndexedSelectionComp, IUIIndexedSelectionComp, IUISelectionComp, IUISingleIndexedSelectionComp, IVSComponentListener, IVSComponentState, IVSFieldListener, IVSGenericComponentListener, Cloneable
Direct Known Subclasses:
EUITabContainer

public class UITabContainer extends UIContainer implements IUIAnimatedSingleIndexedSelectionComp, IUIGroupSeparator
UI tab container.
Author:
Christopher Mindus
  • Field Details

    • PN_OPEN_TAB

      protected static final String PN_OPEN_TAB
      Property name: current open part.
      See Also:
    • OPEN_TAB_ATOM

      protected static final Atom OPEN_TAB_ATOM
      Property atom: current open part.
    • TABS_STYLES_NAME

      protected static final String TABS_STYLES_NAME
      Name of the tabs styles.
      See Also:
    • TABS_STYLES_ATOM

      protected static final Atom TABS_STYLES_ATOM
      Atom of the tabs styles.
  • Constructor Details

    • UITabContainer

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

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

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

    • clone

      public UITabContainer 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.
    • createTabsStyles

      protected Styles createTabsStyles()
      Creates the Tabs Styles container (can be overridden by Designer to create EditorStyles).
    • 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 UIContainer
      Throws:
      PropException - for property exceptions.
    • 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
    • mustHaveWidth

      public boolean mustHaveWidth()
      Does this component require a width?
      Overrides:
      mustHaveWidth in class UIContainer
      Returns:
      true if the width must be defined and non-zero, false otherwise.
    • mustHaveHeight

      public boolean mustHaveHeight()
      Does this component require a height?
      Overrides:
      mustHaveHeight in class UIContainer
      Returns:
      true if the height must be defined and non-zero, false otherwise.
    • mustHaveExplicitWidth

      public boolean mustHaveExplicitWidth()
      Does this component require an explicitly defined width?
      Overrides:
      mustHaveExplicitWidth in class UIComp
      Returns:
      true if the width must be defined and non-zero, false otherwise.
    • mustHaveExplicitHeight

      public boolean mustHaveExplicitHeight()
      Does this component require an explicitly defined height?
      Overrides:
      mustHaveExplicitHeight in class UIComp
      Returns:
      true if the height must be defined and non-zero, false otherwise.
    • 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.
      Overrides:
      hasImplicitAlignFillY in class UIContainer
      Returns:
      Always: true means component will always fill the space in Y.
    • canAlignX

      public boolean canAlignX()
      Returns if the component can be aligned left, right, center, or horizontal fill.
      Overrides:
      canAlignX in class UIComp
      Returns:
      false, grid takes up entire width.
    • canAlignY

      public boolean canAlignY()
      Returns if the component can be aligned top, bottom, middle or vertical fill.
      Overrides:
      canAlignY in class UIComp
      Returns:
      false, grid takes up entire height.
    • isContextMenuSupported

      public boolean isContextMenuSupported()
      Returns if the context menu is supported for this component or not.
      Specified by:
      isContextMenuSupported in interface IUIContextMenuOwner
      Returns:
      false as the Tab Container does not support context menus.
    • getGroupID

      public int getGroupID(GroupNameProp groupName)
      Gets the unique ID for a group name.
      Specified by:
      getGroupID in interface IUIGroupSeparator
      Parameters:
      groupName - The group name. Return The unique for the group name.
    • getSelectionType

      public int getSelectionType()
      Gets the selection type of the component.
      Specified by:
      getSelectionType in interface IUISelectionComp
      Returns:
      A value indicating the selection capability as the SELECTION_TYPE_* values define.
    • getSelectedIndex

      public int getSelectedIndex()
      Gets the first selected index.
      Specified by:
      getSelectedIndex in interface IUISingleIndexedSelectionComp
      Returns:
      The first index in the current selection, or -1 for none.
    • isAnimated

      public boolean isAnimated()
      Returns the animation flag.
      Specified by:
      isAnimated in interface IUIAnimatedSingleIndexedSelectionComp
      Returns:
      If the selection is done with animation or not.
    • setSelection

      public String setSelection(int index, boolean isAnimated)
      Sets the selection as a single selected item at specified index.
      Specified by:
      setSelection in interface IUIAnimatedSingleIndexedSelectionComp
      Parameters:
      index - The single item to select at index, -1 to clear the selection.
      isAnimated - The animation flag.
      Returns:
      null for success, otherwise an error message why the selection failed.
    • isSelected

      public boolean isSelected()
      Returns the selection of state of the component.

      For a multiple-selection capable component, this indicates any selection, i.e. true is returned as soon as at least one element is selected, false for none.

      The checkbox for example has two "selected states": checked and third state: in this case, true is returned for the third state as well as the checked state.

      Specified by:
      isSelected in interface IUISelectionComp
      Returns:
      true if the component is selected, false otherwise.
    • clearSelection

      public String clearSelection()
      Clear the selection.
      Specified by:
      clearSelection in interface IUIIndexedSelectionComp
      Returns:
      Always "Accordion cannot clear selection".
    • getSelection

      public AnimatedSingleIndexSelection getSelection()
      Gets the current selection of the component.
      Specified by:
      getSelection in interface IUISelectionComp
      Returns:
      The current selection of the component.
    • setUIContainerFocus

      public String setUIContainerFocus(UIComp requestor, boolean doAnimate)
      Sets the focus to the UI container and all its parents. This method is called when focus is to be set to a component, making it possible for containers such as accordion/swap/tab to change its main container into view.

      Subclasses must override this method to process it, but make sure to call super.setUIContainerFocus(requestor) first!

      Specified by:
      setUIContainerFocus in interface IUIComp
      Overrides:
      setUIContainerFocus in class UIContainer
      Parameters:
      requestor - The requestor is a child to this container.
      doAnimate - Flag to enable animation when selection is changed for e.g. accordion, swap or tab containers.
      Returns:
      null for success, otherwise an error message why it failed.
    • onPrepare

      protected void onPrepare(ClassReference cr, List<Throwable> errors)
      Called to resolve methods for the component from main "onPrepare" once the ClassReference has been found.

      Components should override this method to load it's required methods.

      Overrides:
      onPrepare in class UIComp
      Parameters:
      cr - The class reference with a valid reference.
      errors - The list of errors that is returned to the caller in case resolving fails.
    • 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.