KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > util > gui > ConfigurableUI


1 package net.suberic.util.gui;
2 import java.util.Hashtable JavaDoc;
3 import net.suberic.util.VariableBundle;
4 import javax.swing.Action JavaDoc;
5
6 /**
7  * This defines a UI component which may be built dynamically using a
8  * set of properties in a VariableBundle, and then may have the Actions
9  * associated with the individual buttons/menu items/whatevers updated
10  * dynamically to reflect the new values.
11  *
12  * In general, the format for the properties which define a ConfigurableUI
13  * component are as follows:
14  *
15  * MenuBar=File:Edit:Mail:Window:Help
16  *
17  * MenuBar.File=NewFolder:NewMail:OpenFolder:OpenMessage:Close:SaveAs:Print:Exit
18  * MenuBar.File.Label=File
19  *
20  * MenuBar.File.NewFolder.Action=folder-new
21  * MenuBar.File.NewFolder.Image=images/New.gif
22  * MenuBar.File.NewFolder.KeyBinding=F
23  * MenuBar.File.NewFolder.Label=New Folder
24  *
25  * where MenuBar would be the name of the 'root' configuration property,
26  * 'MenuBar.File' is the first submenu, and 'MenuBar.File.NewFolder' is
27  * the first actual 'button' configured. On the NewFolder MenuItem, the
28  * 'Action' is the name of the Action which will be run, and is the
29  * central part of the configuration. The rest (Image, KeyBinding, and
30  * Label) just control how the item is displayed and invoked. The
31  * 'KeyBinding' and 'Label' items should probably be put in a localized
32  * file if you want to internationalize your application.
33  */

34
35 public interface ConfigurableUI {
36     
37     /**
38      * This configures the UI Component with the given ID and
39      * VariableBundle.
40      */

41     public void configureComponent(String JavaDoc ID, VariableBundle vars);
42
43     /**
44      * This updates the Actions on the UI Component.
45      *
46      * The commands Hashtable is expected to be a table with the Action
47      * names as keys, and the Actions themselves as values.
48      */

49
50     public void setActive(Hashtable JavaDoc commands);
51
52     /**
53      * This updates the Actions on the UI Component.
54      *
55      */

56
57     public void setActive(Action JavaDoc[] newActions);
58 }
59     
60
Popular Tags