The configuration file (nakedobjects.properties) needs to specify what resources are used by the application and what fixtures to load. These details are common to all the modes that the NOF can be run in. Additional properties can be also specified for use in specific modes, such as database connection details when using the SQL object store.
The configuration file nakedobjects.properties is always picked up. In addition other properties files will be picked up, if present, based on the type, viewer, persistor and connection command line switches with the filename matching the option. E.g.
-r (or --persistor) hibernate will cause persistor.properties and persistor_hibernate.properties to be used
-t (or --type) client will cause client.properties to be used
-v (or --viewer) dnd will cause viewer.properties and viewer_dnd.properties to be used
-x (or -- connector) xstream-sockets will cause transport.properties, transport_sockets.properties, protocol.properties and protocol_xstream.properties to be loaded; because of the way that connector is implemented it will also load persistor.properties and persistor_xstream-sockets.properties too.
In addition a particular file can be selected with the -c switch. For example
-c mysettings.properties
Each properties file can contain lists of services and fixtures as well as any specific settings (e.g. Hibernate setting). Services are defined using the nakedobjects.services property, fixtures by the nakedobjects.fixtures property.
As a shortcut you can specify the prefix for all classes listed in the services property using services.prefix and the fixtures property using fixtures.prefix.
# uncomment to hide splash
#nakedobjects.nosplash
nakedobjects.locale=en_GB
nakedobjects.services.prefix = org.nakedobjects.example.expenses
nakedobjects.services = resources.ExpenseTypeFactory \
, resources.naive.NaiveClaimRepository\
, resources.naive.NaiveEmployeeRepository\
, resources.naive.NaiveExpenseTypeRepository\
, resources.naive.NaiveItemRepository
nakedobjects.fixtures.prefix=org.nakedobjects.example.expenses.fixture
nakedobjects.fixtures=ExpenseTypes, Employees, ExampleClaim, Context
Other settings that can be set include
See the relevant section for details of settings specific to persistence, web viewer etc.
The logging.properties file allows control over the logging settings. The NOF uses log4j for logging so please refer to Apache log4j documentation.
The format for all bytes can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.byte=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all dates can be set, replacing the default format derived from the system, using the following property to specify one of long, medium, short, isolong, isoshort or a mask:
nakedobjects.value.format.date=dd/MM/yy
When a mask is specified it is used to set up a java.text.SimpleDateFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all date/time values can be set, replacing the default format derived from the system, using the following property to specify one of long, medium, short, isolong, isoshort or a mask:
nakedobjects.value.format.datetime=dd/MM/yy
When a mask is specified it is used to set up a java.text.SimpleDateFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for Bigdecimal values can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.decimal=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all double values can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.double=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all float values can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.float=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all integers (including BigInteger) can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.int=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all long values can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.long=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all short values can be set, replacing the default format derived from the system, using the following property to specify a mask:
nakedobjects.value.format.short=####
The mask is used to set up a java.text.DecimalFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for all time values can be set, replacing the default format derived from the system, using the following property to specify one of long, medium, short, isolong, isoshort or a mask:
nakedobjects.value.format.time=ddMMyyyy hhmm
When a mask is specified it is used to set up a java.text.SimpleDateFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The format for time stamp values can be set, replacing the default format derived from the system, using the following property to specify one of long, medium, short, isolong, isoshort or a mask:
nakedobjects.value.format.timestamp=hh:mm
When a mask is specified it is used to set up a java.text.SimpleDateFormat formatting object so details of the mask format can be found in the Java documentation.
This setting can be overriden for a specific field using the @Mask annotation.
The reflector facet-decorators property specifies a list of FacetDecoratorInstaller objects that should be installed and registered with the reflector. These decorators decorate specific facets of the metamodel, allowing it change or modify their behaviour. This allows us to add internationalization, help look up and other features. Although transaction management is also achieved by decorating the reflector this is done automatically and does not need to be specified using this property. The following example adds a single decorator that provide internationalization via resource files.
nakedobjects.reflector.facet-decorators=resource-i18n
The list of users that can be switched between during exploration can be listed, separated by commas, with the following property. If no users are specified the default user "exploration" will be used and switching between users will not be possible.
nakedobjects.exploration.users=sven, dick, bob
To disable the showing of exploration menu items set the following property to false (by default exploration options are shown).
nakedobjects.exploration.show=false
Translated names, descriptions and help text for a specific language should be held in a file named in the following format:
i18n_<language code>_<country code>.properties
The language and country codes must reflect the translated language are ISO standards and are detailed in the Locale section.
Theses files must be on the root of the class path, otherwise they cannot be loaded.
Each property can have a line for each of the name, description and help text. The format for each is shown below.
<fully qualified class name>.property.<property name>.name=<translated name> <fully qualified class name>.property.<property name>.description=<translated description> <fully qualified class name>.property.<property name>.help=<translated help>
The class name must be fully qualified and the property name is the short name provided by the reflector. All the values are case sensitive. The following shows the translated name and description being specified for the property fullName, which is defined by the getFullName method.
example.dom.Contact.property.fullName.name=Nom example.dom.Contact.property.fullName.description=Le nom complet du client
TODO: presumably i18n is supported for collections, too?
Actions are specified in a similar fashion to properties but with the keyword action instead of property. Parameters within an action can also be translated by inserting parameter and a number before the keyword. Each parameter must be numbered to show its position, starting from one (1), eg parameter1, parameter2 etc.
<fully qualified class name>.action.<action name>.name=<translated name> <fully qualified class name>.action.<action name>.description=<translated description> <fully qualified class name>.action.<action name>.help=<translated help> <fully qualified class name>.action.<action name>.parameter<index>.name=<translated name> <fully qualified class name>.action.<action name>.parameter<index>.description=<translated description> <fully qualified class name>.action.<action name>.parameter<index>.help=<translated help>
The class name must be fully qualified and the action name is the short name provided by the reflector. All the values are case sensitive. The following shows the translated action name and description, and two parameter names being specified for the action createPhone, which is defined by the createPhone method.
example.dom.Contact.action.createPhone.name=Nouveau téléphone example.dom.Contact.action.createPhone.parameter1.name=Indicatif de zone example.dom.Contact.action.createPhone.parameter2.name=Nombre example.dom.Contact.action.createPhone.description=Créez un nouveau téléphone et ajoutez-le au contact actuel
The look of the viewing mechanism can be changed by using different fonts, colours and icons. All viewer properties for the drag and drop user interface have a common root of nakedobjects.viewer.dnd and for the HTML interface nakedobjects.viewer.html.
The size and location of the application within the windowing systems can be specified using the initial.size and initial.location properties. If not specified the size defaults to nearly full screen and location to near the top-left corner.
nakedobjects.viewer.dnd.initial.size = 800 x 600 nakedobjects.viewer.dnd.initial.location = 100, 200
The width of the resource icons (as shown on the desktop) can be specified using the large-icon-size property. If not specified it will default to 34 pixels.
nakedobjects.viewer.dnd.large-icon-size = 48
The amount of space allocated for the resize border on a text field can be set using the field-resize-border property. Unless set this will default to 5 pixels.
nakedobjects.viewer.dnd.field-resize-border = 3
The amount of space allocated for the resize border on a tree view can be set using the tree-resize-border property. Unless set this will default to 5 pixels.
nakedobjects.viewer.dnd.tree-resize-border = 3
To turn off exploration menus set the show-exploration property to off.
nakedobjects.viewer.dnd.show-exploration = off
The whole viewer is double buffered by default, but this can be turned off by setting the double-buffer property to off.
nakedobjects.viewer.dnd.double-buffer = off
A background logo can be added to the workspace using the logo-background properties. The image sub-property indicates that a logo should be displayed and what image to use. The size and location are then optional.
nakedobjects.viewer.dnd.logo-background.image = background.jpg nakedobjects.viewer.dnd.logo-background.size = 400 x 300 nakedobjects.viewer.dnd.logo-background.location = 100, 200
Images are normally loaded directly from the Java resources (accessed via the class path) or as files within the images directory. If necessary the loading of files can be suspended so they are only loaded from resources. This is done via the load-images-from-files property.
nakedobjects.viewer.dnd.load-images-from-files = false
nakedobjects.viewer.dnd.hpadding = 5 nakedobjects.viewer.dnd.vpadding = 5
The default image is the one used if the image file/resource that should be used cannot be found. This simply ensures that an image is available for all icons. The default image can be changed using the default-image property.
nakedobjects.viewer.dnd.default-image = square.png
The directory in which the images are to be found can be specified via the image-directory property.
nakedobjects.viewer.dnd.image-directory = graphics
The views used to render objects and collection are created by view specifications. These specifications are installed at start up and can be added to. The specification.view property lists the specifications to load.
nakedobjects.viewer.dnd.specification.view = org.nakedobjects.viewer.skylark.basic.FormSpecification, \
org.nakedobjects.viewer.skylark.basic.ListSpecification
The viewer has a set of default set of views that it loads up, these include specifications for forms, lists, tree browsers and tables. To disable this default set, normally so you can explicitly set up the specification list as above, use the specification.defaults property with the false value.
nakedobjects.viewer.dnd.specification.defaults =off
Specific field and subview types can be also specified, so they no longer use the built-in default. These all have the same property name root of nakedobjects.viewer.dnd.specification and are:-
The following example causes all logical properties to be shown using the standard text field rather than the default check box.
nakedobjects.viewer.dnd.specification.field.checkbox = \
org.nakedobjects.viewer.skylark.basic.TextFieldSpecification
Fonts can be specified using the following font property names:-
A particular font can be specified for an area by specifying
org.nakedobjects.viewer.dnd.font.<area>=<font>
Where the <area> is the name and the <font> is specified according the Font.decode() specification (see java.awt.Font). This essentially is a concatenation of the name, style and size as below:
<logical font name>-<style>-<point size>
In addition to the font the amount of space between lines of text can also be specified.
org.nakedobjects.viewer.dnd.spacing.<area>=<pixels>
The colour properties are prefixed with nakedobjects.viewer.dnd.color and take a numerical value. The most useful form is in hexadecimal where the six digits are grouped into twos to represent the red, green and blue components. The following example specifies the colours green, red and black respectively.
nakedobjects.viewer.dnd.color.normal=0x0000FF nakedobjects.viewer.dnd.color.label=0xFF0000 nakedobjects.viewer.dnd.color.text.edit=0xFFFFFF
The basic colour scheme is made up of a palette of eight colours: three primary, three secondary and black and white. These form the basis for many of the other colour properties. The colour property names are:-
The backgrounds of the application, the windows and the menus can be set with the following properties:-
In addition to the setting of a colour for all window backgrounds you can also set the colour for a specific view type.
nakedobjects.viewer.dnd.color.background.window.List=0x00ffff
The colours of the text on the menus can be specified with the following properties:-
The state of the views can be reflected by its colour. The following colour properties can be specified (only the identified property is based on the core colour scheme, all others are unique by default):-
There are a number of properties relating to text for text fields. These are the colour of text when editing it, the cursor's colour, the colour of the highlight when selecting text, and the colour of text when it has focus for editing but has not been changed yet.
The single character used to represent an entered character in a password field can be specified with the echo property, for example to change it from the default * to a hash specify the following:
nakedobjects.viewer.dnd.echo=#
The html viewer has only two properties
nakedobjects.viewer.html.debug=true
Which enables debugging on the web controller.
nakedobjects.viewer.html.encoding=UTF-8
Which enables the character set encoding used by the HTTPServletRequest. This is ISO-8859-1 by default.
The embedded web server (implemented by Jetty) has only one properties
nakedobjects.embedded-web-server.port=8080
Which specifies the port to use when prototyping.
The locale that the system works in can be set by the following property:
nakedobjects.locale = en_GB
The locale is specified in two parts separated by an underscore.
The first part is the language and is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as: http://www.loc.gov/standards/iso639-2/php/English_list.php The second part is the country and is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
If no underscore is used then the setting is deemed to be the language.
If no locale is specified the system uses the locale specified by the operating system.
The time zone that the system works in can be set by the following property:
nakedobjects.timezone = Europe/London
The time zone is normally a geographic area and a location separated by a slash (/), such as America/New_York, Europe/Paris or Australia/Perth. These codes can be looked up online on sites such as ConvertIt.com and Date and Time Gateway.
Alternatively the time zone can be specified in relative format of the form GMT-8:00 where the relative number of hours and minutes can be specified.