Class UIPanelBase

    • Field Detail

      • EMPTY_ARRAY

        public static final UIPanelBase[] EMPTY_ARRAY
        An empty panel array.
      • VS_BACK_PROP_NAME

        public static final java.lang.String VS_BACK_PROP_NAME
        The property name of the VS Back action: "vsBack".
        See Also:
        Constant Field Values
      • PP_REPLACE_ALL

        public static final int PP_REPLACE_ALL
        How to process pop-up panels when this panel is virtualized: 0 = replace all panels with this one.
        See Also:
        Constant Field Values
      • PP_REPLACE_ALL_POPUPS

        public static final int PP_REPLACE_ALL_POPUPS
        How to process pop-up panels when this panel is virtualized: 1 = replace all pop-up panels with this one.
        See Also:
        Constant Field Values
      • PP_REPLACE_LAST_POPUP

        public static final int PP_REPLACE_LAST_POPUP
        How to process pop-up panels when this panel is virtualized: 2 = replace last pop-up panel (if any).
        See Also:
        Constant Field Values
      • PP_ADD_PANEL

        public static final int PP_ADD_PANEL
        How to process pop-up panels when this panel is virtualized: 3 = add this pop-up panel.
        See Also:
        Constant Field Values
      • REMOTE_REMOVE_EVENT

        public static final int REMOTE_REMOVE_EVENT
        Remote event for panel removal.
        See Also:
        Constant Field Values
    • Constructor Detail

      • UIPanelBase

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

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

      • getPredefinedProps

        public 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.

        Subclasses must override this method to do the appropriate initialization, as this method does nothing for the PropCnr class implementation.

        Overrides:
        getPredefinedProps in class UIContainer
      • createLayout

        protected PanelData createLayout()
        Create the layout property.
        Returns:
        A new instance of EPanelData named Atom.LAYOUT.
      • getLayout

        public PanelData getLayout()
        Gets the layout properties of this component. If the properties are not present, they are created.
        Specified by:
        getLayout in interface IUIComp
        Overrides:
        getLayout in class UIComp
        Returns:
        The layout properties.
      • shouldCreateProps

        protected boolean shouldCreateProps​(org.w3c.dom.Element element)
        Checks if a child Element should be created as properties or if it should be skipped. Override this method (and call super.shouldCreateProps(element)) if the container creates other child elements.
        Overrides:
        shouldCreateProps in class PropCnr
        Parameters:
        element - The element in question.
        Returns:
        true to create properties out of it, false to ignore the element.
      • clone

        public UIPanelBase 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
      • onPropDispose

        protected void onPropDispose()
        Called when a property is disposed of by delete/remove in a container, or by the dispose method.

        This call is done just at the end of the delete/remove routine in the container, without synchronization.

        During this call, whatever components that e.g. the client needs to disposed of is done.

        Subclasses needing to perform some intelligent operations upon deletion should do it by overloading this method and always call the super.onPropDispose() method.

        Overrides:
        onPropDispose in class UIComp
      • virtualize

        public UIPanelBase virtualize​(IAppSessionGyro appGyro,
                                      IClientSessionGyro clientGyro,
                                      VirtualSpace virtualSpace)
                               throws java.lang.CloneNotSupportedException,
                                      PropException
        Call this method to "virtualize" a property tree. This method is used at runtime in the Server for the application session of virtual instances of VirtualSpace, but also virtual instances of panels, for the individual client session. The VirtualSpace is virtualized once for the application session and is shared for parallel client sessions.

        This method is similar to cloning, but enables references that are already resolved to remain if they point to a shared instance, e.g. the VirtualSpace pointing to its participants in the application property container shared instance, or a panel with references to text IDs, assets, etc.

        It is up to the property class to handle this by overriding this method.

        Parameters:
        appGyro - The application gyro instance performing the virtualization.
        clientGyro - The client gyro session, can be null if not initialized from the client gyro.
        virtualSpace - The virtualized or virtualizing VirtualSpace.
        Throws:
        java.lang.CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
        PropException - For property errors during the virtualization.
      • virtualize

        protected GProp<?> virtualize​(IAppSessionGyro appGyro,
                                      IClientSessionGyro clientGyro,
                                      VirtualSpace virtualSpace,
                                      PropCnr virtualizedProp)
                               throws java.lang.CloneNotSupportedException,
                                      PropException
        Call this method to "virtualize" a property tree. This method is used at runtime in the Server for the application session of virtual instances of VirtualSpace, but also virtual instances of panels, for the individual client session. The VirtualSpace is virtualized once for the application session and is shared for parallel client sessions.

        This method is similar to cloning, but enables references that are already resolved to remain if they point to a shared instance, e.g. the VirtualSpace pointing to its participants in the application property container shared instance, or a panel with references to text IDs, assets, etc.

        It is up to the property class to handle this by overriding this method.

        Overrides:
        virtualize in class PropCnr
        Parameters:
        appGyro - The application gyro instance performing the virtualization.
        clientGyro - The client gyro session, can be null if not initialized from the client gyro.
        virtualSpace - The virtualized VirtualSpace.
        virtualizedProp - The property being virtualized.
        Returns:
        The virtualized property.
        Throws:
        java.lang.CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
        PropException - For property errors during the virtualization.
      • doVirtualizePropCnr

        protected void doVirtualizePropCnr​(IAppSessionGyro appGyro,
                                           IClientSessionGyro clientGyro,
                                           GProp<?>[] props,
                                           java.lang.String extendsName,
                                           VirtualSpace virtualSpace,
                                           PropCnr virtualizedProp,
                                           PropCnr clonedProp)
                                    throws java.lang.CloneNotSupportedException,
                                           PropException
        The rest of the virtualization is done using the correct "this" for inner classes.

        Do not call this method! The method is intended for classes that are virtualized and needs to set-up the AppSessionGyro, ClientSessionGyro and VirtualSpace very early in the virtualizing process.

        Overrides:
        doVirtualizePropCnr in class PropCnr
        Parameters:
        appGyro - The application gyro instance performing the virtualization.
        clientGyro - The client gyro session, can be null if not initialized from the client gyro.
        props - The children properties to virtualize.
        extendsName - The name in extends to virtualize.
        virtualSpace - The virtualized or virtualizing VirtualSpace.
        virtualizedProp - The property being virtualized.
        clonedProp - The property that is cloned to produce this virtualized property.
        Throws:
        java.lang.CloneNotSupportedException - If a subclass doesn't allow cloning, e.g. the client properties.
        PropException - For property errors during the virtualization.
      • getNonVirtualized

        public UIPanelBase getNonVirtualized()
        Gets the non-virtualized instance of this panel.
        Returns:
        The non-virtualized panel, always non-null.
      • getAppSessionGyro

        public IAppSessionGyro getAppSessionGyro()
        Returns the Application Session Gyro instance of this virtualized property.
        Specified by:
        getAppSessionGyro in interface IGProp<GProp<?>[]>
        Overrides:
        getAppSessionGyro in class GProp<GProp<?>[]>
        Returns:
        The Application Session Gyro if this instance is virtualized, null otherwise.
      • isPopupPanel

        public boolean isPopupPanel()
        Returns if this is a pop-up panel placed on top of main panels.
        Returns:
        The default panel returns false.
      • getVSReference

        public VSParticipant getVSReference​(Atom refAtom)
        Gets a VSReference instance from the container or any parent containers. The method is used by VSRelativeReference to look up the VSReference instance in order to resolve the relative path to the target property.
        Specified by:
        getVSReference in interface IGProp<GProp<?>[]>
        Overrides:
        getVSReference in class PropCnr
        Parameters:
        refAtom - The property atom of the requesting relative reference property.
        Returns:
        The instance of the VSParticipant (that extends VSReference) or null if unassigned.
      • createVSReference

        public VSParticipant createVSReference​(Atom refAtom,
                                               PropCnr[] returnParent)
        Creates a VSReference instance from the container or any parent containers. The method is used in the Designer to create a VirtualSpace connection for VSRelativeReference to look up the VSReference instance in order to resolve the relative path to the target property.

        This method needs to be overridden by subclasses of PropCnr that has a VSReference as property, and *SHOULD* match getVSReference(Atom).

        The default is to re-target the call to the parent container, and if the root, a folder or a file property is reached, null is returned.

        Overrides:
        createVSReference in class PropCnr
        Parameters:
        refAtom - The property asking for the VSReference.
        returnParent - An array of PropCnr [1] that will be filled in with the parent property of the VSRefernce.
        Returns:
        The instance of the VSReference or null if unassigned. The returned instance could also be a VSParticipant and should therefore be processed accordingly.

        For this method, it's a VSParticipant.

      • getVSParticipant

        public VSParticipant getVSParticipant()
        Gets the VSParticipant instance. This is also an instance of VSReference.
        Specified by:
        getVSParticipant in interface IUIPanelOwner
        Returns:
        The instance of the VSParticipant, or null if not yet defined.
      • getVirtualSpace

        public VirtualSpace getVirtualSpace()
        Gets the VirtualSpace for this panel.

        Method for IVSParticipant: Gets the referrer's back-reference to the VirtualSpace. This is used by the VSParticipantReference when verifying its references.

        Specified by:
        getVirtualSpace in interface IUIComp
        Specified by:
        getVirtualSpace in interface IVSAccessor
        Overrides:
        getVirtualSpace in class UIComp
        Returns:
        The VirtualSpace, or null for none.
      • getParticipantDescription

        public java.lang.String getParticipantDescription()
        Returns the given description of the referrer participant.
        Specified by:
        getParticipantDescription in interface IReferrerParticipant
        Returns:
        The string the Designer entered in the Description field, or "n/a" for none.
      • isPrimaryParticipant

        public boolean isPrimaryParticipant()
        Checks if this panel is primary or not. A primary participant is chosen in the selection processing when multiple participants are ordered in a VSParticipantsHolder container.
        Specified by:
        isPrimaryParticipant in interface IReferrerParticipant
        Returns:
        The default implementation returns true.
      • 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.
      • getClassReference

        public ClassReference getClassReference()
        Gets the ClassReference in the property container from the ClassReference instance.
        Returns:
        The resolved class reference instance, null if not resolved or found.
      • getClassReferenceAtom

        public Atom getClassReferenceAtom​(java.lang.String id)
        Gets the ClassReference atom name.
        Specified by:
        getClassReferenceAtom in interface IClassReferenceOwner
        Parameters:
        id - ID for the class reference if several exist, null for default.
        Returns:
        The class reference atom name for the ID.
      • getClassReference

        public ClassReference getClassReference​(java.lang.String id,
                                                boolean doCreateIfNotPresent)
        Gets or creates the ClassReference in the property container.
        Specified by:
        getClassReference in interface IClassReferenceOwner
        Parameters:
        id - ID for the class reference if several exist, null for default.
        doCreateIfNotPresent - Flag to create the property (this flag can only be true in Designer)!
        Returns:
        The resolved class reference instance, null if the ClassReference doesn't exist if the create flag is false. If flag is true, an orphan unresolved EditorClassReference instance (ONLY for the Designer).
      • isClassReferenceAnnotationBackReferenceRequired

        public boolean isClassReferenceAnnotationBackReferenceRequired​(java.lang.String id)
        Checks if the ClassReference require an annotation back-reference.
        Specified by:
        isClassReferenceAnnotationBackReferenceRequired in interface IClassReferenceOwner
        Parameters:
        id - ID for the class reference if several exist, null for default.
        Returns:
        true, always: the annotation is required to have a back-reference on the "ref" member value pair to the ClassReference owner.
      • getClassReferenceImplementsInterface

        public java.lang.String getClassReferenceImplementsInterface​(java.lang.String id)
        Returns the required Interface.
        Specified by:
        getClassReferenceImplementsInterface in interface IClassReferenceOwner
        Parameters:
        id - ID for the class reference if several exist, null for default.
        Returns:
        The fully qualified name of the interface for the class, or null for none. For panels this is always null.
      • getClassReferenceRequiredAnnotation

        public java.lang.String getClassReferenceRequiredAnnotation​(java.lang.String id)
        Returns the required annotation, or null for none.
        Specified by:
        getClassReferenceRequiredAnnotation in interface IClassReferenceOwner
        Parameters:
        id - ID for the class reference if several exist, null for default.
        Returns:
        The fully qualified name of the interface for the class, or null for none. For panels this is always AnnotationType.UI.fqn.
      • onPrepare

        protected void onPrepare​(IAppOwner appOwner,
                                 IModuleOwner moduleOwner,
                                 boolean isPostCall,
                                 java.util.List<java.lang.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.
      • invokeOnUIConnectMethod

        public void invokeOnUIConnectMethod​(IClientSessionGyro clientGyro)
        Invoke the create event methods of the component and the panel.

        This method is not intended to be called, it is used by the framework.

        Parameters:
        clientGyro - The client gyro.
      • invokeOnUICreateMethod

        protected void invokeOnUICreateMethod​(UIComp component)
        Invoke the create event methods of the component and the panel.

        This method is not intended to be called, it is used by the framework.

        Parameters:
        component - The UI component.
      • invokeOnUIDestroyMethod

        protected void invokeOnUIDestroyMethod​(UIComp component)
        Invoke the create event methods of the component and the panel.

        This method is not intended to be called, it is used by the framework.

        Parameters:
        component - The UI component.
      • invokeOnUIBackMethod

        protected void invokeOnUIBackMethod()
        Invoke the back event method of the panel.

        This method is not intended to be called, it is used by the framework.

      • invokeOnUIFocusMethod

        protected void invokeOnUIFocusMethod​(boolean isFocusGained,
                                             UIComp component,
                                             UIComp opposite,
                                             IGProp<?> trigger)
        Invoke the focus event methods of the component and the panel.

        This method is not intended to be called, it is used by the UI focus engine.

        Parameters:
        isFocusGained - Flag for focus gained operation.
        component - The UI component.
        opposite - The opposite UI component.
        trigger - The trigger property.
      • invokeOnUITextChangeMethod

        public void invokeOnUITextChangeMethod​(UIComp component,
                                               GProp<?> trigger)
        Invoke the onUITextChange event methods of the component and the panel.
        Parameters:
        component - The UI component.
        trigger - The trigger property.
      • invokeOnUIValueChangeMethod

        public void invokeOnUIValueChangeMethod​(UIComp component,
                                                GProp<?> trigger)
        Invoke the onUIValueChange event methods of the component and the panel.
        Parameters:
        component - The UI component.
        trigger - The trigger property.
      • invokeOnUISelectionMethod

        public void invokeOnUISelectionMethod​(IUISelectionComp source,
                                              GProp<?> trigger,
                                              IUISelection selection)
        Invoke the focus event method.
        Parameters:
        source - The selection UI component source.
        trigger - The trigger, null for none.
        selection - The selection.
      • isParticipating

        public final boolean isParticipating​(EnvProps envProps)
        Checks if this panel is participating in the VirtualSpace, i.e. if it's used in the current user session or if it's e.g. the wrong resolution or device.
        Specified by:
        isParticipating in interface IReferrerParticipant
        Parameters:
        envProps - The Client Environment instance of the current client connection.
        Returns:
        The participation state, by default true.
      • getPanelMappings

        public final VSMappings getPanelMappings()
        Gets the panels components that refer to the VirtualSpace in question, and their mappings to the VSComponent's. Only resolved references are returned.

        The return value is cached, and refreshed when required, i.e. if panel components are added or removed.

        Returns:
        The map of components to a VirtualSpace, null when panel is not mapped to a VirtualSpace.
      • onEventSelf

        public void onEventSelf​(GEvent event)
        Invalidates cached mappings.
        Specified by:
        onEventSelf in interface IGProp<GProp<?>[]>
        Overrides:
        onEventSelf in class UIComp
        Parameters:
        event - The property event.
      • onRemoteEvent

        public void onRemoteEvent​(RemoteEvent event)
        Called when a remote property event should be processed by this property.

        A subclass can override this method to perform appropriate processing and is not required to call super.onRemoteEvent(e).

        The onRemoteEvent is NOT called when in a proxied property container, but rather the normal onEventSelf method.

        Specified by:
        onRemoteEvent in interface IGProp<GProp<?>[]>
        Overrides:
        onRemoteEvent in class UIComp
        Parameters:
        event - The remote event.
      • isDesktopType

        public boolean isDesktopType()
        Checks if this panel is of desktop type. (For now, this is the same as not mobile type...)
        Returns:
        true if this panel is of desktop type.
      • isMobileType

        public boolean isMobileType()
        Checks if this panel is of mobile type.
        Returns:
        true if this panel is of mobile type, i.e. for touch, and using mobile themes.
      • isDeviceTypeMatching

        public boolean isDeviceTypeMatching​(int deviceType)
        Returns if the device type is compatible with this panel.
        Parameters:
        deviceType - The device type: -1=mobile, 0=both, 1=desktop.
        Returns:
        true for match, false otherwise (also for invalid device type).
      • setPanelType

        public boolean setPanelType​(IComplexOperation op,
                                    int type)
        Sets the panel type, i.e. desktop, mobile or future values.
        Parameters:
        op - The complex operation, or null for none.
        type - 0=desktop, 1=mobile. (For now...)
        Returns:
        true if changed, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - If type is not 0 or 1.
      • getThemes

        public GThemes getThemes()
        Gets the configured themes for the panel.
        Returns:
        The panel themes, or null if not configured.
      • verify

        public void verify​(PropVerification verification)
        Verifies this property container. The check performed is the extension of classes and that no circular reference is present.
        Specified by:
        verify in interface IGProp<GProp<?>[]>
        Overrides:
        verify in class UIContainer
        Parameters:
        verification - The property verification class.
      • isAnimationPropPrivate

        public final boolean isAnimationPropPrivate()
        Returns if the animation property is private or not.
        Specified by:
        isAnimationPropPrivate in interface IUIPanelAnimation
        Returns:
        true for actions.
      • getDefaultTextTable

        public TextTable getDefaultTextTable()
        Gets the default text table of the panel. This text table may be derived from another base table, and the default input language code can also be checked.
        Returns:
        The default text table, or null if not defined.
      • setDefaultTextTable

        public boolean setDefaultTextTable​(java.lang.String ref)
        Sets the default text table to use for the panel.
        Parameters:
        ref - The text table reference, null for none.
        Returns:
        true for changed, false for no change.
      • getOnCreateExistingPanelProcessing

        public int getOnCreateExistingPanelProcessing()
        Returns how to process pop-up panels when this panel is virtualized.
        Returns:
        PP_REPLACE_ALL = replace all panels with this one,
        PP_REPLACE_ALL_POPUPS = replace all pop-up panels with this one,
        PP_REPLACE_LAST_POPUP = replace last pop-up panel (if any),
        PP_ADD_PANEL = add this pop-up panel.

        The default processing for main panel is to return PP_REPLACE_ALL.

      • requestRemove

        public boolean requestRemove()
        Requests the removal of the panel with the specified animation. This call is not intended to be called elsewhere than from the client Gyro.
        Returns:
        true for success, false if panel is already removed.
      • hasBeenRemoved

        public boolean hasBeenRemoved()
        Returns if this panel is being replaced by another, but has not had the time to be removed from the client yet.
      • onVirtualSpaceVirtualized

        public void onVirtualSpaceVirtualized​(IAppSessionGyro appGyro,
                                              VirtualSpace virtualizedVirtualSpace)
        Called when the VirtualSpace has been virtualized, giving the opportunity for e.g. data connectors to prepare it's virtualized counterparts if this is required.

        This call is done to the non-virtualized instance of the VirtualSpace participant.

        Specified by:
        onVirtualSpaceVirtualized in interface IVSParticipant
        Parameters:
        appGyro - The application gyro instance.
        virtualizedVirtualSpace - The virtualized VirtualSpace instance.