Interface DocumentInterceptor

All Known Implementing Classes:
DocumentAdapter

public interface DocumentInterceptor
DocumentInterceptor completes the interception capabilities for jadice Documents. Most document life cycle events, like page addition, page movement or page removal are handled by EventListInterceptors which can be registered on an EventList of Pages returned by the Document. Implementors of DocumentInterceptor may intercept state changes of Documents. That is, they will be notified whenever a state change occurs. Furthermore implementations of this interface could perform any operations before the state change takes places and may decide whether the operation shall go on or should be cancelled.

All interface methods may be called asynchronously from any thread, especially from other threads than the event dispatching thread. It is in the developer's responsibility to take precautions not to violate swing single thread rule and to ensure to do GUI interactions, like user-acknowledging dialogs, only on the event dispatching thread.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return whether this DocumentListener approves the state change (true) of the given document from the given previous state to the given new state.
  • Method Details

    • approveStateChange

      boolean approveStateChange(Document source, Document.State oldState, Document.State newState)
      Return whether this DocumentListener approves the state change (true) of the given document from the given previous state to the given new state.
      Parameters:
      source - The Document on which a state change occurred
      oldState - that Document.State which was valid up to now.
      newState - that Document.State which will be the Document's new Document.State if no registered DocumentInterceptor disapproves the change.
      Returns:
      true if the change is approved, false otherwise.