Rework:Daffuser Preferences
From Wiki
This page is part of the Daffodil Wiki.
Main Page | User Guide | Programming Guide | Protocol | FAQs
| « Architektur MVB | Übersicht | Zusammenfassung » |
Contents |
Structure
The preferences agent consists of the following classes:
- de.unidu.is.daffodil.preferences.PreferencesGUIHelper
- de.unidu.is.daffodil.preferences.PreferencesPanel
- de.unidu.is.daffodil.preferences.PreferencesTool
- de.unidu.is.daffodil.preferences.PreferencesView
The important classes to extend the preferences are de.unidu.is.daffodil.preferences.PreferencesPanel and de.unidu.is.daffodil.preferences.PreferencesGUIHelper.
How to add a new option
If you just want to add a new radio-group, text-field, password-field or color-chooser, you solely have to modify the class de.unidu.is.daffodil.preferences.PreferencesPanel.
Step one
Look for the right panel to add your new option. The Existing Panels are:
- General: getMainPane()
- Toolpreferences: getToolPanel()
- Proactive Tools: getProactivePanel()
- Look ‘n Feel: getLooksPanel()
- Annotations: getAnnotationPanel()
To add a new one, create a new method with JPanel as return parameter and add look for the initialize() method. Insert something like: tabbedPane.addTab("MyNewPanel", getMyNewPanel());
Step two
You have now created a new tab or found the right one. Now add the option itself. To make it as easy as possible, you can use some helper functions from de.unidu.is.daffodil.preferences.PreferencesGUIHelper. To add your new option, all you have to do is to decide which representation you'd like to use.
You can choose among:
- a text-field: createTextPanel("Text displayed in preferences", "daffuser.properties setting"))
- a password-field: createPasswordPanel("Text displayed in preferences", "daffuser.properties setting"))
- a radiogroup with yes/no/default: createTrueFalseDefaultPanel ("Text displayed in preferences", "daffuser.properties setting"))
- a colorchooser: createColorChooserPanel("Text displayed in preferences", "daffuser.properties setting"))
If these representations do not fit your needs, you're urged to add your own option representation. To keep a clean separation, please add all new ones in PreferencesGUIHelper.java!!!
Step three
Save and start daffodil
| « Architektur MVB | Übersicht | Zusammenfassung » |
