Class LayoutMgr<LAYOUT_PROP extends LayoutProp>

    • Constructor Detail

      • LayoutMgr

        protected LayoutMgr()
        Creates a LayoutMgr without name with a null value.
      • LayoutMgr

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

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

      • clone

        public LayoutMgr<?> 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.
        Overrides:
        clone in class PropCnr
      • virtualize

        public LayoutMgr<?> 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.
      • getUIPanel

        public UIPanelBase getUIPanel()
        Gets the panel for the UI component.

        This method is defined for all UI components and only serves the purpose of a call in the default implementation in this interface.

        Returns:
        The panel, or null if layout manager is not added to a panel.
      • getCompsCnr

        public final UIComps getCompsCnr()
        Gets the container associated with this layout manager and the UI container.
        Returns:
        The UI components container, or null if currently being destroyed.
      • getUIComps

        public UIComp[] getUIComps()
        Gets all components for the container of the layout manager.
        Returns:
        The components in the container for the layout manager.
      • getUIContainer

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

        public abstract LAYOUT_PROP createDefaultLayoutProp​(UIComp uiComp)
        Creates the default LayoutProp to use for a new component that is inserted directly into the UIComps container.

        Note that the layout property is just created and not assigned to the component.

        Parameters:
        uiComp - The component requesting the default layout property.
        Returns:
        A new instance of the layout data of this layout manager.
      • getLayoutPropClass

        public abstract java.lang.Class<LAYOUT_PROP> getLayoutPropClass()
        Returns the class required for this layout property.
      • add

        public final LAYOUT_PROP add​(UIComp component)
                              throws PropException
        Adds the component last.
        Parameters:
        component - The component to add.
        Returns:
        The layout data for the component.
        Throws:
        PropException - for property errors.
      • add

        public final LAYOUT_PROP add​(UIComp component,
                                     int index)
                              throws PropException
        Adds the component at a specific index.
        Parameters:
        component - The component to add.
        index - The insertion index of the property in the UIComps container, -1 for last.
        Returns:
        The layout data for the component.
        Throws:
        PropException - for property errors.
      • add

        public final LAYOUT_PROP add​(UIComp component,
                                     int index,
                                     IComplexOperation op)
                              throws PropException
        Adds the component at a specific index.
        Parameters:
        component - The component to add.
        index - The insertion index of the property in the UIComps container, -1 for last.
        op - The complex operation, null for none.
        Returns:
        The layout data for the component.
        Throws:
        PropException - for property errors.
      • onBeforeAdd

        public void onBeforeAdd​(UIComp component,
                                LayoutProp layout,
                                int index,
                                IComplexOperation op)
                         throws PropException
        Called prior to adding the new component to the layout in order to adjust the layout data.
        Parameters:
        component - Component about to be added.
        layout - The layout data of the component, can be cast to the appropriate value for the layout manager.
        op - The complex operation, null for none.
        Throws:
        PropException - for property errors.
      • remove

        public final boolean remove​(UIComp component)
                             throws PropException
        Removes a component.
        Parameters:
        component - the component to add.
        Returns:
        true for success, false for failure.
        Throws:
        PropException - when the container cannot accept the component with the specific layout property.
      • hasWidth0

        protected boolean hasWidth0​(LAYOUT_PROP layout)
        Verifies if the layout data has a width.
        Parameters:
        layout - The layout data.
        Returns:
        true if the width is defined and non-zero, false otherwise.
      • hasHeight0

        protected boolean hasHeight0​(LAYOUT_PROP layout)
        Verifies if the layout data has a height.
        Parameters:
        layout - The layout data.
        Returns:
        true if the height is defined and non-zero, false otherwise.
      • hasImplicitAlignFillX

        public boolean hasImplicitAlignFillX()
        Returns if the layout causes implicit component horizontal fill.
        Returns:
        true means component will always fill the space in X, false otherwise.
      • hasImplicitAlignFillY

        public boolean hasImplicitAlignFillY()
        Returns if the layout causes implicit component vertical fill.
        Returns:
        true means component will always fill the space in Y, false otherwise.
      • mustHaveWidth

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

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

        protected boolean hasContainerLayoutImplicitWidth()
        Verifies if this container has an implicit width due to e.g. children.
        Returns:
        true if an implicit width is present, false (default) otherwise.
      • hasContainerLayoutImplicitHeight

        protected boolean hasContainerLayoutImplicitHeight()
        Verifies if this container has an implicit height due to e.g. children.
        Returns:
        true if an implicit width is present, false (default) otherwise.