When I develop XPages applications I always use properties files, stored in the files section under Resources in the application.
When the application is finished I can easily copy the properties file and create a new language file, and let it controlled by a Language bean to display the labels in the application based by a key. It is a easy way to give the application multi language support.
Back in my head there was all the time the need to give an administrator or editor of the application more control of the labels.
Over the weekend I made a ProperrtyHandler bean, but first I created a Property class. This is a very basic class, with only 2 properties, label and value.
This method is to collect all the documents from the view and store the value and key in the TreeMap. This method is triggered by the creating of the bean, so everything is in place to serve the front end
This method is to collect all the rows from the default property file, located in the files section and store these values in a TreeMap, with the key as key and a Property object as Value.
Also the code store the key and value in documents, so the user can edit the lablels.
In my Language I made a small enhancement, to not collect the label from the property file, but from the PropertyHandler. In this way I don’t have to change the whole application.
And off course my Front end
To make it possible to control and edit the label values of my properties, I made 2 XPages. An overview with buttons to load the backend properties file.
a XPage to display the labels and key. Only the label is editable, because the key is needed in the application When the document is saved, the property in the TreeMap will also be updated.
As requested, I put the Java classes in GIT repositoryby