Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Berkano
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h2>Step to have user preferences available in your application(s):</h2> <p> 1) <strong>Implement the Application interface</strong> for each "module" of your web-app. These implementations will define a name(getName) and an object defining the parameters you want users to be able to customize: the newPreferencesModel should return a new instance of the model object which will be used to store the user's preferences; the getPreferencesInfo() method should return an array of PreferenceInfo implementations, each describing every item that the user will be able to customize. (I guess this can be related to the javabean/BeanInfo model)</p> <p> So, on one side you have your preferences model object, one the other, you have their definitions. This is currently only feasible through code, since I'm not a big fan of config files: there are always too many, they are a pain to maintain, and they often end up being as verbose as plain code; however, if someone comes up with good ideas in this area, I'd be happy to include the contributions.</p> <p> As the interface says, PreferenceInfo describe each item the user can customize, by giving it</p> <ul class="alternate"> <li>a name : getKeyName()</li> <li>possible multiple values : this is currently only used when using a widget which allows the selection of one or more values in a list, but not used to validate the user's input (this should be implemented, though)</li> <li>a widget : getPreferenceWidget. This is an enum.<br /> There a defaut implementation, which should fulfill most needs: SimplePreferenceInfo.</li> </ul> <p> The keyName of the PreferenceInfo has two usages : it must correspond to the model's property which it defines, and it is used in the UI to display the name of the property, by using it as the key in the translation system.</p> <p>Alright, now we have covered the "Application" concept, let's move on:<br /> 2) <strong>Register all your application implementations</strong> in your IOC container<br /> 3) <strong>Register ApplicationsProvider</strong> in your IOC container (currently there is only a CDI-based implementation)</p> <p>Voilà, you're done. In your main decorator or template, you'll now just need to provide a link to the preferences.action within the namespace you configured it.</p> <h2>Internationalization (i18n)</h2> <p>Before reading this, make sure you know about standard java i18n, because we won't recap. In case you don't, >>> tutorial to i18n <<<<br /> In the webwork based implementation, we obviously use ww's i18n system. Of course we had to trick it a bit: usually, translation chains are retrieved based on the current action's class. Instead of that, we wanted to use the Application classes as base location... Ok, what does this all mean? Well, all in all, it's very easy: if you want i18n, just provide properties files named like your Application implementations are. Alright, a sample?<br /> // here use the snippet macro to include FirstSampleApp<br /> then all you'll need is to define the translations accordingly: you should have a directory structure similar to this:<br /> net/incongru/berkano/sample/FirstSampleApp.properties<br /> net/incongru/berkano/sample/FirstSampleApp_fr.properties<br /> net/incongru/berkano/sample/FirstSampleApp_fr_BE.properties<br /> net/incongru/berkano/sample/FirstSampleApp_zn.properties</p> <p>What keys should I use, you'll ask. Easy:<br /> // here use the snippet macro to include FirstSampleApp.properties</p> <ul> <li>provide a translation for your app's name: (the key is the String returned by the getName() method of your Application implementation)</li> <li>the other keys are those returned by each PropertyInfo's getKeyName() method.</li> </ul> <h2>Tips, ideas, ...</h2> <p>I usually have a "global" implementation for generic or global parameters like language, skin choice, ...</p> <p><img class="emoticon emoticon-warning" data-emoticon-name="warning" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/warning.png" alt="(warning)" title="(warning)" /> This will currently only work if you use berkano-seraph, or if you provide your own implementation of UserPropertyHelper.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced