Class UIComps

  • All Implemented Interfaces:
    EventListener, IGProp<GProp<?>[]>, IPropCnr, java.lang.Cloneable
    Direct Known Subclasses:
    EUIComps

    public class UIComps
    extends PropCnr
    The UIComps class is the property container for all UIComp instances of the UIComps class. All UIComps are indexed and ordering is vital. This sets the placement in layouts, Z-order, etc.
    Author:
    Christopher Mindus
    • Constructor Detail

      • UIComps

        public UIComps()
        Creates a UIComps container without name and with a null value.
      • UIComps

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

        public UIComps​(Atom propertyAtom,
                       GProp<?>[] properties)
                throws PropException
        Creates a UIComps container with the specified name and properties.
        Parameters:
        propertyAtom - the property atom.
        properties - the property array value for the property.
        Throws:
        PropException - as structural changes in containers on client is prohibited.
    • Method Detail

      • usesPropIndex

        public final boolean usesPropIndex()
        Use of index for the property container is enabled.
        Specified by:
        usesPropIndex in interface IPropCnr
        Overrides:
        usesPropIndex in class PropCnr
        Returns:
        true for this container.
      • initPropCnr

        protected void initPropCnr()
        Method called at the earliest possible stage in the constructor of a container property or it's extending classes, before possible initialization of other properties, etc. The implementation of PropCnr doesn't do anything, so direct subclasses of PropCnr doesn't have to call the super.initPropCnr() method, but lower down the extension change of classes, this is the first piece of code that should be executed.
        Overrides:
        initPropCnr in class PropCnr
      • getUIContainer

        public UIContainer getUIContainer()
        Gets the parent container.
        Returns:
        The container, or null if orphan.
      • getUIPanel

        public UIPanelBase getUIPanel()
        Gets the panel.
        Returns:
        The panel, or null if orphan.
      • clone

        public UIComps 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 PropCnr
      • virtualize

        public UIComps 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.
      • getUIComps

        public UIComp[] getUIComps()
        Gets the array of components. This value is cached and this method is very fast to execute and doesn't produce garbage for collection.
        Returns:
        An array of components, never null.
      • onInsertProp

        protected void onInsertProp​(GProp<?> aProperty,
                                    int index,
                                    boolean replace,
                                    boolean isCloning,
                                    PropMgr propMgr,
                                    boolean isMoving)
                             throws PropException
        Method called when the internal function insertProp is called to verify that this is allowed. This method is typically used for the runtime virtuals container in the server.
        Overrides:
        onInsertProp in class PropCnr
        Parameters:
        aProperty - The property to insert.
        index - Index where to insert the property.
        replace - Flag indicating if the value should be replaced or not.
        isCloning - Flag indicating this property is being cloned.
        propMgr - The property manager for remote change, null for local.
        isMoving - Flag indicating the property is moved.
        Throws:
        PropException - when the property has a duplicate property name or if structural changes in containers is prohibited due to creation-ship of container and who is requesting the structural change.