|
||||||||||
| 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.JTabbedPane
edu.wisc.ssec.mcidasv.ui.DraggableTabbedPane
public class DraggableTabbedPane
This is a rather simplistic drag and drop enabled JTabbedPane. It allows users to use drag and drop to move tabs between windows and reorder tabs.
| Nested Class Summary | |
|---|---|
(package private) class |
DraggableTabbedPane.CloseableMetalTabbedPaneUI
|
(package private) class |
DraggableTabbedPane.CloseableTabbedPaneUI
|
private static class |
DraggableTabbedPane.DraggableTabFlavor
To be perfectly honest I'm still a bit fuzzy about DataFlavors. |
static class |
DraggableTabbedPane.TabButton
|
private static class |
DraggableTabbedPane.TransferableIndex
Used to simply provide a reference to the originating DraggableTabbedPane while we're dragging and dropping. |
| Nested classes/interfaces inherited from class javax.swing.JTabbedPane |
|---|
JTabbedPane.AccessibleJTabbedPane, JTabbedPane.ModelListener |
| 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 | |
|---|---|
private String |
currentTabColor
|
private DragSource |
dragSource
Used for starting the dragging process. |
private DropTarget |
dropTarget
Used for signaling that we'll accept drops (registers listeners). |
private McvComponentGroup |
group
The component group holding our components. |
private IntegratedDataViewer |
idv
Keep around this reference so that we can access the UI Manager. |
private static String |
IDX_ICON
Path to the icon we'll use as an index indicator. |
private static String |
indexColorMetal
|
private static String |
indexColorUglyTabs
|
private Image |
INDICATOR
The actual image that we'll use to display the index indications. |
protected static boolean |
outsideDrag
Used to signal across all DraggableTabbedPanes that the component currently being dragged originated in another window. |
private int |
overIndex
The tab index that the user is currently over. |
private static Color |
selected
|
private static long |
serialVersionUID
|
private int |
sourceIndex
The tab index where the drag started. |
private static Color |
unselected
|
private static int |
VALID_ACTION
Local shorthand for the actions we're accepting. |
private IdvWindow |
window
The IDV window that contains this tabbed pane. |
| Fields inherited from class javax.swing.JTabbedPane |
|---|
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT |
| 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 javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DraggableTabbedPane(IdvWindow win,
IntegratedDataViewer idv,
McvComponentGroup group)
Mostly just registers that this component should listen for drag and drop operations. |
|
| Method Summary | |
|---|---|
void |
addTab(String title,
Component component)
|
void |
addTab(String title,
Component component,
Icon extraIcon)
|
void |
doDrop(int srcIdx,
int dstIdx)
Moves a component to its new index within the component group. |
void |
dragDropEnd(DragSourceDropEvent e)
Handles what happens at the very end of a drag and drop. |
void |
dragEnter(DragSourceDragEvent e)
|
void |
dragEnter(DropTargetDragEvent e)
Triggered when the user drags into dropTarget. |
void |
dragExit(DragSourceEvent e)
|
void |
dragExit(DropTargetEvent e)
Triggered when the user drags out of dropTarget. |
void |
dragGestureRecognized(DragGestureEvent e)
Triggered when the user does a (platform-dependent) drag initiating gesture. |
void |
dragOver(DragSourceDragEvent e)
|
void |
dragOver(DropTargetDragEvent e)
Triggered continually while the user is dragging over dropTarget. |
void |
drop(DropTargetDropEvent e)
Triggered when a drop has happened over dropTarget. |
void |
dropActionChanged(DragSourceDragEvent e)
|
void |
dropActionChanged(DropTargetDragEvent e)
|
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
private void |
newWindowDrag(ComponentHolder dragged,
Point drop)
Handle the user dropping a tab outside of a McV window. |
void |
paint(Graphics g)
Overridden so that McIDAS-V can draw an indicator of a dragged tab's possible |
private void |
processMouseEvents(MouseEvent e)
|
private ComponentHolder |
removeDragged()
"Quietly" removes the dragged component from its group. |
void |
setSelectedIndex(int index)
Overriden so that McIDAS-V can change the window title upon changing tabs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private static final int VALID_ACTION
private static final String IDX_ICON
protected static boolean outsideDrag
private final Image INDICATOR
private int sourceIndex
private int overIndex
private DragSource dragSource
private DropTarget dropTarget
private McvComponentGroup group
private IdvWindow window
private IntegratedDataViewer idv
private static final Color unselected
private static final Color selected
private static final String indexColorMetal
private static final String indexColorUglyTabs
private String currentTabColor
| Constructor Detail |
|---|
public DraggableTabbedPane(IdvWindow win,
IntegratedDataViewer idv,
McvComponentGroup group)
win - The IDV window containing this tabbed pane.idv - The main IDV instance.group - The McvComponentGroup that holds this component's tabs.| Method Detail |
|---|
public void dragGestureRecognized(DragGestureEvent e)
dragGestureRecognized in interface DragGestureListenerpublic void dragEnter(DropTargetDragEvent e)
dragEnter in interface DropTargetListenerpublic void dragExit(DropTargetEvent e)
dropTarget.
dragExit in interface DropTargetListenerpublic void dragOver(DropTargetDragEvent e)
dropTarget. McIDAS-V uses this to draw the index indicator.
dragOver in interface DropTargetListenere - Information about the current state of the drag.public void drop(DropTargetDropEvent e)
dropTarget.
drop in interface DropTargetListenere - State that we'll need in order to handle the drop.private ComponentHolder removeDragged()
public void doDrop(int srcIdx,
int dstIdx)
srcIdx - The old index of the component.dstIdx - The new index of the component.public void paint(Graphics g)
paint in class JComponentpublic void setSelectedIndex(int index)
setSelectedIndex in class JTabbedPane
private void newWindowDrag(ComponentHolder dragged,
Point drop)
dragged - The ComponentHolder that's being dragged around.drop - The x- and y-coordinates where the user dropped the tab.public void dragDropEnd(DragSourceDropEvent e)
dragDropEnd in interface DragSourceListenerpublic void dragEnter(DragSourceDragEvent e)
dragEnter in interface DragSourceListenerpublic void dragExit(DragSourceEvent e)
dragExit in interface DragSourceListenerpublic void dragOver(DragSourceDragEvent e)
dragOver in interface DragSourceListenerpublic void dropActionChanged(DragSourceDragEvent e)
dropActionChanged in interface DragSourceListenerpublic void dropActionChanged(DropTargetDragEvent e)
dropActionChanged in interface DropTargetListenerpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerprivate void processMouseEvents(MouseEvent e)
public void addTab(String title,
Component component)
addTab in class JTabbedPane
public void addTab(String title,
Component component,
Icon extraIcon)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||