Configuration

Configuration Settings

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

Properties file contents

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

  • nakedobjects.nosplash
  • nakedobjects.locale (e.g. en_GB)

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.

Reflector Properties

Value formats

Byte format

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.

Date Format

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.

Date/time Format

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.

Decimal format

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.

Double format

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.

Float format

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.

Integer format

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.

Long format

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.

Short format

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.

Time Format

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.

Timestamp Format

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.

Reflector facet decorators

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

Exploration Properties

Users

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

Exploration options

To disable the showing of exploration menu items set the following property to false (by default exploration options are shown).

nakedobjects.exploration.show=false

Internationalization resource files

Files

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.

Properties

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

Collections

TODO: presumably i18n is supported for collections, too?

Actions

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

Viewer Properties

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.

Initial size and location

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

Large icon size

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

Resize border

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

Exploration menu options

To turn off exploration menus set the show-exploration property to off.

nakedobjects.viewer.dnd.show-exploration = off

Double buffering

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

Background logo

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

Loading images from files

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

Padding

nakedobjects.viewer.dnd.hpadding = 5
nakedobjects.viewer.dnd.vpadding = 5

Default image

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

Image directory

The directory in which the images are to be found can be specified via the image-directory property.

nakedobjects.viewer.dnd.image-directory = graphics

View specifications

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:-

  • field.image
  • field.color
  • field.password
  • field.wrappedtext
  • field.checkbox
  • field.text
  • field.empty
  • icon.subview
  • icon.object
  • icon.resource

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

Fonts can be specified using the following font property names:-

  • control, for the text in control widgets such as buttons
  • label, for the field labels
  • large-icon, for the icons on the desktop such as resources
  • menu, for the menu options
  • normal, for edit fields and object labels in fields
  • small-title, for windows bars
  • status, for text on the status bar
  • title, for titling objects

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>

Colours

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:-

  • black
  • white
  • primary1
  • secondary1
  • primary2
  • secondary2
  • primary3
  • secondary3

The backgrounds of the application, the windows and the menus can be set with the following properties:-

  • background.application
  • background.window
  • background.content-menu
  • background.value-menu
  • background.view-menu
  • background.workspace-menu

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:-

  • menu.normal
  • menu.disabled
  • menu.reversed

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):-

  • identified
  • valid
  • invalid
  • active
  • error
  • out-of-synch

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.

  • text.edit
  • text.cursor
  • text.highlight
  • text.saved

Echo character

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=#

HTML viewer

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.

Embedded Web Server

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.

Other Properties

Locale

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.

Time zone

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.