All the news messages and layout indications are gathered in one file. The format of the file looks like XML (will be changed completly to XML in the future).
Every text between the instructions <news> and </news> is showed. Multiple spaces between words and newlines are removed. Every instruction is valid between <tag> and </tag>. <tag/> makes a instruction valid until the next instruction with the same name and nothing is closed. This is especially usefull for <position>. <position/> can also been used outside of a <news>-block . This indicates the startposition of the next <news>-block.
To increase typespeed, it satisfacts to use only the first character of an instruction or parameter (example <f n="Arial">).
Except for <ticker> every instruction can be used several times and Except for <news> and <ticker> every instruction can be used nested.
Instructions for the news message:
|<font name="Arial" size=12 color=#000000>||Changes font|
|<position x=100 y=200>||Position of the next text|
|<effect class="test">||Effect with several parameters|
|<canvas image="background.gif" color=#000000>||Background image or color|
|<link target="http://xyz">||Link for the news message|
The whole file can be optional preceded with the instruction <ticker> and be ended with </ticker>. The parameter play="ordered" or play="random" can be used to indicate the order of the news messages. The <ticker> instruction can be used only one time in the file.
A message can be defined with the instruction <news>. When this instruction is readed, all the current settings are remembered and at the end of this lt;news>-block recovered. This can make for example a <position>-instruction apply on multiple <news>-blocks. When <news/> is used, then this block is valid till the next <news/>, <news>, </ticker> or the end of the file.Other instructions:
<!-- Comment -->
|\ (Backslash followed by a space)||explicit space|
Multiple variables are used in the internal part of the Ticker:
|effectParameter||Hashtable (parameter: String -> value: [Integer | String])|
These can be changed with optional instructions. With <tag/> the old state isn't remembered and after </tag> is the optional state (before </news>) of <tag> restored.
While parsing the file, a list is made with the news-objects, being played depending on the play-parameter. In the pause between the messages, new news is initialized, for example images are loaded.
To keep the applet small, no Lex/Yacc is used for the parsing, but a more direct approach. The two state machine executes an action for every readed instruction, for example <news> saves a potential previous news-object and creates a new news-object.
All instructions and two effects are included in the first beta version. The first, ShowEffect, shows the text directly and the second, WordEffect, shows the text a word at a time, the Canvas-Color fading to the Text-Color.
The current classdiagram:
NewsFile ::= <ticker [Parameters] > [CmdList] </ticker> | <ticker [Parameters] /> [CmdList] | [CmdList] CmdList ::= < [Cmd] [Parameters] > [CmdList] </ [Cmd] [Parameters] > | < [Cmd] [Parameters] /> [CmdList] | <!-- [CommentText] --> | empty Cmd ::= news | n | font | f | bold | b | italic | i | position | p | effect | e | canvas | c | link Parameters ::= [Parameters] [Parameter] | empty Parameter ::= [Identifier] = [Value] Identifier ::= following regular expression: [a-zA-Z_]*[a-zA-Z0-9]* Value ::= String | Int | Hex String ::= text between quotes , \" is " Int ::= following regular expression: [0-9]* Hex ::= following regular expression: #[0-9a-fA-F]* CommentText ::= any String, not containing the character '>'