|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JList com.jstatcom.component.CheckBoxList
public final class CheckBoxList
This class provides a special JList
that renders its items as
selectable JCheckBox
components. Ctrl-A selects all items,
Ctrl-X deselects all.
It can be used to provide the user with a selection mechanism for a set of
keys. The objects to select can be set via a JSCSArray
object
or a general Object
array. If new data is set that contains
elements that have been set before, the current selection is preserved. This
behaviour can be turned off by invoking clear
before setting
new data. It is possible to provide a titled border for this list via
setBorderTitle
.
The contents of this list can be specified by a symbol. In the same way, the selection state can be stored to another symbol. However, it is not possible to change the selection state by changing the symbol contents.
Whenever there is a change in the selection status by either clicking on the
list checkboxes or by invoking clearSelectionStatus
, a
"selectionChanged" property change event is fired. This does not happen if
the selection status changed due to changes in the data model.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JList |
---|
javax.swing.JList.DropLocation |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JList |
---|
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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 | |
---|---|
CheckBoxList()
CheckBoxList default constructor. |
Method Summary | |
---|---|
void |
addNotify()
Overrides addNotify to retrieve data objects as soon as
the component hierarchy is established. |
void |
clear()
Removes all data from the list model and wipes out all selection information. |
void |
clearSelectionStatus()
Deselects all checkboxes in this list and fires a property change event. |
boolean[] |
getBoolSelectionStatus()
Gets the array indicating the selection status of all keys by setting the corresponding elements to true or false . |
java.lang.String |
getBorderTitle()
Gets the title of the border displayed arround this list. |
int[] |
getIntSelectionStatus()
Gets the array indicating the selection status of all keys by setting the corresponding elements to 1 or 0 . |
java.lang.Object[] |
getSelectedObjects()
Gets all elements of this list that are selected. |
java.lang.String |
getSymbolName()
Gets the symbol identifier for the data object of the data displayed. |
java.lang.String |
getSymbolNameSelected()
Gets the symbol identifier for the current selection state. |
Scope |
getSymbolScope()
Gets the current symbol scope. |
void |
setBorderTitle(java.lang.String borderTitle)
Sets the border title of this list. |
void |
setJSCSArray(JSCSArray dataKeys)
Sets the data that should be displayed in the list. |
void |
setObjArray(java.lang.Object[] values)
Sets the data that should be displayed in the list. |
void |
setSelectionChanged()
This method is called, whenever the mouse was clicked over an item in the list and the selection changed. |
void |
setSelectionStatus(int[] selIndizes)
Sets the selection of the checkboxes in this list according to an array indicating the selection status. |
void |
setSymbolName(java.lang.String newSymbolName)
Sets the symbol name to retrieve data from. |
void |
setSymbolNameSelected(java.lang.String newSymbolNameSelected)
Sets the symbol name to store the selection state to. |
void |
setSymbolScope(Scope scope)
Sets the symbol scope. |
void |
valueChanged(SymbolEvent evt)
Updates list if symbol changed. |
Methods inherited from class javax.swing.JList |
---|
addListSelectionListener, addSelectionInterval, clearSelection, ensureIndexIsVisible, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CheckBoxList()
CheckBoxList
default constructor.
Method Detail |
---|
public void valueChanged(SymbolEvent evt)
valueChanged
in interface SymbolListener
evt
- the data event with all relevant information about the changepublic void addNotify()
addNotify
to retrieve data objects as soon as
the component hierarchy is established.
addNotify
in class javax.swing.JComponent
public void clear()
public void clearSelectionStatus()
public void setSelectionStatus(int[] selIndizes)
setSelection
methods take no effect.
selIndizes
- array indicating whether the checkboxes should be selected or
not (0: no selection, else: selection)
java.lang.IllegalArgumentException
- if (selIndizes == null || selIndizes.length != getModel().getSize())
public boolean[] getBoolSelectionStatus()
true
or false
.
Selection here means not list selection, but whether the
JCheckBox
for an item is selected.
public java.lang.String getBorderTitle()
setBorderTitle(java.lang.String)
public int[] getIntSelectionStatus()
1
or 0
.
Selection here means not list selection, but whether the
JCheckBox
for an item is selected.
public java.lang.Object[] getSelectedObjects()
JCheckBox
for an item
is selected.
true
public java.lang.String getSymbolName()
public java.lang.String getSymbolNameSelected()
int
array, where 1 indicates a selection.
public void setBorderTitle(java.lang.String borderTitle)
EtchedBorder
with the title defined in
borderTitle
is wrapped around this list. The title is
displayed top left
.
borderTitle
- the title to be displayed,
if ( borderTitle == null || borderTitle.length() == 0 )
then a simple EtchedBorder
is displayedgetBorderTitle()
public void setObjArray(java.lang.Object[] values)
toString
method is
queried for the label of the repective item to display.
values
- the object array with the elements to add, it must not be
null
java.lang.IllegalArgumentException
- if (values == null)
public void setJSCSArray(JSCSArray dataKeys)
toString
method is queried for the label of the repective item to display.
dataKeys
- the data object with the elements to add, it must not be
null
java.lang.IllegalArgumentException
- if (dataKeys == null)
public void setSelectionChanged()
public void setSymbolName(java.lang.String newSymbolName)
newSymbolName
- the symbol name
java.lang.IllegalArgumentException
- if (JSCConstants.isValidName(newSymbolName) != null)
public void setSymbolNameSelected(java.lang.String newSymbolNameSelected)
newSymbolNameSelected
- the symbol name for the selection state
java.lang.IllegalArgumentException
- if (JSCConstants.isValidName(newSymbolNameSelected) != null)
public Scope getSymbolScope()
public void setSymbolScope(Scope scope)
scope
-
java.lang.IllegalArgumentException
- if (scope == null)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |