|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwaba.ui.Control
waba.ui.Container
net.thestump.ghronos.ui.clock.Clock
Base class for all clocks. Provides configurable hours, minutes, and seconds. Once started, a clock ticks every second. The clock can be paused and unpaused. This class does not provide a usable Clock! The tick method does the very minimum. Decendants of this class are useful.
Field Summary | |
protected NoTapBigNumber[] |
digits
|
protected static byte |
HR1
|
protected static byte |
HR2
|
static byte |
ID
unique ID for this clock |
protected Colon |
leftColon
|
protected Mediator |
mediator
|
protected static byte |
MIN1
|
protected static byte |
MIN2
|
protected char |
myName
|
protected boolean |
paused
|
protected Colon |
rightColon
|
protected static byte |
SEC1
|
protected static byte |
SEC2
|
Fields inherited from class waba.ui.Container |
BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, tail |
Fields inherited from class waba.ui.Control |
AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2 |
Constructor Summary | |
Clock()
|
Method Summary | |
waba.ui.Timer |
addTimer(int millis)
|
boolean |
equals(byte[] time)
Useful for comparing the time of a Clock |
byte |
getID()
|
superwaba.ext.xplat.io.Storable |
getInstance()
|
char |
getName()
Gets this clock's name |
byte[] |
getTime()
Returns an array of the current time. |
boolean |
isOutOfTime()
Tells if this clock is out of time |
void |
loadState(superwaba.ext.xplat.io.DataStream ds)
|
void |
onEvent(waba.ui.Event event)
|
void |
onStart()
|
void |
pause(boolean pause)
Un/pauses the clock |
void |
saveState(superwaba.ext.xplat.io.DataStream ds)
|
void |
setAdjust(boolean adjust)
Enables/disables the clock's ability to accept new time settings |
void |
setName(char name)
Sets this clock's name |
void |
setTime(byte[] time)
Sets the clock to the time given in the array. |
void |
start()
Starts the clock, but not if its currently paused or already started |
void |
stop()
Stops the clock, but not if its currently paused |
protected void |
tick()
Ticks the clock. |
Methods inherited from class waba.ui.Container |
add, add, add, broadcastEvent, findChild, getChildren, getClientRect, getClientRect, onAdd, onColorsChanged, onPaint, onRemove, paintChildren, remove, setBorderStyle, setEnabled |
Methods inherited from class waba.ui.Control |
contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getPreferredHeight, getPreferredWidth, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onFontChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte ID
protected static final byte HR1
protected static final byte HR2
protected static final byte MIN1
protected static final byte MIN2
protected static final byte SEC1
protected static final byte SEC2
protected char myName
protected boolean paused
protected Mediator mediator
protected NoTapBigNumber[] digits
protected Colon leftColon
protected Colon rightColon
Constructor Detail |
public Clock()
Method Detail |
public void onStart()
public void pause(boolean pause)
pause
- true if this clock should be paused, false if
it should be unpausedpublic char getName()
public void setName(char name)
name
- 't' for top clock, 'b' for bottom clock.
Anything else makes the name insignificant.public waba.ui.Timer addTimer(int millis)
public void onEvent(waba.ui.Event event)
public void setAdjust(boolean adjust)
adjust
- True if we want the clock's digits to be settable, false otherwisepublic void stop()
public void start()
public byte[] getTime()
public boolean isOutOfTime()
public void setTime(byte[] time)
BadArgumentException
- If time
is not of length 6public boolean equals(byte[] time)
time
- An array of length 6. Index[0] is the first
hour digit, index[2] is the first minute digit, etc.
time
is the same
exact time as this clock, false otherwise.
BadArgumentException
- If i time
is not length 6public byte getID()
getID
in interface superwaba.ext.xplat.io.Storable
public superwaba.ext.xplat.io.Storable getInstance()
getInstance
in interface superwaba.ext.xplat.io.Storable
public void saveState(superwaba.ext.xplat.io.DataStream ds)
saveState
in interface superwaba.ext.xplat.io.Storable
public void loadState(superwaba.ext.xplat.io.DataStream ds)
loadState
in interface superwaba.ext.xplat.io.Storable
protected void tick()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |