Class GlimpseVerticallyScrollableLayout

  • All Implemented Interfaces:
    GlimpseTarget, GlimpseKeyListener, Keyable, GlimpseMouseListener, GlimpseMouseMotionListener, GlimpseMouseWheelListener, Mouseable, GlimpsePainter

    public class GlimpseVerticallyScrollableLayout
    extends GlimpseLayout
    A GlimpseLayout that shifts its layout-children up or down based on a vertical- offset field, which can be set by calling the setVerticalOffset(int) method. For an example of controlling the vertical-offset using a Swing scrollbar, see com.metsci.glimpse.examples.layout.VerticallyScrollableLayoutExample. In typical usage, when this layout's container is taller than minContentHeight, the child-layouts will not be scrollable -- this layout will size its child- layouts to fit the container. However, when this layout's container is shorter than minContentHeight, it will set child-layout heights to minContentHeight -- and verticalOffset then affects what portion of the content fits inside the container's bounds.
    Author:
    hogye
    • Constructor Detail

      • GlimpseVerticallyScrollableLayout

        public GlimpseVerticallyScrollableLayout​(int minContentHeight)
    • Method Detail

      • attachScrollableToScrollbar

        public static Runnable attachScrollableToScrollbar​(GlimpseVerticallyScrollableLayout layout,
                                                           GlimpseTargetStack stack,
                                                           JScrollBar scrollbar)
        Returns a Runnable that, if called, will detach the layout from the scrollbar, removing all of the listeners put in place by the attach call. If you are doing all Glimpse stuff on the Swing thread, then this function causes no threading concerns. If you have multiple UI threads, you can generally rule out either deadlock or race conditions, but not both. This function rules out deadlock, so it must leave the door open to race conditions -- use at your own risk.
      • addListener

        public void addListener​(boolean runImmediately,
                                Runnable listener)
      • removeListener

        public void removeListener​(Runnable listener)
      • getVerticalOffset

        public int getVerticalOffset()
      • setVerticalOffset

        public void setVerticalOffset​(int verticalOffset)
      • getMinContentHeight

        public int getMinContentHeight()
      • setMinContentHeight

        public void setMinContentHeight​(int minContentHeight)