jjCode
Extending jjCode
Extending jjCode is very easy. For each different new command that you wish to add, you must create a thread-safe class extending from org.jjcode.RenderCommand.
In most cases, you need to override only four abstract methods:
- boolean recognized(String token) - which tells the rendering engine whether the token you are being provided is the one that your class is capable of processing.
- boolean preProcessingAllowed() - which informs the rendering engine whether your command can be pre-processed (i.e. if the rendering result of your command sequence is always the same, regardless of when it is rendered and the user viewing it)
- StringBuffer render(Node tree,int mode,HashMap info) - which renders the command squence
- StringBuffer renderControl(String fieldName, String helpFieldName, HashMap info) - which renders an HTML control (usually a button) that can be included in an HTML editor for a text field. Activating this control inserts your sequence in the editing field.