|
|||||||||||
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.JPanel org.cb.jset.client.ui.JSetBoardComponent
The component representing the set board in the graphical client. FIXME think about using Accessible
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
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 |
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 | |
JSetBoardComponent(Card[] listData)
Constructs a JCardBoardComponent that displays the elements in
the specified array. |
|
JSetBoardComponent(CardBoardModel dataModel)
Constructs a Board component using the specified dataModel. |
Method Summary | |
void |
addBoardSelectionListener(BoardSelectionListener listener)
Adds a listener to the cardBoard that's notified each time a change to the selection occurs. |
void |
addSelectionInterval(int anchor,
int lead)
Sets the selection to be the union of the specified interval with current selection. |
void |
clearSelection()
Clears the selection - after calling this method isSelectionEmpty will return true. |
protected void |
fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
Notifies JCardBoardComponent BoardSelectionListener s that
the selection model has changed. |
int |
getAnchorSelectionIndex()
Returns the first index argument from the most recent addSelectionModel or setSelectionInterval call. |
BoardSelectionListener[] |
getBoardSelectionListeners()
Returns an array of all the BoardSelectionListener s added
to this JCardBoardComponent with addBoardSelectionListener(). |
int |
getLeadSelectionIndex()
Returns the second index argument from the most recent addSelectionInterval or setSelectionInterval
call. |
int |
getMaxSelectionIndex()
Returns the largest selected cell index. |
int |
getMinSelectionIndex()
Returns the smallest selected cell index. |
CardBoardModel |
getModel()
|
int[] |
getSelectedIndices()
Returns an array of all of the selected indices in increasing order. |
java.lang.Object[] |
getSelectedValues()
Returns an array of the values for the selected cells. |
int |
getSelectionMode()
Returns whether single-item or multiple-item selections are allowed. |
BoardSelectionModel |
getSelectionModel()
|
boolean |
isSelectedIndex(int index)
Returns true if the specified index is selected. |
boolean |
isSelectionEmpty()
Returns true if nothing is selected. |
void |
removeBoardSelectionListener(BoardSelectionListener listener)
Removes a listener from the list that's notified each time a change to the selection occurs. |
void |
removeSelectionInterval(int index0,
int index1)
Sets the selection to be the set difference of the specified interval and the current selection. |
void |
setModel(CardBoardModel model)
Sets a new model for that board. |
void |
setSelectedIndex(int index)
Selects a single cell. |
void |
setSelectedIndices(int[] indices)
Selects a set of cells. |
void |
setSelectionInterval(int anchor,
int lead)
Selects the specified interval. |
void |
setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getMinimumSize, getNextFocusableComponent, getPreferredSize, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, 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, imageUpdate, 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 |
Constructor Detail |
public JSetBoardComponent(CardBoardModel dataModel)
dataModel
- the model for that componentpublic JSetBoardComponent(Card[] listData)
JCardBoardComponent
that displays the elements in
the specified array. This constructor just delegates to the
ListModel
constructor.
listData
- the array of Objects to be loaded into the data modelMethod Detail |
public CardBoardModel getModel()
public BoardSelectionModel getSelectionModel()
public void setModel(CardBoardModel model)
model
- the new modelpublic void setSelectionMode(int selectionMode)
selectionMode
values are allowed:
BoardSelectionModel.SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval
and
addSelectionInterval
methods are equivalent, and only the second index
argument is used.
BoardSelectionModel.SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval
and
addSelectionInterval
are equivalent.
BoardSelectionModel.MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
This is the default.
selectionMode
- an integer specifying the type of selections
that are permissiblegetSelectionMode()
public int getSelectionMode()
selectionMode
propertysetSelectionMode(int)
public int getAnchorSelectionIndex()
addSelectionModel
or setSelectionInterval
call.
This is a convenience method that just delegates to the
selectionModel
.
BoardSelectionModel.getAnchorSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public int getLeadSelectionIndex()
addSelectionInterval
or setSelectionInterval
call.
This is a convenience method that just delegates to the
selectionModel
.
BoardSelectionModel.getLeadSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public int getMinSelectionIndex()
selectionModel
.
BoardSelectionModel.getMinSelectionIndex()
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public int getMaxSelectionIndex()
selectionModel
.
BoardSelectionModel.getMaxSelectionIndex()
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public boolean isSelectedIndex(int index)
selectionModel
.
index
- index to be queried for selection state
BoardSelectionModel.isSelectedIndex(int)
,
setSelectedIndex(int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public boolean isSelectionEmpty()
selectionModel
.
BoardSelectionModel.isSelectionEmpty()
,
clearSelection()
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public int[] getSelectedIndices()
removeSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void setSelectedIndex(int index)
index
- the index of the one cell to selectBoardSelectionModel.setSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void setSelectedIndices(int[] indices)
indices
- an array of the indices of the cells to selectBoardSelectionModel.addSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public java.lang.Object[] getSelectedValues()
isSelectedIndex(int)
,
getModel()
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void addBoardSelectionListener(BoardSelectionListener listener)
JCardBoardComponent
will have their ListSelectionEvent.getSource() ==
this JCardBoardComponent
(instead of the BoardSelectionModel
).
listener
- the ListSelectionListener
to addgetSelectionModel()
,
getBoardSelectionListeners()
public void removeBoardSelectionListener(BoardSelectionListener listener)
listener
- the BoardSelectionListener
to removeaddBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
,
getSelectionModel()
public BoardSelectionListener[] getBoardSelectionListeners()
BoardSelectionListener
s added
to this JCardBoardComponent with addBoardSelectionListener().
BoardSelectionListener
s added or an empty
array if no listeners have been addedaddBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
JCardBoardComponent
BoardSelectionListener
s that
the selection model has changed. It's used to forward
BoardSelectionEvents
from the selectionModel
to the BoardSelectionListener
s added directly to the
JCardBoardComponent
.
firstIndex
- the first selected indexlastIndex
- the last selected indexisAdjusting
- true if multiple changes are being madeaddBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
,
removeBoardSelectionListener(BoardSelectionListener)
,
EventListenerList
public void clearSelection()
isSelectionEmpty
will return true.
This is a convenience method that just delegates to the
selectionModel
.
BoardSelectionModel.clearSelection()
,
isSelectionEmpty()
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void setSelectionInterval(int anchor, int lead)
anchor
and lead
indices are included. It's not
necessary for anchor
to be less than lead
.
This is a convenience method that just delegates to the
selectionModel
.
The DefaultBoardSelectionModel
implementation
will do nothing if either anchor
or
lead
are -1.
If anchor
or lead
are less than -1,
IndexOutOfBoundsException
is thrown.
anchor
- the first index to selectlead
- the last index to select
java.lang.IndexOutOfBoundsException
- if either anchor
or lead
are less than -1BoardSelectionModel.setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void addSelectionInterval(int anchor, int lead)
selectionModel
. The
DefaultBoardSelectionModel
implementation
will do nothing if either anchor
or
lead
are -1.
If anchor
or lead
are less than -1,
IndexOutOfBoundsException
is thrown.
anchor
- the first index to add to the selectionlead
- the last index to add to the selection
java.lang.IndexOutOfBoundsException
- if either anchor
or lead
are less than -1BoardSelectionModel.addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
public void removeSelectionInterval(int index0, int index1)
index0
and
index1
indices are removed. It's not necessary for
index0
to be less than index1
.
This is a convenience method that just delegates to the
selectionModel
.
The DefaultBoardSelectionModel
implementation
will do nothing if either index0
or
index1
are -1.
If index0
or index1
are less than -1,
IndexOutOfBoundsException
is thrown.
index0
- the first index to remove from the selectionindex1
- the last index to remove from the selection
java.lang.IndexOutOfBoundsException
- if either index0
or index1
are less than -1BoardSelectionModel.removeSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
addBoardSelectionListener(org.cb.cardboard.BoardSelectionListener)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |