Constructors Summary |
---|
public BodyLayer(ChamDisplayTunnel tunnel)Create a new BodyLayer.
this((Image)null, -1, tunnel);
|
public BodyLayer(Image[] bgImage, int bgColor, ChamDisplayTunnel tunnel)Create a new BodyLayer with the given background image or color.
If the image is null, the color will be used.
super(bgImage, bgColor);
this.tunnel = tunnel;
this.visible = false;
setScrollInd(ScrollIndLayer.getInstance(ScrollIndSkin.MODE));
|
public BodyLayer(Image bgImage, int bgColor, ChamDisplayTunnel tunnel)Create a new BodyLayer with the given background image or color.
If the image is null, the color will be used.
super(bgImage, bgColor);
this.tunnel = tunnel;
this.visible = false;
setScrollInd(ScrollIndLayer.getInstance(ScrollIndSkin.MODE));
|
Methods Summary |
---|
public void | addDirtyRegion()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 void | addNotify()Called by CWindow to notify the layer that is has been
added to the active stack.
if (scrollInd != null && owner != null) {
if (owner.addLayer(scrollInd)) {
updateScrollIndicator();
}
}
|
protected void | paintBody(Graphics g)Paint the contents of this layer. This method is overridden from
the parent class to use the package tunnel to call back into the
javax.microedition.lcdui package and cause the current Displayable
to paint its contents into the body of this layer.
if (tunnel != null) {
tunnel.callPaint(g);
}
|
public void | removeNotify(CWindow owner)Called by CWindow to notify the layer that is has been
removed from the active stack.
if (scrollInd != null && owner != null) {
if (owner.removeLayer(scrollInd) && scrollInd.isVisible()) {
bounds[W] += scrollInd.bounds[W];
}
}
|
public void | scrollContent(int scrollType, int thumbPosition)Scrolling the contents according to the scrolling parameters.
tunnel.callScrollContent(scrollType, thumbPosition);
|
public void | setDirty()Mark this layer as being dirty. By default, this would also mark the
containing window (if there is one) as being dirty as well. However,
this parent class behavior is overridden in BodyLayer so as to not
mark the containing window and therefor not require a full
Chameleon repaint when only the application area needs updating.
setDirtyButNotNotifyOwner();
|
public void | setScrollInd(ScrollIndLayer newScrollInd)
if (scrollInd != newScrollInd ||
scrollInd != null && scrollInd.scrollable != this ||
scrollInd != null && scrollInd.listener != this) {
if (scrollInd != null) {
boolean vis = scrollInd.isVisible();
scrollInd.setScrollable(null);
scrollInd.setListener(null);
if (owner != null) {
if (owner.removeLayer(scrollInd) && vis) {
bounds[W] += scrollInd.bounds[W];
addDirtyRegion();
}
}
}
scrollInd = newScrollInd;
if (scrollInd != null) {
scrollInd.setScrollable(this);
scrollInd.setListener(this);
if (owner != null) {
owner.addLayer(scrollInd);
}
}
}
updateScrollIndicator();
|
public boolean | setVerticalScroll(int scrollPosition, int scrollProportion)Set the current vertical scroll position and proportion.
if (scrollInd != null) {
boolean wasVisible = scrollInd.isVisible();
scrollInd.setVerticalScroll(scrollPosition, scrollProportion);
boolean scrollVisible = scrollInd.isVisible();
if (wasVisible != scrollVisible) {
if (scrollVisible) {
scrollInd.setBounds();
}
int w = scrollInd.bounds[W];
bounds[W] += scrollVisible? -w: +w;
addDirtyRegion();
return true;
}
}
return false;
|
public void | setVisible(boolean visible)Toggle the visibility state of this layer within its containing
window.
boolean oldVis = this.visible;
super.setVisible(visible);
if (oldVis != visible) {
if (scrollInd != null && !visible) {
scrollInd.setVisible(visible);
} else {
updateScrollIndicator();
}
}
|
public void | update(CLayer[] layers)Update bounds of layer
super.update(layers);
bounds[W] = ScreenSkin.WIDTH;
bounds[H] = ScreenSkin.HEIGHT;
if (layers[MIDPWindow.PTI_LAYER] != null && layers[MIDPWindow.PTI_LAYER].isVisible()) {
bounds[H] -= layers[MIDPWindow.PTI_LAYER].bounds[H];
}
if (layers[MIDPWindow.TITLE_LAYER].isVisible()) {
bounds[Y] = layers[MIDPWindow.TITLE_LAYER].bounds[H];
bounds[H] -= layers[MIDPWindow.TITLE_LAYER].bounds[H];
} else {
bounds[Y] = 0;
}
if (layers[MIDPWindow.TICKER_LAYER].isVisible()) {
bounds[H] -= layers[MIDPWindow.TICKER_LAYER].bounds[H];
}
if (layers[MIDPWindow.BTN_LAYER].isVisible()) {
bounds[H] -= layers[MIDPWindow.BTN_LAYER].bounds[H];
}
if (scrollInd != null) {
scrollInd.update(layers);
if (scrollInd.isVisible()) {
bounds[W] -= scrollInd.bounds[W];
}
}
|
public void | updateScrollIndicator()Updates the scroll indicator.
tunnel.updateScrollIndicator();
|