Using the Generic Panel
Sometimes a generator may not have any parameters that need to be set. In other ocassions the user-developed generator may only have a trivial parameter that needs to be set. Under such circumstances, it should not be necessary to develop a new panel for each generator. Even more, since all the parameters that are passed to each randomiser instance are stored in a hash set, (attribute-value pairs), a simple generic panel can be used to actually store these values for any generator!
All the developer needs to know are the names of the parameters and what kind of values go with them. Notice there is no validation taking place when you provide the attributes and their values; this being a generic panel does not know how to validate each value. Additionally, there is an extra value to set and that is the name of the actual randomiser.
The next few lines show how to convert an existing generator that already has a panel, so as to use the GenericPanel:
In file SystemDefinitions.xml:
<randomiser-type name="EnglishTextRandomiser" jtype="0" panel="generator.panels.PanelEnglishTextRandomiser" generator="generator.randomisers.EnglishTextRandomiser"/>
<randomiser-type name="EnglishTextRandomiserGeneric" jtype="0" panel="generator.panels.PanelGenericRandomiser" generator="generator.randomisers.EnglishTextRandomiser"/>
The panel PanelEnglishTextRandomiser (Figure 1) is now replaced by PanelGenericRandomiser (Figure 2):
Basically, both panels will record the same information in file Repository.xml:
<randomiser-instance name="EnglishText2" randomiser-type="EnglishTextRandomiserGeneric">
<property name="minWidth" value="4"/>
<property name="maxWidth" value="20"/>
<property name="punctuation" value="false"/>
<property name="nullField" value="0"/>
A generator that was recently added in dgMaster is a regular expressions generator. This is achieved by making use of another open source project, databene generator. I have not fully tested the abilities of databene generator regarding regular expressions, but I had a quick play with it and I am happy to say it supports most of the well known expressions. You will be better off visiting the databene generator project page for more details about this; apparently every implementation of regular expressions does things slightly differently from other versions. dgMaster's regular expressions generator is named RegularExpressionsRandomiser and the distribution contains a few samples of using it.