Package com.metsci.glimpse.core.layout
Class GlimpseVerticallyScrollableLayout
- java.lang.Object
-
- com.metsci.glimpse.core.layout.GlimpseLayout
-
- com.metsci.glimpse.core.layout.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 thesetVerticalOffset(int)
method. For an example of controlling the vertical-offset using a Swing scrollbar, seecom.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 Summary
Constructors Constructor Description GlimpseVerticallyScrollableLayout(int minContentHeight)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(boolean runImmediately, Runnable listener)
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.GlimpseBounds
getCurrentBounds(GlimpseTargetStack stack)
int
getMinContentHeight()
int
getVerticalOffset()
GlimpseBounds
layoutTo(GlimpseTargetStack stack)
void
removeListener(Runnable listener)
void
setMinContentHeight(int minContentHeight)
void
setVerticalOffset(int verticalOffset)
-
Methods inherited from class com.metsci.glimpse.core.layout.GlimpseLayout
addGlimpseKeyListener, addGlimpseMouseAllListener, addGlimpseMouseListener, addGlimpseMouseMotionListener, addGlimpseMouseWheelListener, addLayout, addLayout, addLayout, addLayout, addLayout, addPainter, addPainter, addPainter, addPainter, addPainter, addPainter, dispose, getGlimpseKeyListeners, getGlimpseMouseListeners, getGlimpseMouseMotionListeners, getGlimpseMouseWheelListeners, getLayoutByKey, getLayoutManager, getLock, getName, getPainterByKey, getTargetBounds, getTargetChildren, invalidateLayout, isDisposed, isEventConsumer, isEventGenerator, isVisible, keyPressed, keyReleased, layoutTo, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, paintTo, removeAll, removeAllGlimpseListeners, removeAllLayouts, removeGlimpseKeyListener, removeGlimpseMouseAllListener, removeGlimpseMouseListener, removeGlimpseMouseMotionListener, removeGlimpseMouseWheelListener, removeLayout, removeLayoutByKey, removePainter, removePainterByKey, setEventConsumer, setEventGenerator, setLayoutData, setLayoutManager, setLookAndFeel, setName, setVisible, setZOrder, setZOrder, toString
-
-
-
-
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)
-
layoutTo
public GlimpseBounds layoutTo(GlimpseTargetStack stack)
- Overrides:
layoutTo
in classGlimpseLayout
-
getVerticalOffset
public int getVerticalOffset()
-
setVerticalOffset
public void setVerticalOffset(int verticalOffset)
-
getMinContentHeight
public int getMinContentHeight()
-
setMinContentHeight
public void setMinContentHeight(int minContentHeight)
-
getCurrentBounds
public GlimpseBounds getCurrentBounds(GlimpseTargetStack stack)
-
-