FileDocCategorySizeDatePackage
ScrollIndLayer.javaAPI DocphoneME MR2 API (J2ME)5125Wed May 02 18:00:20 BST 2007com.sun.midp.chameleon.layers

ScrollIndLayer

public abstract class ScrollIndLayer extends CLayer
A ScrollIndLayer is a region of the display used for showing scroll indicator status either as arrows or bar.

Fields Summary
public static final int
SCROLL_NONE
Scrollbar operation types
public static final int
SCROLL_LINEUP
public static final int
SCROLL_LINEDOWN
public static final int
SCROLL_PAGEUP
public static final int
SCROLL_PAGEDOWN
public static final int
SCROLL_THUMBTRACK
private static ScrollIndLayer
scrollIndArrows
scrollIndArrow layer is just one for all scrollable layers. It is chached and shared between all layers
protected CLayer
scrollable
Scrollable layer
protected boolean
alertMode
True if special alert indicator bar should be drawn instead of the regular one
protected ScrollListener
listener
Scrolling listener. This layer is notified if the scroll indicator is changed
Constructors Summary
protected ScrollIndLayer(CLayer layer)
Common constructor.

param
layer the scrollable controlling the scrolling layer


                           
         
                                   
                
       

                    
       
        super();
        setOpaque(false);
        setSupportsInput(true);
        scrollable = layer;
        alertMode = scrollable instanceof AlertLayer;
    
public ScrollIndLayer(CLayer layer, ScrollListener listener)
Additional constructor.

param
layer the scrollable controlling the scrolling layer
param
listener the scrolling listener

        this(layer);
        this.listener = listener;
    
Methods Summary
public static com.sun.midp.chameleon.layers.ScrollIndLayergetInstance(int type)

        ScrollIndLayer s = null;
        switch (type) {
        case ScrollIndResourcesConstants.MODE_ARROWS:
            if (scrollIndArrows == null) {
                scrollIndArrows = new ScrollArrowLayer(null, null);
            }
            s = scrollIndArrows;
            break;
        case ScrollIndResourcesConstants.MODE_BAR:
            s = new ScrollBarLayer(null, null);
            break;
        default:
            break;
        }
        return s;
    
protected voidinitialize()
Called by MIDPWindow to initialize this layer

        super.initialize();
        setBounds();
    
public abstract voidsetBounds()
Calculate layer bounds depending on the scrollable

public booleansetListener(ScrollListener newListener)
Set new listener

param
newListener new scrolling listener
return
true if the listener is changed, false - otherwise

        boolean ret = listener != newListener;
        if (ret) {
            listener = newListener;
            if (listener != null) {
                listener.updateScrollIndicator();
            }
        }
        return ret;
    
public booleansetScrollable(CLayer layer)
Set new scrollable

param
layer new scrollable controlling the scrolling layer
return
true if the scrollable is changed, false - otherwise

        boolean ret = scrollable != layer;
        if (ret) {
            setVisible(false);
            scrollable = layer;
            alertMode = scrollable instanceof AlertLayer;
        }
        return ret;
    
public abstract voidsetVerticalScroll(int scrollPosition, int scrollProportion)
Set the current vertical scroll position and proportion.

param
scrollPosition vertical scroll position.
param
scrollProportion vertical scroll proportion.

public voidupdate(CLayer[] layers)
Update bounds of layer

param
layers - current layer can be dependant on this parameter

        super.update(layers);
        setBounds();