|
||||||||||
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.JPopupMenu
net.sf.sbcc.componentcombo.plaf.basic.BasicComponentComboPopup
public class BasicComponentComboPopup
This is a basic implementation of the ComboPopup
interface.
This class represents the ui for the popup portion of the combo box.
All event handling is handled by listener classes created with the
createxxxListener()
methods and internal classes.
You can change the behavior of this class by overriding the
createxxxListener()
methods and supplying your own
event listeners or subclassing from the ones supplied in this class.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Nested Class Summary | |
---|---|
private class |
BasicComponentComboPopup.Handler
|
class |
BasicComponentComboPopup.InvocationKeyHandler
As of Java 2 platform v 1.4, this class is now obsolete and is only included for backwards API compatibility. |
protected class |
BasicComponentComboPopup.InvocationMouseHandler
A listener to be registered upon the combo box (not its popup menu) to handle mouse events that affect the state of the popup menu. |
protected class |
BasicComponentComboPopup.InvocationMouseMotionHandler
This listener watches for dragging and updates the current selection in the list if it is dragging over the list. |
protected class |
BasicComponentComboPopup.ItemHandler
This listener watches for changes to the selection in the combo box. |
class |
BasicComponentComboPopup.ListDataHandler
As of 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility. |
protected class |
BasicComponentComboPopup.ListMouseHandler
This listener hides the popup when the mouse is released in the list. |
protected class |
BasicComponentComboPopup.ListMouseMotionHandler
This listener changes the selected item as you move the mouse over the list. |
protected class |
BasicComponentComboPopup.ListSelectionHandler
As of Java 2 platform v 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility. |
protected class |
BasicComponentComboPopup.PropertyChangeHandler
This listener watches for bound properties that have changed in the combo box. |
Nested classes/interfaces inherited from class javax.swing.JPopupMenu |
---|
javax.swing.JPopupMenu.AccessibleJPopupMenu, javax.swing.JPopupMenu.Separator |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected javax.swing.Timer |
autoscrollTimer
This protected field is implementation specific. |
protected JAbstractComponentComboBox |
comboBox
|
private BasicComponentComboPopup.Handler |
handler
Implementation of all the listener classes. |
protected boolean |
hasEntered
|
protected boolean |
isAutoScrolling
|
protected java.awt.event.ItemListener |
itemListener
This protected field is implementation specific. |
protected java.awt.event.KeyListener |
keyListener
This protected field is implementation specific. |
private static javax.swing.border.Border |
LIST_BORDER
|
protected SimpleDataListener |
listDataListener
This protected field is implementation specific. |
protected java.awt.event.MouseListener |
listMouseListener
This protected field is implementation specific. |
protected java.awt.event.MouseMotionListener |
listMouseMotionListener
This protected field is implementation specific. |
protected javax.swing.event.ListSelectionListener |
listSelectionListener
This protected field is implementation specific. |
protected java.awt.event.MouseListener |
mouseListener
This protected field is implementation specific. |
protected java.awt.event.MouseMotionListener |
mouseMotionListener
This protected field is implementation specific. |
protected java.beans.PropertyChangeListener |
propertyChangeListener
This protected field is implementation specific. |
protected static int |
SCROLL_DOWN
|
protected static int |
SCROLL_UP
|
protected int |
scrollDirection
|
protected boolean |
valueIsAdjusting
As of Java 2 platform v1.4 this previously undocumented field is no longer used. |
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 | |
---|---|
BasicComponentComboPopup(JAbstractComponentComboBox combo)
|
Method Summary | |
---|---|
protected java.awt.Rectangle |
computePopupBounds(int px,
int py,
int pw,
int ph)
Calculate the placement and size of the popup portion of the combo box based on the combo box location and the enclosing screen bounds. |
protected void |
configurePopup()
Configures the popup portion of the combo box. |
protected SimpleDataListener |
createDataListener()
Creates a list data listener which will be added to the ComboBoxModel . |
protected java.awt.event.ItemListener |
createItemListener()
Creates an ItemListener which will be added to the
combo box. |
protected java.awt.event.KeyListener |
createKeyListener()
Creates the key listener that will be added to the combo box. |
protected java.awt.event.MouseListener |
createListMouseListener()
Creates a mouse listener that watches for mouse events in the popup's list. |
protected java.awt.event.MouseMotionListener |
createListMouseMotionListener()
Creates a mouse motion listener that watches for mouse motion events in the popup's list. |
protected javax.swing.event.ListSelectionListener |
createListSelectionListener()
Creates a list selection listener that watches for selection changes in the popup's list. |
protected java.awt.event.MouseListener |
createMouseListener()
Creates a listener that will watch for mouse-press and release events on the combo box. |
protected java.awt.event.MouseMotionListener |
createMouseMotionListener()
Creates the mouse motion listener which will be added to the combo box. |
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
Creates a PropertyChangeListener which will be added to
the combo box. |
protected void |
delegateFocus(java.awt.event.MouseEvent e)
This is is a utility method that helps event handlers figure out where to send the focus when the popup is brought up. |
protected void |
firePopupMenuCanceled()
|
protected void |
firePopupMenuWillBecomeInvisible()
|
protected void |
firePopupMenuWillBecomeVisible()
|
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this BasicComboPopup. |
javax.swing.JComponent |
getComponent()
Implementation of ComboPopup.getList(). |
private BasicComponentComboPopup.Handler |
getHandler()
|
java.awt.event.KeyListener |
getKeyListener()
Implementation of ComboPopup.getKeyListener(). |
java.awt.event.MouseListener |
getMouseListener()
Implementation of ComboPopup.getMouseListener(). |
java.awt.event.MouseMotionListener |
getMouseMotionListener()
Implementation of ComboPopup.getMouseMotionListener(). |
protected int |
getPopupHeightForDisplayedContent()
Retrieves the height of the popup based on the current ListCellRenderer and the maximum row count. |
private java.awt.Point |
getPopupLocation()
Calculates the upper left location of the Popup. |
void |
hide()
Implementation of ComboPopup.hide(). |
protected void |
installComboBoxListeners()
This method adds the necessary listeners to the JComboBox. |
protected void |
installComboBoxModelListeners(SimpleModel model)
Installs the listeners on the combo box model. |
boolean |
isFocusTraversable()
Overridden to unconditionally return false. |
void |
show()
Implementation of ComboPopup.show(). |
protected void |
togglePopup()
Makes the popup visible if it is hidden and makes it hidden if it is visible. |
protected void |
uninstallComboBoxModelListeners(SimpleModel model)
Removes the listeners from the combo box model |
void |
uninstallingUI()
Called when the UI is uninstalling. |
protected void |
uninstallKeyboardActions()
|
Methods inherited from class javax.swing.JPopupMenu |
---|
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, 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, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, 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, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, 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, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.sbcc.componentcombo.plaf.basic.ComponentComboPopup |
---|
isVisible |
Field Detail |
---|
private static javax.swing.border.Border LIST_BORDER
protected JAbstractComponentComboBox comboBox
protected boolean valueIsAdjusting
private BasicComponentComboPopup.Handler handler
protected java.awt.event.MouseMotionListener mouseMotionListener
getMouseMotionListener()
,
createMouseMotionListener()
protected java.awt.event.MouseListener mouseListener
getMouseListener()
,
createMouseListener()
protected java.awt.event.KeyListener keyListener
getKeyListener()
,
createKeyListener()
protected javax.swing.event.ListSelectionListener listSelectionListener
createListSelectionListener()
protected java.awt.event.MouseListener listMouseListener
createListMouseListener()
protected java.awt.event.MouseMotionListener listMouseMotionListener
createListMouseMotionListener()
protected java.beans.PropertyChangeListener propertyChangeListener
createPropertyChangeListener()
protected SimpleDataListener listDataListener
#createListDataListener
protected java.awt.event.ItemListener itemListener
createItemListener()
protected javax.swing.Timer autoscrollTimer
protected boolean hasEntered
protected boolean isAutoScrolling
protected int scrollDirection
protected static final int SCROLL_UP
protected static final int SCROLL_DOWN
Constructor Detail |
---|
public BasicComponentComboPopup(JAbstractComponentComboBox combo)
Method Detail |
---|
public void show()
show
in interface ComponentComboPopup
show
in class java.awt.Component
public void hide()
hide
in interface ComponentComboPopup
hide
in class java.awt.Component
public javax.swing.JComponent getComponent()
getComponent
in interface javax.swing.MenuElement
getComponent
in interface ComponentComboPopup
getComponent
in class javax.swing.JPopupMenu
public java.awt.event.MouseListener getMouseListener()
getMouseListener
in interface ComponentComboPopup
MouseListener
or nullComponentComboPopup.getMouseListener()
public java.awt.event.MouseMotionListener getMouseMotionListener()
getMouseMotionListener
in interface ComponentComboPopup
MouseMotionListener
or nullComponentComboPopup.getMouseMotionListener()
public java.awt.event.KeyListener getKeyListener()
getKeyListener
in interface ComponentComboPopup
KeyListener
or nullComponentComboPopup.getKeyListener()
public void uninstallingUI()
uninstallingUI
in interface ComponentComboPopup
protected void uninstallComboBoxModelListeners(SimpleModel model)
model
- The combo box model to install listenersinstallComboBoxModelListeners(net.sf.sbcc.componentcombo.SimpleModel)
protected void uninstallKeyboardActions()
protected void firePopupMenuWillBecomeVisible()
firePopupMenuWillBecomeVisible
in class javax.swing.JPopupMenu
protected void firePopupMenuWillBecomeInvisible()
firePopupMenuWillBecomeInvisible
in class javax.swing.JPopupMenu
protected void firePopupMenuCanceled()
firePopupMenuCanceled
in class javax.swing.JPopupMenu
protected java.awt.event.MouseListener createMouseListener()
MouseListener
which will be added to
the combo box or nullprotected java.awt.event.MouseMotionListener createMouseMotionListener()
MouseMotionListener
which will be added to
the combo box or nullprotected java.awt.event.KeyListener createKeyListener()
KeyListener
or nullprotected javax.swing.event.ListSelectionListener createListSelectionListener()
ListSelectionListener
or nullprotected SimpleDataListener createDataListener()
ComboBoxModel
. If this method returns null then
it will not be added to the combo box model.
ListDataListener
or nullprotected java.awt.event.MouseListener createListMouseListener()
MouseListener
or nullprotected java.awt.event.MouseMotionListener createListMouseMotionListener()
MouseMotionListener
or nullprotected java.beans.PropertyChangeListener createPropertyChangeListener()
PropertyChangeListener
which will be added to
the combo box. If this method returns null then it will not
be added to the combo box.
PropertyChangeListener
or nullprotected java.awt.event.ItemListener createItemListener()
ItemListener
which will be added to the
combo box. If this method returns null then it will not
be added to the combo box.
Subclasses may override this method to return instances of their own ItemEvent handlers.
ItemListener
or nullprivate BasicComponentComboPopup.Handler getHandler()
protected void configurePopup()
protected void installComboBoxListeners()
protected void installComboBoxModelListeners(SimpleModel model)
uninstallComboBoxModelListeners
.
model
- The combo box model to install listenersuninstallComboBoxModelListeners(net.sf.sbcc.componentcombo.SimpleModel)
public boolean isFocusTraversable()
isFocusTraversable
in class java.awt.Component
public javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext
in interface javax.accessibility.Accessible
getAccessibleContext
in class javax.swing.JPopupMenu
protected void delegateFocus(java.awt.event.MouseEvent e)
protected void togglePopup()
protected int getPopupHeightForDisplayedContent()
protected java.awt.Rectangle computePopupBounds(int px, int py, int pw, int ph)
px
- starting x locationpy
- starting y locationpw
- starting widthph
- starting height
private java.awt.Point getPopupLocation()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |