BlocklyEvent.ChangeEvent

public static final class BlocklyEvent.ChangeEvent extends BlocklyEvent

Event fired when a property of a block changes.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

BlocklyEvent.ChangeEvent(String element, Block block, Field field, String oldValue, String newValue)
Constructs a ChangeEvent, signifying block's value changed.
BlocklyEvent.ChangeEvent(JSONObject json)
Constructs a ChangeEvent from the JSON serialized representation.

Public Method Summary

String
String
String
String
static BlocklyEvent.ChangeEvent
newCommentTextEvent(Block block, String oldValue, String newValue)
Creates a ChangeEvent reflecting a change in the block's comment text.
static BlocklyEvent.ChangeEvent
newFieldValueEvent(Block block, Field field, String oldValue, String newValue)
Creates a ChangeEvent reflecting a change in a field's value.
static BlocklyEvent.ChangeEvent
newInlineStateEvent(Block block)
Creates a ChangeEvent reflecting a change in the block's inlined inputs state.
static BlocklyEvent.ChangeEvent
newMutateEvent(Block block, String oldValue, String newValue)
Creates a ChangeEvent reflecting a change in the block's mutation state.
String

Protected Method Summary

void
writeJsonAttributes(JSONStringer out)

Inherited Method Summary

Public Constructors

public BlocklyEvent.ChangeEvent (String element, Block block, Field field, String oldValue, String newValue)

Constructs a ChangeEvent, signifying block's value changed.

Parameters
element
block The block containing the change.
field The field containing the change, if the change is a field value. Otherwise null.
oldValue The original value.
newValue The new value.

public BlocklyEvent.ChangeEvent (JSONObject json)

Constructs a ChangeEvent from the JSON serialized representation.

Parameters
json The serialized ChangeEvent.
Throws
JSONException

Public Methods

public String getElement ()

public String getFieldName ()

public String getNewValue ()

public String getOldValue ()

public static BlocklyEvent.ChangeEvent newCommentTextEvent (Block block, String oldValue, String newValue)

Creates a ChangeEvent reflecting a change in the block's comment text.

Parameters
block The block where the state changed.
oldValue The prior comment text.
newValue The updated comment text.
Returns
  • The new ChangeEvent.

public static BlocklyEvent.ChangeEvent newFieldValueEvent (Block block, Field field, String oldValue, String newValue)

Creates a ChangeEvent reflecting a change in a field's value.

Parameters
block The block where the state changed.
field The field with the changed value.
oldValue The prior value.
newValue The updated value.
Returns
  • The new ChangeEvent.

public static BlocklyEvent.ChangeEvent newInlineStateEvent (Block block)

Creates a ChangeEvent reflecting a change in the block's inlined inputs state.

Parameters
block The block where the state changed.
Returns
  • The new ChangeEvent.

public static BlocklyEvent.ChangeEvent newMutateEvent (Block block, String oldValue, String newValue)

Creates a ChangeEvent reflecting a change in the block's mutation state.

Parameters
block The block where the state changed.
oldValue The serialized version of the prior mutation state.
newValue The serialized version of the updated mutation state.
Returns
  • The new ChangeEvent.

public String toString ()

Protected Methods

protected void writeJsonAttributes (JSONStringer out)

Parameters
out
Throws
JSONException