Methods Summary |
---|
public java.lang.String | getText()
return text;
|
protected void | initialize()
super.initialize();
setAnchor();
tickerTimer = new Timer();
|
protected void | paintBody(Graphics g)
synchronized (this) {
if (text == null) {
return;
}
g.setFont(TickerSkin.FONT);
if (TickerSkin.COLOR_FG_SHD != TickerSkin.COLOR_FG) {
int x = textLoc;
int y = TickerSkin.TEXT_ANCHOR_Y;
switch (TickerSkin.TEXT_SHD_ALIGN) {
case(Graphics.TOP | Graphics.LEFT):
x -= 1;
y -= 1;
break;
case(Graphics.TOP | Graphics.RIGHT):
x += 1;
y -= 1;
break;
case(Graphics.BOTTOM | Graphics.LEFT):
x -= 1;
y += 1;
break;
case(Graphics.BOTTOM | Graphics.RIGHT):
default:
x += 1;
y += 1;
break;
}
g.setColor(TickerSkin.COLOR_FG_SHD);
g.drawString(text, x, y, Graphics.TOP | TickerSkin.DIRECTION);
}
g.setColor(TickerSkin.COLOR_FG);
g.drawString(text, textLoc, TickerSkin.TEXT_ANCHOR_Y,
Graphics.TOP | TickerSkin.DIRECTION);
if (tickerPainter == null) {
startTicker();
}
}
|
public void | setAnchor()
bounds[X] = 0;
bounds[W] = ScreenSkin.WIDTH;
bounds[H] = TickerSkin.HEIGHT;
switch (TickerSkin.ALIGN) {
case(Graphics.TOP):
bounds[Y] = 0;
break;
case(Graphics.BOTTOM):
default:
bounds[Y] = ScreenSkin.HEIGHT - SoftButtonSkin.HEIGHT -
bounds[H];
}
|
public boolean | setText(java.lang.String text)Set the ticker of this ticker layer.
boolean oldVisable = super.visible;
synchronized (this) {
this.text = text;
super.visible = (text != null && text.trim().length() > 0);
textLoc = bounds[X] + bounds[W];
textLen = (text == null) ? 0 : TickerSkin.FONT.stringWidth(text);
setDirty();
}
return (oldVisable != super.visible);
|
public void | startTicker()
if (!visible) {
return;
}
stopTicker();
tickerPainter = new TickerPainter();
tickerTimer.schedule(tickerPainter, 0, TickerSkin.RATE);
|
public void | stopTicker()Stop the ticking of the ticker.
if (tickerPainter == null) {
return;
}
tickerPainter.cancel();
tickerPainter = null;
|
public void | toggleAlert(boolean alertUp)
if (alertUp && TickerSkin.IMAGE_AU_BG != null) {
super.setBackground(TickerSkin.IMAGE_AU_BG, 0);
} else if (!alertUp) {
super.setBackground(TickerSkin.IMAGE_BG, TickerSkin.COLOR_BG);
}
|
public void | update(CLayer[] layers)Update bounds of layer
super.update(layers);
setAnchor();
|