|
Sleepbot.com Java Classes | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepbot.WRLDtime.time.WRLDtime
A generfied WRLD.time clockface generator.
This is the default time-piece class generated and used by both WRLDtimeApp
and WRLDtimeApplet
.
It implements WRLDtimePiece
, which provides an invokable event structure for any time-piece class.
The most important aspect of this time-piece is its configurability:
';'
).
NAME=KEY:VALUE, KEY:VALUE, ...
NAME
is the name of the configuration line and it is followed by an equal sign ('='
).
The line contains a series of key-value pairs; these are the individual settings, each separated by a comma (','
).
The setting's KEY
is separated from its VALUE
by a colon (':'
).
If you need to include a comma (or leading or trailing whitespace) within your setting, then enclose the entire KEY:VALUE
setting in full quotes ('"'
).
Field Summary | |
static java.lang.String |
CONFIG_ALIAS_LIST
The alias configuration listing ( 'alias.list' ) line. |
static java.lang.String |
CONFIG_BACKGROUND
The background ( 'bg' ) configuration line. |
static java.lang.String |
CONFIG_CRON
The 'cron' configuration line. |
static java.lang.String |
CONFIG_DIGIT_DELIMITER
Index-number delimiter for a digit configuration line; it's a '.' . |
static java.lang.String |
CONFIG_DIGIT_LIST
The digit configuration listing ( 'd.list' ) line. |
static java.lang.String |
CONFIG_DIGIT_PREFIX
Prefix for a digit configuration line. |
static java.lang.String |
CONFIG_DRAWORDER
The draw order ( 'draworder' ) configuration line. |
static java.lang.String |
CONFIG_FOREGROUND
The foreground ( 'fg' ) configuration line. |
static java.lang.String |
CONFIG_MARKER_ASSIGNMENT
|
static java.lang.String |
CONFIG_MARKER_COMMENT
|
static java.lang.String |
CONFIG_SEPARATOR_LIST
The separator configuration listing ( 'sep.list' ) line. |
static java.lang.String |
CONFIG_SEPARATOR_PREFIX
Prefix for a separator configuration line. |
static java.lang.String |
CONFIG_SETTING_ASSIGNMENT
|
static java.lang.String |
CONFIG_SETTING_DELIMITER
|
static java.lang.String |
CONFIG_TABLET_DELIMITER
Index-number-range delimiter for a tablet configuration line; it's a '.' . |
static java.lang.String |
CONFIG_TABLET_LIST
The tablet configuration listing ( 't.list' ) line. |
static java.lang.String |
CONFIG_TABLET_PREFIX
Prefix for a tablet configuration line. |
static java.lang.String |
CONFIG_WINDOW
The 'window' configuration line. |
static java.lang.String |
PARAM_CONFIGFILE
The configuration file parameter. |
static java.lang.String |
SETTING_COLOR_HEX
The 'color' dimension setting. |
static java.lang.String |
SETTING_CRON_DIVISOR
The 'divisor' WRLDcron setting. |
static java.lang.String |
SETTING_CRON_FACTOR
The 'factor' WRLDcron setting. |
static java.lang.String |
SETTING_CRON_FROMGMT
The minutes-from-GMT ( 'fromgmt' ) WRLDcron setting. |
static java.lang.String |
SETTING_CRON_UTC_CGI
The UTC CGI URL ( 'utccgi' ) WRLDcron setting. |
static java.lang.String |
SETTING_CRON_UTC_HOST
The UTC host ( 'utchost' ) WRLDcron setting. |
static java.lang.String |
SETTING_CRON_UTC_PORT
The UTC port ( 'utcport' ) WRLDcron setting. |
static java.lang.String |
SETTING_RECTANGLE_HEIGHT
The 'height' dimension setting. |
static java.lang.String |
SETTING_RECTANGLE_WIDTH
The 'width' dimension setting. |
static java.lang.String |
SETTING_RECTANGLE_X
The 'x' position setting. |
static java.lang.String |
SETTING_RECTANGLE_Y
The 'y' position setting. |
static java.lang.String |
SETTING_TEXT_FACE
The 'face' font setting. |
static java.lang.String |
SETTING_TEXT_SIZE
The 'size' font setting. |
static java.lang.String |
SETTING_TEXT_STYLE_BOLD
The 'bold' font setting. |
static java.lang.String |
SETTING_TEXT_STYLE_ITALIC
The 'italic' font setting. |
static java.lang.String |
SETTING_TEXT_STYLE_PLAIN
The 'plain' font setting. |
static java.lang.String |
SETTING_TYPE_ALIAS
The 'alias' entity type setting. |
static java.lang.String |
SETTING_TYPE_HIDE
The 'hide' entity type setting. |
static java.lang.String |
SETTING_TYPE_IMAGE
The 'image' entity type setting. |
static java.lang.String |
SETTING_TYPE_TEXT
The 'text' entity type setting. |
Constructor Summary | |
WRLDtime()
|
Method Summary | |
void |
destroy()
This routine is called by the owner just before it destroys itself. |
void |
init(WRLDcron cron,
java.applet.Applet app)
This routine is called during initialization by an owning applet (eg. WRLDtimeApplet ). |
void |
init(WRLDcron cron,
java.awt.Frame fme,
java.lang.String[] args)
This routine is called during initialization by an owning application (eg. WRLDtimeApp ) which has constructed a Frame. |
void |
init(WRLDcron cron,
java.lang.String[] args)
This routine is called during initialization by a simple owning application. |
boolean |
isLoaded()
This routine is called when the owner needs to know if all resources (images, configuration files, etc) have been loaded. |
boolean |
isPaintable()
This routine is called when the owner needs to know if this class is ready to paint itself or not. |
void |
paint(java.awt.Graphics gfx,
java.awt.Dimension dim)
This routine is called when the owner wants you to paint yourself. |
void |
start(WRLDcron cron)
This routine is called by the owner just before its thread starts up. |
void |
stop(WRLDcron cron)
This routine is called by the owner just before its thread stops. |
void |
tick(WRLDcron cron)
This routine is called when the owner's chronometer has been incremented. |
void |
waiting(WRLDcron cron)
This routine is called within the owner's inner time-keeping loop. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PARAM_CONFIGFILE
public static final java.lang.String CONFIG_MARKER_COMMENT
public static final java.lang.String CONFIG_MARKER_ASSIGNMENT
public static final java.lang.String CONFIG_SETTING_DELIMITER
public static final java.lang.String CONFIG_SETTING_ASSIGNMENT
public static final java.lang.String CONFIG_CRON
'cron'
configuration line.
WRLDcron
chronometer.
See SETTING_CRON_FACTOR
, SETTING_CRON_DIVISOR
and SETTING_CRON_FROMGMT
for more information.
SETTING_CRON_UTC_HOST
, SETTING_CRON_UTC_PORT
and SETTING_CRON_UTC_CGI
for more information.
public static final java.lang.String CONFIG_BACKGROUND
'bg'
) configuration line.
SETTING_COLOR_HEX
.
If not specified, it defaults to lightGrey
.
SETTING_TYPE_IMAGE
.
If specified, it's rendered on top of the background color.
public static final java.lang.String CONFIG_FOREGROUND
'fg'
) configuration line.
SETTING_COLOR_HEX
.
If specified, it overrides the default setting of black
.
SETTING_TEXT_FACE
, SETTING_TEXT_SIZE
, SETTING_TEXT_STYLE_PLAIN
, SETTING_TEXT_STYLE_BOLD
and SETTING_TEXT_STYLE_ITALIC
.
Where not specified -- face, size and style are handled separately -- it overrides the default setting of 16-point Courier Bold
.
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the default of (0, 0).
Now... this may sound strange, but if you don't supply either coordinate, it actually defaults to (5, -2) so that the generic clock will look right.
public static final java.lang.String CONFIG_WINDOW
'window'
configuration line.
SETTING_RECTANGLE_X
, SETTING_RECTANGLE_Y
, SETTING_RECTANGLE_WIDTH
and SETTING_RECTANGLE_HEIGHT
.
public static final java.lang.String CONFIG_DRAWORDER
'draworder'
) configuration line.
d#
, where '#' is the index of a digit.sep
, or sep#
, where '#' is the index of a separator.CONFIG_DIGIT_PREFIX
and CONFIG_SEPARATOR_PREFIX
configuration lines for more details.
public static final java.lang.String CONFIG_DIGIT_PREFIX
'd'
+ digit index
'd'
+ digit index + '.'
+ a number from 0 to 9
d3
) = 1 and the lowest digit (d0
) = 4.
A digit group setting allows you to generally over-ride the global settings for all digits in the group.
SETTING_COLOR_HEX
.
If specified, it overrides the previous color in the heirarchy (most likely the global color).
SETTING_TEXT_FACE
, SETTING_TEXT_SIZE
, SETTING_TEXT_STYLE_PLAIN
, SETTING_TEXT_STYLE_BOLD
and SETTING_TEXT_STYLE_ITALIC
.
Where not specified -- face, size and style are handled separately -- it overrides the previous setting in the heirarchy (most likely the global text).
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the previous position in the heirarchy (most likely the global position).
Be aware that the text font's inner spacing (etc.) will have a significant effect on string positioning.
d3.9
, d2.8
, d1.7
and d0.6
are displayed.
Any digit setting which is not explicitly specified will not be displayed (eg. it's assumed to be hidden).
SETTING_TYPE_HIDE
, SETTING_TYPE_TEXT
, SETTING_TYPE_IMAGE
or SETTING_TYPE_ALIAS
.
public static final java.lang.String CONFIG_DIGIT_DELIMITER
'.'
.
public static final java.lang.String CONFIG_DIGIT_LIST
'd.list'
) line.
CONFIG_DIGIT_PREFIX
line names.
Fortunately, you only need this line when you're configuring via <APPLET /> parameters.
Applet
, there's no way to get all of your <APPLET /> parameters.
You have to explicitly ask for them by name.
So, this line tells the time-piece about all the digit lines to be parsed.
Remember to keep your list up-to-date... if it doesn't contain a new (or modified) digit line name, the applet won't parse it!
public static final java.lang.String CONFIG_TABLET_PREFIX
't'
+ digit index
't'
+ digit index + '.'
+ tablet number
't'
+ digit index + '.'
+ range start + '.'
+ range end
CONFIG_DIGIT_PREFIX
.
SETTING_COLOR_HEX
.
If specified, it overrides the previous color in the heirarchy (most likely the global color).
SETTING_TEXT_FACE
, SETTING_TEXT_SIZE
, SETTING_TEXT_STYLE_PLAIN
, SETTING_TEXT_STYLE_BOLD
and SETTING_TEXT_STYLE_ITALIC
.
Where not specified -- face, size and style are handled separately -- it overrides the previous setting in the heirarchy (most likely the global text).
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the previous position in the heirarchy (most likely the global position).
Be aware that the text font's inner spacing (etc.) will have a significant effect on string positioning.
CONFIG_DIGIT_PREFIX
.
SETTING_TYPE_HIDE
, SETTING_TYPE_TEXT
, SETTING_TYPE_IMAGE
or SETTING_TYPE_ALIAS
.
public static final java.lang.String CONFIG_TABLET_DELIMITER
'.'
.
public static final java.lang.String CONFIG_TABLET_LIST
't.list'
) line.
CONFIG_TABLET_PREFIX
line names.
Fortunately, you only need this line when you're configuring via <APPLET /> parameters.
Applet
, there's no way to get all of your <APPLET /> parameters.
You have to explicitly ask for them by name.
So, this line tells the time-piece about all the tablet lines to be parsed.
Remember to keep your list up-to-date... if it doesn't contain a new (or modified) tablet line name, the applet won't parse it!
public static final java.lang.String CONFIG_SEPARATOR_PREFIX
'sep'
(an old-style format, which is interpreted as 'sep0')
'sep'
+ separator index
'sep'
and 'sep0'
settings are identical, and either one is recognized.
If you want more than one separator, then create settings named 'sep1'
, 'sep2'
, etc. until you've done.
The indexes must be in sequence; if you have a 'sep2' without a 'sep1', you'll never see it.
SETTING_TYPE_HIDE
, SETTING_TYPE_TEXT
, SETTING_TYPE_IMAGE
or SETTING_TYPE_ALIAS
.
public static final java.lang.String CONFIG_SEPARATOR_LIST
'sep.list'
) line.
CONFIG_SEPARATOR_PREFIX
line names.
Fortunately, you only need this line when you're configuring via <APPLET /> parameters.
Applet
, there's no way to get all of your <APPLET /> parameters.
You have to explicitly ask for them by name.
So, this line tells the time-piece about all the separator lines to be parsed.
Remember to keep your list up-to-date... if it doesn't contain a new (or modified) separator line name, the applet won't parse it!
public static final java.lang.String CONFIG_ALIAS_LIST
'alias.list'
) line.
SETTING_TYPE_ALIAS
settings (which define your alias line names).
Fortunately, you only need this line when you're configuring via <APPLET /> parameters.
Applet
, there's no way to get all of your <APPLET /> parameters.
You have to explicitly ask for them by name.
So, this line tells the time-piece about all the alias lines to be parsed.
Remember to keep your list up-to-date... if it doesn't contain a new (or re-named) alias setting, the applet won't parse it!
public static final java.lang.String SETTING_TYPE_HIDE
'hide'
entity type setting.
public static final java.lang.String SETTING_TYPE_TEXT
'text'
entity type setting.
and
value) in full-quotes.
SETTING_COLOR_HEX
.
If specified, it overrides the previous color in the heirarchy.
SETTING_TEXT_FACE
, SETTING_TEXT_SIZE
, SETTING_TEXT_STYLE_PLAIN
, SETTING_TEXT_STYLE_BOLD
and SETTING_TEXT_STYLE_ITALIC
.
Where not specified -- face, size and style are handled separately -- it overrides the previous setting in the heirarchy.
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the previous position in the heirarchy (most likely the global position).
Be aware that the text font's inner spacing (etc.) will have a significant effect on string positioning.
public static final java.lang.String SETTING_TYPE_IMAGE
'image'
entity type setting.
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the previous position in the heirarchy.
public static final java.lang.String SETTING_TYPE_ALIAS
'alias'
entity type setting.
one
or my_logo
.
You can even reference another 'reserved' entity, such as d3.1
or sep2
.
Your entities can freely share your aliases (assuming that you make them generic enough for sizing and positioning).
Of course, aliases are not required... but they make the file a little more legible and provide for re-usability.
SETTING_COLOR_HEX
.
If specified, it overrides the previous color in the heirarchy.
SETTING_TEXT_FACE
, SETTING_TEXT_SIZE
, SETTING_TEXT_STYLE_PLAIN
, SETTING_TEXT_STYLE_BOLD
and SETTING_TEXT_STYLE_ITALIC
.
Where not specified -- face, size and style are handled separately -- it overrides the previous setting in the heirarchy.
SETTING_RECTANGLE_X
and SETTING_RECTANGLE_Y
.
Where specified -- the coordinates are handled separately -- it overrides the previous position in the heirarchy.
Be aware that the text font's inner spacing (etc.) will have a significant effect on string positioning.
SETTING_TYPE_HIDE
, SETTING_TYPE_TEXT
or SETTING_TYPE_IMAGE
Yes, its entity type cannot be another alias -- they don't cascade.
public static final java.lang.String SETTING_RECTANGLE_X
'x'
position setting.
'x:+10'
sets the horizontal position to 10 pixels to the right of the point it is overriding.
public static final java.lang.String SETTING_RECTANGLE_Y
'y'
position setting.
'y:-5'
sets the vertical position to 5 pixels above the point it is overriding.
public static final java.lang.String SETTING_RECTANGLE_WIDTH
'width'
dimension setting.
public static final java.lang.String SETTING_RECTANGLE_HEIGHT
'height'
dimension setting.
public static final java.lang.String SETTING_COLOR_HEX
'color'
dimension setting.
'000000'
is black, 'FF0000'
is bright red and '000080'
is dark green.
public static final java.lang.String SETTING_TEXT_FACE
'face'
font setting.
'Courier'
and 'Times'
are the standard fixed and proportional fonts (respectively) for Java.
public static final java.lang.String SETTING_TEXT_SIZE
'size'
font setting.
'size:8'
sets the font size to 8, whereas 'size:+8'
sets the font size to 8 points larger than the font it is overriding.
public static final java.lang.String SETTING_TEXT_STYLE_PLAIN
'plain'
font setting.
public static final java.lang.String SETTING_TEXT_STYLE_BOLD
'bold'
font setting.
public static final java.lang.String SETTING_TEXT_STYLE_ITALIC
'italic'
font setting.
public static final java.lang.String SETTING_CRON_FACTOR
'factor'
WRLDcron setting.
WRLDcron.getFactor()
.
public static final java.lang.String SETTING_CRON_DIVISOR
'divisor'
WRLDcron setting.
WRLDcron.getDivisor()
.
public static final java.lang.String SETTING_CRON_FROMGMT
'fromgmt'
) WRLDcron setting.
WRLDcron.getFromGMT()
.
public static final java.lang.String SETTING_CRON_UTC_HOST
'utchost'
) WRLDcron setting.
WRLDcron.setAdjustByUTC(String, int)
.
public static final java.lang.String SETTING_CRON_UTC_PORT
'utcport'
) WRLDcron setting.
WRLDcron.setAdjustByUTC(String, int)
.
public static final java.lang.String SETTING_CRON_UTC_CGI
'utccgi'
) WRLDcron setting.
WRLDcron.setAdjustByUTC(URL)
.
SETTING_CRON_UTC_HOST
and SETTING_CRON_UTC_PORT
don't work in an applet context.
That's due to security hobbling in Java... the applet isn't allowed to go off to another site and make a request.
However, you can use this setting to reference a local CGI script which will proxy the response from a UTC server.
If the configuration contains both a SETTING_CRON_UTC_CGI
and a SETTING_CRON_UTC_HOST
setting, the script is referenced first, and if it fails, the host is referenced.
Constructor Detail |
public WRLDtime()
Method Detail |
public void init(WRLDcron cron, java.applet.Applet app)
WRLDtimeApplet
).
Applet
for later referenceMediaTracker
, for asynchronous resource loadingPARAM_CONFIGFILE
), if specified
init
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.app
- the owning Applet
itselfWRLDtimePiece.init(WRLDcron, Applet)
public void init(WRLDcron cron, java.awt.Frame fme, java.lang.String[] args)
WRLDtimeApp
) which has constructed a Frame.
init(WRLDcron, String[])
Frame
for later referenceMediaTracker
, for asynchronous resource loadingCONFIG_WINDOW
), if specified
init
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.fme
- the Frame
into which the time-piece will be renderedargs
- the raw command line arguments from the application, in case you want themWRLDtimePiece.init(WRLDcron, Frame, String[])
public void init(WRLDcron cron, java.lang.String[] args)
init
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.args
- the raw command line arguments from the application, in case you want themWRLDtimePiece.init(WRLDcron, String[])
public void destroy()
destroy
in interface WRLDtimePiece
WRLDtimePiece.destroy()
public void start(WRLDcron cron)
start
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.WRLDtimePiece.start(WRLDcron)
public void stop(WRLDcron cron)
stop
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.WRLDtimePiece.stop(WRLDcron)
public void waiting(WRLDcron cron)
MediaTracker
, for asynchronous resource loading
waiting
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.WRLDtimePiece.waiting(WRLDcron)
public void tick(WRLDcron cron)
tick
in interface WRLDtimePiece
cron
- a WRLDcron
object which is maintained by the owner.WRLDtimePiece.tick(WRLDcron)
public void paint(java.awt.Graphics gfx, java.awt.Dimension dim)
CONFIG_BACKGROUND
CONFIG_DRAWORDER
.
However, all tablets are rendered first (in specified draw-order by digit), followed by the digits and separators in the specified draw-order.
Defaults are specified by CONFIG_FOREGROUND
and are overridden heirarchically, where specified.
tick(WRLDcron)
.
paint
in interface WRLDtimePiece
gfx
- a Graphics
object for drawingdim
- the Dimension
of the display areaWRLDtimePiece.paint(Graphics, Dimension)
public boolean isPaintable()
true
once configuration has been applied.
Initial configuration is applied via the start(WRLDcron)
method.
isPaintable
in interface WRLDtimePiece
true
if this class is ready to handle paint requests, false
otherwiseWRLDtimePiece.isPaintable()
public boolean isLoaded()
true
once all resources have been loaded.
That's largely dependent upon the asynchronous MediaTracker
as leveraged by the waiting(WRLDcron)
method.
isLoaded
in interface WRLDtimePiece
true
if this class has loaded all of its resources, false
otherwiseWRLDtimePiece.isLoaded()
|
Sleepbot.com Java Classes | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |