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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class snap.view.ParentView
_children, Child_Prop, NeedsLayout_Prop
Fields inherited from class snap.view.View
_align, _borderRadius, _effect, _font, _margin, _padding, _repaintRect, _showing, _spacing, _vertical, Action, Align_Prop, Border_Prop, BorderRadius_Prop, Clip_Prop, Cursor_Prop, DEFAULT_ALIGN, DEFAULT_MARGIN, DEFAULT_PADDING, DEFAULT_SPACING, 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, Padding_Prop, Paintable_Prop, Parent_Prop, Pickable_Prop, PrefHeight_Prop, PrefWidth_Prop, Rotate_Prop, ScaleX_Prop, ScaleY_Prop, Scroll, Showing_Prop, Spacing_Prop, Text_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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
ViewHost method: Override to set content.Returns the content.protected Size
Returns preferred size of content view in Scroller.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 height of the content being scrolled.double
Returns the maximum possible horizontal offset.double
Returns the maximum possible vertical offset.double
Returns the ratio of ScrollX to ScrollXMax.double
Returns the ratio of ScrollY to ScrollYMax.double
Returns the width of the content being scrolled.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.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.protected void
setScrollHeight
(double aValue) Sets the height of the content being scrolled.void
setScrollRatioX
(double aValue) Sets ScrollX from the given ratio of ScrollY to ScrollYMax.void
setScrollRatioY
(double aValue) Sets ScrollY from the given ratio of ScrollY to ScrollYMax.protected void
setScrollWidth
(double aValue) Sets the width of the content being scrolled.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, getChildAt, getChildAt, getChildCount, getChildCountManaged, getChildForClass, getChildForName, getChildLast, getChildren, getChildrenForClass, getChildrenInPaintOrder, getChildrenManaged, getFocusNext, getFocusPrev, getViewList, getViewProxy, indexOfChild, initProps, intersectsShape, isInLayout, isNeedsLayout, isNeedsLayoutDeep, isNeedsRepaintDeep, layout, layoutDeep, layoutDeepImpl, layoutFloatingViews, paintAbove, 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
addBinding, addEventFilter, addEventHandler, clone, contains, contains, containsShape, createActionEvent, disableEvents, enableEvents, fireActionEvent, getAlign, getAlignX, getAlignY, getAnim, getAnimCleared, getAnimTimeDeep, getBestHeight, getBestSize, getBestWidth, getBinding, getBinding, getBindingCount, getBindings, getBorder, getBorderRadius, getBounds, getBoundsLocal, getBoundsParent, getBoundsShape, getBoundsShapeParent, getClip, getClipAll, getClipAllBounds, getClipBounds, getClippedRect, getCursor, getDefaultBorder, getDefaultFill, 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, getOwner, getOwner, getPadding, getParent, getParent, getParentCount, getParentToLocal, getParentToLocal, getPhysics, getPhysics, getPrefHeight, getPrefHeight, getPrefSize, getPrefWidth, getPrefWidth, getProp, getPropDefault, getProps, getRealClassName, getRepaintRect, getRepaintRectExpanded, getRootView, getRotate, getScale, getScaleX, getScaleY, getSize, getSpacing, getText, getToolTip, getToolTip, getTransX, getTransY, getUpdater, getValuePropName, getVisRect, getWidth, getWindow, getX, getXY, getY, indexInHost, indexInParent, isActionable, isAncestor, 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, isShowing, isToolTipEnabled, isVertical, isVisible, localToParent, localToParent, localToParent, localToParent, localToScreen, paintBack, paintFront, parentToLocal, parentToLocal, parentToLocal, parentToLocal, playAnimDeep, processEventAll, processEventFilters, processEventHandlers, relayoutParent, removeBinding, removeBinding, removeEventFilter, removeEventHandler, repaint, repaint, repaint, repaintInParent, requestFocus, runDelayed, runIntervals, runLater, setActionable, setAlign, setAlignX, setAlignY, setAnimProps, setAnimString, setAnimTimeDeep, setBorder, setBorder, setBorderRadius, setBounds, setBounds, setBoundsLocal, setClip, 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, setPadding, setPadding, setPaintable, setParent, setPickable, setPrefHeight, setPrefSize, setPrefSize, setPrefWidth, setProp, setRealClassName, setRotate, setScale, setScaleX, setScaleY, setSize, setSize, setSizeLocal, setSizeToBestSize, setSizeToPrefSize, setSpacing, setText, 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, isPropDefault, 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
-
Field Details
-
Content_Prop
- See Also:
-
ScrollX_Prop
- See Also:
-
ScrollY_Prop
- See Also:
-
ScrollWidth_Prop
- See Also:
-
ScrollHeight_Prop
- See Also:
-
-
Constructor Details
-
Scroller
public Scroller()Creates a new Scroller.
-
-
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. -
getScrollWidth
public double getScrollWidth()Returns the width of the content being scrolled. -
setScrollWidth
protected void setScrollWidth(double aValue) Sets the width of the content being scrolled. -
getScrollHeight
public double getScrollHeight()Returns the height of the content being scrolled. -
setScrollHeight
protected void setScrollHeight(double aValue) Sets the height of the content being scrolled. -
getScrollLimitX
public double getScrollLimitX()Returns the maximum possible horizontal offset. -
getScrollLimitY
public double getScrollLimitY()Returns the maximum possible vertical offset. -
getScrollRatioX
public double getScrollRatioX()Returns the ratio of ScrollX to ScrollXMax. -
setScrollRatioX
public void setScrollRatioX(double aValue) Sets ScrollX from the given ratio of ScrollY to ScrollYMax. -
getScrollRatioY
public double getScrollRatioY()Returns the ratio of ScrollY to ScrollYMax. -
setScrollRatioY
public void setScrollRatioY(double aValue) Sets ScrollY from the given ratio of ScrollY to ScrollYMax. -
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
-