Class AbstractUIAction

    • Field Detail

      • VS_FOCUS_ATOM

        public static final Atom VS_FOCUS_ATOM
        Property atom for VS component to focus when action processing completes: "vsFocus".
      • vsAction

        protected VSAction vsAction
        The connected action, null for none.

        Note: use thread-safe code when working with this variable as it can become unresolved, thus null.

      • vsDisconnectedAction

        protected VSAction vsDisconnectedAction
        The disconnected action, null for none.
    • Constructor Detail

      • AbstractUIAction

        public AbstractUIAction()
        Creates the component without a name. The name must be set in all cases using the setPropertyAtom call.
      • AbstractUIAction

        public AbstractUIAction​(Atom propertyAtom)
        Creates the component with the specified name. All system-reserved names for components begins with "$".
        Parameters:
        propertyAtom - the name of the component, unique within it's parent.
      • AbstractUIAction

        public AbstractUIAction​(Atom propertyAtom,
                                GProp<?>[] newValue)
                         throws PropException
        Creates the component with the specified name, initialized to contain the GProp items. All system-reserved names for components begins with "$".
        Parameters:
        propertyAtom - The name of the component, unique within it's parent.
        newValue - The array of all properties the component should have.
        Throws:
        PropException - when at least one of the properties to initialize the label component with is invalid.
    • Method Detail

      • isAnimationPropPrivate

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

        public VSAction getVSAction()
        Gets the connected or disconnected VirtualSpace Action.
        Specified by:
        getVSAction in interface IUIAction
        Returns:
        The action, or null if no action resolved (connected or disconnected) is present.
      • isVSActionDisconnected

        public boolean isVSActionDisconnected()
        Checks if the connection state to the VirtualSpace Action is disconnected.
        Returns:
        true if currently disconnected.
      • disconnectVSAction

        public boolean disconnectVSAction()
        Disconnects from the VirtualSpace Action connection.
        Returns:
        true for success, false if already done or none is connected.
      • reconnectVSAction

        public boolean reconnectVSAction​(boolean update)
        Reconnects to a previously disconnected VirtualSpace Action connection.

        The method IUIAction.setVSActionToComponent(VSAction) is called if there was a disconnected action set.

        Parameters:
        update - Update flag, i.e. if all states and message should be updated to match the action.
        Returns:
        true for success, false if not disconnected.
      • onResolved

        public void onResolved​(VSRelativeReference<?> reference,
                               VSAction action)
        Called when the property reference has been resolved. UI components use this method to set its state according to the action, this is handled in by the UIComp class.

        Components must override to provide the implementation for e.g. value contents, styles, etc.

        Specified by:
        onResolved in interface IVSActionListener
        Parameters:
        reference - The VSRelativeReference instance holding the reference.
        action - The target reference.
      • onBroken

        public void onBroken​(VSRelativeReference<?> reference,
                             VSAction action)
        Called when the property reference has been broken, i.e. unresolved.
        Specified by:
        onBroken in interface IVSActionListener
        Parameters:
        reference - The VSRelativeReference instance holding the reference.
        action - The target reference.
      • onActionCompleted

        public void onActionCompleted​(VSAction action,
                                      VSActionTXProcess process,
                                      java.lang.Throwable exception)
        Called after the action completes the TXP processing i.e. all its Action Actor calls. This method is called regardless of success or failures. It can be used to check the state of the process.
        Specified by:
        onActionCompleted in interface IVSActionListener
        Parameters:
        action - The VS action.
        process - The completed process.
        exception - Potential exception in TX process, null for none.
      • onRemoteEvent

        public void onRemoteEvent​(RemoteEvent event)
        Called when a remote property event should be processed by this property.
        Specified by:
        onRemoteEvent in interface IGProp<GProp<?>[]>
        Overrides:
        onRemoteEvent in class UIComp
        Parameters:
        event - The remote event.
      • getMappedVSComponent

        public VSComponent getMappedVSComponent()
        Gets the main component that is used to map the UI component to the VirtualSpace.
        Overrides:
        getMappedVSComponent in class UIComp
        Returns:
        The VS component, or null for none. Default is to return the VSField of UIComp. Override e.g. for actions.
      • processVSComponentSelection

        protected void processVSComponentSelection​(VSComponent mappedComponent)
        Override to process the VS components selection state when Atom.SELECTED BoolProp changes. Nothing is done by default and must be overridden to process selections by each component.

        Typically, call mappedComponent.setSelected(isSelected(),this);

        Overrides:
        processVSComponentSelection in class UIComp
        Parameters:
        mappedComponent - The matching mapped component.
      • getVSFocusComponent

        public VSComponent getVSFocusComponent()
        Gets the VS component to focus when action is triggered.
        Specified by:
        getVSFocusComponent in interface IUIAction
        Returns:
        The VS component, or null for none.
      • isBackReferenceValid

        public java.lang.String isBackReferenceValid​(AnnotationType annotationType,
                                                     java.lang.String name,
                                                     boolean isRefOnly)
        Validates if the back-reference specified is referenced in the first place, i.e. is valid or not.
        Specified by:
        isBackReferenceValid in interface IBackReferenceProvider
        Parameters:
        annotationType - The annotation type.
        name - The class or method name.
        isRefOnly - Flag indicating the back reference is not required, but must be valid otherwise.
        Returns:
        null for valid, otherwise an error message.
      • onPrepare

        protected void onPrepare​(ClassReference cr,
                                 java.util.List<java.lang.Throwable> errors)
        Called to resolve methods for the component from main "onPrepare" once the ClassReference has been found.

        Components should override this method to load it's required methods.

        Overrides:
        onPrepare in class UIComp
        Parameters:
        cr - The class reference with a valid reference.
        errors - The list of errors that is returned to the caller in case resolving fails.
      • getOnUIActionMethod

        public java.lang.reflect.Method getOnUIActionMethod()
        Gets the method for the OnUIAction event at runtime. The method can be stored in another instance, e.g. a group holding multiple action items.
        Specified by:
        getOnUIActionMethod in interface IUIAction
        Specified by:
        getOnUIActionMethod in interface IUIActionHolder
        Returns:
        The method for OnUIAction event, null for none.
      • setVSFocusComponent

        public boolean setVSFocusComponent​(VSComponent component)
        Sets the VS focus reference when action is clicked.
        Parameters:
        component - The component to focus reference.
        Returns:
        true for changed, false for no change.
      • setVSFocusComponent

        public boolean setVSFocusComponent​(java.lang.String vsFocusReference)
        Sets the VS focus reference when action is clicked.
        Parameters:
        vsFocusReference - The component to focus reference.

        Note: focusReference must be to a VSComponent, otherwise it will fail.

        Returns:
        true for changed, false for no change.
      • setVSAction

        public boolean setVSAction​(VSAction action)
        Sets the VSAction to invoke when action is clicked.
        Parameters:
        action - The VSAction to invoke when placed in focus.
        Returns:
        true for changed, false for no change.
      • setVSAction

        public boolean setVSAction​(java.lang.String vsActionReference)
        Sets the VSAction reference to invoke when action is clicked.
        Parameters:
        vsActionReference - The VSAction to invoke when placed in focus.

        Note: actionReference must be to a VSComponent, otherwise it will fail.

        Returns:
        true for changed, false for no change.