Interface MPPWebControl


@GwtCompatible public interface MPPWebControl
FirstSpirit JavaScript MPP API, accessible via "MPP_API".
Example:
 if ("MPP_API".isParameterized()) {
     var gender = "MPP_API".getParameter("gender");
     var age = "MPP_API".getParameter("age");
     if (gender == "male" && age >= 18) {
         // ...
     }
 }
Since:
5.2.28
  • Field Details

    • IDENTIFIER

      static final String IDENTIFIER
      JavaScript identifier for the instance of this MPP control object
      Since:
      5.2.28
      See Also:
  • Method Details

    • isParameterized

      boolean isParameterized()
      Returns whether or not the current preview parametrization is enabled by the user.
      Returns:
      true if preview has parameter, false otherwise.
      Since:
      5.2.28
    • addParameterizedListener

      void addParameterizedListener(MPPWebControl.ParameterizedListener listener)

      Adds a listener to be informed when current preview parametrization is enabled/disabled by the user.

      May be used only in WebEdit mode.

      Parameters:
      listener - the listener to add
      Since:
      5.2.190301
    • getParameter

      @Nullable @Nullable Object getParameter(@NotNull @NotNull String name)
      Returns the current value of the specified preview parameter. The return value may be null if there is no editor with the specified name, or if the editors value is null.
      Parameters:
      name - name of the preview parameter to get the value for.
      Returns:
      parameter value, or null for the above mentioned reasons.
      Since:
      5.2.28
    • setParameter

      void setParameter(@NotNull @NotNull String name, @Nullable @Nullable Object value)
      Sets the current value of the specified preview parameter.
      Parameters:
      name - name of the preview parameter to set the value for.
      value - parameter value, or null to clear the value.
      Since:
      5.2.28
    • addParameterListener

      void addParameterListener(MPPWebControl.ParameterListener listener)

      Adds a listener to be informed when a custom preview parameter has changed

      May be used only in WebEdit mode.

      Parameters:
      listener - the listener to add
      Since:
      5.2.190301
    • getTimeParameter

      @Nullable @Nullable Object getTimeParameter()
      Returns the current time the user has chosen using the preview timeline.
      Returns:
      the current time (as javascript Date) object, or null
      Since:
      5.2.28
    • setTimeParameter

      void setTimeParameter(Object date)
      Set the time that should be used for preview.
      Parameters:
      date - the time (as javascript Date) object, or null
      Since:
      5.2.28
    • addTimeParameterListener

      void addTimeParameterListener(MPPWebControl.TimeParameterListener listener)

      Adds a listener to be informed when the time parameter has changed.

      May be used only in WebEdit mode.

      Parameters:
      listener - the listener to add
      Since:
      5.2.190301