|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.rice.cs.drjava.ui.TabbedPanel
edu.rice.cs.drjava.ui.RegionsTreePanel<R>
public abstract class RegionsTreePanel<R extends OrderedDocumentRegion>
Panel for displaying regions in a tree sorted by class name and line number. Only accessed from event thread. The volatile declarations are included because the event-thread-only invariant is not enforced. TODO: fix this.
| Nested Class Summary | |
|---|---|
protected class |
RegionsTreePanel.DefaultState
Normal state, GUI changes not delayed. |
protected static interface |
RegionsTreePanel.IChangeState
State pattern for improving performance during rapid updates. |
protected class |
RegionsTreePanel.RegionMouseAdapter
Mouse adapter for the region tree. |
(package private) class |
RegionsTreePanel.RegionRenderer
Adds config color support to DefaultTreeCellEditor. |
protected class |
RegionsTreePanel.RegionTree
|
protected static class |
RegionsTreePanel.RegionTreeUserObj<R extends OrderedDocumentRegion>
Class that is embedded in each leaf node. |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected JPanel |
_buttonPanel
|
protected RegionsTreePanel.IChangeState |
_changeState
|
protected HashMap<OpenDefinitionsDocument,DefaultMutableTreeNode> |
_docToTreeNode
A table mapping each document entered in this panel to its corresponding MutableTreeNode in _regTreeModel. |
protected MainFrame |
_frame
|
protected boolean |
_hasNextPrevButtons
|
protected R |
_lastSelectedRegion
the region that was last selected (may be null). |
protected JPanel |
_leftPane
|
protected SingleDisplayModel |
_model
|
protected JButton |
_nextButton
button to go to the next region (or null if _hasNextPrevButtons==false). |
protected JButton |
_prevButton
button to go to the previous region (or null if _hasNextPrevButtons==false). |
private RegionManager<R> |
_regionManager
|
protected JPopupMenu |
_regionPopupMenu
|
protected IdentityHashMap<R,DefaultMutableTreeNode> |
_regionToTreeNode
A table mapping each region entered in this panel to its corresponding MutableTreeNode in _regTreeModel. |
private JTree |
_regTree
|
private DefaultTreeModel |
_regTreeModel
|
private DefaultMutableTreeNode |
_rootNode
|
private String |
_title
|
protected RegionsTreePanel.IChangeState |
DEFAULT_STATE
State pattern to improve performance when rapid changes are made. |
protected DefaultTreeCellRenderer |
dtcr
|
| Fields inherited from class edu.rice.cs.drjava.ui.TabbedPanel |
|---|
_closeButton, _closePanel, _displayed, _mainPanel, dropTarget |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
RegionsTreePanel(MainFrame frame,
String title,
RegionManager<R> regionManager)
Constructs a new panel to display regions in a tree. |
|
RegionsTreePanel(MainFrame frame,
String title,
RegionManager<R> regionManager,
boolean hasNextPrevButtons)
Constructs a new panel to display regions in a tree. |
|
| Method Summary | |
|---|---|
protected void |
_close()
Close the panel and update buttons. |
private void |
_initPopup()
Initializes the pop-up menu. |
protected void |
_remove()
Remove the selected regions. |
protected boolean |
_requestFocusInWindow()
Forces the panel to be updated and requests focus in this panel. |
private static void |
_setColors(Component c)
Quick helper for setting up color listeners. |
private void |
_setupButtonPanel()
Creates the buttons for controlling the regions. |
private void |
_setupRegionTree()
Creates the region tree. |
protected void |
_updateButtons()
|
void |
addRegion(R r)
Add a region to the tree. |
protected void |
closeIfEmpty()
Close the panel if the tree becomes empty. |
void |
collapseAll()
Collapse all tree nodes. |
void |
expandAll()
Expand all tree nodes. |
private void |
expandRecursive(JTree tree,
TreePath parent,
boolean expand)
|
void |
expandTree()
Expands all nodes in a two-level tree. |
SingleDisplayModel |
getGlobalModel()
|
protected R |
getNextRegionInTree(R r)
Return the region following r in the tree, or null if there isn't one. |
(package private) DefaultMutableTreeNode |
getNode(OpenDefinitionsDocument doc)
Gets the tree node for the given document. |
(package private) DefaultMutableTreeNode |
getNode(R region)
Gets the tree node for the given region. |
protected R |
getPrevRegionInTree(R r)
Return the region preceding r in the tree, or null if there isn't one. |
RegionManager<R> |
getRegionManager()
|
JTree |
getRegTree()
|
DefaultTreeModel |
getRegTreeModel()
|
DefaultMutableTreeNode |
getRootNode()
|
protected ArrayList<R> |
getSelectedRegions()
Gets the currently selected regions in the region tree, or an empty array if no regions are selected. |
String |
getTitle()
|
void |
goToNextRegion()
Go to next region. |
void |
goToPreviousRegion()
Go to previous region. |
protected void |
goToRegion()
Go to region. |
private void |
insertNewRegionNode(R r,
DefaultMutableTreeNode docNode,
int pos)
|
protected JComponent[] |
makeButtons()
Creates the buttons for controlling the regions. |
protected AbstractAction[] |
makePopupMenuActions()
Makes the popup menu actions. |
protected RegionsTreePanel.RegionTreeUserObj<R> |
makeRegionTreeUserObj(R r)
Factory method to create user objects put in the tree. |
protected void |
performDefaultAction()
Action performed when the Enter key is pressed. |
void |
reload(R startRegion,
R endRegion)
|
void |
removeRegion(R r)
Remove a region from this panel. |
boolean |
requestFocusInWindow()
Update the JTree. |
protected void |
selectRegion(R r)
Select a region in this panel. |
protected void |
updateButtons()
Update button state and text. |
protected void |
updateNextPreviousRegionButtons()
Update the enabled/disabled state of the next/previous region buttons. |
protected void |
updateNextPreviousRegionButtons(R lastSelectedRegion)
Update the enabled/disabled state of the next/previous region buttons. |
protected void |
updatePanel()
Forces this panel to be completely updated. |
| Methods inherited from class edu.rice.cs.drjava.ui.TabbedPanel |
|---|
addCloseListener, dragEnter, dragExit, dragOver, drop, dropActionChanged, getMainPanel, getName, isDisplayed, setDisplayed, setVisible |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected volatile JPanel _leftPane
private volatile DefaultMutableTreeNode _rootNode
private volatile DefaultTreeModel _regTreeModel
private volatile JTree _regTree
private volatile String _title
private volatile RegionManager<R extends OrderedDocumentRegion> _regionManager
protected volatile JPopupMenu _regionPopupMenu
protected final SingleDisplayModel _model
protected final MainFrame _frame
protected volatile JPanel _buttonPanel
protected volatile DefaultTreeCellRenderer dtcr
protected volatile boolean _hasNextPrevButtons
protected volatile JButton _prevButton
protected volatile JButton _nextButton
protected volatile R extends OrderedDocumentRegion _lastSelectedRegion
protected final RegionsTreePanel.IChangeState DEFAULT_STATE
protected volatile RegionsTreePanel.IChangeState _changeState
protected volatile HashMap<OpenDefinitionsDocument,DefaultMutableTreeNode> _docToTreeNode
protected volatile IdentityHashMap<R extends OrderedDocumentRegion,DefaultMutableTreeNode> _regionToTreeNode
| Constructor Detail |
|---|
public RegionsTreePanel(MainFrame frame,
String title,
RegionManager<R> regionManager)
frame - the MainFrametitle - title of the paneregionManager - the region manager associated with this panel
public RegionsTreePanel(MainFrame frame,
String title,
RegionManager<R> regionManager,
boolean hasNextPrevButtons)
frame - the MainFrametitle - title of the paneregionManager - the region manager associated with this panelhasNextPrevButtons - whether this panel should have next/previous buttons| Method Detail |
|---|
private static void _setColors(Component c)
protected void _close()
_close in class TabbedPanelpublic boolean requestFocusInWindow()
requestFocusInWindow in class TabbedPanelprotected void updatePanel()
protected boolean _requestFocusInWindow()
private void _setupRegionTree()
public DefaultMutableTreeNode getRootNode()
public JTree getRegTree()
public DefaultTreeModel getRegTreeModel()
public String getTitle()
public RegionManager<R> getRegionManager()
public SingleDisplayModel getGlobalModel()
protected void updateButtons()
protected void _updateButtons()
public void expandAll()
public void collapseAll()
protected void _remove()
private void expandRecursive(JTree tree,
TreePath parent,
boolean expand)
protected void performDefaultAction()
protected JComponent[] makeButtons()
private void _setupButtonPanel()
protected AbstractAction[] makePopupMenuActions()
private void _initPopup()
DefaultMutableTreeNode getNode(OpenDefinitionsDocument doc)
DefaultMutableTreeNode getNode(R region)
protected ArrayList<R> getSelectedRegions()
protected void goToRegion()
protected void updateNextPreviousRegionButtons()
protected void updateNextPreviousRegionButtons(R lastSelectedRegion)
lastSelectedRegion - new region selectedpublic void goToPreviousRegion()
protected R getPrevRegionInTree(R r)
public void goToNextRegion()
protected R getNextRegionInTree(R r)
public void addRegion(R r)
r - the region
private void insertNewRegionNode(R r,
DefaultMutableTreeNode docNode,
int pos)
public void expandTree()
public void removeRegion(R r)
r - the regionprotected void selectRegion(R r)
r - the regionprotected void closeIfEmpty()
public void reload(R startRegion,
R endRegion)
protected RegionsTreePanel.RegionTreeUserObj<R> makeRegionTreeUserObj(R r)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||