Class ThemeEditorMessageHandler

java.lang.Object
com.vaadin.copilot.plugins.themeeditor.ThemeEditorMessageHandler
All Implemented Interfaces:
DevToolsMessageHandler, HasSourceModifier, HasThemeModifier

public class ThemeEditorMessageHandler extends Object implements HasSourceModifier, HasThemeModifier, DevToolsMessageHandler
Handler for ThemeEditor debug window communication messages. Responsible for preparing data for ThemeModifier and JavaSourceModifier.
  • Constructor Details

    • ThemeEditorMessageHandler

      public ThemeEditorMessageHandler()
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • getStateMessage

      public StateMessage getStateMessage()
    • getSourceModifier

      public JavaSourceModifier getSourceModifier()
      Specified by:
      getSourceModifier in interface HasSourceModifier
    • getThemeModifier

      public ThemeModifier getThemeModifier()
      Specified by:
      getThemeModifier in interface HasThemeModifier
    • canHandle

      public boolean canHandle(String command, elemental.json.JsonObject data)
      Checks if given command can be handled by ThemeEditor.
      Parameters:
      command - command to be verified if supported
      data - data object to be verified if is of proper structure
      Returns:
      true if it can be handled, false otherwise
    • handleDebugMessageData

      public BaseResponse handleDebugMessageData(String command, elemental.json.JsonObject data)
      Handles debug message command and performs given action.
      Parameters:
      command - Command name
      data - Command data
      Returns:
      response in form of JsonObject
    • registerHandlers

      protected void registerHandlers()
    • handleConnect

      public void handleConnect(DevToolsInterface devToolsInterface)
      Description copied from interface: DevToolsMessageHandler
      Called when a browser connects.

      This happens on each refresh but also when the application is opened in a new browser tab or window.

      Specified by:
      handleConnect in interface DevToolsMessageHandler
      Parameters:
      devToolsInterface - for interaction with the development tools, e.g. sending a message
    • handleMessage

      public boolean handleMessage(String command, elemental.json.JsonObject data, DevToolsInterface devToolsInterface)
      Description copied from interface: DevToolsMessageHandler
      Called when a message from the browser arrives.
      Specified by:
      handleMessage in interface DevToolsMessageHandler
      Parameters:
      command - the command received
      data - the data received
      devToolsInterface - for interaction with the development tools, e.g. sending a message
      Returns:
      true if the message was handled and should not be passed on to further handlers