Package snap.view

Class Scroller

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable, ViewHost

public class Scroller extends ParentView implements ViewHost
A class that can scroll a child view.
  • Field Details

  • Constructor Details

    • Scroller

      public Scroller()
      Creates a new Scroller.
  • Method Details

    • getContent

      public View getContent()
      Returns the content.
    • setContent

      public void setContent(View aView)
      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.
    • isGrowContentWidth

      public boolean isGrowContentWidth()
      Returns whether to grow content to scroller width if smaller than scroller (overrides content setting if true).
    • setGrowContentWidth

      public void setGrowContentWidth(boolean aValue)
      Sets whether to grow content to scroller width if smaller than scroller (overrides content setting if true).
    • isGrowContentHeight

      public boolean isGrowContentHeight()
      Returns whether to grow content to scroller height if smaller than scroller (overrides content setting if true).
    • setGrowContentHeight

      public void setGrowContentHeight(boolean aValue)
      Sets whether to grow content to scroller height if smaller than scroller (overrides content setting if true).
    • 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.
    • getWidthRatio

      public double getWidthRatio()
      Returns the ratio of Scroller.Width to Content.Width.
    • getHeightRatio

      public double getHeightRatio()
      Returns the ratio of Scroller.Height to Content.Height.
    • getContentPrefSize

      protected Size getContentPrefSize()
      Returns preferred size of content view in Scroller.
    • scrollToVisible

      public void scrollToVisible(Shape aShape)
      Called to scroll the given shape in this node coords to visible.
      Overrides:
      scrollToVisible in class View
    • getGuestCount

      public int getGuestCount()
      ViewHost method: Override to return 1 if content is present.
      Specified by:
      getGuestCount in interface ViewHost
    • getGuest

      public View getGuest(int anIndex)
      ViewHost method: Override to return content (and complain if index beyond 0).
      Specified by:
      getGuest in interface ViewHost
    • addGuest

      public void addGuest(View aChild, int anIndex)
      ViewHost method: Override to set content.
      Specified by:
      addGuest in interface ViewHost
    • removeGuest

      public View removeGuest(int anIndex)
      ViewHost method: Override to clear content (and complain if index beyond 0).
      Specified by:
      removeGuest in interface ViewHost
    • getMinWidthImpl

      protected double getMinWidthImpl()
      Calculates the minimum width.
      Overrides:
      getMinWidthImpl in class View
    • getMinHeightImpl

      protected double getMinHeightImpl()
      Calculates the minimum height.
      Overrides:
      getMinHeightImpl in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Calculates the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Calculates the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout children.
      Overrides:
      layoutImpl in class ParentView
    • processEvent

      public void processEvent(ViewEvent anEvent)
      Handle events.
      Overrides:
      processEvent in class View
    • getPropValue

      public Object getPropValue(String aPropName)
      Override for Scroller properties.
      Overrides:
      getPropValue in class ParentView
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override for Scroller properties.
      Overrides:
      setPropValue in class ParentView