BasicFieldVariableView

public class BasicFieldVariableView extends AppCompatSpinner
implements FieldView VariableChangeView

Renders a dropdown field containing the workspace's variables as part of a Block.

Nested Class Summary

class BasicFieldVariableView.VariableViewAdapter An implementation of ArrayAdapter that wraps the NameManager.VariableNameManager to create the variable item views. 

Field Summary

protected BasicFieldVariableView.VariableViewAdapter mAdapter
protected VariableRequestCallback mCallback
protected Field.Observer mFieldObserver
protected FieldVariable mVariableField

Public Constructor Summary

BasicFieldVariableView(Context context)
Constructs a new BasicFieldVariableView.
BasicFieldVariableView(Context context, AttributeSet attrs)
BasicFieldVariableView(Context context, AttributeSet attrs, int defStyleAttr)

Public Method Summary

Field
void
setAdapter(SpinnerAdapter adapter)
void
setField(Field field)
Sets the Field model for this view.
void
setSelection(int position)
void
setVariableRequestCallback(VariableRequestCallback requestCallback)
Sets the callback for user generated variable change requests, such as deleting or renaming a variable.
void
unlinkField()
Disconnect the model from this view.

Inherited Method Summary

Fields

protected VariableRequestCallback mCallback

protected Field.Observer mFieldObserver

protected FieldVariable mVariableField

Public Constructors

public BasicFieldVariableView (Context context)

Constructs a new BasicFieldVariableView.

Parameters
context The application's context.

public BasicFieldVariableView (Context context, AttributeSet attrs)

Parameters
context
attrs

public BasicFieldVariableView (Context context, AttributeSet attrs, int defStyleAttr)

Parameters
context
attrs
defStyleAttr

Public Methods

public Field getField ()

public void setAdapter (SpinnerAdapter adapter)

Parameters
adapter

public void setField (Field field)

Sets the Field model for this view. If null the current field will be disconnected from the view if one is set. The field must be of the appropriate type for the specific view implementation or a ClassCastException may be thrown.

Parameters
field The field backing this view.

public void setSelection (int position)

Parameters
position

public void setVariableRequestCallback (VariableRequestCallback requestCallback)

Sets the callback for user generated variable change requests, such as deleting or renaming a variable. The view takes no action on its own so the callback is expected to handle any requests.

Parameters
requestCallback The callback to notify when the user has selected an action.

public void unlinkField ()

Disconnect the model from this view.