public class BasicMenuComponentFactory extends Object implements NamedMenuComponentFactory
MenuComponentFactory
,
DefaultMenuComponentFactory
Modifier and Type | Field and Description |
---|---|
protected static String |
ACCELERATORKEY
Parameter of the MnemonicKey in the menu components properties file
|
protected static String |
CHECKBOX_MENU
type of the menu is checkbox - it used in the file of actions definition in the parameter
menuType
|
protected org.jadice.util.preferences.PropertiesPreferenceStore |
compositionLookupProperties
Instance of the property file.
|
protected boolean |
enableFocus
Control if elements should be set focussable
|
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 |
SNAPIN_VARIABLE |
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 |
SUBMENU_VARIABLE
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
|
ACTIONS, CONTEXT_MENU_ACTIONS, MENU_ACTIONS, TOOLBAR_ACTIONS
Modifier | Constructor and Description |
---|---|
|
BasicMenuComponentFactory()
Constructor that should only be used for testing.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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 |
createSnapIn(String metaInfo,
Context context) |
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 information 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 JSeparator |
getSeparator() |
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.
|
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 ACCELERATORKEY
protected static final String SEPARATOR
protected static final String SUBMENU_VARIABLE
protected static final String SNAPIN_VARIABLE
protected static final String VARIABLE
protected static final String EXTERNAL_ACTION
protected static final String STARTSUB
protected static final String ENDSUB
protected org.jadice.util.preferences.PropertiesPreferenceStore compositionLookupProperties
protected String factoryName
protected boolean enableFocus
public BasicMenuComponentFactory()
protected BasicMenuComponentFactory(InputStream propertyInputStream, String factoryName) throws IOException
compositionLookupProperties
.propertyInputStream
- the input stream to read the command propertiesfactoryName
- name of this factoryIOException
Properties
protected BasicMenuComponentFactory(String propertiesFileName) throws IOException
propertiesFileName
- for which should be factory createdIOException
Object()
protected Action adaptAdditionalAction(String metaInfo, Context context, Action additionalAction)
context
- additionalAction
- metaInfo
- public void clearLookupProperties()
protected JComponent createSnapIn(String metaInfo, Context context)
protected JComponent doCreateComponentForAction(Action action)
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 menuprotected 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 menuprotected 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 menuprotected 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 toolbarprotected 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 toolbarprotected ActionFactory getActionFactory(String key)
key
- identifier of the action factorynull
public Collection<String> getActions(String key)
getActions
in interface MenuComponentFactory
key
- template keyMenuComponentFactory.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 structureMenuComponentFactory.getActions(String)
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)
public String getFactoryName()
getFactoryName
in interface NamedMenuComponentFactory
public String getLookupProperty(String key)
key
- The key to look upnull
if the key is not mapped to any
value.NullPointerException
- if the key is null.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 JMenuBar getMenuBar(String key, Context context)
MenuComponentFactory
JMenuBar
for the given template key or context name.
getMenuBar
in interface MenuComponentFactory
key
- context
- protected MenuComponentFactory getMenuFactory(String key)
protected JSeparator getSeparator()
protected Collection<String> getStructureOfActionNames(String key, String type)
SUBMENU_VARIABLE
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
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)
protected void loadProperties(InputStream is) throws IOException
compositionLookupProperties
.IOException
protected void loadProperties(String propertiesFileName) throws IOException
propertiesFileName
- from which should be the informations readIOException
- - the file not found@Deprecated public void putLookupProperty(String key, String value)
setLookupProperty(String, String)
insteadkey
- value
- The value of the given key, null
if the key is not mapped to any
value.public void removeLookupProperty(String key)
key
- protected void setFactoryName(String factoryName)
factoryName
- the new factory namepublic void setLookupProperty(String key, String value)
key
- value
- The value of the given key, null
if the key is not mapped to any
value.Copyright © 2024 levigo holding gmbh. All rights reserved.