View Javadoc

1   package org.xnap.commons.gui.factory;
2   
3   import javax.swing.AbstractButton;
4   import javax.swing.Action;
5   import javax.swing.JComponent;
6   import javax.swing.JMenu;
7   import javax.swing.text.JTextComponent;
8   import org.xnap.commons.gui.action.ToggleAction;
9   import org.xnap.commons.gui.completion.Completion;
10  
11  /***
12   * Defines the requirements for a factory class used by 
13   * {@link org.xnap.commons.gui.Builder}.
14   */
15  public interface Factory {
16  	
17  	/***
18  	 * Adds a completion mode menu to the text component which pops up
19  	 * when the platform dependent popup action is triggered.
20  	 * 
21  	 * @param textComponent
22  	 * @param completion the completion object whose completion modes
23  	 * are set by the menu
24  	 */
25  	void addCompletionModeMenu(JTextComponent textComponent, Completion completion);
26  	
27  	/***
28  	 * Adds a completion mode menu as a sub menu to the <code>menu</code>.
29  	 * 
30  	 * @param menu the menu into which the completion mode menu is plugged
31  	 * @param completion the completion object whose completion modes
32  	 * are set by the menu
33  	 */
34  	void addCompletionModeMenu(JMenu menu, Completion completion);
35  	
36  	/***
37  	 * Creates a button for an action.
38  	 *
39  	 * @param action the action
40  	 * @return the button
41  	 */
42  	AbstractButton createButton(Action action);
43  	
44  	/***
45  	 * Creates a checkbox for a toggle action.
46  	 * 
47  	 * @param action the action
48  	 * @return the checkbox 
49  	 */
50  	AbstractButton createCheckBox(ToggleAction action);
51  	
52  	/***
53  	 * Creates an icon button for an action that only shows the icon and
54  	 * not the text of the action.
55  	 * 
56  	 * @param action the action
57  	 * @return the button
58  	 */
59  	AbstractButton createIconButton(Action action);
60  	
61  	/***
62  	 * Creates a toolbar button for an action making sure the right
63  	 * sized icon is used.
64  	 * 
65  	 * @param action the action
66  	 * @return the button
67  	 */
68  	AbstractButton createToolBarButton(Action action);
69  	
70  	/***
71  	 * Creates a menu item for an action making sure the right sized icon
72  	 * is used.
73  	 * 
74  	 * @param action the action
75  	 * @return the menu item
76  	 */
77  	JComponent createMenuItem(Action action);
78  	
79  	/***
80  	 * Sets a property of the factory to configure it.
81  	 * 
82  	 * @param key the key
83  	 * @param value the value
84  	 */
85  	void setProperty(Object key, Object value);
86  
87  }