The model package is responsible for the majority of the logic and state in DrJava. It is independent of the presentation, allowing different user interfaces to be created for the same codebase. The interfaces and classes in this package maintain the state of all open documents, interface to the compiler and interaction components, and communicate with the user interface through public methods and GlobalModelListeners.

GlobalModel's Role

The GlobalModel is the central point of DrJava, coordinating all components and communicating with the user interface.

To maintain state, the GlobalModel keeps a list of the OpenDefinitionsDocuments, each of which is responsible for its own DefinitionsDocument object and document specific actions on that object, such as saving and compiling.

The GlobalModel also provides a set of public methods which allow it to communicate with the user interface. This gives the ui package access to the OpenDefinitionsDocuments, compiler, console, and interactions code.

To keep the user interface up-to-date, the GlobalModel fires events to all GlobalModelListeners which have registered with it. Events are fired after actions which can affect the user interface, such as the opening, saving, and closing of files, or the starting and ending of compilation or interaction.

Subpackages