Class ServerEventObject

java.lang.Object
com.google.gwt.core.client.JavaScriptObject
com.vaadin.client.flow.binding.ServerEventObject

public final class ServerEventObject extends com.google.gwt.core.client.JavaScriptObject
A representation of a server object able to send notifications to the server.
Since:
1.0
Author:
Vaadin Ltd
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    JSO constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    defineMethod(String methodName, StateNode node, boolean returnPromise)
    Defines a method with the given name to be a callback to the server for the given state node.
    get(elemental.dom.Element element)
    Gets or creates element.
    getIfPresent(elemental.dom.Node node)
    Gets or creates element.
    Gets the defined methods.
    protected static com.vaadin.client.flow.binding.ServerEventObject.ServerEventDataExpression
    getOrCreateExpression(String expressionString)
     
    void
    Reject all promises pending on this server object.
    void
    removeMethod(String methodName)
    Removes a method with the given name.

    Methods inherited from class com.google.gwt.core.client.JavaScriptObject

    cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ServerEventObject

      protected ServerEventObject()
      JSO constructor.
  • Method Details

    • defineMethod

      public void defineMethod(String methodName, StateNode node, boolean returnPromise)
      Defines a method with the given name to be a callback to the server for the given state node.

      Note! If the Polymer.Element contains an implementation for methodName it will be run before the server-side method.

      Parameters:
      methodName - the name of the method to add
      node - the node to use as an identifier when sending an event to the server
      returnPromise - true if the handler should return a promise that will reflect the server-side result; false to not return any value
    • removeMethod

      public void removeMethod(String methodName)
      Removes a method with the given name.
      Parameters:
      methodName - the name of the method to remove
    • getMethods

      public JsArray<String> getMethods()
      Gets the defined methods.
      Returns:
      an array of defined method names
    • get

      public static ServerEventObject get(elemental.dom.Element element)
      Gets or creates element.$server for the given element.
      Parameters:
      element - the element to use
      Returns:
      a reference to the $server object in the element
    • getIfPresent

      public static ServerEventObject getIfPresent(elemental.dom.Node node)
      Gets or creates element.$server for the given element, if present.
      Parameters:
      node - the element to use
      Returns:
      a reference to the $server object in the element, or null if note present.
    • getOrCreateExpression

      protected static com.vaadin.client.flow.binding.ServerEventObject.ServerEventDataExpression getOrCreateExpression(String expressionString)
    • rejectPromises

      public void rejectPromises()
      Reject all promises pending on this server object. Called during client resynchronization to free consumers of promises that are never delivered by the server.