
public class TweetDetailView extends AbstractEntityView
A view for showing a "tweet" details. This is the logical view that would be shown
when a user clicks on a "tweet" in the TweetListView
to see an expanded version of
the tweet.
Will accept any entity conforming to the TweetSchema
schema.
The there are 3 primary action categories for injecting content into this view: TWEET_ACTIONS
, STATS_ACTIONS
, and OVERFLOW_ACTIONS
.
The TWEET_ACTIONS
are the actions rendered just below the tweet. These are usually things like "Like", "Retweet", or "Reply", but you can place any
actions you like here.
The STATS_ACTIONS
are actions rendered (also) below the tweet that are meant to contain information about the tweet such as the number of
likes or rewteets. Example action definitions to take advantage of this:
public static final ActionNode retweets = action(
icon("Retweets"),
label("245"),
actionStyle(ActionStyle.IconRight)
), likes = action(
icon("Likes"),
label("1444"),
actionStyle(ActionStyle.IconRight)
);
...
ViewNode vn = new ViewNode(
actions(TweetDetailView.TWEET_ACTIONS, TwitterUIDemo.reply, TwitterUIDemo.retweet, TwitterUIDemo.favorite, TwitterUIDemo.share),
actions(TweetDetailView.STATS_ACTIONS, retweets, likes),
actions(TweetDetailView.OVERFLOW_ACTIONS, TwitterUIDemo.mute)
);
The following UIIDs are used for styling this component, and can be overridden in your own stylesheets.
TweetDetailView
- The UIID for the detail view container.
TweetDetailViewAuthorName
- UIID used for author’s full name.
TweetDetailViewAuthorID
- UIID for author’s ID (e.g. user ID).
TweetDetailViewAuthorIcon
- UIID for the author’s Icon/thumbnail.
TweetDetailViewContent
- UIID for the SpanLabel containing the tweet content.
TweetDetailViewContentText
- UIID for the text in the SpanLabel containing the tweet content.
TweetDetailViewImage
- UIID for the image in the tweet, if the tweet contains an image.
TweetDetailsViewDatePosted
- UIID for the date posted label.
TweetDetailViewOverflowMenuButton
- UIID for the overflow menu button.
TweetDetailViewStatsAction
- UIID for the label of a STATS_ACTIONS
action button.
TweetDetailViewStatsActionIcon
- UIID for the "icon" of a STATS_ACTIONS
action button. The "label" is actually used to render text containing the amount of the stats.
TweetDetailViewStatsActions
- UIID for the container containing all of the STATS_ACTIONS
action buttons.
TweetDetailViewTweetAction
- UIID for the TWEET_ACTIONS
action buttons.
TweetDetailViewTweetActions
- UIID for the container containing the TWEET_ACTIONS
buttons.
package com.codename1.demos.twitterui;
import ca.weblite.shared.components.CollapsibleHeaderContainer;
import com.codename1.rad.controllers.Controller;
import com.codename1.rad.controllers.ControllerEvent;
import com.codename1.rad.models.Entity;
import com.codename1.rad.nodes.ActionNode;
import com.codename1.rad.nodes.ViewNode;
import com.codename1.rad.ui.ActionStyle;
import com.codename1.rad.ui.UI;
import com.codename1.twitterui.controllers.TWTFormController;
import com.codename1.twitterui.views.TWTTitleComponent;
import com.codename1.twitterui.views.TweetDetailView;
import com.codename1.ui.Label;
import static com.codename1.rad.ui.UI.*;
public class TweetDetailsController extends BaseFormController {
public static final ActionNode retweets = action(
icon("Retweets"),
label("245"),
actionStyle(ActionStyle.IconRight)
), likes = action(
icon("Likes"),
label("1444"),
actionStyle(ActionStyle.IconRight)
);
public TweetDetailsController(Controller parent, Entity tweet) {
super(parent);
TweetDetailView view = new TweetDetailView(tweet, getViewNode());
CollapsibleHeaderContainer wrapper = new CollapsibleHeaderContainer(
new TWTTitleComponent(tweet, getViewNode(), new Label("Tweet")),
view,
view);
setView(wrapper);
}
@Override
protected ViewNode createViewNode() {
ViewNode vn = new ViewNode(
actions(TweetDetailView.TWEET_ACTIONS, TwitterUIDemo.reply, TwitterUIDemo.retweet, TwitterUIDemo.favorite, TwitterUIDemo.share),
actions(TweetDetailView.STATS_ACTIONS, retweets, likes),
actions(TweetDetailView.OVERFLOW_ACTIONS, TwitterUIDemo.mute)
);
return vn;
}
@Override
public void actionPerformed(ControllerEvent evt) {
super.actionPerformed(evt);
}
}
Modifier and Type | Field and Description |
---|---|
static ActionNode.Category |
OVERFLOW_ACTIONS
Actions that are meant to display a statistic about the tweet.
|
static ActionNode.Category |
STATS_ACTIONS
Actions that are meant to display a statistic about the tweet.
|
static ActionNode.Category |
TWEET_ACTIONS
Actions that are meant to display a statistic about the tweet.
|
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 |
---|
TweetDetailView(Tweet entity,
ViewNode node)
Creates a new detail view.
|
Modifier and Type | Method and Description |
---|---|
void |
commit() |
Node |
getViewNode() |
void |
update() |
activate, addBindListener, addUnbindListener, addUpdateListener, bind, bindImpl, deinitialize, findProperty, getContext, getEntity, getParam, initComponent, 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 ActionNode.Category STATS_ACTIONS
Actions that are meant to display a statistic about the tweet. These are rendered just below the tweet content. E.g. "245 Retweets", or "1444 Likes".
public static final ActionNode.Category TWEET_ACTIONS
Actions that are meant to display a statistic about the tweet. These are rendered just below the tweet content. E.g. "245 Retweets", or "1444 Likes".
public static final ActionNode.Category OVERFLOW_ACTIONS
Actions that are meant to display a statistic about the tweet. These are rendered just below the tweet content. E.g. "245 Retweets", or "1444 Likes".
public TweetDetailView(Tweet entity, ViewNode node)
Creates a new detail view.
entity
- The view model. Any entity conforming to the TweetSchema
schema.node
- The view node.public void update()
public void commit()
public Node getViewNode()
getViewNode
in interface EntityView
getViewNode
in class AbstractEntityView
Copyright © 2021. All Rights Reserved.