SOURCECODE

How to... display a userīs Capability


Description:
To display the status of a user's Capability, the class User has the method getCapabilityCheckBox(String nameOfCap). This will return a JCheckBox with the DisplayName of the Capability on it and it will be checked or not, depending on wether the user is granted that capability.
The tricky thing about this is the CapabilityDisplayName which is used as the caption of the JCheckBox. You have to extend the java.util.ResourceBundle at first and put the DisplayName (the caption matching to the locale) into the keyList. For more information on ResourceBundles go to ResourceBundle of the JAVA api and setDisplayNameResourceBundleName of the Framework api.
You can find two extensions of the ResourceBundle as an example in the zip-file below. One for the default locale and one for the french.

ToDo's:
  1. Resolve the user you want to display the Capability of
  2. Call the getCapabilityCheckBox(String nameOfCap) method in order to get the JCheckBox
  3. Add the JCheckBox to the Container you want it to be displayed in.

You don't have to take care about any action triggered by the CheckBox. The status of the Capability will be updated automatically at the User by the Framework, so it can also be used to edit the Capabilites.
For the complete example refer to "How to display Users in a JUserListBox".

Uses:
User  

Example:
MyResourceBundles.zip


SourceCode

                 1
                //create the new CheckBox
                jcb = jul.getSelectedUser().getCapabilityCheckBox("Office");
                 2
                //add it to the JUserList
                jul.add(jcb);