|
||||||||||
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.JTree
edu.rice.cs.util.docnavigation.JTreeSortNavigator<ItemT>
public class JTreeSortNavigator<ItemT extends INavigatorItem>
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTree |
---|
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector |
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 |
---|
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 edu.rice.cs.util.docnavigation.IDocumentNavigator |
---|
MODEL_INITIATED_PROPERTY_NAME |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JTreeSortNavigator(String projRoot)
Standard constructor. |
|
JTreeSortNavigator(String projRoot,
DisplayManager<? super ItemT> dm)
Alternate constructor specifying the display manager that provides icons for the navigator. |
Method Summary | ||
---|---|---|
boolean |
_contains(ItemT doc)
Tests to see if a given document is contained in this navigator. |
|
void |
addDocument(ItemT doc)
Adds an IDocument to this navigator. |
|
void |
addDocument(ItemT doc,
String path)
Adds an INavigatorItem to this navigator in the specified position. |
|
void |
addNavigationListener(INavigationListener<? super ItemT> listener)
Adds an INavigationListener to this navigator. |
|
void |
addTopLevelGroup(String name,
INavigatorItemFilter<? super ItemT> f)
Adds a top level group to the navigator. |
|
Container |
asContainer()
|
|
void |
clear()
Removes all IDocuments from this IDocumentNavigator . |
|
void |
collapsePaths(String[] paths)
Collapses all the paths in the tree that match one of the path strings included in the given hash set. |
|
boolean |
contains(ItemT doc)
Tests to see if a given document is contained in this navigator. |
|
void |
dragEnter(DropTargetDragEvent dropTargetDragEvent)
User dragged something into the component. |
|
void |
dragExit(DropTargetEvent dropTargetEvent)
|
|
void |
dragOver(DropTargetDragEvent dropTargetDragEvent)
|
|
void |
drop(DropTargetDropEvent dropTargetDropEvent)
User dropped something on the component. |
|
void |
dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
|
|
|
execute(IDocumentNavigatorAlgo<ItemT,InType,ReturnType> algo,
InType input)
Standard visitor pattern. |
|
String |
generatePathString(TreePath tp)
Generates a path string for the given tree node. |
|
String[] |
getCollapsedPaths()
|
|
ItemT |
getCurrent()
Returns the currently selected leaf node, or null if the selected node is not a leaf. |
|
int |
getDocumentCount()
Returns the number of IDocuments contained by this IDocumentNavigator
Not synchronized on the assumption that size field of a HashMap always has a legitimate
value (either the size of the current state or the size of its state before some concurrent
operation started. |
|
ArrayList<ItemT> |
getDocuments()
Returns all the IDocuments contained in this navigator. |
|
int |
getDocumentSelectedCount()
|
|
ArrayList<ItemT> |
getDocumentsInBin(String binName)
Returns all the IDocuments contained in the specified bin. |
|
ItemT |
getFirst()
Returns the first document in the collection (using enumeration order). |
|
int |
getGroupSelectedCount()
|
|
ItemT |
getLast()
Returns the last document in the collection (using enumeration order). |
|
Object |
getModelLock()
Returns the model lock. |
|
Set<String> |
getNamesOfSelectedTopLevelGroup()
Returns the names of the top level groups that the selected items descend from. |
|
Collection<INavigationListener<? super ItemT>> |
getNavigatorListeners()
Returns a collection of all navigator listeners. |
|
ItemT |
getNext(ItemT doc)
Returns the next document in the collection (using enumeration order). |
|
ItemT |
getPrevious(ItemT doc)
Returns the previous document in the collection (using enumeration order). |
|
Component |
getRenderer()
Returns a renderer for this object. |
|
List<ItemT> |
getSelectedDocuments()
|
|
List<File> |
getSelectedFolders()
|
|
boolean |
isDocumentSelected()
|
|
boolean |
isEmpty()
Returns whether this IDocumentNavigator contains any IDocuments . |
|
boolean |
isGroupSelected()
|
|
boolean |
isNextChangeModelInitiated()
|
|
boolean |
isRootSelected()
Returns true if the root is selected. |
|
boolean |
isSelectedAt(int x,
int y)
Returns true if the item at the x,y coordinate of the navigator pane is currently selected. |
|
boolean |
isSelectedInGroup(ItemT i)
|
|
boolean |
isTopLevelGroupSelected()
Returns true if at least one top level group is selected. |
|
void |
refreshDocument(ItemT doc,
String path)
Resets a given INavigatorItem |
|
ItemT |
removeDocument(ItemT doc)
Removes a given INavigatorItem |
|
void |
removeNavigationListener(INavigationListener<? super ItemT> listener)
Removes the given listener from observing this navigator. |
|
void |
requestSelectionUpdate(ItemT ini)
If the currently selected item is not an INavigatorItem, select the one given. |
|
void |
selectDocument(ItemT doc)
Sets the specified document to be active (current). |
|
boolean |
selectDocumentAt(int x,
int y)
Selects the document at the x,y coordinate of the navigator pane and installs it as the active document. |
|
void |
setBackground(Color c)
Sets the background color of this tree |
|
void |
setDisplayManager(DisplayManager<? super ItemT> manager)
Sets the display manager that is used to select icons for the leaves of the tree. |
|
void |
setForeground(Color c)
Sets the foreground color of this JTree |
|
void |
setNextChangeModelInitiated(boolean b)
Marks the next selection change as model-initiated (true) or user-initiated (false; default). |
|
void |
setRootIcon(Icon ico)
Sets the icon to be displayed at the root of the tree |
|
void |
treeCollapsed(TreeExpansionEvent event)
Called whenever an item in the tree has been collapsed. |
|
void |
treeExpanded(TreeExpansionEvent event)
Called whenever an item in the tree has been expanded. |
|
void |
valueChanged(TreeSelectionEvent e)
Called whenever the value of the selection changes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.rice.cs.util.docnavigation.IDocumentNavigator |
---|
addFocusListener, getFocusListeners, getSelectionCount, removeFocusListener, repaint |
Constructor Detail |
---|
public JTreeSortNavigator(String projRoot)
projRoot
- the path identifying the root node for the projectpublic JTreeSortNavigator(String projRoot, DisplayManager<? super ItemT> dm)
projRoot
- the path identifying the root node for the projectdm
- the display manager for the navigagtorMethod Detail |
---|
public void setForeground(Color c)
setForeground
in class JComponent
c
- the color to set topublic void setBackground(Color c)
setBackground
in class JComponent
c
- the color for the backgroundpublic void setDisplayManager(DisplayManager<? super ItemT> manager)
public void setRootIcon(Icon ico)
public Container asContainer()
asContainer
in interface IAWTContainerNavigatorActor
asContainer
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public void addDocument(ItemT doc)
IDocument
to this navigator. Should only executed from event thread.
addDocument
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the document to be added into this navigator.public void addDocument(ItemT doc, String path)
INavigatorItem
to this navigator in the specified position. The behavior of this navigator
and the position associated with a path are left to the implementing class. Only runs in event-handling thread.
addDocument
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the document to be added into this navigator.path
- in navigator to parent directory for doc
IllegalArgumentException
- if this navigator does not contain relativeto
as tested by the
contains
method.public ItemT removeDocument(ItemT doc)
INavigatorItem from this navigator. Removes all INavigatorItem
s
from this navigator that are "equal" (using .equals(...)
) to the passed argument. Any of
the removed documents may be returned by this method. If the NavigatorItem is found in the navigator, null
is returned. Only executes from event thread.
- Specified by:
removeDocument
in interface IDocumentNavigator<ItemT extends INavigatorItem>
- Parameters:
doc
- the docment to be removed
- Returns:
- doc a document removed from this navigator as a result of invoking this method.
- Throws:
IllegalArgumentException
- if this navigator contains no document equal to doc
public void refreshDocument(ItemT doc, String path)
INavigatorItem in the tree. Updates the placement of the item and its display
to reflect any changes made in the model. Only executes in the event thread.
Note: full synchronization commented out because this operation is only performed in the event thread. The
synchronized sections must be atomic but the rest of the code can run concurrently with read operations in
other threads.
- Specified by:
refreshDocument
in interface IDocumentNavigator<ItemT extends INavigatorItem>
- Parameters:
doc
- the document to be refreshedpath
- the path to the parent folder for this document
- Throws:
IllegalArgumentException
- if this navigator contains no document equal to doc.
public void selectDocument(ItemT doc)
selectDocument
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the document to selectpublic ItemT getNext(ItemT doc)
getNext
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the INavigatorItem of interest
public ItemT getPrevious(ItemT doc)
getPrevious
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the INavigatorItem of interest
public ItemT getFirst()
getFirst
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public ItemT getLast()
getLast
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean contains(ItemT doc)
contains
in interface IDocumentNavigator<ItemT extends INavigatorItem>
doc
- the document to test for containment.
true
if this navigator contains a document that is "equal" (as tested by the
equals
false.public boolean _contains(ItemT doc)
public ArrayList<ItemT> getDocuments()
IDocuments
contained in this navigator. Does not assert any type of ordering on
the returned structure. Executes in any thread.
getDocuments
in interface IDocumentNavigator<ItemT extends INavigatorItem>
INavigatorItem enumeration of this navigator's contents.
public ArrayList<ItemT> getDocumentsInBin(String binName)
IDocuments
contained in the specified bin.
getDocumentsInBin
in interface IDocumentNavigator<ItemT extends INavigatorItem>
binName
- name of bin
INavigatorItem enumeration of this navigator's contents.
public int getDocumentCount()
IDocuments
contained by this IDocumentNavigator
Not synchronized on the assumption that size field of a HashMap always has a legitimate
value (either the size of the current state or the size of its state before some concurrent
operation started. Executes in any thread. Assume size() always returns a valid (perhaps stale) value.
getDocumentCount
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isEmpty()
IDocumentNavigator
contains any IDocuments
.
isEmpty
in interface IDocumentNavigator<ItemT extends INavigatorItem>
true
if this navigator contains one or more documents, else false
.
Executes in any thread. Assume isEmpty() always returns a valid (perhaps stale) value.public void clear()
IDocuments
from this IDocumentNavigator
. Only executes in event thread.
clear
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public void addNavigationListener(INavigationListener<? super ItemT> listener)
INavigationListener
to this navigator. After invoking this method, the passed
listener will be eligible for observing this navigator. If the provided listener is already observing
this navigator (as tested by the == operator), no action is taken. Only executes in event thread.
addNavigationListener
in interface IDocumentNavigator<ItemT extends INavigatorItem>
listener
- the listener to be added to this navigator.public void removeNavigationListener(INavigationListener<? super ItemT> listener)
removeNavigationListener
in interface IDocumentNavigator<ItemT extends INavigatorItem>
listener
- the listener to be removed from this navigatorpublic Collection<INavigationListener<? super ItemT>> getNavigatorListeners()
getNavigatorListeners
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public <InType,ReturnType> ReturnType execute(IDocumentNavigatorAlgo<ItemT,InType,ReturnType> algo, InType input)
execute
in interface IDocumentNavigator<ItemT extends INavigatorItem>
algo
- the visitor to runinput
- the input for the visitorpublic void valueChanged(TreeSelectionEvent e)
valueChanged
in interface TreeSelectionListener
e
- the event that characterizes the change.public Component getRenderer()
getRenderer
in interface IAWTContainerNavigatorActor
public boolean selectDocumentAt(int x, int y)
selectDocumentAt
in interface IDocumentNavigator<ItemT extends INavigatorItem>
x
- the x coordinate of the navigator paney
- the y coordinate of the navigator panepublic boolean isSelectedAt(int x, int y)
isSelectedAt
in interface IDocumentNavigator<ItemT extends INavigatorItem>
x
- the x coordinate of the navigator paney
- the y coordinate of the navigator pane
public boolean isGroupSelected()
isGroupSelected
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public int getGroupSelectedCount()
getGroupSelectedCount
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public List<File> getSelectedFolders()
getSelectedFolders
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isDocumentSelected()
isDocumentSelected
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public int getDocumentSelectedCount()
getDocumentSelectedCount
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public List<ItemT> getSelectedDocuments()
getSelectedDocuments
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isTopLevelGroupSelected()
isTopLevelGroupSelected
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isRootSelected()
isRootSelected
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public Set<String> getNamesOfSelectedTopLevelGroup() throws GroupNotSelectedException
getNamesOfSelectedTopLevelGroup
in interface IDocumentNavigator<ItemT extends INavigatorItem>
GroupNotSelectedException
public ItemT getCurrent()
getCurrent
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public Object getModelLock()
getModelLock
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isSelectedInGroup(ItemT i)
isSelectedInGroup
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public void addTopLevelGroup(String name, INavigatorItemFilter<? super ItemT> f)
addTopLevelGroup
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public void treeCollapsed(TreeExpansionEvent event)
treeCollapsed
in interface TreeExpansionListener
public void treeExpanded(TreeExpansionEvent event)
treeExpanded
in interface TreeExpansionListener
public void collapsePaths(String[] paths)
generatePathString
for information on the format of the path strings. Only executes in event thread.
paths
- A hash set of path strings.public String[] getCollapsedPaths()
generatePathString
for information on the format of the path strings. Only runs in event thread (except when testing).public String generatePathString(TreePath tp)
The path string does not include the project root node, but rather a period in its place. Following the "./" is one of the 3 main groups, "[ Source Files ]", "[ Auxiliary ]", "[ External ]". The nodes in the path are represented by their names delimited by the forward slash ("/"). The path ends with a final delimeter. (e.g. "./[ Source Files ]/util/docnavigation/") Only runs in event thread.
public void requestSelectionUpdate(ItemT ini)
requestSelectionUpdate
in interface IDocumentNavigator<ItemT extends INavigatorItem>
ini
- The suggested current INavigatorItem.public void setNextChangeModelInitiated(boolean b)
setNextChangeModelInitiated
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public boolean isNextChangeModelInitiated()
isNextChangeModelInitiated
in interface IDocumentNavigator<ItemT extends INavigatorItem>
public void dragEnter(DropTargetDragEvent dropTargetDragEvent)
dragEnter
in interface DropTargetListener
public void dragExit(DropTargetEvent dropTargetEvent)
dragExit
in interface DropTargetListener
public void dragOver(DropTargetDragEvent dropTargetDragEvent)
dragOver
in interface DropTargetListener
public void dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
dropActionChanged
in interface DropTargetListener
public void drop(DropTargetDropEvent dropTargetDropEvent)
drop
in interface DropTargetListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |