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 TypeMethodDescriptionvoidAdding a piece to theKeyBuffer"selects the piece" (and lets it know about in its SELECTED property)voidaddFromPalette(GamePiece p, PieceSlot slot) asList()Returns a list of all selected pieces.voidIf we had items selected from a palette, repaint them now that they aren't selected, and switch out of palette modevoidclear()Deselects all pieces (removes them all from theKeyBuffer)booleanTells if a particular piece is selected (i.e. present in the KeyBuffer)booleancontainsChild(Stack stack) Check if any member of the specified Stack is currently selectedstatic KeyBufferDeprecated, for removal: This API element is subject to removal in a future version.Returns an iterator for all selected pieces.getSlotForPiece(GamePiece piece) static voidbooleanisEmpty()booleankeyCommand(KeyStroke stroke) Applies a key command to every selected piece (i.e. to piece in theKeyBuffer)voidDeselect the specified piece -- removes it from theKeyBuffervoidremoveFromPalette(GamePiece p, PieceSlot slot) Deselects a palette piece, repainting its palette slotvoidvoidsetSuppressActionButtons(boolean suppress) voidsort(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
KeyBufferis 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.