Class VSAction

    • Field Detail

      • EMPTY_LISTENERS

        public static final IVSActionListener[] EMPTY_LISTENERS
        Empty list of listeners.
      • EXEC_TIMEOUT

        public static final java.lang.String EXEC_TIMEOUT
        Action execution property: timeout, LongProp.
        See Also:
        Constant Field Values
      • EXEC_TIMEOUT_DEFAULT

        public static final long EXEC_TIMEOUT_DEFAULT
        Action execution property: timeout, LongProp, default 2 minutes.
        See Also:
        Constant Field Values
      • EXEC_ASYNC

        public static final java.lang.String EXEC_ASYNC
        Action execution property: thread, IntProp.
          0=application worker,
          1=client,
          2=caller thread,
          3=separate thread (asynchronously).
         
        See Also:
        Constant Field Values
      • TARGET_VIRTUALSPACE

        public static final java.lang.String TARGET_VIRTUALSPACE
        Action property: target VirtualSpace.
        See Also:
        Constant Field Values
      • actors

        protected ActionActors actors
        The action actors container.
    • Constructor Detail

      • VSAction

        public VSAction()
        Creates a VirtualSpace Action property with the specified name with a null value.
      • VSAction

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

      • getComponentIsHidden

        public java.lang.String getComponentIsHidden()
        Gets the focus message for "Component is hidden" but for the component in question.
        Specified by:
        getComponentIsHidden in class VSComponent
      • getComponentIsDisabled

        public java.lang.String getComponentIsDisabled()
        Gets the focus message for "Component is disabled" but for the component in question.
        Specified by:
        getComponentIsDisabled in class VSComponent
      • isAnimationPropPrivate

        public boolean isAnimationPropPrivate()
        Returns if the animation property is private or not.
        Specified by:
        isAnimationPropPrivate in interface IUIPanelAnimation
        Returns:
        Always false for VS actions.
      • onParentStateChanged

        public void onParentStateChanged​(IVSComponent parent,
                                         IVSComponentState.State state,
                                         boolean stateValue)
        Invokes the parent state notification function for the component.
        Specified by:
        onParentStateChanged in interface IVSComponentListener
        Parameters:
        parent - The parent who's state was changed.
        state - The state that changed.
        stateValue - The new state value.
      • createActionActors

        protected ActionActors createActionActors()
        Creates a new instance of the action actors, overridden for the Editor.
      • addPredefinedProps

        protected void addPredefinedProps()
                                   throws PropException
        Adds the predefined properties for this container. This method is called once just after construction of the property container and sometimes population of it.

        The method should add properties to create or get reference to using the maybeAddProp method. When the PropCnr instance is cloned, the method getPredefinedProps() is called in order for the subclass to be able to retrieve the new instances to these properties, if stored in instance variables.

        Overrides:
        addPredefinedProps in class PropCnr
        Throws:
        PropException - for property exceptions.
      • getPredefinedProps

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

        Overrides:
        getPredefinedProps in class PropCnr
      • getActionActors

        public ActionActors getActionActors()
        Gets the action actors instance.
        Returns:
        The instance of the actors.
      • getTargetVirtualSpace

        public VSReference getTargetVirtualSpace()
        Gets the target VirtualSpace for operations.
        Returns:
        The target VirtualSpace if defined, otherwise the same VirtualSpace as the action.
      • addListener

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

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

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

        public IVSActionListener[] getActionListeners()
        Gets the listeners of the VS action events.
        Returns:
        A cached array of listeners for the value, retrieved without synchronization if possible.
      • 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 VSComponent
        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.
      • invokeExecute

        public java.lang.String invokeExecute()
        Invokes and executes the action directly in the callers thread, regardless of the action settings.

        Note: This must be done with care: certain Action Actors may require its processing to run in a special thread that suites their purpose. If this thread happens to be the current caller thread, the operation may not succeed or hang.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Returns:
        null for success, otherwise an error message. The entire action TX process is performed before returning.
      • invokeExecute

        public java.lang.String invokeExecute​(IClientSessionGyro clientGyro)
        Invokes and executes the action directly in the callers thread, regardless of the action settings.

        Note: This must be done with care: certain Action Actors may require its processing to run in a special thread that suites their purpose. If this thread happens to be the current caller thread, the operation may not succeed or hang.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Parameters:
        clientGyro - Client gyro to use, null to look-it up if needed from current thread.
        Returns:
        null for success, otherwise an error message. The entire action TX process is performed before returning.
      • invokeExecute

        public java.lang.String invokeExecute​(GProp<?> trigger)
        Invokes and executes the action directly in the callers thread, regardless of the action settings.

        Note: This must be done with care: certain Action Actors may require its processing to run in a special thread that suites their purpose. If this thread happens to be the current caller thread, the operation may not succeed or hang.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Parameters:
        trigger - The trigger property, null for none.
        Returns:
        null for success, otherwise an error message. The entire action TX process is performed before returning.
      • invokeExecute

        public java.lang.String invokeExecute​(IClientSessionGyro clientGyro,
                                              GProp<?> trigger)
        Invokes and executes the action directly in the callers thread, regardless of the action settings.

        Note: This must be done with care: certain Action Actors may require its processing to run in a special thread that suites their purpose. If this thread happens to be the current caller thread, the operation may not succeed or hang.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Parameters:
        clientGyro - Client gyro to use, null to look-it up if needed from current thread.
        trigger - The trigger property, null for none.
        Returns:
        null for success, otherwise an error message. The entire action TX process is performed before returning.
      • invoke

        public java.lang.String invoke​(IClientSessionGyro clientGyro,
                                       GProp<?> trigger,
                                       boolean isRemote,
                                       IVSActionProcessComplete completeCallback)
        Invokes the action. The action is posted to the appropriate worker thread for execution, or run in a separate thread depending on settings.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Parameters:
        clientGyro - Client gyro to use, null to look-it up if needed from current thread.
        trigger - The trigger property, null for none.
        isRemote - Flag indicating that the reason for the action invocation is remote, i.e. from the Client.
        completeCallback - Called when complete (in the action execution thread), null for none.
        Returns:
        null for success, otherwise an error message. The return from this method may be done prior to completion of the TX process (use the completeCallback to monitor completion).
      • invoke

        public java.lang.String invoke​(IClientSessionGyro clientGyro,
                                       GProp<?> trigger,
                                       boolean isRemote,
                                       UIComp contextComponent,
                                       IVSActionProcessComplete completeCallback)
        Invokes the action. The action is posted to the appropriate worker thread for execution, or run in a separate thread depending on settings.

        If not enabled or read-only, the method will fail with an error message. The same message will then also be logged as a warning,

        If this method is called from a Run Mode not being any of the Server Run Modes, the method will just log an informational message and return null

        Parameters:
        clientGyro - Client gyro to use, null to look-it up if needed from current thread.
        trigger - The trigger property, null for none.
        isRemote - Flag indicating that the reason for the action invocation is remote, i.e. from the Client.
        contextComponent - The context component causing the event, used for context menus.
        completeCallback - Called when complete (in the action execution thread), null for none.
        Returns:
        null for success, otherwise an error message. The return from this method may be done prior to completion of the TX process (use the completeCallback to monitor completion).
      • onRemoteEvent

        public void onRemoteEvent​(RemoteEvent event)
        Called when a remote property event should be processed by this property. This method is typically invoked from the VSViewer.
        Specified by:
        onRemoteEvent in interface IGProp<GProp<?>[]>
        Overrides:
        onRemoteEvent in class VSComponent
        Parameters:
        event - The remote event.