|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.BasicMenuComponentFactory
public class BasicMenuComponentFactory
BasicMenuComponentFactory provides base functionality for menu component factories
MenuComponentFactory
,
DefaultMenuComponentFactory
Field Summary | |
---|---|
protected static String |
CHECKBOX_MENU
type of the menu is checkbox - it used in the file of actions definition in the parameter menuType |
protected com.levigo.util.preferences.PropertiesPreferenceStore |
compositionLookupProperties
Instance of the property file. |
protected static String |
ENDSUB
End submenu [Format:{EndSubMenu}] |
protected static String |
EXTERNAL_ACTION
An externally defined action. |
protected String |
factoryName
Name of this command factory, usually the properties file name. |
protected static String |
ICON_MENU
type of the menu is an menu with icon decorated icons - it used in the file of actions definition in the parameter menuType |
protected static String |
MNEMONICKEY
Parameter of the MnemonicKey in the menu components properties file |
protected static String |
RADIOBUTTON_MENU
type of the menu is radioButton - it used in the file of actions definition in the parameter menuType |
protected static String |
SELECTED_MENU
type of the menu is radioButton - it used in the file of actions definition in the parameter menuState |
protected static String |
SEPARATOR
Separator [Format:{separator}] |
protected static String |
STARTSUB
Start submenu [Format:{StartSubmenu=NameofSubmenu}] |
protected static String |
SUBMENU_ACTION
Parameter of the action in the property file to which a submenu should be attached to |
protected static String |
SUBMENUVARIABLE
Submenu [Format:{$submenu keyOfName}] |
protected static String |
TEXT
Parameter of the submenu text in the property file |
protected static String |
VARIABLE
Variable [Format:{$nameOfVariable}] |
protected static String |
VISIBILITY_CHECKBOX_MENU
type of the menu is radioButton - it used in the file of actions definition in the parameter menuType |
protected static String |
VISIBILITY_MENU
type of the menu item is a Item which is visible only if it is enabled - it used in the file of actions definition in the parameter menuState |
protected static String |
VISIBILITY_RADIOBUTTON_MENU
type of the menu is radioButton - it used in the file of actions definition in the parameter menuType |
Fields inherited from interface com.levigo.util.swing.action.MenuComponentFactory |
---|
ACTIONS, CONTEXT_MENU_ACTIONS, MENU_ACTIONS, TOOLBAR_ACTIONS |
Constructor Summary | |
---|---|
protected |
BasicMenuComponentFactory(InputStream propertyInputStream,
String factoryName)
Constructor, reads a property list (key and element pairs) from the given input stream and fills up the contained compositionLookupProperties . |
protected |
BasicMenuComponentFactory(String propertiesFileName)
Constructor invokes a loading of the property file. |
Method Summary | |
---|---|
protected Action |
adaptAdditionalAction(String metaInfo,
Context context,
Action additionalAction)
Read settings for external actions from the action properties file. |
void |
clearLookupProperties()
Clears the lookup properties. |
protected JComponent |
doCreateComponentForAction(Action action)
Create a beautiful button to carry an action in a toolbar. |
protected JPopupMenu |
doCreateContextMenu(String key,
Collection<String> actionNameCollection,
Context context,
Action[] additionalActions)
Creates the context menu from the informations inside the collection. |
protected JMenu |
doCreateMenu(String key,
Collection<String> actionNameCollection,
Context context,
Action[] additionalActions)
Creates the menu from the informations inside the collection. |
protected JMenuBar |
doCreateMenuBar(String key,
Collection<String> actionNameCollection,
Context context,
Action[] additionalActions)
Creates the menu from the informations inside the collection. |
protected JToolBar |
doCreateToolbar(Collection<String> actionNameCollection,
Context context,
Action[] additionalActions)
Creates the toolbar from the informations inside the collection. |
protected JToolBar |
doCreateToolbar(String key,
Collection<String> actionNameCollection,
Context context,
Action[] additionalActions)
Creates the toolbar from the informations inside the collection. |
protected ActionFactory |
getActionFactory(String key)
Returns an action factory for given resource key. |
Collection<String> |
getActions(String key)
Create all currently available action names(!) for the given template key. |
Collection<String> |
getActionsForType(String key,
String type)
Create a collection of all currently available action names(!) for the given template key and action structure type. |
Collection<CommandAction> |
getCommandActions(String key,
Context context)
Create all currently available command actions for the given template key. |
JPopupMenu |
getContextMenu(String key,
Context context)
Create a JPopupMenu for the given template key or context name. |
JPopupMenu |
getContextMenu(String key,
Context context,
Action[] additionalActions)
Create a JPopupMenu for the given template key or context name. |
String |
getFactoryName()
Returns the name of this factory, usually its properties file name. |
String |
getLookupProperty(String key)
Allows an application to request lookup properties programmatically. |
JMenu |
getMenu(String key,
Context context)
Create a JMenu for the given template key or context name. |
JMenu |
getMenu(String key,
Context context,
Action[] additionalActions)
Create a JMenu for the given template key or context name. |
JMenuBar |
getMenuBar(String key,
Context context)
Create a JMenuBar for the given template key or context name. |
protected MenuComponentFactory |
getMenuFactory(String key)
|
protected Collection<String> |
getStructureOfActionNames(String key,
String type)
Separate the actions for the specific key of the component and typ of query and puts them into the collection. |
JToolBar |
getToolbar(String key,
Context context)
Create a JToolbar for the given template key or context name. |
JToolBar |
getToolbar(String key,
Context context,
Action[] additionalActions)
Create a JToolbar for the given template key or context name. |
protected void |
loadProperties(InputStream is)
Reads a property list (key and element pairs) from the input stream and fills the embedded compositionLookupProperties . |
protected void |
loadProperties(String propertiesFileName)
Load the data from the propertyFile. |
void |
putLookupProperty(String key,
String value)
Deprecated. use setLookupProperty(String, String) instead |
void |
removeLookupProperty(String key)
Removes the value for given key. |
protected void |
setFactoryName(String factoryName)
Changes the name of this factory. |
void |
setLookupProperty(String key,
String value)
Allows an application to overwrite or set lookup properties programmatically. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String CHECKBOX_MENU
protected static final String VISIBILITY_CHECKBOX_MENU
protected static final String VISIBILITY_RADIOBUTTON_MENU
protected static final String RADIOBUTTON_MENU
protected static final String ICON_MENU
protected static final String VISIBILITY_MENU
protected static final String SELECTED_MENU
protected static final String TEXT
protected static final String SUBMENU_ACTION
protected static final String MNEMONICKEY
protected static final String SEPARATOR
protected static final String SUBMENUVARIABLE
protected static final String VARIABLE
protected static final String EXTERNAL_ACTION
protected static final String STARTSUB
protected static final String ENDSUB
protected com.levigo.util.preferences.PropertiesPreferenceStore compositionLookupProperties
protected String factoryName
Constructor Detail |
---|
protected BasicMenuComponentFactory(String propertiesFileName) throws Exception
propertiesFileName
- for which should be factory created
Exception
Object.Object()
protected BasicMenuComponentFactory(InputStream propertyInputStream, String factoryName) throws Exception
compositionLookupProperties
.
propertyInputStream
- the input stream to read the command propertiesfactoryName
- name of this factory
Exception
Properties
Method Detail |
---|
public JToolBar getToolbar(String key, Context context)
getToolbar
in interface MenuComponentFactory
key
- of the toolbar which should be createdcontext
- for the actions in the toolbar. Actions in the toolbar
belong then in this context.
MenuComponentFactory.getToolbar(String, Context)
public JToolBar getToolbar(String key, Context context, Action[] additionalActions)
getToolbar
in interface MenuComponentFactory
MenuComponentFactory.getToolbar(String, Context)
public JMenu getMenu(String key, Context context)
getMenu
in interface MenuComponentFactory
key
- of the menu which should be createdcontext
- for the actions in the menu. Actions in the menu belong then
in this context.
MenuComponentFactory.getMenu(String, Context)
public JMenu getMenu(String key, Context context, Action[] additionalActions)
getMenu
in interface MenuComponentFactory
MenuComponentFactory.getMenu(String, Context)
public JPopupMenu getContextMenu(String key, Context context)
getContextMenu
in interface MenuComponentFactory
key
- of the context menu which should be createdcontext
- for the actions in the context menu. Actions in the context
menu belong then in this context.
MenuComponentFactory.getContextMenu(String, Context)
public JPopupMenu getContextMenu(String key, Context context, Action[] additionalActions)
getContextMenu
in interface MenuComponentFactory
MenuComponentFactory.getContextMenu(String, Context)
protected ActionFactory getActionFactory(String key)
key
- identifier of the action factory
null
public Collection<String> getActions(String key)
getActions
in interface MenuComponentFactory
key
- template key
MenuComponentFactory.getActions(String)
public Collection<String> getActionsForType(String key, String type)
MenuComponentFactory
getActionsForType
in interface MenuComponentFactory
key
- template keytype
- structure type like MenuComponentFactory
MenuComponentFactory.ACTIONS
,
MenuComponentFactory
MenuComponentFactory.CONTEXT_MENU_ACTIONS
,MenuComponentFactory
MenuComponentFactory.MENU_ACTIONS
,MenuComponentFactory
MenuComponentFactory.TOOLBAR_ACTIONS
MenuComponentFactory.getActionsForType(java.lang.String,
java.lang.String)
public Collection<CommandAction> getCommandActions(String key, Context context)
getCommandActions
in interface MenuComponentFactory
context
- the returned actions refer to this context.key
- template key for action structure
MenuComponentFactory.getActions(String)
protected JToolBar doCreateToolbar(Collection<String> actionNameCollection, Context context, Action[] additionalActions)
Submenus are separated in the toolbar with the separators.
actionNameCollection
- collection of the names of actions and informations about structure
of the toolbar.context
- context for the actions in the toolbar.additionalActions
- additional actions to add to the created toolbar
protected JToolBar doCreateToolbar(String key, Collection<String> actionNameCollection, Context context, Action[] additionalActions)
Submenus are separated in the toolbar with the separators.
key
- of the component which has the menuactionNameCollection
- collection of the names of actions and informations about structure
of the toolbar.context
- context for the actions in the toolbar.additionalActions
- additional actions to add to the created toolbar
protected Action adaptAdditionalAction(String metaInfo, Context context, Action additionalAction)
context
- additionalAction
- metaInfo
-
protected JComponent doCreateComponentForAction(Action action)
protected JMenu doCreateMenu(String key, Collection<String> actionNameCollection, Context context, Action[] additionalActions)
It is possible to set the type of the menu then the specified type is created. These parameters have to be written in the definition of action!
CHECKBOX_MENU
VISIBILITY_CHECKBOX_MENU
RADIOBUTTON_MENU
VISIBILITY_RADIOBUTTON_MENU
VISIBILITY_MENU
Default state:
SELECTED_MENU
actionNameCollection
- collection of the names of actions and informations about structure
of the menu.context
- context for the actions in the menu.additionalActions
- additional actions to add to the menu
protected JPopupMenu doCreateContextMenu(String key, Collection<String> actionNameCollection, Context context, Action[] additionalActions)
It is possible to set the type of the menu then the specified type is created. These parameters have to be written in the definition of action!
CHECKBOX_MENU
VISIBILITY_CHECKBOX_MENU
RADIOBUTTON_MENU
VISIBILITY_RADIOBUTTON_MENU
VISIBILITY_MENU
Default state:
SELECTED_MENU
key
- actionNameCollection
- collection of the names of actions and informations about structure
of the context menu.context
- context for the actions in the menu.additionalActions
- additional actions to add to the menu
protected MenuComponentFactory getMenuFactory(String key)
protected Collection<String> getStructureOfActionNames(String key, String type)
SUBMENUVARIABLE
VARIABLE
SEPARATOR
It is possible to add more menus into one another through the
VARIABLE
.
key
- of the component which has the menutype
- of the query. There are these possibilities:
MenuComponentFactory.ACTIONS
MenuComponentFactory.MENU_ACTIONS
MenuComponentFactory.CONTEXT_MENU_ACTIONS
MenuComponentFactory.TOOLBAR_ACTIONS
MenuComponentFactory.ACTIONS
,
MenuComponentFactory.MENU_ACTIONS
,
MenuComponentFactory.CONTEXT_MENU_ACTIONS
,
MenuComponentFactory.TOOLBAR_ACTIONS
,
SEPARATOR
,
STARTSUB
,
ENDSUB
protected void loadProperties(String propertiesFileName) throws IOException
propertiesFileName
- from which should be the informations read
IOException
- - the file not foundprotected void loadProperties(InputStream is) throws IOException
compositionLookupProperties
.
IOException
public JMenuBar getMenuBar(String key, Context context)
MenuComponentFactory
JMenuBar
for the given template key or context name.
getMenuBar
in interface MenuComponentFactory
key
- context
- protected JMenuBar doCreateMenuBar(String key, Collection<String> actionNameCollection, Context context, Action[] additionalActions)
It is possible to set the type of the menu then the specified type is created. These parameters have to be written in the definition of action!
CHECKBOX_MENU
VISIBILITY_CHECKBOX_MENU
RADIOBUTTON_MENU
VISIBILITY_RADIOBUTTON_MENU
VISIBILITY_MENU
Default state:
SELECTED_MENU
actionNameCollection
- collection of the names of actions and informations about structure
of the menu.context
- context for the actions in the menu.additionalActions
- additional actions to add to the menu
@Deprecated public void putLookupProperty(String key, String value)
setLookupProperty(String, String)
instead
key
- value
- The value of the given key, null
if the key is not mapped to any
value.public void setLookupProperty(String key, String value)
key
- value
- The value of the given key, null
if the key is not mapped to any
value.public void removeLookupProperty(String key)
key
- public void clearLookupProperties()
public String getLookupProperty(String key)
key
- The key to look up
null
if the key is not mapped to any
value.
NullPointerException
- if the key is null.public String getFactoryName()
getFactoryName
in interface NamedMenuComponentFactory
protected void setFactoryName(String factoryName)
factoryName
- the new factory name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |