Class VSComponent

    • Constructor Detail

      • VSComponent

        protected VSComponent()
        Creates a VirtualSpace Field property with the specified name with a null value.
      • VSComponent

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

        protected VSComponent​(Atom propertyAtom,
                              VSComponent[] properties)
                       throws PropException
        Creates a property 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

      • forbiddenGetCustomDataMap

        @Deprecated
        public java.util.Map<java.lang.String,​java.lang.Object> forbiddenGetCustomDataMap​(boolean doCreate)
        Deprecated.
        Gets or creates the provider map. This method is not intended to be called by user code, it is used by the system.

        Do not call this method!

        Specified by:
        forbiddenGetCustomDataMap in interface ICustomDataProvider
        Parameters:
        doCreate - Creates the map if required.
        Returns:
        The map or newly created map, null if not created.

        Note: the map returned is NOT synchronized thus not thread safe. It is up to the caller to synchronize on it to ensure thread safety.

      • clone

        public VSComponent clone()
        Clones the VirtualSpace component. The runtime method instances (onVSChange and onVSFocus) are kept for the clone, so they do not need to be looked up again.
        Overrides:
        clone in class PropCnr
      • getDescription

        public java.lang.String getDescription()
        Gets the description of the component.
        Specified by:
        getDescription in interface IVSComponent
        Returns:
        The description, or null for none.
      • initPropCnr

        protected final void initPropCnr()
        Initializes the ENABLED property to true if it doesn't exist.
        Overrides:
        initPropCnr in class PropCnr
      • getVirtualSpace

        public VirtualSpace getVirtualSpace()
        Gets the VirtualSpace instance.
        Specified by:
        getVirtualSpace in interface IVSComponent
        Returns:
        The VirtualSpace instance (an ancestor of this property or itself), or null if not found (i.e. property is not yet attached to a VirtualSpace).
      • onEventSelf

        public void onEventSelf​(GEvent event)
        Checks for state change events and fires it to listeners.
        Specified by:
        onEventSelf in interface IGProp<GProp<?>[]>
        Overrides:
        onEventSelf in class GProp<GProp<?>[]>
        Parameters:
        event - The property event.
      • addListener

        public boolean addListener​(IVSGenericComponentListener listener)
        Adds a new listener to the VS component.
        Parameters:
        listener - The listener for VS component events.
        Returns:
        true for success, false if the listener already is added.
      • removeListener

        public boolean removeListener​(IVSGenericComponentListener listener)
        Removes a listener from the VS component.
        Parameters:
        listener - The existing listener for VS component events.
        Returns:
        true for success, false if the listener has not been added.
      • onListenerChanged

        protected void onListenerChanged​(IVSGenericComponentListener listener)
        Called when a listener is added or removed. This method is overridden by the Designer to update connections.
      • getComponentListeners

        public IVSGenericComponentListener[] getComponentListeners()
        Gets the listeners of the VS component events.
        Returns:
        A cached array of listeners for the value, retrieved without synchronization if possible.
      • isFree

        public boolean isFree()
        Verifies if this component is included in a work unit currently in progress in the VirtualSpace.
        Returns:
        true if it's OK to process, false means the component is included in this work unit.
      • isFree

        public boolean isFree​(java.lang.Runnable callback,
                              boolean callbackIfFree)
        Verifies if this component is included in a work unit currently in progress in the VirtualSpace.
        Parameters:
        callback - The callback to call when work completes, or null for none.
        callbackIfFree - Performs a call to the callback if free when true.
        Returns:
        true if it's OK to process, false means the component is included in this work unit and if callback is non-null, it will be called. The callback is called if free and the flag callbackIfFree is true.
      • areFree

        public boolean areFree​(java.lang.Runnable callback,
                               boolean callbackIfFree,
                               VSComponent component)
        Verifies if this component and another are included in a work unit currently in progress in the VirtualSpace.
        Parameters:
        callback - The callback to call when work completes, or null for none.
        callbackIfFree - Performs a call to the callback if free when true.
        component - The component to verify.
        Returns:
        true if it's OK to process, false means the component is included in this work unit and if callback is non-null, it will be called. The callback is called if free and the flag callbackIfFree is true.
      • areFree

        public boolean areFree​(java.lang.Runnable callback,
                               boolean callbackIfFree,
                               VSComponent... components)
        Verifies if this component and other component(s) are included in a work unit currently in progress in the VirtualSpace.
        Parameters:
        callback - The callback to call when work completes, or null for none.
        callbackIfFree - Performs a call to the callback if free when true.
        components - The components to verify.
        Returns:
        true if it's OK to process, false means the component is included in this work unit and if callback is non-null, it will be called. The callback is called if free and the flag callbackIfFree is true.
      • 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 GProp<GProp<?>[]>
        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.
      • onVirtualized

        protected void onVirtualized​(IAppSessionGyro appGyro,
                                     IClientSessionGyro clientGyro,
                                     VirtualSpace virtualSpace,
                                     PropCnr virtualizedProp,
                                     GProp<?> clonedProp)
        Called when this property has been virtualized.

        Override to perform required processing.

        Overrides:
        onVirtualized in class GProp<GProp<?>[]>
        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.
        clonedProp - The property that is cloned to produce this virtualized property.
      • onVirtualizationCompleted

        protected void onVirtualizationCompleted​(IAppSessionGyro appGyro,
                                                 IClientSessionGyro clientGyro,
                                                 VirtualSpace virtualSpace,
                                                 PropCnr virtualizedProp,
                                                 boolean isPostResolve)
        Called when virtualization completed.

        This method is called to the entire tree of the newly virtualized property container.

        Overrides:
        onVirtualizationCompleted in class GProp<GProp<?>[]>
        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.
        isPostResolve - Flag indicating this call is done after references are attempted to be resolved.
      • onPropDispose

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

        The Property Container clears the structure of unsent communication requests to clear memory.

        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 PropCnr
      • getNonVirtualized

        public VSComponent getNonVirtualized()
        Gets the non-virtualized instance of this component, if it exists.

        The non-virtualized counterpart may not exist in case the component has been programmatically created or is e.g. a row or cell in a table that has been filled by a data connector.

        Specified by:
        getNonVirtualized in interface IVSComponent
        Returns:
        The non-virtualized component, null if not found.
      • getComponentIsHidden

        public abstract java.lang.String getComponentIsHidden()
        Gets the focus message for "Component is hidden" but for the component in question.
      • getComponentIsDisabled

        public abstract java.lang.String getComponentIsDisabled()
        Gets the focus message for "Component is disabled" but for the component in question.
      • canRequestFocus

        public java.lang.String canRequestFocus()
        Returns if this component can receive focus. Focus capable components may override to return null for success, or other error message.

        Default processing is to return "Component not focusable" if the component doesn't implement the IFocusComp interface, "Not virtualized" if the component is not in a virtualized state, "Component is hidden" if IVSComponent.isVisible() is false or "Component is disabled" if IVSComponent.isEnabled() is false.

        Specified by:
        canRequestFocus in interface IPropCnr
        Returns:
        null focus is possible to this component, or an error message describing why focus cannot be requested.
      • couldRequestFocusIfVirtualized

        public java.lang.String couldRequestFocusIfVirtualized​(boolean ignoreStates)
        Returns if this component could receive focus if it would be virtualized. Focus capable components may override to return null for success, or other error message.

        Default processing is to return "Component not focusable" if the component doesn't implement the IFocusComp interface, "Component is hidden" if IVSComponent.isVisible() is false or "Component is disabled" if IVSComponent.isEnabled() is false.

        Specified by:
        couldRequestFocusIfVirtualized in interface IPropCnr
        Parameters:
        ignoreStates - Flag indicating that states should be ignored, such as visible or enabled. If false, hidden or disabled components return an error message.
        Returns:
        null focus is possible to this component, or an error message describing why focus cannot be requested.
      • onFocusGained

        public void onFocusGained​(IFocusComp opposite,
                                  IGProp<?> trigger,
                                  boolean isRemoteInduced)
        Called to the component when it receives focus.

        Focus components override this method if they need to process focus lost.

        Specified by:
        onFocusGained in interface IFocusComp
        Parameters:
        opposite - Component losing focus, null for none.
        trigger - The trigger property, null for none.
        isRemoteInduced - Flag indicating this event is due to a remote event.
      • onFocusLost

        public void onFocusLost​(IFocusComp focusComp,
                                IGProp<?> trigger,
                                boolean isRemoteInduced)
        Called to the focused component when it loses focus.

        Focus components override this method if they need to process focus lost.

        Specified by:
        onFocusLost in interface IFocusComp
        Parameters:
        focusComp - Component receiving focus, null for none.
        trigger - The trigger property, null for none.
        isRemoteInduced - Flag indicating this event is due to a remote 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 GProp<GProp<?>[]>
        Parameters:
        event - The remote event.