edu.rice.cs.drjava.ui |
The ui package contains classes for the default user interface
for DrJava.
The interface allows multiple documents to be open, but requires that exactly
one document is active at any time, since only one document is displayed in
the GUI. This is enforced by subclassing the
DefaultGlobalModel in the model package to add
additional constraints to the logic and state of DrJava, while maintaining
the separation from the pure user interface classes.
Additional Logic
The SingleDisplayModel is a subclass of
DefaultGlobalModel , primarily providing the constraint that
exactly one document is active at any time. It adds public methods for
getting and setting the currently active document to the interface provided
by GlobalModel , and fires a corresponding event through the
SingleDisplayModelListener class, which is a subclass of
GlobalModelListener .
Note that this behavior is not included in the
DefaultGlobalModel because the notion of a single active document
is specific to this user interface. Alternative GUIs might choose to display
multiple documents simultaneously, eliminating the need for this additional
constraint. Housing this logic in a subclass of
DefaultGlobalModel , rather than in MainFrame itself,
allows us to verify through unit tests that only one document can be active.
User Interface
The graphical user interface is implemented in Swing and is coordinated
through the MainFrame class. The general layout and primary
components of the interface are shown in the image below.
MainFrame
The MainFrame is the JFrame which houses all
other components of the GUI. It is solely a means of displaying the
state and logic kept within its SingleDisplayModel , and
maintains as little state of its own as possible. The
MainFrame consists of a JMenuBar containing the
menus, current filename, and toolbar buttons, together with a collection
of panes for displaying the various components of DrJava. These include
a scrollable JList with the OpenDefinitionDocuments ,
a DefinitionsPane for displaying and editing the source code,
and a tabbed pane at the bottom which houses the
InteractionsPane , CompilerErrorPanel , and
OutputPane .
In addition to setting up the GUI and passing action requests to the
model, MainFrame is also responsible for listening to
events fired by both the GlobalModel and the document
itself, in order to keep the display current.
Other Components
- The primary GUI component outside the
MainFrame is the
DefinitionsPane , which is a JEditorPane that
is tied to a specific OpenDefinitionsDocument in the
model. This pane handles all highlighting and text indenting for its
document, as well as undoing actions specific to the document.
- The
InteractionsPane is held in the tabbed pane at the
bottom of the interface and provides the actual interaction with the
repl interpreter within the GlobalModel .
- The
CompilerErrorPanel is another tab in the tabbed pane,
and contains both a JComboBox for selecting the compiler
and an ErrorListPane for displaying all the errors from
the most recent compilation, sorted by document. The
ErrorListPane is an inner class of
CompilerErrorPanel , and is responsible for highlighting
errors in the list and in the source consistently.
- The
OutputPane is the third tab in the tabbed pane, and
is simply where System.out and System.err
are redirected when DrJava is run.
- The
FindReplaceDialog is a separate JDialog
which handles the logic and state of finding and replacing text in the
code, including highlighting and changing the source position as
necessary. Only one FindReplaceDialog exists in the GUI,
and it must be notified each time the active document is changed.
|
Java Source File Name | Type | Comment |
AboutDialog.java | Class | About dialog. |
AbstractConsoleController.java | Class | Abstract class to handle hooking up a console document with its pane. |
AbstractDJPane.java | Class | This pane class for a SwingDocument. |
BackgroundColorListener.java | Class | Creates and installs an OptionListener for DEFINITIONS_BACKGROUND_COLOR on a specified JTextComponent. |
BookmarksPanel.java | Class | Panel for displaying bookmarks. |
BreakpointsPanel.java | Class | Panel for displaying the breakpoints. |
BrowserHistoryPanel.java | Class | Panel for displaying browser history. |
ClassPathFilter.java | Class | A file filter for files with extensions ".jar"/".zip". |
ClipboardHistoryFrame.java | Class | Frame with history of clipboard. |
CommonCloseButton.java | Class | Common button that can be instantiated to create close buttons with
any ActionListener to notify, or not, if you so choose. |
CompilerErrorPanel.java | Class | The panel which houses the list of errors after an unsuccessful compilation. |
ConsoleController.java | Class | |
ConsoleControllerTest.java | Class | |
DebugPanel.java | Class | Panel for displaying the debugger input and output in MainFrame. |
DefinitionsPane.java | Class | The pane in which work on a given OpenDefinitionsDocument occurs. |
DefinitionsPaneTest.java | Class | |
DirectoryFilter.java | Class | A file filter for selecting directories. |
DrJavaErrorHandler.java | Class | The handle() method in this class is called everytime an uncaught exception propagates to an AWT action.
The static log() method can be used to put log entries into the error log but continue execution.
This does not automatically update the "DrJava Errors" window when new errors occur. |
DrJavaErrorPopup.java | Class | Displays a popup window for the first uncaught exception or logged conditions. |
DrJavaErrorWindow.java | Class | Displays uncaught exceptions and logged conditions.
This window is not automatically updated when new errors occur. |
DrJavaScrollableDialog.java | Class | A JDialog with a scrollable text area and a button panel. |
ErrorCaretListener.java | Class | Listens to the caret in the associated DefinitionsPane and highlights the text containing CompilerErrors. |
ErrorPanel.java | Class | This class contains common code and interfaces from CompilerErrorPanel, JUnitPanel, and JavadocErrorPanel. |
FindReplacePanel.java | Class | The tabbed panel that handles requests for finding and replacing text. |
FindResultsPanel.java | Class | Panel for displaying find results. |
ForegroundColorListener.java | Class | Creates and installs an OptionListener for DEFINITIONS_NORMAL_COLOR on a specified JTextComponent. |
HelpFrame.java | Class | The frame for displaying the HTML help files. |
HistorySaveDialog.java | Class | Displayed when the user chooses to save the interactions history. |
HTMLFrame.java | Class | The frame for displaying the HTML help files. |
InteractionsController.java | Class | This class installs listeners and actions between an InteractionsDocument (the model) and an InteractionsPane
(the view). |
InteractionsHistoryFilter.java | Class | A file filter for files with extensions ".hist". |
InteractionsPane.java | Class | The view component for repl interaction. |
InteractionsPaneTest.java | Class | Test functions of InteractionsPane. |
InteractionsScriptController.java | Class | Controller for an interactions script. |
InteractionsScriptPane.java | Class | Pane for an interactions script. |
JarOptionsDialog.java | Class | |
JavadocDialog.java | Class | Manages a dialog box that can select a destination directory for generating Javadoc. |
JavadocErrorPanel.java | Class | The panel which displays all the Javadoc parsing errors. |
JavadocFrame.java | Class | |
JavaSourceFilter.java | Class | A file filter for files with extensions ".java" and ".gj". |
JUnitPanel.java | Class | The panel that displays all the testing errors. |
KeyBindingManager.java | Class | Contains Hashtables that are used in the key-binding process along with methods to build them and access their
contents. |
LineEnumRule.java | Class | |
MainFrame.java | Class | DrJava's main window. |
MainFrameTest.java | Class | Test functions of MainFrame. |
PreviewConsoleFrame.java | Class | |
PreviewDefDocFrame.java | Class | |
PreviewFrame.java | Class | |
ProjectMenuTest.java | Class | Test functions of Project Facility working through the main frame and model. |
ProjectPropertiesFrame.java | Class | |
QuickStartFrame.java | Class | The frame for displaying the HTML quick start files. |
RecentDocFrame.java | Class | This class extends a Swing view class. |
RecentFileManager.java | Class | Manages a list of the most recently used files to be displayed
in the File menu. |
RecentFileManagerTest.java | Class | Test functions of RecentFileManager. |
RegionsListPanel.java | Class | Panel for displaying regions in a list sorted by time of creation. |
RegionsTreePanel.java | Class | Panel for displaying regions in a tree sorted by class name and line number. |
ReverseHighlighter.java | Class | Implements the Highlighter interfaces. |
SimpleInteractionsWindow.java | Class | A standalone Interactions Window that provides the functionality of DrJava's Interactions Pane in a single JVM. |
SplashScreen.java | Class | A splash screen window to be displayed as DrJava is first starting up. |
TabbedPanel.java | Class | Extended by all panels that can dynamically be added or removed from the
_tabbedPane in MainFrame. |