BlocklyEvent.UIEvent

public static final class BlocklyEvent.UIEvent extends BlocklyEvent

Event class for user interface related actions, including selecting blocks, opening/closing the toolbox or trash, and changing toolbox categories.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

BlocklyEvent.UIEvent(String element, Block block, String oldValue, String newValue)
Constructs a block related UI event, such as clicked, selected, comment opened, mutator opened, or warning opened.
BlocklyEvent.UIEvent(JSONObject json)
Constructs a UIEvent from the JSON serialized representation.

Public Method Summary

String
String
String
BlocklyEvent.UIEvent
BlocklyEvent.UIEvent
newBlockCommentEvent(Block block, boolean openedBefore, boolean openedAfter)
BlocklyEvent.UIEvent
newBlockMutatorEvent(Block block, boolean openedBefore, boolean openedAfter)
BlocklyEvent.UIEvent
newBlockSelectedEvent(Block block, boolean selectedBefore, boolean selectedAfter)
BlocklyEvent.UIEvent
newBlockWarningEvent(Block block, boolean openedBefore, boolean openedAfter)
BlocklyEvent.UIEvent
newToolboxCategoryEvent(String oldValue, String newValue)

Protected Method Summary

void
writeJsonAttributes(JSONStringer out)

Inherited Method Summary

Public Constructors

public BlocklyEvent.UIEvent (String element, Block block, String oldValue, String newValue)

Constructs a block related UI event, such as clicked, selected, comment opened, mutator opened, or warning opened.

Parameters
element The UI element that changed.
block The related block. Null for toolbox category events.
oldValue The value before the event. Booleans are mapped to "true" and "false".
newValue The value after the event. Booleans are mapped to "true" and "false".

public BlocklyEvent.UIEvent (JSONObject json)

Constructs a UIEvent from the JSON serialized representation.

Parameters
json The serialized UIEvent.
Throws
JSONException

Public Methods

public String getElement ()

public String getNewValue ()

public String getOldValue ()

public BlocklyEvent.UIEvent newBlockClickedEvent (Block block)

Parameters
block

public BlocklyEvent.UIEvent newBlockCommentEvent (Block block, boolean openedBefore, boolean openedAfter)

Parameters
block
openedBefore
openedAfter

public BlocklyEvent.UIEvent newBlockMutatorEvent (Block block, boolean openedBefore, boolean openedAfter)

Parameters
block
openedBefore
openedAfter

public BlocklyEvent.UIEvent newBlockSelectedEvent (Block block, boolean selectedBefore, boolean selectedAfter)

Parameters
block
selectedBefore
selectedAfter

public BlocklyEvent.UIEvent newBlockWarningEvent (Block block, boolean openedBefore, boolean openedAfter)

Parameters
block
openedBefore
openedAfter

public BlocklyEvent.UIEvent newToolboxCategoryEvent (String oldValue, String newValue)

Parameters
oldValue
newValue

Protected Methods

protected void writeJsonAttributes (JSONStringer out)

Parameters
out
Throws
JSONException