|
|||||||||||
| 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.AbstractButton
javax.swing.JButton
com.tensegrity.gui.swing.control.multiselect.MultiSelectComboBox
A MultiSelectComboBox follows the general principle of a combobox but offers the possibility to use a different component as list. Items of a combobox are usually listed below the control. A MultiSelectComboBox allows to display all contained elements at once by using a MultiSelectPanel. This class is by intention abstract. Users of this class must extend the class and implement 3 methods.
createLabel: This method must return a Component which will
be used as Label for the combo. The label is the most left component of the
collapsed combo and should reflect the current selected item of the internal
multiselectpanel.
createMultiSelect: This method returns the MultiSelectPanel
which should be used to display when the user clicks on the button.
updateLabel: This method will be invoked each time the label
must be updated. That happens on setSelection, setSelectedIndex or whenever
the internal multiselect fires an itemStateChanged.
createLabel(),
updateItemLabel(MultiSelectItem),
createMultiSelect(),
Serialized Form| Nested Class Summary |
| Nested classes inherited from class javax.swing.JButton |
javax.swing.JButton.AccessibleJButton |
| Nested classes inherited from class javax.swing.AbstractButton |
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener |
| 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 | |
protected java.util.ArrayList |
listeners
The list of item listeners. |
protected MultiSelectPanel |
multiSelect
MultiSelectPanel for the various colors. |
UIItemEvaluationList |
uiItemEvList
the item list |
protected UIManager |
uiManager
uiManager: The registered UIManager for
resolving resources |
| Fields inherited from class javax.swing.AbstractButton |
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
| 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 | |
protected |
MultiSelectComboBox()
Empty default constructor for the MultiSelectComboBox.
|
|
MultiSelectComboBox(UIManager uiManager)
The Constructor for ColorComboBox creates a new ColorComboBox with the Default colors and a button within the popup to let user pick a custom color. |
|
MultiSelectComboBox(UIManager uiManager,
int preferredControlHeight)
The Constructor for ColorComboBox creates a new ColorComboBox with the Default colors and a button within the popup to let user pick a custom color. |
| Method Summary | |
void |
addItemListener(java.awt.event.ItemListener listener)
Creates a new Listener-list if necessary and adds the given listener instance to it. |
void |
applyEvList()
Triggers the update mechanism for the installed controls. |
protected void |
createCombo()
Method createCombo creates the combo consisting of a label, separator, a button and a popup, which pops up if the user clicks on the button. |
protected abstract javax.swing.JLabel |
createLabel()
Implemented by subclasses to specify the label to be used next to the button. |
protected abstract MultiSelectPanel |
createMultiSelect()
Implemented by subclass to specify the MultiSelectPanel control used within the popup menu. |
void |
fireEvent(MultiSelectItem item)
Fires an ItemEvent to all listeners of this ComboBox. |
void |
fireEvent(java.lang.Object object)
Allows subclasses to fire ItemEvents with a custom object "by hand". |
protected java.awt.event.ItemEvent |
getItemEvent(MultiSelectItem item)
This method returns a new ItemEvent with this as
source and the given MultMultiSelectItem instance as
item.
|
javax.swing.JLabel |
getItemLabel()
Method getLabel returns the internal used instance of the label. |
java.awt.Dimension |
getMinimumSize()
|
MultiSelectPanel |
getMultiSelect()
Method getMultiSelect returns the internal MultiSelectPanel. |
javax.swing.JPopupMenu |
getPopup()
Returns the popup window used in this ComboBox. |
java.awt.Dimension |
getPreferredSize()
|
int |
getSelectedIndex()
Method getSelectedIndex returns the index of the current selected item. |
java.lang.Object[] |
getSelectedObjects()
Returns an array with the current selection. |
MultiSelectItem |
getSelection()
Method getSelection returns the current selected MultiSelectItem. |
int |
indexOf(java.lang.Object object)
Method indexOf returns the index in the internal
MultiSelectPanel of the given object. |
void |
installEvList()
Resets the uiItemEvList. |
void |
itemStateChanged(java.awt.event.ItemEvent e)
Sets the color for the label and closes the popup, then fires an ItemEvent with the combo as source to all listeners. |
protected void |
paintChildren(java.awt.Graphics g)
|
void |
removeItemListener(java.awt.event.ItemListener listener)
Removes the given listener from the internal ItemListener list. |
void |
setEnabled(boolean enabled)
Sets the enable flag for this ComboBox. |
void |
setSelectedIndex(int i)
Method setSelectedIndex sets the selected item within the multiselect to the given index. |
protected void |
togglePopup()
Opens the internal itemWindow instance |
protected abstract void |
updateItemLabel(MultiSelectItem item)
Called by the ComboBox when a selection occurs within the
MultiSelectPanel. |
| Methods inherited from class javax.swing.JButton |
configurePropertiesFromAction, getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI |
| Methods inherited from class javax.swing.AbstractButton |
addActionListener, addChangeListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public UIItemEvaluationList uiItemEvList
protected UIManager uiManager
uiManager: The registered UIManager for
resolving resources
protected MultiSelectPanel multiSelect
protected java.util.ArrayList listeners
| Constructor Detail |
protected MultiSelectComboBox()
MultiSelectComboBox.
Useful for subclasses which like to create custom ComboBoxes.
public MultiSelectComboBox(UIManager uiManager)
uiManager - UIManager to obtain strings from.
public MultiSelectComboBox(UIManager uiManager,
int preferredControlHeight)
uiManager - UIManager to obtain strings from.preferredControlHeight - The height of the control| Method Detail |
protected abstract javax.swing.JLabel createLabel()
updateLabel to get notified when the label needs to be
updated.
updateItemLabel(MultiSelectItem)public javax.swing.JLabel getItemLabel()
protected abstract void updateItemLabel(MultiSelectItem item)
ComboBox when a selection occurs within the
MultiSelectPanel. Subclasses should specify how to update
the label according to the selection.
item - the selected item.createLabel()public int indexOf(java.lang.Object object)
index in the internal
MultiSelectPanel of the given object. or
-1 if no such object was found.
object - the object to find the index for.
protected java.awt.event.ItemEvent getItemEvent(MultiSelectItem item)
this as
source and the given MultMultiSelectItem instance as
item.
Subclasses may overwrite this method and return a custom event with different source or item. E.g. a ColorComboBox may wish to send out ItemEvent's with a Color instance as item, rather then a MultiSelectItem item.
item - The item which has been selected by user.
protected abstract MultiSelectPanel createMultiSelect()
MultiSelectItems, add these to a new instance of
MultiSelectPanel and return that instance.
MultiSelectPanel used for the popup of this
ComboBox.public MultiSelectPanel getMultiSelect()
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public void setSelectedIndex(int i)
i - the index of the element.MultiSelectPanel.setSelectedIndex(int)public void addItemListener(java.awt.event.ItemListener listener)
addItemListener in interface java.awt.ItemSelectablelistener - the listener to add to the internal list.ItemSelectable.addItemListener(ItemListener)public void removeItemListener(java.awt.event.ItemListener listener)
removeItemListener in interface java.awt.ItemSelectablelistener - the listener to remove.ItemSelectable.removeItemListener(ItemListener)public void setEnabled(boolean enabled)
setEnabled(false) for all of its
components. This call is delegated to the internal button,
separator and label. A different border is
used for the label and the raisedBevelBorder for this combo is removed
as well to give the control a nifty disabled look.
JComponent.setEnabled(boolean)public java.lang.Object[] getSelectedObjects()
getSelectedObjects in interface java.awt.ItemSelectableItemSelectable.getSelectedObjects()public int getSelectedIndex()
public MultiSelectItem getSelection()
protected void togglePopup()
protected void createCombo()
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged in interface java.awt.event.ItemListenerItemListener.itemStateChanged(ItemEvent)public void fireEvent(MultiSelectItem item)
getItemEvent method. This allows users of this class to
overwrite this method and provide their own ItemEvent instance.
item - MultiSelectItem which originated the event.public void fireEvent(java.lang.Object object)
object - the instance to send to all listeneners.public javax.swing.JPopupMenu getPopup()
protected void paintChildren(java.awt.Graphics g)
public void installEvList()
class MyPanelImpl {
JTextField userName;
// ...
protected void installEvList() {
uiItemEvList.add(GUIItem.MYPANEL_SHEET_ID, this);
uiItemEvList.add(GUIItem.MYPANEL_EDTUSERNAME_ID, userName);
}
}
installEvList in interface Evaluablepublic void applyEvList()
applyEvList in interface Evaluable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||