Package snap.view
Class Scroller
java.lang.Object
snap.props.PropObject
snap.view.View
snap.view.ParentView
snap.view.Scroller
- All Implemented Interfaces:
PropChange.DoChange
,XMLArchiver.Archivable
,ViewHost
A class that can scroll a child view.
-
Nested Class Summary
Nested classes/interfaces inherited from class snap.view.View
View.Overflow
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class snap.view.ParentView
_children, Children_Prop, NeedsLayout_Prop
Fields inherited from class snap.view.View
_align, _border, _borderRadius, _effect, _fill, _font, _margin, _padding, _repaintRect, _showing, _spacing, _vertical, Action, Align_Prop, Border_Prop, BorderRadius_Prop, Cursor_Prop, Disabled_Prop, DragEvents, Effect_Prop, Fill_Prop, Focusable_Prop, Focused_Prop, FocusWhenPressed_Prop, Font_Prop, GrowHeight_Prop, GrowWidth_Prop, Height_Prop, KeyEvents, KeyPress, KeyRelease, KeyType, LeanX_Prop, LeanY_Prop, Managed_Prop, Margin_Prop, MaxHeight_Prop, MaxWidth_Prop, MinHeight_Prop, MinWidth_Prop, MouseDrag, MouseEnter, MouseEvents, MouseExit, MouseMove, MousePress, MouseRelease, Name_Prop, Opacity_Prop, Overflow_Prop, Padding_Prop, Paintable_Prop, Parent_Prop, Pickable_Prop, PrefHeight_Prop, PrefWidth_Prop, Rotate_Prop, RuntimeClassName_Prop, ScaleX_Prop, ScaleY_Prop, Scroll, Showing_Prop, Spacing_Prop, Text_Prop, TextColor_Prop, ToolTip_Prop, TransX_Prop, TransY_Prop, Vertical_Prop, Visible_Prop, Width_Prop, X_Prop, Y_Prop
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
ViewHost method: Override to set content.Returns the content.double
Returns the height of the content being scrolled.protected Size
Returns preferred size of content view in Scroller.double
Returns the width of the content being scrolled.getGuest
(int anIndex) ViewHost method: Override to return content (and complain if index beyond 0).int
ViewHost method: Override to return 1 if content is present.protected double
Calculates the minimum height.protected double
Calculates the minimum width.protected double
getPrefHeightImpl
(double aW) Calculates the preferred height.protected double
getPrefWidthImpl
(double aH) Calculates the preferred width.getPropValue
(String aPropName) Override for Scroller properties.double
Returns the maximum possible scroll X offset.double
Returns the maximum possible scroll Y offset.double
Returns the ratio of ScrollX to ScrollMaxX.double
Returns the ratio of ScrollY to ScrollMaxY.double
Returns the horizontal offset into content.double
Returns the vertical offset into content.boolean
Returns whether this scroller fits content to its height.boolean
Returns whether this scroller fits content to its width.protected void
Override to layout children.void
processEvent
(ViewEvent anEvent) Handle events.removeGuest
(int anIndex) ViewHost method: Override to clear content (and complain if index beyond 0).void
scrollToVisible
(Shape aShape) Called to scroll the given shape in this node coords to visible.void
setContent
(View aView) Sets the content.protected void
setContentHeight
(double aValue) Sets the height of the content being scrolled.protected void
setContentWidth
(double aValue) Sets the width of the content being scrolled.void
setFillHeight
(boolean aValue) Sets whether this scroller fits content to its height.void
setFillWidth
(boolean aValue) Sets whether this scroller fits content to its width.void
setPropValue
(String aPropName, Object aValue) Override for Scroller properties.void
setScrollRatioX
(double aValue) Sets ScrollX from the given ratio of ScrollY to ScrollMaxY.void
setScrollRatioY
(double aValue) Sets ScrollY from the given ratio of ScrollY to ScrollMaxY.void
setScrollX
(double aValue) Sets the horizontal offset into content.void
setScrollY
(double aValue) Sets the vertical offset into content.Methods inherited from class snap.view.ParentView
addChild, addChild, addDeepChangeListener, childDidDeepChange, childDidPropChange, fromXML, fromXMLChildren, fromXMLView, getChild, getChildAtXY, getChildCount, getChildCountManaged, getChildForClass, getChildForName, getChildLast, getChildren, getChildrenArray, getChildrenForClass, getChildrenInPaintOrder, getChildrenManaged, getFocusNext, getFocusPrev, getViewProxy, indexOfChild, initProps, intersectsShape, isInLayout, isNeedsLayout, isNeedsLayoutDeep, isNeedsRepaintDeep, layout, layoutDeep, layoutDeepImpl, layoutFloatingViews, paintAll, paintChildren, parentFontChanged, processPropChange, relayout, removeChild, removeChild, removeChildren, removeDeepChangeListener, setChildren, setFont, setNeedsLayout, setNeedsLayoutDeep, setNeedsRepaintDeep, setOwner, setOwnerChildren, setShowing, themeChanged, toXML, toXMLChildren, toXMLView
Methods inherited from class snap.view.View
addEventFilter, addEventHandler, clone, contains, contains, containsShape, createActionEvent, disableEvents, enableEvents, fireActionEvent, getAlign, getAlignX, getAlignY, getAnim, getAnimCleared, getAnimTimeDeep, getBestHeight, getBestSize, getBestWidth, getBorder, getBorderRadius, getBounds, getBoundsLocal, getBoundsParent, getBoundsShape, getBoundsShapeParent, getClip, getClipAll, getClipBounds, getClipBoundsAll, getCursor, getDefaultFont, getEffect, getEnv, getEventAdapter, getFill, getFillColor, getFocusNext, getFocusPrev, getFont, getHeight, getHost, getInsetsAll, getLean, getLeanX, getLeanY, getLocalToParent, getLocalToParent, getMargin, getMaxHeight, getMaxSize, getMaxWidth, getMaxX, getMaxY, getMidX, getMidY, getMinHeight, getMinSize, getMinWidth, getName, getOpacity, getOpacityAll, getOverflow, getOwner, getOwner, getPadding, getParent, getParent, getParentCount, getParentToLocal, getParentToLocal, getPhysics, getPhysics, getPrefHeight, getPrefHeight, getPrefSize, getPrefWidth, getPrefWidth, getProp, getPropDefault, getProps, getRepaintRect, getRepaintRectExpanded, getRootView, getRotate, getRuntimeClassName, getScale, getScaleX, getScaleY, getSize, getSpacing, getText, getTextColor, getToolTip, getToolTip, getTransX, getTransY, getUpdater, getValuePropName, getVisibleBounds, getWidth, getWindow, getX, getXY, getY, indexInHost, indexInParent, initStyleProps, isActionable, isAncestor, isAnimActive, isClipToBounds, isDisabled, isEnabled, isFocusable, isFocused, isFocusKeysEnabled, isFocusPainted, isFocusWhenPressed, isFontSet, isGrowHeight, isGrowWidth, isGuest, isHorizontal, isLocalToParentSimple, isManaged, isManagedVisible, isMaxHeightSet, isMaxWidthSet, isMinHeightSet, isMinWidthSet, isMouseDown, isMouseOver, isNeedsRepaint, isPaintable, isPickable, isPickableVisible, isPrefHeightSet, isPrefWidthSet, isPropDefault, isShowing, isToolTipEnabled, isVertical, isVisible, localToParent, localToParent, localToParent, localToParent, localToScreen, paintAbove, paintBack, paintFront, parentToLocal, parentToLocal, parentToLocal, parentToLocal, playAnimDeep, processEventAll, processEventFilters, processEventHandlers, relayoutParent, removeEventFilter, removeEventHandler, repaint, repaint, repaint, repaintInParent, requestFocus, runDelayed, runIntervals, runLater, setActionable, setAlign, setAlignX, setAlignY, setAnimString, setAnimTimeDeep, setBorder, setBorder, setBorderRadius, setBounds, setBounds, setBoundsLocal, setClipToBounds, setCursor, setDisabled, setEffect, setEnabled, setFill, setFocusable, setFocused, setFocusKeysEnabled, setFocusPainted, setFocusWhenPressed, setGrowHeight, setGrowWidth, setHeight, setLean, setLeanX, setLeanY, setManaged, setMargin, setMargin, setMaxHeight, setMaxSize, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinSize, setMinWidth, setName, setOpacity, setOverflow, setPadding, setPadding, setPaintable, setParent, setPickable, setPrefHeight, setPrefSize, setPrefSize, setPrefWidth, setProp, setRotate, setRuntimeClassName, setScale, setScaleX, setScaleY, setSize, setSize, setSizeLocal, setSizeToBestSize, setSizeToPrefSize, setSpacing, setText, setTextColor, setToolTip, setToolTipEnabled, setTransX, setTransY, setVertical, setVisible, setWidth, setX, setXY, setXYLocal, setY, stopAnimDeep, stopIntervals, toStringProps
Methods inherited from class snap.props.PropObject
addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, processArchivedNode, processUnarchivedNode, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface snap.view.ViewHost
addGuest, getGuests, removeGuest, setGuests
-
Field Details
-
Content_Prop
- See Also:
-
FillWidth_Prop
- See Also:
-
FillHeight_Prop
- See Also:
-
ScrollX_Prop
- See Also:
-
ScrollY_Prop
- See Also:
-
ContentWidth_Prop
- See Also:
-
ContentHeight_Prop
- See Also:
-
-
Constructor Details
-
Scroller
public Scroller()Constructor.
-
-
Method Details
-
getContent
Returns the content. -
setContent
Sets the content. -
isFillWidth
public boolean isFillWidth()Returns whether this scroller fits content to its width. -
setFillWidth
public void setFillWidth(boolean aValue) Sets whether this scroller fits content to its width. -
isFillHeight
public boolean isFillHeight()Returns whether this scroller fits content to its height. -
setFillHeight
public void setFillHeight(boolean aValue) Sets whether this scroller fits content to its height. -
getScrollX
public double getScrollX()Returns the horizontal offset into content. -
setScrollX
public void setScrollX(double aValue) Sets the horizontal offset into content. -
getScrollY
public double getScrollY()Returns the vertical offset into content. -
setScrollY
public void setScrollY(double aValue) Sets the vertical offset into content. -
getContentWidth
public double getContentWidth()Returns the width of the content being scrolled. -
setContentWidth
protected void setContentWidth(double aValue) Sets the width of the content being scrolled. -
getContentHeight
public double getContentHeight()Returns the height of the content being scrolled. -
setContentHeight
protected void setContentHeight(double aValue) Sets the height of the content being scrolled. -
getScrollMaxX
public double getScrollMaxX()Returns the maximum possible scroll X offset. -
getScrollMaxY
public double getScrollMaxY()Returns the maximum possible scroll Y offset. -
getScrollRatioX
public double getScrollRatioX()Returns the ratio of ScrollX to ScrollMaxX. -
setScrollRatioX
public void setScrollRatioX(double aValue) Sets ScrollX from the given ratio of ScrollY to ScrollMaxY. -
getScrollRatioY
public double getScrollRatioY()Returns the ratio of ScrollY to ScrollMaxY. -
setScrollRatioY
public void setScrollRatioY(double aValue) Sets ScrollY from the given ratio of ScrollY to ScrollMaxY. -
getContentPrefSize
Returns preferred size of content view in Scroller. -
scrollToVisible
Called to scroll the given shape in this node coords to visible.- Overrides:
scrollToVisible
in classView
-
getGuestCount
public int getGuestCount()ViewHost method: Override to return 1 if content is present.- Specified by:
getGuestCount
in interfaceViewHost
-
getGuest
ViewHost method: Override to return content (and complain if index beyond 0). -
addGuest
ViewHost method: Override to set content. -
removeGuest
ViewHost method: Override to clear content (and complain if index beyond 0).- Specified by:
removeGuest
in interfaceViewHost
-
getMinWidthImpl
protected double getMinWidthImpl()Calculates the minimum width.- Overrides:
getMinWidthImpl
in classView
-
getMinHeightImpl
protected double getMinHeightImpl()Calculates the minimum height.- Overrides:
getMinHeightImpl
in classView
-
getPrefWidthImpl
protected double getPrefWidthImpl(double aH) Calculates the preferred width.- Overrides:
getPrefWidthImpl
in classView
-
getPrefHeightImpl
protected double getPrefHeightImpl(double aW) Calculates the preferred height.- Overrides:
getPrefHeightImpl
in classView
-
layoutImpl
protected void layoutImpl()Override to layout children.- Overrides:
layoutImpl
in classParentView
-
processEvent
Handle events.- Overrides:
processEvent
in classView
-
getPropValue
Override for Scroller properties.- Overrides:
getPropValue
in classParentView
-
setPropValue
Override for Scroller properties.- Overrides:
setPropValue
in classParentView
-