Interface IUIComp

    • Method Detail

      • 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​(java.lang.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​(java.lang.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

        java.util.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

        java.lang.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

        java.lang.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.
      • getUIRef

        default @UIRef java.lang.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:
        java.lang.IllegalStateException - If the UI component tree is invalid.
      • getPanelUIComponent

        default <COMP extends UIComp> COMP getPanelUIComponent​(@UIRef java.lang.String uiPath,
                                                               java.lang.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 java.lang.String uiPath,
                                                                   java.lang.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​(java.lang.String name,
                                                               java.lang.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​(java.lang.String name,
                                                                   java.lang.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​(java.lang.String name,
                                                                        java.lang.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​(java.lang.String name,
                                                                            java.lang.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.