Package org.apache.pivot.wtk.skin
Class ScrollPaneSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.ScrollPaneSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,ScrollBarValueListener,ScrollPaneListener,Skin,Viewport.Skin,ViewportListener,Visual
- Direct Known Subclasses:
TerraScrollPaneSkin
public class ScrollPaneSkin extends ContainerSkin implements Viewport.Skin, ScrollPaneListener, ViewportListener, ScrollBarValueListener
Scroll pane skin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter, ContainerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter, ContainerMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ScrollBarValueListener
ScrollBarValueListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ScrollPaneListener
ScrollPaneListener.Adapter, ScrollPaneListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ViewportListener
ViewportListener.Adapter, ViewportListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description ScrollPaneSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcolumnHeaderChanged(ScrollPane scrollPane, Component previousColumnHeader)Called when the scroll pane's column header changed.voidcornerChanged(ScrollPane scrollPane, Component previousCorner)Called when the scroll pane's corner component changed.intgetBaseline(int width, int height)Should be implemented in every subclass.intgetHorizontalIncrement()intgetHorizontalReveal()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.intgetVerticalIncrement()intgetVerticalReveal()BoundsgetViewportBounds()voidhorizontalScrollBarPolicyChanged(ScrollPane scrollPane, ScrollPane.ScrollBarPolicy previousHorizontalScrollBarPolicy)Called when the scroll pane's horizontal scroll bar policy changed.voidinstall(Component component)Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.booleankeyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)Key presses have no effect if the event has already been consumed.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.booleanmouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)Called when the mouse wheel is scrolled over a component.voidrowHeaderChanged(ScrollPane scrollPane, Component previousRowHeader)Called when the scroll pane's row header changed.voidscrollLeftChanged(Viewport viewport, int previousScrollLeft)Called when a viewport's scroll left has changed.voidscrollTopChanged(Viewport viewport, int previousScrollTop)Called when a viewport's scroll top has changed.voidsetBackgroundPaint(java.awt.Paint backgroundPaint)Sets the object used to paint the background of the container.voidsetHorizontalIncrement(int horizontalIncrement)voidsetHorizontalReveal(int horizontalReveal)voidsetVerticalIncrement(int verticalIncrement)voidsetVerticalReveal(int verticalReveal)voidvalueChanged(ScrollBar scrollBar, int previousValue)Called when a scroll bar's value has changed.voidverticalScrollBarPolicyChanged(ScrollPane scrollPane, ScrollPane.ScrollBarPolicy previousVerticalScrollBarPolicy)Called when the scroll pane's vertical scroll bar policy changed.voidviewChanged(Viewport viewport, Component previousView)Called when a viewport's view component has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, paint, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint
-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkinMust be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
installin interfaceSkin- Overrides:
installin classContainerSkin- Parameters:
component- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- Parameters:
height- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Overrides:
getPreferredHeightin classContainerSkin- Parameters:
width- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Overrides:
getPreferredSizein classComponentSkin- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)andConstrainedVisual.getPreferredHeight(int).
-
getBaseline
public int getBaseline(int width, int height)Description copied from class:ComponentSkinShould be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaselinein interfaceConstrainedVisual- Overrides:
getBaselinein classComponentSkin- Parameters:
width- Constrained width to compute the baseline for.height- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1if this visual does not have a baseline.
-
mouseWheel
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Description copied from interface:ComponentMouseWheelListenerCalled when the mouse wheel is scrolled over a component.- Specified by:
mouseWheelin interfaceComponentMouseWheelListener- Overrides:
mouseWheelin classComponentSkin- Parameters:
component- Component under the mouse pointer.scrollType- What type of scroll was requested on the mouse.scrollAmount- Amount of scrolling.wheelRotation- Rotation value.x- X position of the mouse.y- Y position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
Key presses have no effect if the event has already been consumed.UPScroll up a single scroll unit.
DOWNScroll down a single scroll unit.
LEFTScroll left a single scroll unit.
RIGHTScroll right a single scroll unit.
PAGE_UPScroll up a single scroll block.
PAGE_DOWNScroll down a single scroll block.- Specified by:
keyPressedin interfaceComponentKeyListener- Overrides:
keyPressedin classComponentSkin- Parameters:
component- Component that has the focus.keyCode- The key code for the key that was pressed.keyLocation- Location value for the key (left or right for shift keys, etc.).- Returns:
trueto consume the event;falseto allow it to propagate.- See Also:
ScrollBar.getBlockIncrement(),ScrollBar.getUnitIncrement()
-
layout
public void layout()
Description copied from interface:SkinIf the component on which the skin is installed is a container, lays out the container's children.
-
setBackgroundPaint
public void setBackgroundPaint(java.awt.Paint backgroundPaint)
Description copied from class:ContainerSkinSets the object used to paint the background of the container.- Overrides:
setBackgroundPaintin classContainerSkin- Parameters:
backgroundPaint- The newPaintobject to paint the background.
-
getHorizontalIncrement
public int getHorizontalIncrement()
-
setHorizontalIncrement
public void setHorizontalIncrement(int horizontalIncrement)
-
getVerticalIncrement
public int getVerticalIncrement()
-
setVerticalIncrement
public void setVerticalIncrement(int verticalIncrement)
-
getHorizontalReveal
public int getHorizontalReveal()
-
setHorizontalReveal
public void setHorizontalReveal(int horizontalReveal)
-
getVerticalReveal
public int getVerticalReveal()
-
setVerticalReveal
public void setVerticalReveal(int verticalReveal)
-
getViewportBounds
public Bounds getViewportBounds()
- Specified by:
getViewportBoundsin interfaceViewport.Skin- Returns:
- The bounds of the Viewport within the container, for example, in ScrollPaneSkin, this excludes the scrollbars.
-
horizontalScrollBarPolicyChanged
public void horizontalScrollBarPolicyChanged(ScrollPane scrollPane, ScrollPane.ScrollBarPolicy previousHorizontalScrollBarPolicy)
Description copied from interface:ScrollPaneListenerCalled when the scroll pane's horizontal scroll bar policy changed.- Specified by:
horizontalScrollBarPolicyChangedin interfaceScrollPaneListener- Parameters:
scrollPane- The source of the event.previousHorizontalScrollBarPolicy- The previous horizontal scroll bar policy.
-
verticalScrollBarPolicyChanged
public void verticalScrollBarPolicyChanged(ScrollPane scrollPane, ScrollPane.ScrollBarPolicy previousVerticalScrollBarPolicy)
Description copied from interface:ScrollPaneListenerCalled when the scroll pane's vertical scroll bar policy changed.- Specified by:
verticalScrollBarPolicyChangedin interfaceScrollPaneListener- Parameters:
scrollPane- The source of the event.previousVerticalScrollBarPolicy- The previous vertical scroll bar policy.
-
rowHeaderChanged
public void rowHeaderChanged(ScrollPane scrollPane, Component previousRowHeader)
Description copied from interface:ScrollPaneListenerCalled when the scroll pane's row header changed.- Specified by:
rowHeaderChangedin interfaceScrollPaneListener- Parameters:
scrollPane- The source of the event.previousRowHeader- The previous row header for this scroll pane.
-
columnHeaderChanged
public void columnHeaderChanged(ScrollPane scrollPane, Component previousColumnHeader)
Description copied from interface:ScrollPaneListenerCalled when the scroll pane's column header changed.- Specified by:
columnHeaderChangedin interfaceScrollPaneListener- Parameters:
scrollPane- The source of the event.previousColumnHeader- The previous column header for this scroll pane.
-
cornerChanged
public void cornerChanged(ScrollPane scrollPane, Component previousCorner)
Description copied from interface:ScrollPaneListenerCalled when the scroll pane's corner component changed.- Specified by:
cornerChangedin interfaceScrollPaneListener- Parameters:
scrollPane- The source of the event.previousCorner- The previous corner component.
-
scrollTopChanged
public void scrollTopChanged(Viewport viewport, int previousScrollTop)
Description copied from interface:ViewportListenerCalled when a viewport's scroll top has changed.- Specified by:
scrollTopChangedin interfaceViewportListener- Parameters:
viewport- The viewport that has scrolled.previousScrollTop- The previous top scroll position.
-
scrollLeftChanged
public void scrollLeftChanged(Viewport viewport, int previousScrollLeft)
Description copied from interface:ViewportListenerCalled when a viewport's scroll left has changed.- Specified by:
scrollLeftChangedin interfaceViewportListener- Parameters:
viewport- The viewport that has been scrolled.previousScrollLeft- The previous left scroll position.
-
viewChanged
public void viewChanged(Viewport viewport, Component previousView)
Description copied from interface:ViewportListenerCalled when a viewport's view component has changed.- Specified by:
viewChangedin interfaceViewportListener- Parameters:
viewport- The viewport whose view has changed.previousView- What the view (or the scrollable component) used to be.
-
valueChanged
public void valueChanged(ScrollBar scrollBar, int previousValue)
Description copied from interface:ScrollBarValueListenerCalled when a scroll bar's value has changed.- Specified by:
valueChangedin interfaceScrollBarValueListener- Parameters:
scrollBar- The scroll bar that is changing.previousValue- The previous value of this scroll bar.
-
-