Interface IUIComp

All Superinterfaces:
IComponent, ICustomDataProvider, IGProp<GProp<?>[]>, IMessageBox, IPropCnr, IVSComponentListener, IVSComponentState, IVSFieldListener
All Known Subinterfaces:
IContentItem, IEUIComp, IEUICompCommon, IEUIContainer, IEUIPanel, IUIAction, IUIAnimatedSingleIndexedSelectionComp, IUIBooleanSelectionComp, IUICellSelectionComp, IUICheck2Component, IUICheckComponent, IUICompRelativeTarget, IUIContainer, IUIDateTimeComponent, IUIDateValueComponent, IUIDoubleRangeValueComponent, IUIDoubleValueComponent, IUIHint, IUIIndexedSelectionComp, IUILabelForTarget, IUINullableValueComponent, IUIRadioComponent, IUISelectionComp, IUISingleIndexedSelectionComp, IUITimeValueComponent, IUITriStateSelectionComp, IUIValueComponent
All Known Implementing Classes:
AbstractContentUIContainer, AbstractUIAction, CalendarEvent, ECalendarEvent, EMapMarkerProp, EMapMarkers, EMLGroup, EMList, EMLItemProp, EMUIHeading, EMUISimpleDialog, EMUISwitch, EMUITabBar, EUIAccordion, EUIButton, EUICalendar, EUICalendarList, EUIChart, EUICheckBox, EUICheckedMenuItem, EUIComboBox, EUIContainer, EUIContextMenu, EUIDateTime, EUIDialog, EUIEmpty, EUIGauge, EUIImage, EUIImage2, EUILabel, EUIMap, EUIMedia, EUIMenu, EUIMenuBar, EUIMenuItem, EUIMenuSeparator, EUIOutput, EUIPanel, EUIPanelPart, EUIPanelPartCnr, EUIProgress, EUIRadioButton, EUIRadioMenuItem, EUISlider, EUISpinner, EUISwapContainer, EUITabContainer, EUITable, EUITableColumn, EUIText, EUITextArea, EUITitlePane, MapMarkerProp, MapMarkers, MLGroup, MList, MLItemProp, MUIHeading, MUISimpleDialog, MUISwitch, MUITabBar, UIAbstractListChoice, UIAccordion, UIButton, UICalendar, UICalendarList, UIChart, UICheckBox, UICheckedMenuItem, UIComboBox, UIComp, UIContainer, UIContextMenu, UIDateTime, UIDialog, UIEmpty, UIGauge, UIImage, UIImage2, UILabel, UIMap, UIMedia, UIMenu, UIMenuBar, UIMenuItem, UIMenuSeparator, UIOutput, UIPanel, UIPanelBase, UIPanelPart, UIPanelPartCnr, UIProgress, UIRadioButton, UIRadioMenuItem, UISlider, UISpinner, UISwapContainer, UITabContainer, UITable, UITableColumn, UIText, UITextArea, UITitlePane

public interface IUIComp extends IComponent, IVSFieldListener, ICustomDataProvider
The interface for the UIComp class is the basic implementation of a single user interface component.

The component has a data container that is not persistent, i.e. is not written e.g. to disk.

Author:
Christopher Mindus
  • Field Details

  • Method Details

    • getDeviceType

      int getDeviceType()
      Gets the device type: -1=mobile, 0=both, 1=desktop.
    • isMobile

      boolean isMobile()
      Checks if the panel is of mobile type.
      Returns:
      true if panel is found and it's mobile.
    • getFixWidth

      int getFixWidth()
      Gets the designed fixed width of this component in pixels.
      Returns:
      Zero (default) for not fixed.
    • getFixHeight

      int getFixHeight()
      Gets the designed fixed height of this component in pixels.
      Returns:
      Zero (default) for not fixed.
    • getComponentID

      int getComponentID()
      Creates or gets the unique ID within the panel for a component. This ID can be used as the HTML ID and is used by the LabelForReference.
      Returns:
      A unique number for a component in a panel.
    • getLayout

      LayoutProp getLayout()
      Gets the layout properties of this component. If the properties are not present, they are created.
      Returns:
      The layout properties.
    • getLayoutMgr

      <LAYOUT_MGR extends LayoutMgr<?>> LAYOUT_MGR getLayoutMgr(Class<LAYOUT_MGR> layoutMgrClass)
      Gets the layout manager for the component.
      Parameters:
      layoutMgrClass - The class of the layout manager.
      Returns:
      the layout manager instance, or null if none is set.
    • isRTL

      boolean isRTL()
      Returns if the component is displayed in RTL or not.
    • getValue

      Value getValue(String name)
      Gets the value from a property named name.
      Parameters:
      name - The name of the property.
      Returns:
      The Value for the property with the specified name, or null if not found.
    • getValue

      Value getValue(Atom atom)
      Gets the value from a property named atom.
      Parameters:
      atom - The atom name of the property.
      Returns:
      The Value for the property with the specified name, or null if not found.
    • getVirtualSpace

      VirtualSpace getVirtualSpace()
      Gets the VirtualSpace of the UI component.
      Returns:
      The VirtualSpace, or null for none.
    • getVSField

      VSField getVSField()
      Gets the connected or disconnected VirtualSpace Field.
      Returns:
      The field, or null if no field resolved (connected or disconnected) is present.
    • isVSFieldDisconnected

      boolean isVSFieldDisconnected()
      Checks if the connection state to the VirtualSpace Field is disconnected.
      Returns:
      true if currently disconnected.
    • disconnectVSField

      boolean disconnectVSField()
      Disconnects from the VirtualSpace Field connection.
      Returns:
      true for success, false if already done or none is connected.
    • reconnectVSField

      boolean reconnectVSField(boolean update)
      Reconnects to a previously disconnected VirtualSpace Field connection.

      The method setVSFieldToComponent(VSField) is called if there was a disconnected field set.

      Parameters:
      update - Update flag, i.e. if all states, messages and field contents should be updated to match the field.
      Returns:
      true for success, false if not disconnected.
    • getComponentMappings

      List<VSComponent> getComponentMappings()
      Gets the mappings to VSComponent's for this component.

      The VS components are sorted for the deepest first.

      Returns:
      An unmodifiable set of VSComponent's, or null for no VS mappings.
    • setVSFieldToComponent

      void setVSFieldToComponent(VSField field)
      Method called when a VirtualSpace Field is resolved or when reconnection is done. Override to provide additional processing. By default all states (enabled, read-only and visible), message and field contents are set from the field to the component.
      Parameters:
      field - The VS field.
    • setVSFieldMessageToComponent

      boolean setVSFieldMessageToComponent(VSField field, boolean clear)
      Sets the VirtualSpace Field's message to this component.
      Parameters:
      field - The VS field.
      clear - Flag to clear the component message if the field hasn't got a message.
      Returns:
      true if changed, false for no change.
    • canAcceptUIContainerFocus

      String canAcceptUIContainerFocus()
      Returns if this container can accept focus itself or for one of its children components. If this is a component and not a container, this request is redirected to the parent container.

      This method recurses up to the topmost UI container, and all containers must return null for this method to return null.

      Typically, a container returns itself as instance if it is disabled or hidden.

      Returns:
      null if this container (or parent container if this is a component) and all containers up to the topmost level returns null, otherwise an error message why the container that did not accept focus.
    • setUIContainerFocus

      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!

      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.
    • setComponentToVSField

      int setComponentToVSField()
      Sets the text or value from this text or value component to its VirtualSpace Field, if any.
      Returns:
      1 for update completed, 0 for nothing done and -1 for error occurred.
    • getErrorMessage

      KString getErrorMessage(ValueConversionException exception) throws KStringException
      Gets the localized error message for a validation exception.
      Parameters:
      exception - The exception.
      Returns:
      The error message, e.g. to display in the component.
      Throws:
      KStringException - For exceptions formatting a HTML string.
    • getErrorMessage

      KString getErrorMessage(ILocaleString localeString, ValueConversionException exception) throws KStringException
      Gets the localized error message for a validation exception.
      Parameters:
      localeString - The localeString instance to used for localization, or null to look it up for the current session.
      exception - The exception.
      Returns:
      The error message, e.g. to display in the component.
      Throws:
      KStringException - For exceptions formatting a HTML string.
    • setErrorMessage

      void setErrorMessage(ValueConversionException exception)
      Transposes an exception from conversion to the component as an error message.
      Parameters:
      exception - The exception, or null to remove it.
    • setErrorMessage

      void setErrorMessage(ILocaleString localeString, ValueConversionException exception)
      Transposes an exception from conversion to the component as an error message.
      Parameters:
      localeString - The localeString instance to used for localization, or null to look it up for the current session.
      exception - The exception, or null to remove it.
    • getCSSClassNames

      List<String> getCSSClassNames()
      Gets the current CSS class names assigned to this component.
      Returns:
      null for none, or the class names separated by spaces.
    • setCSSClassNames

      boolean setCSSClassNames(Collection<String> cssNames) throws IllegalArgumentException, PropException
      Assigns a new collection of class names to the component. Use
      invalid @link
      {@link Collections.emptyList()
      } if you wish to remove all the class names.

      A valid CSS class name consists of a string with the characters 'a-z', 'A-Z', '0-9' or '-_' and cannot start with a digit.

      Parameters:
      cssNames - A collection of Strings for the class names.
      Returns:
      true if modified, false for no change.
      Throws:
      IllegalArgumentException - If one of the class names are invalid.
      PropException - If there was a property error setting the class names.
    • setCSSClassNames2

      boolean setCSSClassNames2(Collection<String> cssNames) throws IllegalArgumentException
      Assigns a new collection of class names to the component. Use
      invalid @link
      {@link Collections.emptyList()
      } if you wish to remove all the class names.

      A valid CSS class name consists of a string with the characters 'a-z', 'A-Z', '0-9' or '-_' and cannot start with a digit.

      This method is the same as calling setCSSClassNames(java.util.Collection<java.lang.String>) but with a try-catch that logs a warning message in case the PropException occurs and then returns false

      Parameters:
      cssNames - A collection of Strings for the class names.
      Returns:
      true if modified, false for no change.
      Throws:
      IllegalArgumentException - If one of the class names are invalid.
    • getUIRef

      default @UIRef String getUIRef()
      Gets the @UIRef path to this component. This path is relative the panel or context menu that is located in the Panel Module directory.

      This @UIRef path can be used with the getPanelUIComponent(String,Class) or getPanelUIComponentNull(String,Class).

      Returns:
      The @UIRef path to the component, or empty string for top-level panel or context menu.
      Throws:
      IllegalStateException - If the UI component tree is invalid.
    • getPanelUIComponent

      default <COMP extends UIComp> COMP getPanelUIComponent(@UIRef String uiPath, Class<COMP> uiClass) throws NotFoundException
      Gets a UI component by UI path reference from the panel.

      Note: A UI path is not the same as a property path, it omits the UI container UIComps instance from the path.

      Parameters:
      uiPath - The UI path for the component.
      uiClass - The UI class of the component.
      Returns:
      The component, never null.
      Throws:
      NotFoundException - The not-found exception is thrown if the component is not found instead of returning null.
    • getPanelUIComponentNull

      default <COMP extends UIComp> COMP getPanelUIComponentNull(@UIRef String uiPath, Class<COMP> uiClass)
      Gets a UI component by UI path reference from the panel.

      Note: A UI path is not the same as a property path, it omits the UI container UIComps instance from the path.

      Parameters:
      uiPath - The UI path for the component.
      uiClass - The UI class of the component.
      Returns:
      The component, or null if not found.
    • getFirstUIComponent

      default <COMP extends UIComp> COMP getFirstUIComponent(String name, Class<COMP> uiClass) throws NotFoundException
      Gets the first UI component of the specified name and UI class. The search for the component is done from the panel root and searches all its children containers recursively.
      Parameters:
      name - The name of the component.
      uiClass - The UI class of the component.
      Returns:
      The component, never null.
      Throws:
      NotFoundException - The not-found exception is thrown if the component is not found instead of returning null.
    • getFirstUIComponentNull

      default <COMP extends UIComp> COMP getFirstUIComponentNull(String name, Class<COMP> uiClass)
      Gets the first UI component of the specified name and UI class. The search for the component is done from the panel root and searches all its children containers recursively.
      Parameters:
      name - The name of the component.
      uiClass - The UI class of the component.
      Returns:
      The component, or null if not found.
    • getContainerFirstUIComponent

      default <COMP extends UIComp> COMP getContainerFirstUIComponent(String name, Class<COMP> uiClass) throws NotFoundException
      Gets the first UI component of the specified name and UI class. The search for the component is done from this UI container, and if this is a UI component, from its parent UI container. Then all children UI containers and components are searched recursively down the component tree.
      Parameters:
      name - The name of the component.
      uiClass - The UI class of the component.
      Returns:
      The component, never null.
      Throws:
      NotFoundException - The not-found exception is thrown if the component is not found instead of returning null.
    • getContainerFirstUIComponentNull

      default <COMP extends UIComp> COMP getContainerFirstUIComponentNull(String name, Class<COMP> uiClass)
      Gets the first UI component of the specified name and UI class. The search for the component is done from this UI container, and if this is a UI component, from its parent UI container. Then all children UI containers and components are searched recursively down the component tree.
      Parameters:
      name - The name of the component.
      uiClass - The UI class of the component.
      Returns:
      The component, or null if not found.