Interface UIAjaxContext

All Superinterfaces:
UIBodyWriter, UIComponentWriter, UIDependencyRegisterer, UIJavaScriptWriter, UIResourceLocator, UISessionContext

public interface UIAjaxContext extends UIComponentWriter
Encapsulates an HTTP response so that an Ajax component is able to generate its part of the DHTML page.

Extending UIBodyWriter

The methods add(...) and add_cr(...) write text into the body of the Ajax response output stream.

This text has no constraints (it can be a raw string, HTML, CSV, JSON, XML ...), provided that the JavaScript function handleAjaxResponseSuccess(responseContent) manages that kind of data format.

It is up to the caller to correctly handle the Ajax response generated by this component. So it is strongly advised to use the EBX_AJAXResponseHandler JavaScript prototype for handling the response.

Extending UIJavaScriptWriter

The methods addJS(...) and addJS_cr(...) write a piece of JavaScript code into the Ajax response output stream.

The entire JavaScript code will be executed once the function handleAjaxResponseSuccess(responseContent) has been executed.

Since:
5.2.0
See Also:
  • Method Details

    • addUserMessage

      void addUserMessage(UserMessage aMessage)
      Add a user message to the message box according to its severity.
      Since:
      5.3.1
    • isCalledFromUIService

      boolean isCalledFromUIService()

      Returns true if the Ajax component is called from a user service.

      It will always return false if called from a UI bean whether this UI bean is hosted or not by a user service.

    • getOptionalRequestParameterValue

      String getOptionalRequestParameterValue(String aParameterName)
      Returns the HTTP parameter value from the incoming request.
    • getOptionalRequestParameterValues

      String[] getOptionalRequestParameterValues(String aParameterName)
      Returns the HTTP parameter values from the incoming request.
    • getHierarchyNode

      HierarchyNode getHierarchyNode()
      Returns the current hierarchy node if the user interface is in the context of a hierarchy. Returns null otherwise.
    • getCurrentAdaptation

      Adaptation getCurrentAdaptation()
      Returns the dataset or record currently selected in the session.

      This method returns a dataset if the current Ajax component is called from:

      • a dataset node,
      • a service running on a dataset,
      • a service running on an entire table,
      • a service running on a table selection and more than one record is selected.

      This method returns a record if the current Ajax component is called from:

      • a record node,
      • a service running on a table selection and if a single record is selected,
      • a service running on a page record,
      • a service running on a hierarchy node.

      Returns null if this Ajax component is called in the context of a record creation or duplication.

      Throws:
      IllegalStateException - if the current Ajax component is called from a service on a dataspace or a snapshot.
      See Also:
    • getCurrentDataSetNode

      SchemaNode getCurrentDataSetNode()
      Returns the dataset node currently selected in the session. Returns null if no dataset is selected.
      Since:
      5.3.1
    • getCurrentRecordNode

      SchemaNode getCurrentRecordNode()
      Returns the record node currently selected in the session. Returns null if no record is selected.
      Since:
      5.3.1
    • getCurrentRecord

      Adaptation getCurrentRecord()
      Returns the record currently selected in the session.

      Returns null if this Ajax component is called from:

      • a dataset node,
      • the context of a record creation or duplication,
      • a service running on a dataset,
      • a service running on a whole table,
      • a service running on a table selection with more than one record selected.
      Throws:
      IllegalStateException - if the current Ajax component is called from a service on a dataspace or on a snapshot.
      Since:
      5.2.2
    • getCurrentDataSet

      Adaptation getCurrentDataSet()
      Returns the dataset currently selected in the session.
      Throws:
      IllegalStateException - if the current Ajax component is called from a service on a dataspace or a snapshot.
      Since:
      5.2.2
    • getCurrentHome

      AdaptationHome getCurrentHome()
      Returns the dataspace or snapshot currently selected in the session.
    • getValue

      Object getValue(Path aPath)
      Returns the value of the specified node. Returns null if the value of the node is undefined.

      If this method is called on an Adaptation, a lookup mechanism is used to retrieve the value (see Inheritance and value resolution).

      Access and mapping rules

      The access and mapping rules between XML Schema and Java are described in the chapter Mapping to Java.

      Parameters:
      aPath - required, resolved in the context of the current record, or the current dataset if the current record is null.
      Throws:
      PathAccessException -
    • if aPath does not refer to an existing node in the underlying type tree structure,
    • the specified node is above a terminal node.
    • Since:
      5.5.0
      See Also:
    • getServiceContext

      @Deprecated ServiceContext getServiceContext()
      Deprecated.
      From release 6.0, this API is no longer supported. The new UserService API should be used instead.
      Returns an instance of ServiceContext if this AJAX component is called from a UIService, Returns null otherwise.
      Since:
      5.5.0
      See Also: