Package VASSAL.counters
Class KeyBuffer
java.lang.Object
VASSAL.counters.KeyBuffer
The KeyBuffer is the list of "currently selected pieces" in the VASSAL UI (map windows). Its somewhat confusing name
derives from the idea that if the player then presses a key, a key command will be sent to all of the pieces in the
buffer. KeyBuffer is a "singleton", so there is one for the whole app, across all map windows.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adding a piece to theKeyBuffer
"selects the piece" (and lets it know about in its SELECTED property)void
addFromPalette
(GamePiece p, PieceSlot slot) asList()
Returns a list of all selected pieces.void
If we had items selected from a palette, repaint them now that they aren't selected, and switch out of palette modevoid
clear()
Deselects all pieces (removes them all from theKeyBuffer
)boolean
Tells if a particular piece is selected (i.e. present in the KeyBuffer)boolean
containsChild
(Stack stack) Check if any member of the specified Stack is currently selectedstatic KeyBuffer
Deprecated, for removal: This API element is subject to removal in a future version.Returns an iterator for all selected pieces.getSlotForPiece
(GamePiece piece) static void
boolean
isEmpty()
boolean
keyCommand
(KeyStroke stroke) Applies a key command to every selected piece (i.e. to piece in theKeyBuffer
)void
Deselect the specified piece -- removes it from theKeyBuffer
void
removeFromPalette
(GamePiece p, PieceSlot slot) Deselects a palette piece, repainting its palette slotvoid
void
setSuppressActionButtons
(boolean suppress) void
sort
(Comparator<GamePiece> comp) Sorts the selected pieces based on a particular Comparator
-
Method Details
-
init
-
getBuffer
-
setSuppressActionButtons
public void setSuppressActionButtons(boolean suppress) -
isSuppressActionButtons
public boolean isSuppressActionButtons() -
getSlotForPiece
-
setClickPoint
-
getClickPoint
-
add
-
addFromPalette
-
cleansePalette
public void cleansePalette()If we had items selected from a palette, repaint them now that they aren't selected, and switch out of palette mode -
clear
public void clear()Deselects all pieces (removes them all from theKeyBuffer
) -
remove
-
removeFromPalette
-
contains
-
isEmpty
public boolean isEmpty()- Returns:
- true if the
KeyBuffer
is empty - i.e. no pieces are selected
-
keyCommand
Applies a key command to every selected piece (i.e. to piece in theKeyBuffer
)- Parameters:
stroke
- Keystroke to apply- Returns:
- Command that encapsulates any changes to the game state made while processing the key command, for replay on other clients or in logfile.
-
asList
-
getPiecesIterator
-
getPieces
Deprecated, for removal: This API element is subject to removal in a future version.UsegetPiecesIterator()
instead. -
sort
Sorts the selected pieces based on a particular Comparator- Parameters:
comp
- Comparator to use
-
containsChild
Check if any member of the specified Stack is currently selected- Parameters:
stack
- Stack to check- Returns:
- true if a child of the specified Stack is selected
-
getPiecesIterator()
instead.