Interface StrangeEonsEditor.HeartbeatListener

  • All Superinterfaces:
    java.util.EventListener
    Enclosing interface:
    StrangeEonsEditor

    public static interface StrangeEonsEditor.HeartbeatListener
    extends java.util.EventListener
    A heartbeat listener is notified by an editor once per heartbeat. An editor's heartbeat is used to performed tasks that must be repeated on a timed basis. The primary example is the synchronization of preview window updates with editing by an AbstractGameComponentEditor, in which the editor waits to redraw the preview window until the current round of quick edits has finished. (For example, if the user types a word and then pauses, the preview window would typically be redrawn during the pause rather than while the user was typing.) Other kinds of editors may use the editor's heartbeat for different purposes. Even editors that do not require a heartbeat themselves are expected to provide one for use by plug-ins.

    Editors that use the heartbeat to synchronize preview updates will respond to a boolean value returned by the listener. If this method returns true, it is assumed that the listener has made changes to the edited content. These changes may or may not be detectable by the editor; the editor should thus redraw the preview from scratch at the next opportunity.

    See Also:
    AbstractStrangeEonsEditor.addHeartbeatListener(ca.cgjennings.apps.arkham.StrangeEonsEditor.HeartbeatListener), AbstractStrangeEonsEditor.createTimer()
    • Method Detail

      • heartbeat

        boolean heartbeat​(StrangeEonsEditor editor)
        Called to indicate that a heartbeat is taking place in the indicated editor. If a listener has attached to an editor for the purpose of modifying the edited content, it should return true on those heartbeats where a genuine modification takes place. In any other case, the listener should return false.

        Important: Editors that synchronize redrawing using the heartbeat, including nearly all game component editors, will never update the preview display if a heartbeat listener always returns true.

        Parameters:
        editor - the editor that is processing a heartbeat
        Returns:
        true if the edited content was modified