public class AndroidMetawidget
extends android.widget.LinearLayout
Note: this class extends LinearLayout
rather than FrameLayout
, because
FrameLayout
would always need to have another Layout
embedded
within it, whereas LinearLayout
is occasionally useful directly.
Modifier and Type | Class and Description |
---|---|
protected class |
AndroidMetawidget.Pipeline |
android.widget.LinearLayout.LayoutParams
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
CLIP_TO_PADDING_MASK, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
Constructor and Description |
---|
AndroidMetawidget(android.content.Context context) |
AndroidMetawidget(android.content.Context context,
android.util.AttributeSet attributes) |
Modifier and Type | Method and Description |
---|---|
void |
addView(android.view.View child) |
void |
addView(android.view.View child,
android.widget.LinearLayout.LayoutParams params) |
void |
buildWidgets()
Build the widgets under this Metawidget.
|
protected void |
configureDefaults() |
protected void |
endBuild() |
Set<android.view.View> |
fetchExistingUnusedViews()
Fetch a list of
Views that were added manually, and have so far not been used. |
<V extends android.view.View> |
findViewWithTags(String... tags)
Find the nested view with the given path of tags.
|
android.view.View |
getChildAt(int index) |
int |
getChildCount() |
<T> T |
getClientProperty(Object key)
Storage area for WidgetProcessors, Layouts, and other stateless clients.
|
Facet |
getFacet(String name) |
<T> T |
getInspectionResultProcessor(Class<T> inspectionResultProcessorClass) |
String |
getLabelString(Map<String,String> attributes)
Returns a label for the given set of attributes.
|
String |
getLocalizedKey(String key)
Looks up the given key in the given bundle using
getContext().getResources().getText() . |
int |
getMaximumInspectionDepth() |
String |
getPath() |
<T> T |
getToInspect()
Gets the Object being inspected.
|
<T> T |
getValue(String... names)
Gets the value from the View with the given name.
|
<T> T |
getValue(android.view.View view)
Gets the value from the given View.
|
<T> T |
getWidgetProcessor(Class<T> widgetProcessorClass) |
protected void |
initNestedMetawidget(AndroidMetawidget nestedMetawidget,
Map<String,String> attributes) |
String |
inspect(Object toInspect,
String type,
String... names)
Useful for WidgetBuilders to perform nested inspections (eg.
|
protected void |
invalidateInspection()
Invalidates the current inspection result (if any) and invalidates the widgets.
|
protected void |
invalidateWidgets()
Invalidates the widgets.
|
boolean |
isReadOnly() |
protected void |
layoutWidget(android.view.View view,
String elementName,
Map<String,String> attributes) |
protected AndroidMetawidget.Pipeline |
newPipeline()
Instantiate the Pipeline used by this Metawidget.
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
void |
putClientProperty(Object key,
Object value)
Storage area for WidgetProcessors, Layouts, and other stateless clients.
|
void |
removeAllViews() |
void |
removeView(android.view.View view) |
void |
setBundle(Class<?> bundle) |
void |
setConfig(int config)
Provides an id for the inspector configuration.
|
void |
setInspectionResultProcessors(InspectionResultProcessor<AndroidMetawidget>... inspectionResultProcessors) |
void |
setInspector(Inspector inspector) |
void |
setLayout(Layout<android.view.View,android.view.ViewGroup,AndroidMetawidget> layout) |
void |
setMaximumInspectionDepth(int maximumInspectionDepth) |
void |
setPath(String path)
Sets the path to be inspected.
|
void |
setReadOnly(boolean readOnly) |
void |
setToInspect(Object toInspect)
Sets the Object to inspect.
|
void |
setValue(Object value,
String... names)
Sets the value of the View with the given name.
|
void |
setValue(Object value,
android.view.View view)
Sets the value of the given View.
|
void |
setWidgetBuilder(WidgetBuilder<android.view.View,AndroidMetawidget> widgetBuilder) |
void |
setWidgetProcessors(WidgetProcessor<android.view.View,AndroidMetawidget>... widgetProcessors) |
protected void |
startBuild() |
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getBaseline, getBaselineAlignedChildIndex, getOrientation, getWeightSum, isBaselineAligned, onLayout, setBaselineAligned, setBaselineAlignedChildIndex, setGravity, setHorizontalGravity, setOrientation, setVerticalGravity, setWeightSum
addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, showContextMenuForChild, startLayoutAnimation, updateViewLayout
bringToFront, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isPaddingOffsetRequired, isPressed, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onCreateContextMenu, onCreateInputConnection, onDetachedFromWindow, onDraw, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyDown, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
public AndroidMetawidget(android.content.Context context)
public AndroidMetawidget(android.content.Context context, android.util.AttributeSet attributes)
public void setToInspect(Object toInspect)
If setPath
has not been set, or points to a previous setToInspect
,
sets it to point to the given Object.
public <T> T getToInspect()
Exposed for binding implementations.
Person p = getToInspect()
)public void setPath(String path)
Note setPath
is quite different to setTag
. setPath
is
always in relation to setToInspect
, so must include the type name and any
subsequent sub-names (eg. type/name/name). Conversely, setTag
is a single name
relative to our immediate parent.
public String getPath()
public void setConfig(int config)
Typically, the id will be retrieved by R.raw.inspector
public void setInspector(Inspector inspector)
public String inspect(Object toInspect, String type, String... names)
public void setInspectionResultProcessors(InspectionResultProcessor<AndroidMetawidget>... inspectionResultProcessors)
public <T> T getInspectionResultProcessor(Class<T> inspectionResultProcessorClass)
public void setWidgetBuilder(WidgetBuilder<android.view.View,AndroidMetawidget> widgetBuilder)
public void setWidgetProcessors(WidgetProcessor<android.view.View,AndroidMetawidget>... widgetProcessors)
public <T> T getWidgetProcessor(Class<T> widgetProcessorClass)
public void setLayout(Layout<android.view.View,android.view.ViewGroup,AndroidMetawidget> layout)
public void setBundle(Class<?> bundle)
public String getLabelString(Map<String,String> attributes)
The label is determined using the following algorithm:
public String getLocalizedKey(String key)
getContext().getResources().getText()
.public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public int getMaximumInspectionDepth()
public void setMaximumInspectionDepth(int maximumInspectionDepth)
public void putClientProperty(Object key, Object value)
setTag
for a similar purpose, but we use that for child names.public <T> T getClientProperty(Object key)
setTag
for a similar purpose, but we use that for child names.public int getChildCount()
getChildCount
in class android.view.ViewGroup
public void addView(android.view.View child, android.widget.LinearLayout.LayoutParams params)
public void addView(android.view.View child)
addView
in class android.view.ViewGroup
public void removeAllViews()
removeAllViews
in class android.view.ViewGroup
public void removeView(android.view.View view)
removeView
in interface android.view.ViewManager
removeView
in class android.view.ViewGroup
public android.view.View getChildAt(int index)
getChildAt
in class android.view.ViewGroup
public <T> T getValue(String... names)
The value is returned as it is stored in the View (eg. Editable for EditText) so may need some conversion before being reapplied to the object being inspected. This obviously requires knowledge of which View AndroidMetawidget created, which is not ideal.
String s = getValue(names)
)public <T> T getValue(android.view.View view)
The value is returned as it is stored in the View (eg. Editable for EditText) so may need some conversion before being reapplied to the object being inspected. This obviously requires knowledge of which View AndroidMetawidget created, which is not ideal.
String s = getValue(names)
)public void setValue(Object value, String... names)
Clients must ensure the value is of the correct type to suit the View (eg. String for EditText). This obviously requires knowledge of which View AndroidMetawidget created, which is not ideal.
public void setValue(Object value, android.view.View view)
Clients must ensure the value is of the correct type to suit the View (eg. String for EditText). This obviously requires knowledge of which View AndroidMetawidget created, which is not ideal.
public <V extends android.view.View> V findViewWithTags(String... tags)
public Set<android.view.View> fetchExistingUnusedViews()
Views
that were added manually, and have so far not been used.
This is an internal API exposed for OverriddenWidgetBuilder. Clients should not call it directly.
public void buildWidgets()
Clients will not normally need to call this method. It is called automatically by a number of
other methods, including onMeasure
and findViewWithTags
. However
sometimes it may be necessary to force a rebuild.
Note: this method is idempotent. Calling it multiple times will not rebuild widgets multiple
times unless the internal flag (mNeedToBuildWidgets
) gets reset.
protected AndroidMetawidget.Pipeline newPipeline()
Subclasses wishing to use their own Pipeline should override this method to instantiate their version.
protected void configureDefaults()
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
onMeasure
in class android.widget.LinearLayout
protected void invalidateInspection()
protected void invalidateWidgets()
protected void startBuild()
protected void layoutWidget(android.view.View view, String elementName, Map<String,String> attributes)
view
- the widget to layout. Never nullelementName
- XML node name of the business field. Typically 'entity', 'property' or 'action'.
Never nullattributes
- attributes of the widget to layout. Never nullprotected void endBuild()
protected void initNestedMetawidget(AndroidMetawidget nestedMetawidget, Map<String,String> attributes)
Copyright © 2015. All Rights Reserved.