org.springframework.richclient.command
Class ExpansionPointGroupMember

java.lang.Object
  extended by org.springframework.richclient.command.GroupMember
      extended by org.springframework.richclient.command.ExpansionPointGroupMember

public class ExpansionPointGroupMember
extends GroupMember

A collection of GroupMembers that represent a subsection of a CommandGroup.


Field Summary
 
Fields inherited from class org.springframework.richclient.command.GroupMember
logger
 
Constructor Summary
protected ExpansionPointGroupMember()
          Creates a new ExpansionPointGroupMember with a default name.
protected ExpansionPointGroupMember(String expansionPointName)
          Creates a new ExpansionPointGroupMember with the given name.
 
Method Summary
protected  void add(GroupMember member)
          Attempts to add the given member to this expansion point.
protected  void clear()
          Removes all the group members from this expansion point.
protected  void fill(GroupContainerPopulator containerPopulator, Object controlFactory, CommandButtonConfigurer configurer, List previousButtons)
          Adds each member of this expansion point to a GUI container using the given container populator.
 String getExpansionPointName()
          Returns the name of this expansion point.
 GroupMember getMemberFor(String commandId)
          Returns the group member that manages the command with the given id, or null if none of the members in this expansion point manage a command with that id.
 boolean isEmpty()
          Returns true if this expansion point has no members.
 boolean isEndingSeparator()
          Returns true if the visual representation of this expansion point will include a trailing separator.
 boolean isLeadingSeparator()
          Returns true if the visual representation of this expansion point will include a leading separator.
 boolean managesCommand(String commandId)
          Subclasses must implement this method to indicate whether or not they manage a command with the given id.
 void remove(GroupMember member)
          If the given member belongs to this exponsion point, it will be removed.
 void setEnabled(boolean enabled)
          Default implementation, performs no operation.
 void setEndingSeparator(boolean endingSeparator)
          Sets the flag that indicates whether or not the visual representation of this expansion point will display a trailing separator.
 void setLeadingSeparator(boolean leadingSeparator)
          Sets the flag that indicates whether or not the visual representation of this expansion point will display a leading separator.
 
Methods inherited from class org.springframework.richclient.command.GroupMember
getCommand, onAdded, onRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpansionPointGroupMember

protected ExpansionPointGroupMember()
Creates a new ExpansionPointGroupMember with a default name.


ExpansionPointGroupMember

protected ExpansionPointGroupMember(String expansionPointName)
Creates a new ExpansionPointGroupMember with the given name.

Parameters:
expansionPointName - The name of the expansion point. Must not be null.
Throws:
IllegalArgumentException - if expansionPointName is null.
Method Detail

isLeadingSeparator

public boolean isLeadingSeparator()
Returns true if the visual representation of this expansion point will include a leading separator.

Returns:
true for a leading separator.

setLeadingSeparator

public void setLeadingSeparator(boolean leadingSeparator)
Sets the flag that indicates whether or not the visual representation of this expansion point will display a leading separator.

Parameters:
leadingSeparator - Set to true to display a leading separator.

isEndingSeparator

public boolean isEndingSeparator()
Returns true if the visual representation of this expansion point will include a trailing separator.

Returns:
true for a trailing separator.

setEndingSeparator

public void setEndingSeparator(boolean endingSeparator)
Sets the flag that indicates whether or not the visual representation of this expansion point will display a trailing separator.

Parameters:
endingSeparator - Set to true to display a trailing separator.

getExpansionPointName

public String getExpansionPointName()
Returns the name of this expansion point.

Returns:
The expansion point name, never null.

add

protected void add(GroupMember member)
Attempts to add the given member to this expansion point. The member will not be added if an equivalent entry (according to its equals() method) already exists. If added, the member's GroupMember.onAdded() method will be called.

Parameters:
member - The member to be added. Must not be null.
Throws:
IllegalArgumentException - if member is null.

remove

public void remove(GroupMember member)
If the given member belongs to this exponsion point, it will be removed. Its GroupMember.onRemoved() method will be called.

Parameters:
member - The member that is to be removed.

clear

protected void clear()
Removes all the group members from this expansion point.


fill

protected void fill(GroupContainerPopulator containerPopulator,
                    Object controlFactory,
                    CommandButtonConfigurer configurer,
                    List previousButtons)
Adds each member of this expansion point to a GUI container using the given container populator. Leading and trailing separators will also be added as determined by the appropriate flags set on this instance. Subclasses must implement this method to use the given container populator to add a GUI control component to a GUI container. The actual type of the GUI control will be determined by the type of the controlFactory provided, but it will generally be a control that a command can be associated with, such as a button or menu item.

Specified by:
fill in class GroupMember
Parameters:
containerPopulator - The object responsible for populating a GUI container with an appropriate control component based on this instance. Must not be null.
controlFactory - The factory for creating an appropriate GUI control that the underlying command will be associated with.
configurer - The object that is to configure the newly created control component.
previousButtons - A list of AbstractButton instances that have already been added to the container. May be null or empty.

getMemberFor

public GroupMember getMemberFor(String commandId)
Returns the group member that manages the command with the given id, or null if none of the members in this expansion point manage a command with that id.

Parameters:
commandId - The id of the command whose managing member is to be returned.
Returns:
The group member that manages the command with the given id, or null.

managesCommand

public boolean managesCommand(String commandId)
Subclasses must implement this method to indicate whether or not they manage a command with the given id. This method should also traverse nested commands if the command managed by this member is a CommandGroup.

Specified by:
managesCommand in class GroupMember
Parameters:
commandId - The id of the command to be checked for. May be null.
Returns:
true if the command, or any of its nested commands, managed by this group member has the given command id.

isEmpty

public boolean isEmpty()
Returns true if this expansion point has no members.

Returns:
true if this expansion point has no members.

setEnabled

public void setEnabled(boolean enabled)
Default implementation, performs no operation.

Specified by:
setEnabled in class GroupMember
Parameters:
enabled - The enabled flag.


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.