01: package net.suberic.util.gui;
02:
03: import java.util.Hashtable;
04: import net.suberic.util.VariableBundle;
05: import javax.swing.Action;
06:
07: /**
08: * This defines a UI component which may be built dynamically using a
09: * set of properties in a VariableBundle, and then may have the Actions
10: * associated with the individual buttons/menu items/whatevers updated
11: * dynamically to reflect the new values.
12: *
13: * In general, the format for the properties which define a ConfigurableUI
14: * component are as follows:
15: *
16: * MenuBar=File:Edit:Mail:Window:Help
17: *
18: * MenuBar.File=NewFolder:NewMail:OpenFolder:OpenMessage:Close:SaveAs:Print:Exit
19: * MenuBar.File.Label=File
20: *
21: * MenuBar.File.NewFolder.Action=folder-new
22: * MenuBar.File.NewFolder.Image=images/New.gif
23: * MenuBar.File.NewFolder.KeyBinding=F
24: * MenuBar.File.NewFolder.Label=New Folder
25: *
26: * where MenuBar would be the name of the 'root' configuration property,
27: * 'MenuBar.File' is the first submenu, and 'MenuBar.File.NewFolder' is
28: * the first actual 'button' configured. On the NewFolder MenuItem, the
29: * 'Action' is the name of the Action which will be run, and is the
30: * central part of the configuration. The rest (Image, KeyBinding, and
31: * Label) just control how the item is displayed and invoked. The
32: * 'KeyBinding' and 'Label' items should probably be put in a localized
33: * file if you want to internationalize your application.
34: */
35:
36: public interface ConfigurableUI {
37:
38: /**
39: * This configures the UI Component with the given ID and
40: * VariableBundle.
41: */
42: public void configureComponent(String ID, VariableBundle vars);
43:
44: /**
45: * This updates the Actions on the UI Component.
46: *
47: * The commands Hashtable is expected to be a table with the Action
48: * names as keys, and the Actions themselves as values.
49: */
50:
51: public void setActive(Hashtable commands);
52:
53: /**
54: * This updates the Actions on the UI Component.
55: *
56: */
57:
58: public void setActive(Action[] newActions);
59: }
|