Class AvatarGroup
Avatars: the approvers of a document, the members of a team.
Each avatar overlaps the one before by a quarter of its width, ringed in the surface colour so
the overlap reads as a stack. A circle covered by the next one centres its initials on the part
that shows, the three quarters away from the overlap, so no letter is cut; the last circle keeps
them in its middle. Every circle draws its initials at one size: the label's, or the smaller size
the group's widest pair needs to fit that part ("MW" in the shipped face), so the stack reads
even.
Past the most shown (four by default), the first ones are
drawn and the last place is a circle that says how many more there are, "+3", whose tooltip lists
the hidden names. The count takes no click: a group is a picture of who, and a list of everyone
is the application's, in a Popover from a button beside it if it wants one.
To a reader a group is one node, a Accessible.Role.GROUP named by
Widget.setAccessibleName(limn.i18n.I18nString) ("Approvers") and described by every member's name in order, the
hidden ones included, joined by the language's list comma. The avatars inside are not published:
they would repeat the description, and the hidden ones have no box to publish. A reader is not
limited by the width the eye is.
Right to left, the group starts at the leading edge, the right one, and overlaps toward the left.
new AvatarGroup(new Avatar("Ana Lima"), new Avatar("Rui Costa"), new Avatar("Eva Melo"))
.setAccessibleName("Approvers");
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a member at the end.intintmaxShown()members()protected voidOneAccessible.Role.GROUP, named by the application and described by every member, the hidden ones included.protected voidonAccessibilityChild(Widget<?> child, Accessibility a) The circles inside are not published: the group's description already says every name.protected voidonLayout()Containers position children here (measure +Widget.layoutBox(float, float, float, float)per child).protected SizeonMeasure(Constraints constraints) Reports the size this widget wants withinconstraints.Removes a member.setMaxShown(int count) How many circles the group draws at most, the "+k" circle included: past it, the firstcount - 1members are drawn and the last place counts the rest.Methods inherited from class limn.scene.Widget
acceptsTextInput, accessibleLabelAccessKey, accessibleLabelTarget, accessibleLabelText, add, add, announceChange, backdropReach, baselineOffset, baselineOffsetOf, caretRect, children, clipboard, clipHeight, clipsChildren, clipWidth, clipX, clipY, controlSize, cursor, declaredControlSize, declaredLayoutDirection, declaredLocale, focusArrivedBackward, focusArrivedByTraversal, handleUserChange, height, hitTest, hitTestChild, id, imageCursor, inheritanceHost, invalidate, invalidate, invalidateAccessible, isEnabled, isFocusable, isFocused, isRightToLeft, isSelfEnabled, isShowing, isVisible, isVisibleByItsOwnFlag, layoutBox, layoutDirection, locale, localToScene, localToSceneBounds, markNeedsContainedLayout, markNeedsLayout, markNeedsLayoutInPlace, maxHeight, maxWidth, measure, minHeight, minWidth, moveChild, moveChild, moveChild, neutralBase, notifyChange, notifyTextEdit, observeChanges, onAccessibilityAction, onAccessibilityChildAction, onAccessibilityChildIdentity, onAttached, onCanEdit, onCharTyped, onDetached, onDragExit, onDragOver, onDragStart, onDrop, onEdit, onFocusGained, onFocusLost, onHitTest, onKeyEvent, onMouseEvent, onPaint, onPaintOverlay, onPreedit, onSyntheticAction, overlayPassesPointer, paintChildren, paintOutset, paintsDecoration, paintsFromBackdrop, paintWidget, parent, remove, remove, requestFocus, requestFocus, revealInView, revealInView, runHandler, scene, sceneNanos, sceneToLocal, self, setAccessibleDescribedBy, setAccessibleDescription, setAccessibleDescription, setAccessibleIgnored, setAccessibleLabelledBy, setAccessibleName, setAccessibleName, setAccessibleRole, setControlSize, setCursor, setEnabled, setFocusable, setId, setImageCursor, setInheritanceHost, setLayoutDirection, setLocale, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setPresentedElsewhere, setTooltip, setTooltip, setVisible, shapeText, textRuler, tooltip, tooltipSource, width, x, y
-
Constructor Details
-
AvatarGroup
A group of the avatars given, in order.- Parameters:
avatars- the members, in the order drawn
-
-
Method Details
-
add
Adds a member at the end.- Parameters:
avatar- the member to add, which is in no other group- Returns:
- this group
- Throws:
IllegalArgumentException- if the avatar is already in a group
-
remove
Removes a member.- Parameters:
avatar- the member- Returns:
- this group
-
members
- Returns:
- the members, in order, the hidden ones included
-
setMaxShown
How many circles the group draws at most, the "+k" circle included: past it, the firstcount - 1members are drawn and the last place counts the rest.- Parameters:
count- at least 1- Returns:
- this group
- Throws:
IllegalArgumentException- ifcountis less than 1
-
maxShown
public int maxShown()- Returns:
- how many circles the group draws at most
-
onMeasure
Description copied from class:WidgetReports the size this widget wants withinconstraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.Resolve the
ControlSizeand theLayoutDirectiononce each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, andI18n.locale()answers it wherever text is resolved.- Specified by:
onMeasurein classWidget<AvatarGroup>
-
onLayout
protected void onLayout()Description copied from class:WidgetContainers position children here (measure +Widget.layoutBox(float, float, float, float)per child).- Overrides:
onLayoutin classWidget<AvatarGroup>
-
onAccessibility
OneAccessible.Role.GROUP, named by the application and described by every member, the hidden ones included.- Overrides:
onAccessibilityin classWidget<AvatarGroup>- Parameters:
a- the node being described
-
onAccessibilityChild
The circles inside are not published: the group's description already says every name.- Overrides:
onAccessibilityChildin classWidget<AvatarGroup>- Parameters:
child- the child being describeda- the child's node
-