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

ScrollablePopupLayer

public class ScrollablePopupLayer extends PopupLayer implements ScrollListener
A "Popup" layer is a special kind of layer which can also have commands associated with it. When a popup layer is added to a MIDPWindow, its commands (if it has any) can be accessed through the soft button bar. If a popup layer does have commands associated with it, any commands on the current displayable/item are no longer accessible. If the popup layer does not have its own commands, any existing commands from the displayable/item remain. NOTE: For now, a PopupLayer is also always visible, that is isVisible() always returns true. To control the visibility of a PopupLayer, you add it and remove it from a MIDPWindow. IMPL_NOTE: determine if a relationship between PopupLayer and MIDPWindow can allow non visible popup layers.

Fields Summary
protected ScrollIndLayer
scrollInd
The scroll indicator layer to notify of scroll settings in case not all content can fit on the menu.
Constructors Summary
public ScrollablePopupLayer()
Construct a new PopupLayer. By default, setSupportsInput() is set to true.

        super((Image)null, -1);
    
public ScrollablePopupLayer(Image bgImage, int bgColor)
Construct a new PopupLayer, given a background image. By default, setSupportsInput() is set to true, and so is setVisible().

        super(bgImage, bgColor);
    
public ScrollablePopupLayer(Image[] bgImage, int bgColor)
Construct a new PopupLayer, given a 9 pc background image. By default, setSupportsInput() is set to true, and so is setVisible().

        super(bgImage, bgColor);
    
Methods Summary
public voidaddDirtyRegion()
Add this layer's entire area to be marked for repaint. Any pending dirty regions will be cleared and the entire layer will be painted on the next repaint. TODO: need to be removed as soon as removeLayer algorithm takes into account layers interaction

        super.addDirtyRegion();
        if (scrollInd != null) {
            scrollInd.addDirtyRegion();
        }
    
public voidscrollContent(int scrollType, int thumbPosition)
Scrolling the contents according to the scrolling parameters.

param
scrollType can be SCROLL_LINEUP, SCROLL_LINEDOWN, SCROLL_PAGEUP, SCROLL_PAGEDOWN or SCROLL_THUMBTRACK
param
thumbPosition only valid when scrollType is SCROLL_THUMBTRACK

    
public voidsetScrollInd(ScrollIndLayer newScrollInd)

        if (scrollInd != newScrollInd ||
            scrollInd != null && scrollInd.scrollable != this ||
            scrollInd != null &&  scrollInd.listener != this) {
            if (scrollInd != null) {
                scrollInd.setScrollable(null);
                scrollInd.setListener(null);
            }
            if (owner != null) {
                owner.removeLayer(scrollInd);
            }
            
            scrollInd = newScrollInd;
            if (scrollInd != null) {
                scrollInd.setScrollable(this);
                scrollInd.setListener(this);
            }
        }
        updateScrollIndicator();        
    
public voidupdate(CLayer[] layers)
Update bounds of layer

param
layers - current layer can be dependant on this parameter

        super.update(layers);
        if (scrollInd != null) {
            scrollInd.update(layers);
            if (scrollInd.isVisible()) {
                bounds[W] -= scrollInd.bounds[W];
            }
        }
    
public voidupdateScrollIndicator()
Updates the scroll indicator.

        if (scrollInd != null && owner != null)  {
            if (scrollInd.isVisible()) {
                owner.addLayer(scrollInd);
            } else {
                owner.removeLayer(scrollInd);
            }
        }