
public class TWTTitleComponent extends AbstractEntityView
This component is the equivalent of the "ToolBar" for TweetAppUIKit apps. It will display either a "Back" button, or the current user’s avatar in the upper left, depending on context, The remainder of the component is filled with the "main content", which is passed to the component constructor.
There are no "hard" requirements with respect to schemas that the view model must support. However
the view model will be used to add an avatar to its WEST
slot which is a ProfileAvatarView
of the view model. Hence if the view model includes a property with the Thing.thumbnailUrl
or ListRowItem#icon
tag,
it will be used to generate an avatar. If neither of those is available, it will create an avatar out of the first letter
of the name, as supplied in the Thing.name
property.
Actions in the TITLE_ACTIONS
category will be rendered in the EAST slot of the border layout of this
component.
You can explicitly handle when the user clicks the "Back" button via the BACK_BUTTON_CLICKED
action. If you don’t supply this
action, or if the resulting event is not consumed, it will proceed to perform default behaviour for the back button, which is to navigate back to the previous form.
You can explicitly handle when the user clicks on the avatar (in the WEST slot) via the AVATAR_CLICKED
action. If you
don’t supply this action, or if the resulting event is not consumed, it will proceed to perform default behaviour.
The default behaviour when the user clicks on the avatar is to open the sidebar. This component doesn’t perform this action on its own
though, it just fires a CollapsibleSideBarContainer.ShowSideBarEvent
event up the Controller hierarchy, which will be consumed
by any CollapsibleSideBar container that is currently displayed, to show itself. If you setup your UI to use a CollapsibleSideBarContainer
,
then this will "just work".
TWTTitleComponent
- UIID for the component.
TWTTitleComponentLeftButton
- UIID for the back button and avatar button in WEST slot.
TWTTitleComponentOverflowMenuButton
- UIID used for the overflow actions button. (If there is more than one action registered in the TITLE_ACTIONS
category, then they will be rendered in an overflow menu.
If the current form controller has a "back" option (e.g. there is a parent form controller that it can navigate back to, then a "Back Arrow" button will be rendered in the WEST slot. Otherwise it will render the avatar generated from the view model.
TWTSearchButton
as its main content, and a single "Settings" action rendered in its EAST
slot via the TITLE_ACTIONS
category.UserProfile p = new UserProfile();
p.set(Thing.name, "Steve Hannah");
p.set(Thing.identifier, "@shannah78");
p.set(Thing.thumbnailUrl, "https://www.codenameone.com/img/steve.jpg");
ViewNode viewNode = new ViewNode(actions(TWTTitleComponent.TITLE_ACTIONS, settings));
new TWTTitleComponent(p, viewNode, new TWTSearchButton(p, viewNode));
EAST
slot via the TITLE_ACTIONS
category. The "Back" button is rendered here instead of the avatar because there is a form to go back to.Modifier and Type | Field and Description |
---|---|
static ActionNode.Category |
AVATAR_CLICKED
Action triggered with the avatar (in the WEST slot) is clicked.
|
static ActionNode.Category |
BACK_BUTTON_CLICKED
Action triggered when the back button is clicked.
|
static Tag |
mainContentSlot
Slot ID that allows controllers to override the main content of this view.
|
static ActionNode.Category |
TITLE_ACTIONS
Actions displayed in the EAST slot of the title component.
|
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
TWTTitleComponent(Entity entity,
ViewNode node,
Component mainContent)
Deprecated.
|
TWTTitleComponent(ViewContext<Entity> context,
Component mainContent)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
commit() |
protected void |
initComponent() |
void |
update() |
activate, addBindListener, addUnbindListener, addUpdateListener, bind, bindImpl, deinitialize, findProperty, getContext, getEntity, getParam, getViewNode, isBindOnPropertyChangeEvents, removeUpdateListener, setBindOnPropertyChangeEvents, setEntity, unbind, unbindImpl
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, parsePreferredSize, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final Tag mainContentSlot
Slot ID that allows controllers to override the main content of this view.
public static final ActionNode.Category TITLE_ACTIONS
Actions displayed in the EAST slot of the title component. If only one action is registered in this category, then it will be displayed directly as a button. If more than one is registered, then there will be "menu" button which displays an action menu with all of the actions.
public static final ActionNode.Category AVATAR_CLICKED
Action triggered with the avatar (in the WEST slot) is clicked. If you do not supply this action, or the resulting event
is not consumed, then it will proceed to perform default behaviour which is to expand the CollapsibleSideBarContainer
.
public static final ActionNode.Category BACK_BUTTON_CLICKED
Action triggered when the back button is clicked. If you do not supply this actiokn, or the resulting event is not consumed, then it will proceed to perform defualt behaviour, which is to navigate to the previous form.
public TWTTitleComponent(Entity entity, ViewNode node, Component mainContent)
TWTTitleComponent(ViewContext, Component)
Creates a new title component.
entity
- The view model.node
- The UI descriptor.mainContent
- public TWTTitleComponent(ViewContext<Entity> context, Component mainContent)
TWTTitleComponent(ViewContext, Component)
Creates a new title component.
context
- The View contextmainContent
- protected void initComponent()
initComponent
in class AbstractEntityView
public void update()
public void commit()
Copyright © 2021. All Rights Reserved.