: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw
Class LwScrollPan

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwPanel
              |
              +--org.zaval.lw.LwScrollPan
All Implemented Interfaces:
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 scrolled child components:

  • The child component doesn't implement the org.zaval.misc.ScrollObj interface. In this case the scroll panel will use a preferred size of the component to calculate if it is necessary to use horizontal or vertical scrolling. The child component will be scrolled by the setLocation method.
  • The child component implements the org.zaval.misc.ScrollObj interface. In this case the child component defines the size, and scrolling mechanism by the interface. For example, it is possible to scroll a content of the child component instead of the changing the component location.


Fields inherited from class org.zaval.lw.LwPanel
children
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
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 was added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable comp, int index)
          Invoked when the specified layoutable component was 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.
 LwScroll getScrollbar(int type)
          Gets the horizontal or vertical scroller component.
 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, int w, int h)
          Makes visible the specified area of the scrolled component.
 boolean moveContent()
          Tests if the scrolled component performs scrolling by changing its location or moving view.
 void moveScrolledObj(int x, int y)
          Moves the scrolled object inside the scroll area to the specified location.
 void posChanged(java.lang.Object target, int prevOffset, int prevLine, int prevCol)
          Invoked when a virtual position has been changed.
 void setIncrements(int hUnit, int hPage, int vUnit, int vPage)
          Sets the horizontal, vertical unit and 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, getPreferredSize, indexOf, insert, insert, invalidate, isInvalidatedByChild, laidout, paintOnTop, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getOrigin, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, paint, recalc, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, paint, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getSize, getWidth, getX, getY, isVisible, setLocation
 
Methods inherited from interface org.zaval.util.Validationable
isValid
 

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:
  • LwToolkit.HORIZONTAL - to enable horizontal scroll bar.
  • LwToolkit.VERTICAL - to enable vertical scroll bar.
  • LwToolkit.VERTICAL | LwToolkit.HORIZONTAL - to enable both vertical and horizontal scroll bars.
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)
Sets the horizontal, vertical unit and page increments.
Parameters:
hUnit - the horizontal unit increment (use -1 to not change the property)
hPage - the horizontal page increment (use -1 to not change the property)
vUnit - the vertical unit increment (use -1 to not change the property)
vPage - the vertical page increment (use -1 to not change the property)

posChanged

public void posChanged(java.lang.Object target,
                       int prevOffset,
                       int prevLine,
                       int prevCol)
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:
target - the specified pos controller.
prevOffset - the previous offset.
prevLine - the previous line.
prevColumn - the previous column.

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 stored and used by the scrolled object to move itself inside the scrolled area.
Specified by:
setScrollMan in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
m - the specified scroll manager.

moveScrolledObj

public void moveScrolledObj(int x,
                            int y)
Description copied from interface: ScrollMan
Moves the scrolled object inside the scroll area to the specified location.
Specified by:
moveScrolledObj in interface ScrollMan
Following copied from interface: org.zaval.misc.ScrollMan
Parameters:
x - the x coordinate of the specified location.
y - the y coordinate of the specified location.

moveContent

public boolean moveContent()
Description copied from interface: ScrollObj
Tests if the scrolled 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 was 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 was 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,
                        int w,
                        int h)
Makes visible the specified area of the scrolled component.
Specified by:
makeVisible in interface ScrollMan
Parameters:
x - the "x" coordinate of the scrolled component area.
y - the "y" coordinate of the scrolled component area.
w - the width of the scrolled component area.
h - the height of the scrolled component area.

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.

getScrollbar

public LwScroll getScrollbar(int type)
Gets the horizontal or vertical scroller component.
Parameters:
type - the specified scroller type. Use the LwToolkit.VERTICAL constant to get vertical scroller component or the LwToolkit.HORIZONTAL constant to get horizontal scroller component.
Returns:
a scroller component.

getDefaultLayout

protected LwLayout getDefaultLayout()
Gets the default layout manager that is set with the container during initialization. Pay attention that the panel implements own layout manager and returns it by the method. You should not try to set other layout, since it brings the component to fail.
Overrides:
getDefaultLayout in class LwPanel
Returns:
a layout manager.


: up