|
|||||||||
| Home >> All >> org >> greenstone >> gatherer >> gui >> [ tree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.greenstone.gatherer.gui.tree
Class DragTree

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
org.greenstone.gatherer.gui.tree.DragTree
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.dnd.Autoscroll, org.greenstone.gatherer.util.DragComponent, java.awt.dnd.DragGestureListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable, javax.swing.event.TreeSelectionListener
- Direct Known Subclasses:
- WorkspaceTree
- public class DragTree
- extends javax.swing.JTree
- implements java.awt.dnd.Autoscroll, java.awt.dnd.DragGestureListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, org.greenstone.gatherer.util.DragComponent, javax.swing.event.TreeSelectionListener
- extends javax.swing.JTree
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JTree |
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private static int |
AUTOSCROLL_MARGIN
The distance from the edge of the current view within the scroll bar which if entered causes the view to scroll. |
private java.awt.Color |
background_color
The normal background color. |
static int |
COLLECTION_CONTENTS_CHANGED
|
private javax.swing.ImageIcon |
disabled_background
The image to use for the disabled background. |
private int |
drag_action
The default drag action, although its not that important as we provide custom icons during drags. |
private java.awt.Color |
foreground_color
The normal foreground color. |
private org.greenstone.gatherer.util.DragGroup |
group
The Group this component belongs to. |
static int |
LIBRARY_CONTENTS_CHANGED
|
static int |
LOADED_COLLECTION_CHANGED
|
private java.awt.Rectangle |
lower_cue_line
The region borderer by the lower cue line. |
private javax.swing.ImageIcon |
multiple_icon
The icon to use for multiple node drag'n'drops. |
private java.lang.String |
name
The identifying name of this Tree. |
private static java.awt.Cursor |
NO_DRAG_CURSOR
|
private javax.swing.ImageIcon |
normal_background
The image to use for a normal background. |
private javax.swing.tree.TreePath |
previous_path
The last tree path the drag was hovered over. |
private java.awt.Point |
pt_last
The location of the last ghost drawn, so that we can repair the 'spoilt' area. |
private java.awt.Rectangle |
ra_ghost
The region covered by the drag ghost icon. |
private static java.awt.Color |
TRANSPARENT_COLOR
|
static int |
TREE_DISPLAY_CHANGED
|
private java.awt.Rectangle |
upper_cue_line
The region borderer by the upper cue line. |
| 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.Container |
|
| 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 | |
DragTree(java.lang.String name,
java.lang.String background_name,
boolean mixed_selection)
|
|
DragTree(java.lang.String name,
javax.swing.tree.TreeModel model,
java.lang.String background_name,
boolean mixed_selection)
|
|
| Method Summary | |
void |
autoscroll(java.awt.Point pt)
Notify the Component to autoscroll |
void |
clearGhost()
In order for the appearance to be consistant, given we may be in the situation where the pointer has left our focus but the ghost remains, this method allows other members of the GGroup to tell this component to clear its ghost. |
void |
dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
Any implementation of DragSourceListener must include this method so we can be notified when the drag event ends (somewhere else), which will in turn remove actions. |
void |
dragEnter(java.awt.dnd.DragSourceDragEvent event)
Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component. |
void |
dragEnter(java.awt.dnd.DropTargetDragEvent event)
Any implementation of DropTargetListener must include this method so we can be notified when the drag focus enters this component, which in this case is to grab focus from within our group. |
void |
dragExit(java.awt.dnd.DragSourceEvent event)
Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component. |
void |
dragExit(java.awt.dnd.DropTargetEvent event)
Any implementation of DropTargetListener must include this method so we can be notified when the drag focus leaves this component. |
void |
dragGestureRecognized(java.awt.dnd.DragGestureEvent event)
Any implementation of DragGestureListener must include this method so we can be notified when a drag action has been noticed, thus a drag action has begun. |
void |
dragOver(java.awt.dnd.DragSourceDragEvent event)
Implementation side-effect. |
void |
dragOver(java.awt.dnd.DropTargetDragEvent event)
Any implementation of DropTargetListener must include this method so we can be notified when the drag moves in this component. |
void |
drop(java.awt.dnd.DropTargetDropEvent event)
Any implementation of DropTargetListener must include this method so we can be notified when the drag ends, ie the transferable is dropped. |
void |
dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
Any implementation of DragSourceListener must include this method so we can be notified when the action to be taken upon drop changes. |
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
Any implementation of DropTargetListener must include this method so we can be notified when the action to be taken upon drop changes. |
void |
gainFocus()
Used to notify this component that it has gained focus. |
java.awt.Insets |
getAutoscrollInsets()
Autoscroll Interface... |
java.lang.String |
getSelectionDetails()
|
org.greenstone.gatherer.file.FileSystemModel |
getTreeModel()
Retrieve the model associated with this component. |
void |
init(java.lang.String name,
java.lang.String background_name,
boolean mixed_selection)
|
private boolean |
isValidDrag()
returns false for dummy nodes (ones without files), and system root nodes |
private boolean |
isValidDrop(javax.swing.tree.TreePath target_path)
|
void |
loseFocus()
This method is used to inform this component when it loses focus, and should indicate this somehow. |
void |
mapDirectory(java.io.File file,
java.lang.String title)
|
void |
paint(java.awt.Graphics g)
Paint the component. |
void |
refresh(javax.swing.tree.TreePath path)
|
void |
setBackgroundNonSelectionColor(java.awt.Color color)
|
void |
setBackgroundSelectionColor(java.awt.Color color)
|
void |
setEnabled(boolean state)
Override the normal setEnabled so the Tree exhibits a little more change, which in this instance is the background colour changing. |
void |
setGroup(org.greenstone.gatherer.util.DragGroup group)
Set the components group. |
void |
setImmediate(boolean state)
Determines whether the following selection attempts should go through the normal delayed selection model, or should happen immediately. |
void |
setModel(javax.swing.tree.TreeModel model)
Sets the model to use in JTree. |
void |
setSelection(java.io.File file)
Ensure that that file node denoted by the given file is selected. |
void |
setTextNonSelectionColor(java.awt.Color color)
|
void |
setTextSelectionColor(java.awt.Color color)
|
java.lang.String |
toString()
Returns a string representation of this component. |
void |
valueChanged(javax.swing.event.TreeSelectionEvent event)
Value changed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.greenstone.gatherer.util.DragComponent |
addFocusListener |
| Field Detail |
background_color
private java.awt.Color background_color
- The normal background color.
foreground_color
private java.awt.Color foreground_color
- The normal foreground color.
group
private org.greenstone.gatherer.util.DragGroup group
- The Group this component belongs to.
disabled_background
private javax.swing.ImageIcon disabled_background
- The image to use for the disabled background.
normal_background
private javax.swing.ImageIcon normal_background
- The image to use for a normal background.
multiple_icon
private javax.swing.ImageIcon multiple_icon
- The icon to use for multiple node drag'n'drops. We decided against using the windows paradigm or a block of x horizontal lines for x files.
drag_action
private int drag_action
- The default drag action, although its not that important as we provide custom icons during drags.
pt_last
private java.awt.Point pt_last
- The location of the last ghost drawn, so that we can repair the 'spoilt' area.
lower_cue_line
private java.awt.Rectangle lower_cue_line
- The region borderer by the lower cue line.
ra_ghost
private java.awt.Rectangle ra_ghost
- The region covered by the drag ghost icon.
upper_cue_line
private java.awt.Rectangle upper_cue_line
- The region borderer by the upper cue line.
name
private java.lang.String name
- The identifying name of this Tree.
previous_path
private javax.swing.tree.TreePath previous_path
- The last tree path the drag was hovered over.
NO_DRAG_CURSOR
private static java.awt.Cursor NO_DRAG_CURSOR
TRANSPARENT_COLOR
private static final java.awt.Color TRANSPARENT_COLOR
AUTOSCROLL_MARGIN
private static final int AUTOSCROLL_MARGIN
- The distance from the edge of the current view within the scroll bar which if entered causes the view to scroll.
- See Also:
- Constant Field Values
LIBRARY_CONTENTS_CHANGED
public static int LIBRARY_CONTENTS_CHANGED
LOADED_COLLECTION_CHANGED
public static int LOADED_COLLECTION_CHANGED
COLLECTION_CONTENTS_CHANGED
public static int COLLECTION_CONTENTS_CHANGED
TREE_DISPLAY_CHANGED
public static int TREE_DISPLAY_CHANGED
| Constructor Detail |
DragTree
public DragTree(java.lang.String name, java.lang.String background_name, boolean mixed_selection)
DragTree
public DragTree(java.lang.String name, javax.swing.tree.TreeModel model, java.lang.String background_name, boolean mixed_selection)
| Method Detail |
init
public void init(java.lang.String name, java.lang.String background_name, boolean mixed_selection)
autoscroll
public void autoscroll(java.awt.Point pt)
- Description copied from interface:
java.awt.dnd.Autoscroll - Notify the Component to autoscroll
- Specified by:
autoscrollin interfacejava.awt.dnd.Autoscroll
clearGhost
public void clearGhost()
- In order for the appearance to be consistant, given we may be in the situation where the pointer has left our focus but the ghost remains, this method allows other members of the GGroup to tell this component to clear its ghost.
- Specified by:
clearGhostin interfaceorg.greenstone.gatherer.util.DragComponent
dragDropEnd
public void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
- Any implementation of DragSourceListener must include this method so we can be notified when the drag event ends (somewhere else), which will in turn remove actions.
- Specified by:
dragDropEndin interfacejava.awt.dnd.DragSourceListener
dragEnter
public void dragEnter(java.awt.dnd.DragSourceDragEvent event)
- Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component.
- Specified by:
dragEnterin interfacejava.awt.dnd.DragSourceListener
dragEnter
public void dragEnter(java.awt.dnd.DropTargetDragEvent event)
- Any implementation of DropTargetListener must include this method so we can be notified when the drag focus enters this component, which in this case is to grab focus from within our group.
- Specified by:
dragEnterin interfacejava.awt.dnd.DropTargetListener
dragExit
public void dragExit(java.awt.dnd.DragSourceEvent event)
- Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component.
- Specified by:
dragExitin interfacejava.awt.dnd.DragSourceListener
dragExit
public void dragExit(java.awt.dnd.DropTargetEvent event)
- Any implementation of DropTargetListener must include this method
so we can be notified when the drag focus leaves this component.
- Specified by:
dragExitin interfacejava.awt.dnd.DropTargetListener
dragGestureRecognized
public void dragGestureRecognized(java.awt.dnd.DragGestureEvent event)
- Any implementation of DragGestureListener must include this method
so we can be notified when a drag action has been noticed, thus a
drag action has begun.
- Specified by:
dragGestureRecognizedin interfacejava.awt.dnd.DragGestureListener
dragOver
public void dragOver(java.awt.dnd.DragSourceDragEvent event)
- Implementation side-effect.
- Specified by:
dragOverin interfacejava.awt.dnd.DragSourceListener
dragOver
public void dragOver(java.awt.dnd.DropTargetDragEvent event)
- Any implementation of DropTargetListener must include this method
so we can be notified when the drag moves in this component.
- Specified by:
dragOverin interfacejava.awt.dnd.DropTargetListener
drop
public void drop(java.awt.dnd.DropTargetDropEvent event)
- Any implementation of DropTargetListener must include this method
so we can be notified when the drag ends, ie the transferable is
dropped.
- Specified by:
dropin interfacejava.awt.dnd.DropTargetListener
dropActionChanged
public void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
- Any implementation of DragSourceListener must include this method
so we can be notified when the action to be taken upon drop changes.
- Specified by:
dropActionChangedin interfacejava.awt.dnd.DragSourceListener
dropActionChanged
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
- Any implementation of DropTargetListener must include this method
so we can be notified when the action to be taken upon drop changes.
- Specified by:
dropActionChangedin interfacejava.awt.dnd.DropTargetListener
gainFocus
public void gainFocus()
- Used to notify this component that it has gained focus. It should
make some effort to inform the user of this.
- Specified by:
gainFocusin interfaceorg.greenstone.gatherer.util.DragComponent
getAutoscrollInsets
public java.awt.Insets getAutoscrollInsets()
- Autoscroll Interface...
The following code was borrowed from the book:
Java Swing
By Robert Eckstein, Marc Loy & Dave Wood
Paperback - 1221 pages 1 Ed edition (September 1998)
O'Reilly & Associates; ISBN: 156592455X
The relevant chapter of which can be found at:
http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf
Calculate the insets for the *JTREE*, not the viewport
the tree is in. This makes it a bit messy.
- Specified by:
getAutoscrollInsetsin interfacejava.awt.dnd.Autoscroll
getSelectionDetails
public java.lang.String getSelectionDetails()
getTreeModel
public org.greenstone.gatherer.file.FileSystemModel getTreeModel()
- Description copied from interface:
org.greenstone.gatherer.util.DragComponent - Retrieve the model associated with this component.
- Specified by:
getTreeModelin interfaceorg.greenstone.gatherer.util.DragComponent
loseFocus
public void loseFocus()
- This method is used to inform this component when it loses focus,
and should indicate this somehow.
- Specified by:
loseFocusin interfaceorg.greenstone.gatherer.util.DragComponent
mapDirectory
public void mapDirectory(java.io.File file, java.lang.String title)
paint
public void paint(java.awt.Graphics g)
- Description copied from class:
javax.swing.JComponent Paint the component. This is a delicate process, and should only be called from the repaint thread, under control of the javax.swing.RepaintManager. Client code should usually call Component.repaint()>
Component.repaint()55 to trigger painting.The body of the
paintcall involves calling JComponent.paintComponent(java.awt.Graphics)>JComponent.paintComponent(java.awt.Graphics)55 , JComponent.paintBorder(java.awt.Graphics)>JComponent.paintBorder(java.awt.Graphics)55 , and JComponent.paintChildren(java.awt.Graphics)>JComponent.paintChildren(java.awt.Graphics)55 in order. If you want to customize painting behavior, you should override one of these methods rather thanpaint.For more details on the painting sequence, see this article.
refresh
public void refresh(javax.swing.tree.TreePath path)
setBackgroundNonSelectionColor
public void setBackgroundNonSelectionColor(java.awt.Color color)
setBackgroundSelectionColor
public void setBackgroundSelectionColor(java.awt.Color color)
setEnabled
public void setEnabled(boolean state)
- Override the normal setEnabled so the Tree exhibits a little more
change, which in this instance is the background colour changing.
setGroup
public void setGroup(org.greenstone.gatherer.util.DragGroup group)
- Description copied from interface:
org.greenstone.gatherer.util.DragComponent - Set the components group.
- Specified by:
setGroupin interfaceorg.greenstone.gatherer.util.DragComponent
setImmediate
public void setImmediate(boolean state)
- Determines whether the following selection attempts should go through the normal delayed selection model, or should happen immediately.
setModel
public void setModel(javax.swing.tree.TreeModel model)
- Description copied from class:
javax.swing.JTree - Sets the model to use in
JTree.
setSelection
public void setSelection(java.io.File file)
- Ensure that that file node denoted by the given file is selected.
setTextNonSelectionColor
public void setTextNonSelectionColor(java.awt.Color color)
setTextSelectionColor
public void setTextSelectionColor(java.awt.Color color)
toString
public java.lang.String toString()
- Description copied from class:
java.awt.Component - Returns a string representation of this component. This is implemented
as
getClass().getName() + '[' + paramString() + ']'.
valueChanged
public void valueChanged(javax.swing.event.TreeSelectionEvent event)
- Description copied from interface:
javax.swing.event.TreeSelectionListener - Value changed
- Specified by:
valueChangedin interfacejavax.swing.event.TreeSelectionListener
isValidDrag
private boolean isValidDrag()
- returns false for dummy nodes (ones without files), and system root
nodes
isValidDrop
private boolean isValidDrop(javax.swing.tree.TreePath target_path)
|
|||||||||
| Home >> All >> org >> greenstone >> gatherer >> gui >> [ tree overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC