pivot.wtk
Class Viewport

java.lang.Object
  extended by pivot.wtk.Component
      extended by pivot.wtk.Container
          extended by pivot.wtk.Viewport
All Implemented Interfaces:
Iterable<Component>, Sequence<Component>, ConstrainedVisual, Visual
Direct Known Subclasses:
Panorama, ScrollPane

public abstract class Viewport
extends Container

Abstract base class for viewport components. Viewports provide a windowed view on a component (called the "view") that is too large to fit within a given area. They are generally scrollable.

Author:
tvolkert

Nested Class Summary
static interface Viewport.Skin
          Viewport skin interface.
 
Nested classes/interfaces inherited from class pivot.wtk.Component
Component.Attributes, Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Nested classes/interfaces inherited from interface pivot.collections.Sequence
Sequence.Search, Sequence.Sort, Sequence.Tree
 
Constructor Summary
Viewport()
           
 
Method Summary
 int getScrollLeft()
           
 int getScrollTop()
           
 Component getView()
           
 Bounds getViewportBounds()
           
 ListenerList<ViewportListener> getViewportListeners()
           
 boolean isConsumeRepaint()
          Returns the consumeRepaint flag, which controls whether the viewport will propagate repaints to its parent or consume them.
 Sequence<Component> remove(int index, int count)
          Removes one or more items from the sequence.
 void repaint(int x, int y, int width, int height, boolean immediate)
          Flags an area as needing to be repainted.
 void setConsumeRepaint(boolean consumeRepaint)
          Sets the consumeRepaint flag, which controls whether the viewport will propagate repaints to its parent or consume them.
 void setScrollLeft(int scrollLeft)
           
 void setScrollTop(int scrollTop)
           
protected  void setSkin(Skin skin)
          Sets the skin, replacing any previous skin.
 void setView(Component view)
           
 
Methods inherited from class pivot.wtk.Container
add, containsFocus, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getContextKey, getDescendantAt, getFocusTraversalPolicy, getLength, indexOf, insert, isAncestor, isFocusable, iterator, load, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, removeAll, requestFocus, setContextKey, setEnabled, setFocusTraversalPolicy, setParent, setTooltip, setVisible, store, update, validate
 
Methods inherited from class pivot.wtk.Component
clearFocus, clearFocus, finalize, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentDragDropListeners, getComponentKeyListeners, getComponentLayoutListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHandle, getHeight, getLocation, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isDisplayable, isEnabled, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, load, mapPointFromAncestor, mapPointToAncestor, mouseOver, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDisplayable, setDragSource, setDropTarget, setFocused, setHeight, setLocation, setLocation, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setStyles, setStyles, setStyles, setTooltipText, setWidth, setX, setY, store, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Viewport

public Viewport()
Method Detail

setSkin

protected void setSkin(Skin skin)
Description copied from class: Component
Sets the skin, replacing any previous skin.

Overrides:
setSkin in class Component
Parameters:
skin - The new skin.

getScrollTop

public int getScrollTop()

setScrollTop

public void setScrollTop(int scrollTop)

getScrollLeft

public int getScrollLeft()

setScrollLeft

public void setScrollLeft(int scrollLeft)

getView

public Component getView()

setView

public void setView(Component view)

isConsumeRepaint

public boolean isConsumeRepaint()
Returns the consumeRepaint flag, which controls whether the viewport will propagate repaints to its parent or consume them. This flag enables skins to optimize viewport scrolling by blitting the display to reduce the required repaint area.

Returns:
true if this viewport will consume repaints that bubble up through it; false if it will propagate them up like normal.

setConsumeRepaint

public void setConsumeRepaint(boolean consumeRepaint)
Sets the consumeRepaint flag, which controls whether the viewport will propagate repaints to its parent or consume them. This flag enables skins to optimize viewport scrolling by blitting the display to reduce the required repaint area.

Parameters:
consumeRepaint - true to consume repaints that bubble up through this viewport; false to propagate them up like normal.

getViewportBounds

public Bounds getViewportBounds()

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height,
                    boolean immediate)
Description copied from class: Component
Flags an area as needing to be repainted.

Overrides:
repaint in class Component

remove

public Sequence<Component> remove(int index,
                                  int count)
Description copied from interface: Sequence
Removes one or more items from the sequence.

Specified by:
remove in interface Sequence<Component>
Overrides:
remove in class Container
Parameters:
index - The starting index to remove.
count - The number of items to remove, beginning with index.
Returns:
A sequence containing the items that were removed.

getViewportListeners

public ListenerList<ViewportListener> getViewportListeners()