org.zaval.lw
Class LwScrollPan

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwCanvas
              |
              +--org.zaval.lw.LwPanel
                    |
                    +--org.zaval.lw.LwScrollPan
All Implemented Interfaces:
Drawable, java.util.EventListener, Layoutable, LayoutContainer, LwComponent, LwContainer, LwLayout, PosListener, ScrollMan, ScrollObj, Validationable

public class LwScrollPan
extends LwPanel
implements PosListener, ScrollObj, ScrollMan, LwLayout

This is scroll panel component. The scroll panel is a container that implements automatic horizontal and/or vertical scrolling for a single child component. The horizontal and vertical scrollbars are shown only if it is necessary, the properties of the scroll bar components are computed with the component accordingly the metrical characteristics of the child component. There are two types of the scrolling child components:


Fields inherited from class org.zaval.lw.LwPanel
children
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, height, insets, parent, psHeight, psWidth, skins, width, x, y
 
Fields inherited from class org.zaval.util.ValidationObject
isValidFlag
 
Constructor Summary
LwScrollPan(LwComponent c)
          Constructs a scroll panel component with the specified child component to be scrolled.
LwScrollPan(LwComponent c, int barMask)
          Constructs a scroll panel component with the specified child component to be scrolled and the given scroll bar mask.
 
Method Summary
 java.awt.Dimension calcPreferredSize(LayoutContainer target)
          Calculates the preferred size dimension of the layout container.
 void componentAdded(java.lang.Object id, Layoutable comp, int index)
          Invoked when the specified layoutable component is added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable comp, int index)
          Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager.
protected  LwLayout getDefaultLayout()
          Gets the default layout manager that is set with the container during initialization.
 java.awt.Point getSOLocation()
          Gets the scroll object location.
 java.awt.Dimension getSOSize()
          Gets the scroll object size.
 void layout(LayoutContainer target)
          Lays out the child layoutable components inside the layout container.
 void makeVisible(int x, int y)
          Makes visible the specified location of the scrolled component.
 boolean moveContent()
          Tests if the scroll component performs scrolling by changing its location or moving view.
 void posChanged(PosEvent e)
          Invoked when a virtual position has been changed.
 void scrollObjMoved(int x, int y)
          Invoked when a scroll object has been moved.
 void scrollObjResized(int w, int h)
          Invoked when a scroll object has been resized.
 void setIncrements(int hUnit, int hPage, int vUnit, int vPage)
          Set the horizontal & vertical unit & page increments.
 void setScrollMan(ScrollMan m)
          Sets the specified scroll manager for the scroll object.
 void setSOLocation(int x, int y)
          Sets the specified scroll object location.
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, indexOf, insert, insert, invalidate, paintOnTop, recalc, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, toFront, updateCashedPs
 
Methods inherited from class org.zaval.lw.LwCanvas
canHaveFocus, getBackground, getBounds, getHeight, getInsets, getLocation, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isVisible, paint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setSize, setViewMan, setVisible, toString, update, validate, viewManChanged, vrp
 
Methods inherited from class org.zaval.util.ValidationObject
isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getLwParent, getViewMan, getVisiblePart, setEnabled, setLwParent, setViewMan, setVisible
 
Methods inherited from interface org.zaval.lw.Drawable
getBackground, getOrigin, isEnabled, isOpaque, paint, repaint, repaint, update
 
Methods inherited from interface org.zaval.util.Validationable
isValid, validate
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getPreferredSize, getSize, getWidth, getX, getY, isVisible, setLocation, setSize
 

Constructor Detail

LwScrollPan

public LwScrollPan(LwComponent c)
Constructs a scroll panel component with the specified child component to be scrolled. This constructor allows vertical and horizontal scroll bars.
Parameters:
c - the specified child component.

LwScrollPan

public LwScrollPan(LwComponent c,
                   int barMask)
Constructs a scroll panel component with the specified child component to be scrolled and the given scroll bar mask. The mask defines if the horizontal or vertical scroll bar or both scrollbars should be shown. Use following values for the mask:
Parameters:
c - the specified child component.
barMask - the specified scroll bar mask.
Method Detail

setIncrements

public void setIncrements(int hUnit,
                          int hPage,
                          int vUnit,
                          int vPage)
Set the horizontal & vertical unit & page increments.
Parameters:
hUnit - the horizontal scroll unit increment (-1 for no change)
hPage - the horizontal scroll page increment (-1 for no change)
vUnit - the vertical scroll unit increment (-1 for no change)
vPage - the vertical scroll page increment (-1 for no change)

posChanged

public void posChanged(PosEvent e)
Description copied from interface: PosListener
Invoked when a virtual position has been changed.
Specified by:
posChanged in interface PosListener
Following copied from interface: org.zaval.misc.event.PosListener
Parameters:
e - the specified pos event.

getSOLocation

public java.awt.Point getSOLocation()
Description copied from interface: ScrollObj
Gets the scroll object location.
Specified by:
getSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object location.

setSOLocation

public void setSOLocation(int x,
                          int y)
Description copied from interface: ScrollObj
Sets the specified scroll object location. The method defines a mechanism that will be used to scrool the object.
Specified by:
setSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
x - the specified x coordinate.
y - the specified y coordinate.

getSOSize

public java.awt.Dimension getSOSize()
Description copied from interface: ScrollObj
Gets the scroll object size. The size is a size that the scroll object wants to have.
Specified by:
getSOSize in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object size.

setScrollMan

public void setScrollMan(ScrollMan m)
Description copied from interface: ScrollObj
Sets the specified scroll manager for the scroll object. The manager reference should be used with the scroll object to notify when the scroll object has been moved or resized.
Specified by:
setScrollMan in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
m - the specified scroll manager.

scrollObjMoved

public void scrollObjMoved(int x,
                           int y)
Description copied from interface: ScrollMan
Invoked when a scroll object has been moved.
Specified by:
scrollObjMoved in interface ScrollMan
Following copied from interface: org.zaval.misc.ScrollMan
Parameters:
x - the x coordinate of a new scroll object location.
y - the y coordinate of a new scroll object location.

scrollObjResized

public void scrollObjResized(int w,
                             int h)
Description copied from interface: ScrollMan
Invoked when a scroll object has been resized.
Specified by:
scrollObjResized in interface ScrollMan
Following copied from interface: org.zaval.misc.ScrollMan
Parameters:
w - the new width of the scroll object.
h - the new height of the scroll object.

moveContent

public boolean moveContent()
Description copied from interface: ScrollObj
Tests if the scroll component performs scrolling by changing its location or moving view.
Specified by:
moveContent in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
true if the scroll component organizes scrolling by moving its view; otherwise false.

componentAdded

public void componentAdded(java.lang.Object id,
                           Layoutable comp,
                           int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component is added to the layout container (that uses the layout manager). The specified constraints, layoutable component and child index are passed as arguments into the method.
Specified by:
componentAdded in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
id - the layoutable component constraints.
lw - the layoutable component that has been added.
index - the child index.

componentRemoved

public void componentRemoved(Layoutable comp,
                             int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager.
Specified by:
componentRemoved in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
lw - the layoutable component that has been removed.
index - the child component index.

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer target)
Calculates the preferred size dimension of the layout container. The method calculates "pure" preferred size, it means that an insets of the container is not considered.
Specified by:
calcPreferredSize in interface LwLayout
Parameters:
target - the layout container.

makeVisible

public void makeVisible(int x,
                        int y)
Makes visible the specified location of the scrolled component.
Parameters:
x - the "x" coordinate of the scrolled component. Pass -1 to ignore.
y - the "y" coordinate of the scrolled component. Pass -1 to ignore.

layout

public void layout(LayoutContainer target)
Lays out the child layoutable components inside the layout container.
Specified by:
layout in interface LwLayout
Parameters:
target - the layout container that needs to be laid out.

getDefaultLayout

protected LwLayout getDefaultLayout()
Gets the default layout manager that is set with the container during initialization. This implementation of the method returns LwScrollLayout as the default layout manager.
Overrides:
getDefaultLayout in class LwPanel
Returns:
a layout manager.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org