AbstractInputView

public abstract class AbstractInputView extends NonPropagatingViewGroup
implements InputView
Known Direct Subclasses

Optional base {@ ViewGroup} representation of an Input to a Block.

Default implementation assumes all FieldViews are added directly to this view as their parent, as the first children. Subclasses can use an alternate behavior by overriding addFieldViewsToViewHierarchy().

Inherited Constant Summary

Field Summary

protected BlockGroup mConnectedGroup
protected final ArrayList<FieldView> mFieldViews
protected final WorkspaceHelper mHelper
protected final Input mInput
protected final int mInputType

Inherited Field Summary

Protected Constructor Summary

AbstractInputView(Context context, WorkspaceHelper helper, Input input, List<FieldView> fieldViews)
Constructs a base implementation of an InputView.

Public Method Summary

BlockGroup
Input
void
setConnectedBlockGroup(BlockGroup blockGroup)
Sets the view of the blocks whose output/previous connector is connected to this input.
void
unlinkModel()
Recursively disconnects the view from the model, and removes all views.

Protected Method Summary

void
addFieldViewsToViewHierarchy()
Adds the FieldViews in mFieldViews to the view hierarchy.

Inherited Method Summary

Fields

protected BlockGroup mConnectedGroup

protected final ArrayList<FieldView> mFieldViews

protected final WorkspaceHelper mHelper

protected final Input mInput

protected final int mInputType

Protected Constructors

protected AbstractInputView (Context context, WorkspaceHelper helper, Input input, List<FieldView> fieldViews)

Constructs a base implementation of an InputView.

Parameters
context The Android Context for the app.
helper The WorkspaceHelper for the activity.
input The Input the view represents.
fieldViews The FieldViews instantiated by the BlockViewFactory.

Public Methods

public BlockGroup getConnectedBlockGroup ()

Returns
  • The BlockGroup containing the blocks connected to this input port, if any.

public Input getInput ()

Returns
  • The block Input wrapped by this view.

public void setConnectedBlockGroup (BlockGroup blockGroup)

Sets the view of the blocks whose output/previous connector is connected to this input. Setting it to null will remove any set block group.

Parameters
blockGroup The BlockGroup to attach to this input. The childView will be added to the layout hierarchy for the current view via a call to addView(View).
Throws
IllegalStateException if a child view is already set. The Blockly model requires disconnecting a block from an input before a new one can be connected.
IllegalArgumentException if the method argument is null.

public void unlinkModel ()

Recursively disconnects the view from the model, and removes all views.

Protected Methods

protected void addFieldViewsToViewHierarchy ()

Adds the FieldViews in mFieldViews to the view hierarchy. The default implementation adds the views directly to this view, in order.