|
"The most polished open source software projects." |
|
| Projects: FlexiPrefsJ | Home | Documentation | Screenshots | Download | Support | Contact |
DocumentationThe documentation is still under work. However here is a quick guide how to get started. The basic idea is to provide a way to easily add program preferences to a java client/desktop program. The core consists of a preferences file parser, Setting-interface and gui class. The different setting types implement the Setting-interface. A single Setting-component (the class implementing Setting-interface) takes care of parsing its own content as well as rebuilding the content for saving. Additionally every Setting-component takes care of the editor which is used to edit the setting. This is done through the getEditorComponent()-method. It returns a javax.swing.JComponent. For example the StringSetting returns a javax.swing.JTextField and PasswordSetting a javax.swing.JPasswordField. There is still quite minimum comments in the source code, but the Setting.java (the interface class) contains description of the usage of its methods. You can find examples on how to build your own setting-component in the fi.canter.flexiprefs.settings package where are the ready setting-components (StringSetting etc.) One can for example (a poor example :)) write a MailSetting, which would in the xml look like this: <setting type="mypackage.subpackage.MailSetting"
name="Mail Settings" key="" visibility="write"> That could be rendered by three JTextFields. Or some other way. What ever the developer wants. Building and runningThere is an Ant build script that is used to build the project.Additionally You need some libraries. Put them in folder named 'lib' under project folder.
Once the build is ready you can run it: Preferences file syntaxThere is a XML-schema coming, but now you can see the syntax from sample setting file. The sample is not working. You have to define the urls for the images and icons. Using in codeReading the preferences from a file and adding the Preferences-object to the pool: PreferencesPool pool = PreferencesPool.getInstance(); Getting Preferences object from the pool: Preferences prefs = PreferencesPool.getInstance().getPreferences("default"); Getting single setting (preference) from the Preferences object: Setting setting = prefs.getSetting("stringSetting"); Getting value of the setting (in this case the type is fi.canter.flexiprefs.settings.StringSetting: String value = (String) setting.getValue(); |