Adds a text to an Input. This can be used to add text to the block or label another field. The text is not modifiable by the user.
Inherited Constant Summary
Inherited Field Summary
Public Constructor Summary
FieldLabel(String name, String text)
|
Public Method Summary
FieldLabel |
clone()
|
static FieldLabel |
fromJson(JSONObject json)
|
String | |
String |
getText()
|
boolean |
setFromString(String text)
Sets the values of the field from a string.
|
void |
setText(String newValue)
Sets the text for this label.
|
Protected Method Summary
void |
fireValueChanged(String oldText, String newText)
Notify Observers of change, without firing ChangeEvent nor as an event group, since labels
are not really value fields for state changes.
|
Inherited Method Summary
Public Constructors
public FieldLabel (String name, String text)
Parameters
name | |
---|---|
text |
Public Methods
public String getSerializedValue ()
Returns
- The value serialized into a string.
public String getText ()
Returns
- The text for this label.
public boolean setFromString (String text)
Sets the values of the field from a string.
This is used for setting values of all types of fields when loading a workspace from XML. It is also used, however, as the primary means of setting text fields (e.g., inputs, labels, dates). There should be a concrete implementation for each field type.Parameters
text | The text value for this field from the XML. |
---|
Returns
- True if the value was set, false otherwise.
public void setText (String newValue)
Sets the text for this label. Changes to the label will not be serialized by Blockly and
should not be caused by user input. For user editable text fields use
FieldInput
instead.
Parameters
newValue |
---|
Protected Methods
protected void fireValueChanged (String oldText, String newText)
Notify Observers of change, without firing ChangeEvent nor as an event group, since labels are not really value fields for state changes.
Parameters
oldText | The original label text (not field value). |
---|---|
newText | The new label text (not field value). |