Class EventStreamResourceEditor

All Implemented Interfaces:
Disposable, ImageObserver, MenuContainer, Serializable, Accessible

public class EventStreamResourceEditor extends ResourceEditor<EventStreamConfig> implements Disposable
See Also:
  • Constructor Details

  • Method Details

    • init

      protected void init(EventStreamConfig config)
      Specified by:
      init in class ResourceEditor<EventStreamConfig>
    • deserialize

      protected EventStreamConfig deserialize(Resource resource) throws Exception
      Description copied from class: ResourceEditor
      Deserialize a project resource into the editing object type for this editor. Default implementation simply calls this.deserialize(resource.getData().orElseThrow().getBytes()). Override this method if your resource does not use the default data.bin file.
      Overrides:
      deserialize in class ResourceEditor<EventStreamConfig>
      Throws:
      Exception
    • serializeResource

      protected void serializeResource(ResourceBuilder builder, EventStreamConfig config) throws Exception
      Description copied from class: ResourceEditor
      Serialize the object and put the serialized file(s) and attribute(s) into the project resource builder. Default implementation is:
      builder.putData(serialize(object));
      Implementations don't need to bother setting the project's resourcePath, projectName, or applicationScope; those will be set automatically.
      Overrides:
      serializeResource in class ResourceEditor<EventStreamConfig>
      Throws:
      Exception
    • getObjectForSave

      protected EventStreamConfig getObjectForSave() throws Exception
      This method works in conjunction with handleEditorWillCommit() and the isClosing variable. This method is called in the following 2 scenarios:
      1. When the "Save All" button is clicked in the Designer
      2. When the Event Stream is closed in the Designer workspace
      In scenario 1, when the Event Stream is saved, we reinitialize the UI with the new the configForSaving, so that the UI reflects the current saved changes

      In scenario 2, the Event Stream is being closed in the Designer, therefor a reinitialization of the UI with configForSaving is unnecessary. In addition to being unnecessary, it also incurs a slight time delay when the Event Stream is closed.

      To differentiate between scenario 1 and 2, the handleEditorWillCommit() sets a flag on the isClosing variable. This method is called when the editor is about to close, and before the commit method is called, and the isClosing flag is set, and allows us to differentiate between scenario 1 and 2.
      Specified by:
      getObjectForSave in class ResourceEditor<EventStreamConfig>
      Throws:
      Exception
    • updateResource

      public void updateResource(Resource resource)
      Description copied from class: ResourceEditor
      Call this when the resource changes due to project pulls
      Overrides:
      updateResource in class ResourceEditor<EventStreamConfig>
    • handleEditorWillCommit

      public void handleEditorWillCommit()
      This method is called before the commit method is called. It works in conjunction with the getObjectForSave() method. The getObjectForSave() to understand how the 2 methods work together.
    • dispose

      public void dispose()
      Description copied from class: ResourceEditor
      Disposes of resources used by the editor. Subclasses should override this method to perform their specific cleanup operations.
      Specified by:
      dispose in interface Disposable
      Overrides:
      dispose in class ResourceEditor<EventStreamConfig>