|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.command.CommandGroupFactoryBean
public class CommandGroupFactoryBean
A FactoryBean
that produces a CommandGroup
.
Use of this bean simplifies the process of building up complex nested command
groups such as the main menu of an application window, a toolbar or popup
menus. The main property of interest when creating a bean definition for this
class is the members
list. This list defines the members of the
command group that will be produced by the factory. The objects contained in
this list can be instances of the actual command or they can be strings that
represent the identifier of the command. Some strings have special meaning:
Field Summary | |
---|---|
static String |
COMMAND_MEMBER_PREFIX
The string prefix that indicates a command group member that is a command. |
static String |
GLUE_MEMBER_CODE
The string that represents a glue component, to be used between other members of the command group. |
static String |
GROUP_MEMBER_PREFIX
The string prefix that indicates a command group member that is another command group. |
protected org.apache.commons.logging.Log |
logger
Class logger, available to subclasses. |
static String |
SEPARATOR_MEMBER_CODE
The string that represents a separator between commands in the command group. |
Fields inherited from interface org.springframework.richclient.core.Authorizable |
---|
AUTHORIZED_PROPERTY |
Constructor Summary | |
---|---|
CommandGroupFactoryBean()
Creates a new uninitialized CommandGroupFactoryBean . |
|
CommandGroupFactoryBean(String groupId,
CommandRegistry commandRegistry,
CommandConfigurer commandConfigurer,
Object[] members)
Creates a new CommandGroupFactoryBean . |
|
CommandGroupFactoryBean(String groupId,
CommandRegistry commandRegistry,
Object[] members)
Creates a new CommandGroupFactoryBean . |
|
CommandGroupFactoryBean(String groupId,
Object[] members)
Creates a new CommandGroupFactoryBean with the given group ID and
command group members. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected void |
configureIfNecessary(AbstractCommand command)
Configures the given command if it has not already been configured and this instance has been provided with a CommandConfigurer . |
protected CommandGroup |
createCommandGroup()
Creates the command group for this factory and assigns it an identifier equal to the group id of the factory. |
protected String |
getBeanName()
|
CommandGroup |
getCommandGroup()
Returns the command group that this factory produces. |
protected CommandRegistry |
getCommandRegistry()
|
protected Object[] |
getMembers()
|
Object |
getObject()
Returns the command group that this factory produces. |
Class |
getObjectType()
Returns the Class object for CommandGroup . |
String |
getSecurityControllerId()
Get the id (bean name) of the security controller that should manage this object. |
protected void |
initCommandGroupMembers(CommandGroup group)
Iterates over the collection of encoded members and adds them to the given command group. |
protected boolean |
isAllowsEmptySelection()
|
boolean |
isAuthorized()
Get the authorized state. |
boolean |
isExclusive()
Returns the value of the flag that indicates whether or not this factory produces an exclusive command group. |
boolean |
isSingleton()
Always returns true. |
void |
setAllowsEmptySelection(boolean allowsEmptySelection)
Sets the flag that indicates whether or not the command group produced by this factory allows no items in the group to be selected, default is false. |
void |
setAuthorized(boolean authorized)
Set the authorized state. |
void |
setBeanName(String beanName)
Accepts notification from the IoC container of this instance's bean name as declared in the bean definition file. |
void |
setCommandConfigurer(CommandConfigurer configurer)
Sets the object that will be used to configure the command objects in the command groups produced by this factory. |
void |
setCommandRegistry(CommandRegistry commandRegistry)
Sets the registry that will be used to retrieve the actual instances of the command group members as specified in the encoded members collection. |
void |
setExclusive(boolean exclusive)
Sets the flag that indicates whether or not this factory produces an exclusive command group. |
void |
setMembers(Object[] members)
Sets the collection of objects that specify the members of the command group produced by this factory. |
void |
setSecurityControllerId(String controllerId)
Set the Id of the security controller that should manage this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String GLUE_MEMBER_CODE
public static final String SEPARATOR_MEMBER_CODE
public static final String COMMAND_MEMBER_PREFIX
public static final String GROUP_MEMBER_PREFIX
protected org.apache.commons.logging.Log logger
Constructor Detail |
---|
public CommandGroupFactoryBean()
CommandGroupFactoryBean
. If created
by the Spring IoC container, the groupId
assigned to this
instance will be the bean name of the bean as declared in the bean
definition file. If using this constructor, a non-null list of command
group members must be provided by calling the
setMembers(Object[])
method before this instance is used.
public CommandGroupFactoryBean(String groupId, Object[] members)
CommandGroupFactoryBean
with the given group ID and
command group members.
groupId
- The identifier that will be assigned to the command group
produced by this factory. Note that if this instance is created by a
Spring IoC container, the group ID provided here will be overwritten by
the bean name of this instance's bean definition.members
- The collection of objects that specify the members of the
command group. These objects are expected to be either instances of
AbstractCommand
or strings. See the class documentation for
details on how these strings will be interpreted. Must not be null.
IllegalArgumentException
- if members
is null.public CommandGroupFactoryBean(String groupId, CommandRegistry commandRegistry, Object[] members)
CommandGroupFactoryBean
.
groupId
- The value to be used as the command identifier of the
command group produced by this factory.commandRegistry
- The registry that will be used to retrieve the
actual instances of the command group members as specified in
members
.members
- The collection of objects that specify the members of the
command group. These objects are expected to be either instances of
AbstractCommand
or strings. See the class documentation for
details on how these strings will be interpreted. Must not be null.
IllegalArgumentException
- if members
is null.public CommandGroupFactoryBean(String groupId, CommandRegistry commandRegistry, CommandConfigurer commandConfigurer, Object[] members)
CommandGroupFactoryBean
.
groupId
- The value to be used as the command identifier of the
command group produced by this factory.commandRegistry
- The registry that will be used to retrieve the
actual instances of the command group members as specified in
members
.members
- The collection of objects that specify the members of the
command group. These objects are expected to be either instances of
AbstractCommand
or strings. See the class documentation for
details on how these strings will be interpreted. Must not be null.commandConfigurer
- The object that will be used to configure the
command objects contained in this factory's command group.
IllegalArgumentException
- if members
is null.Method Detail |
---|
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public void setCommandRegistry(CommandRegistry commandRegistry)
commandRegistry
- The registry containing commands for the command
group produced by this factory. May be null.protected CommandRegistry getCommandRegistry()
public void setCommandConfigurer(CommandConfigurer configurer)
configurer
- The command configurer, may be null.public final void setMembers(Object[] members)
members
are
expected to be either instances of AbstractCommand
or strings.
See the class documentation for details on how these strings will be
interpreted.
members
- The (possibly) encoded representation of the command group
members. Must not be null.
IllegalArgumentException
- if members
is null.protected Object[] getMembers()
public void setBeanName(String beanName)
setBeanName
in interface BeanNameAware
protected String getBeanName()
public boolean isExclusive()
ExclusiveCommandGroup
public void setExclusive(boolean exclusive)
exclusive
- true
to produce an exclusive command group,
false otherwise.ExclusiveCommandGroup
public void setAllowsEmptySelection(boolean allowsEmptySelection)
allowsEmptySelection
- Set true
for the command group to
allow none of its members to be selected.protected boolean isAllowsEmptySelection()
true
if the exclusive commandGroup can have no
item selected.public Object getObject() throws Exception
getObject
in interface FactoryBean
Exception
public CommandGroup getCommandGroup()
protected CommandGroup createCommandGroup()
setSecurityControllerId(String)
method and the values from the
encoded members list will be used to retrieve the corresponding command
objects from the command registry.
protected void initCommandGroupMembers(CommandGroup group)
group
- The group that is to contain the commands from the encoded
members list. Must not be null.
InvalidGroupMemberEncodingException
- if a member prefix is
provided without a command id.protected void configureIfNecessary(AbstractCommand command)
CommandConfigurer
.
command
- The command to be configured.
IllegalArgumentException
- if command
is null.public Class getObjectType()
CommandGroup
.
getObjectType
in interface FactoryBean
public boolean isSingleton()
isSingleton
in interface FactoryBean
true
always.public void setSecurityControllerId(String controllerId)
setSecurityControllerId
in interface SecurityControllable
controllerId
- Id (bean name) of the security controllerpublic String getSecurityControllerId()
getSecurityControllerId
in interface SecurityControllable
public void setAuthorized(boolean authorized)
setAuthorized
in interface Authorizable
authorized
- Pass true
if the object is to be authorizedpublic boolean isAuthorized()
isAuthorized
in interface Authorizable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |