|
||||||||||
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
org.peace_tools.generic.dndTabs.DnDTabbedPane
public class DnDTabbedPane
Nested Class Summary | |
---|---|
static class |
DnDTabbedPane.Location
Preferred docking locations for tabs. |
Nested classes/interfaces inherited from class javax.swing.JTabbedPane |
---|
javax.swing.JTabbedPane.AccessibleJTabbedPane, javax.swing.JTabbedPane.ModelListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private DnDTabbedPane.Location |
dockCue
This instance variable is used to track if this DndTabbedPane should paint a outline on itself to indicate where a tab being dragged will be docked with respect to this window. |
private static double |
EDGE_PANEL_SIZE
This constant determines the default size that is used for panels that are docked to the edges (top, left, bottom, right) of a given DnDTabPanel. |
private static java.util.ArrayList<DnDTabListener> |
listeners
The list of listeners that have been added for this DnDTabbedPane. |
private boolean |
permanent
A boolean variable that indicates if this tab is permanent and should not be deleted even if it is empty. |
private static long |
serialVersionUID
A generated serial version ID. |
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 | |
---|---|
DnDTabbedPane()
The default constructor. |
Method Summary | |
---|---|
static void |
addListener(DnDTabListener listener)
Add a listener to be notified when a tab in this panel is deleted. |
DnDTabbedPane |
createSplitPane(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
DnDTabbedPane.Location location)
This method may be used to manually add components either directly to this tabbed pane or around this tabbed pane. |
DnDTabbedPane |
createSplitPane(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
DnDTabbedPane.Location location,
double gravity)
This method may be used to manually add components either directly to this tabbed pane or around this tabbed pane. |
DnDTabbedPane |
createSplitPane(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component c,
DnDTabbedPane.Location location,
double gravity,
int size)
This method may be used to manually add components either directly to this tabbed pane or around this tabbed pane. |
void |
deleteTab(java.awt.Component componentRemoved)
Delete (and remove) a given tab component. |
DnDTabbedPane.Location |
getDockCue()
This method can be used to determine the current docking cue associated with this DndTabPane. |
boolean |
isPermanent()
This method may be used to determine if this tabbed pane should be permanently present or not. |
protected static void |
notifyListeners(java.awt.Component comp)
Helper method to report listeners that a component has been removed. |
void |
paintChildren(java.awt.Graphics g)
This method overrides the default method in the parent class. |
static void |
removeListener(DnDTabListener listener)
Remove a listener to be notified from this tab. |
void |
removeTab(java.awt.Component componentRemoved)
Remove a tab (or component) from this DnDTabbedPane. |
void |
setDockCue(DnDTabbedPane.Location cue)
This method must be used to set/clear the current docking cue associated with this DndTabPane. |
void |
setPermanent(boolean perm)
This method should be used to set if a tabbed pane should be permanent or not. |
static javax.swing.JSplitPane |
setSplitWindow(java.awt.Container parent,
DnDTabbedPane.Location location,
java.awt.Component window1,
java.awt.Component window2,
int prefWidth,
int prefHeight,
java.awt.Dimension area)
This is a utility method that is used by both DnDTabbedPane and DnDTabPos to create a JSplitPane containing two components organized in a specific manner to occupy a given preferred width/height depending on the type of orientation. |
Methods inherited from class javax.swing.JTabbedPane |
---|
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getAccessibleContext, getBackgroundAt, getBoundsAt, getChangeListeners, getComponentAt, getDisabledIconAt, getDisplayedMnemonicIndexAt, getForegroundAt, getIconAt, getMnemonicAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getTitleAt, getToolTipText, getToolTipTextAt, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, insertTab, isEnabledAt, paramString, remove, remove, removeAll, removeChangeListener, removeTabAt, setBackgroundAt, setComponentAt, setDisabledIconAt, setDisplayedMnemonicIndexAt, setEnabledAt, setForegroundAt, setIconAt, setMnemonicAt, setModel, setSelectedComponent, setSelectedIndex, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, setTitleAt, setToolTipTextAt, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
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 double EDGE_PANEL_SIZE
private boolean permanent
private DnDTabbedPane.Location dockCue
private static final java.util.ArrayList<DnDTabListener> listeners
Note: The list of listeners is static so that all DnDTabbedPane objects, including those created dynamically when the user drags and drops tabs, will use this list of listeners. This is a bit non-standard implementation but appears to be the best given the dynamic nature of creation of DnDTabbedPanes
Constructor Detail |
---|
public DnDTabbedPane()
Method Detail |
---|
public boolean isPermanent()
public void setPermanent(boolean perm)
perm
- Flag to indicate if this tabbed pane is permanent or not. True
value indicates the tab is permanent and should not be removed
even if it is empty.public DnDTabbedPane createSplitPane(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, DnDTabbedPane.Location location)
title
- The title to be used for new tab when created.icon
- The icon to be used if any.c
- The actual component to be added.location
- The preferred location around this pane.
public DnDTabbedPane createSplitPane(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, DnDTabbedPane.Location location, double gravity)
title
- The title to be used for new tab when created.icon
- The icon to be used if any.c
- The actual component to be added.location
- The preferred location around this pane.gravity
- The size into which the two panes must be split.
public DnDTabbedPane createSplitPane(java.lang.String title, javax.swing.Icon icon, java.awt.Component c, DnDTabbedPane.Location location, double gravity, int size)
title
- The title to be used for new tab when created.icon
- The icon to be used if any.c
- The actual component to be added.location
- The preferred location around this pane.gravity
- The ratio of space to be allocated to each window.
This value is set for JSplitPane.setResizeWeightsize
- The size to be set for the component to be added. If
this size is less than the minimum size of the component c, then
the minimum size of component c will be used. If the size is
negative then a size is not set and the defaults are used.
public static javax.swing.JSplitPane setSplitWindow(java.awt.Container parent, DnDTabbedPane.Location location, java.awt.Component window1, java.awt.Component window2, int prefWidth, int prefHeight, java.awt.Dimension area)
parent
- The parent component that contains window1location
- The location to decide where window2 should be placed. This
location cannot be CENTER.window1
- The component to be replaced with a new split window containing
window1 and window2.window2
- The second component to be placed in the newly created split
pane.prefWidth
- The preferred width of window1 if the location requires a
vertical split.prefHeight
- The preferred height of window1 if the location requires a
horizontal split.area
- The allocated area for the tabs so that the area is appropriately
split between the two parts.
public void deleteTab(java.awt.Component componentRemoved)
componentRemoved
- public void removeTab(java.awt.Component componentRemoved)
componentRemoved
- The component to be removed from this pane.protected static void notifyListeners(java.awt.Component comp)
comp
- The component that has been removed.public static void addListener(DnDTabListener listener)
Note:The listener is not recursively propagated to all associated tabs. However, the listener is inherited by any new DnDTabbedPane that may be created from this pane due to user dragging tabs.
listener
- The listener to be added.public static void removeListener(DnDTabListener listener)
Note: The listener is not recursively removed from all associated tabs.
listener
- The listener to be removed from the set of
listeners to be notified.public DnDTabbedPane.Location getDockCue()
public void setDockCue(DnDTabbedPane.Location cue)
public void paintChildren(java.awt.Graphics g)
paintChildren
in class javax.swing.JComponent
g
- The graphics object to be used for drawing the cue
box.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |