add
public void add(Command command)
Adds a command to the groups expansion point and rebuilds all dependant widgets.
Each command is appended to the list in order of addition. Each command can only
be added once.
command
- the command to installFace.
add
public void add(Command command,
boolean rebuild)
Adds a command to the groups expansion point and optionally rebuilds all
dependant widgets. Each command is appended to the list in order
of addition.
command
- the command to installFace.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.
addGlue
public void addGlue()
Inserts a glue member into the group and rebuilds all dependant widgets.
addGlue
public void addGlue(boolean rebuild)
Inserts a glue member into the group and optionally rebuilds all dependant widgets.
rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.l
addGroupListener
public void addGroupListener(GroupListener l)
l
- the listener to installFace.
addInline
public void addInline(CommandGroup group)
Adds the specified group to this groups expansion point as an inline member. The childen
of the specified group will appears to the user as though they are direct members of the
group. This method will rebuild all dependant widgets.
group
- the group to installFace inline.
addInline
public void addInline(CommandGroup group,
boolean rebuild)
Adds the specified group to this groups expansion point as an inline member. The childen
of the specified group will appears to the user as though they are direct members of the
group. This method will optionally rebuild all dependant widgets.
group
- the group to installFace inline.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.
addSeparator
public void addSeparator()
Inserts a separator into the command list and rebuilds all the groups dependant widgets.
addSeparator
public void addSeparator(boolean rebuild)
Inserts a separator into the command list and optionally rebuilds all the groups dependant widgets.
rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.
bindMembers
protected void bindMembers(JComponent container,
ButtonFactory factory,
String faceName)
Binds this group to the specified container. The group will ensure the containers contents
are aligned with this groups members. This binding will insert buttons
into the container.
container
- the container
that will hold the members of the group.factory
- the ButtonFactory
used to create the buttons.faceName
- the face to use for the group members.
bindMembers
protected void bindMembers(JComponent container,
MenuFactory factory,
String faceName)
Binds this group to the specified container. The group will ensure the containers contents
are aligned with this groups members. This binding will insert menu items
into the container.
container
- the container
that will hold the members of the group.factory
- the MenuFactory
used to create the menu items.faceName
- the face to use for the group members.
contains
public boolean contains(Command c)
Checks if this group contains the specified command. This method only checks the direct
chidren, it will only recurse into
ToggleCommandGroup
children if they have been added
inline.
- true if this groups children contain the command, or if a child group
specified as inline contains this command.
createButton
public AbstractButton createButton(ButtonFactory buttonFactory,
String buttonFaceName,
MenuFactory menuFactory,
String menuFaceName)
Creates a new button using the specified id's for the button and menu faces and the specified factories for the
button and menu items.
createMenuBar
public JMenuBar createMenuBar()
createMenuBar
public JMenuBar createMenuBar(String faceName)
createMenuBar
public JMenuBar createMenuBar(String faceName,
MenuFactory factory)
createMenuBar
public JMenuBar createMenuBar(MenuFactory factory)
createMenuItem
public JMenuItem createMenuItem(MenuFactory factory,
String faceName)
Creates a new menu item for this command.
- createMenuItem in interface Command
createPopupMenu
public JPopupMenu createPopupMenu()
- a popup menu for the group.
createPopupMenu
public JPopupMenu createPopupMenu(String faceName,
MenuFactory factory)
Creates a popup menu for this group using the specified
Face
id and
MenuFactory
.
faceName
- the id of the Face
to use.factory
- the MenuFactory
to use to generate the menu items.
- a new popup menu for this group.
createToolBar
public JToolBar createToolBar()
Creates a new JToolBar
bound to this GroupCommand.
createToolBar
public JToolBar createToolBar(String faceName)
createToolBar
public JToolBar createToolBar(String faceName,
ToolbarFactory factory)
Creates a toolbar using the specified facename for the toolbar and the
specified toolbar factory for the buttons.
faceName
- the face name to use for the toolbar name.factory
- the ButtonFactory
to use to create the toolbar buttons.
- a new JToolbar bound to this GroupCommand.
fireMembersChanged
protected void fireMembersChanged()
getMemberCount
public int getMemberCount()
Returns the number of members in this group. This includes commands that have been registered
with the group but may not as yet been exported, it also constains commands that have been programatically
added. Thus this number may be higher than the actuall number of commands that are visible in the groups
menus and popups.
- the number of registered members of this group.
getMemberList
protected org.pietschy.command.MemberList getMemberList()
isAllowableMember
public boolean isAllowableMember(Command prospectiveMember)
Checks if the specified
Command
can be added to this group. By default this
method returns
true but can be overriden by subclasses to control the command
types that are allowable.
prospectiveMember
- the command that is to be added to the group.
- true if the command type is allowable for this group, false otherwise.
isInlineMember
public boolean isInlineMember(CommandGroup group)
rebuildAllPopups
protected void rebuildAllPopups()
remove
public void remove(Command command)
Removes this specified command from the group and rebuilds all dependant widgets.
command
- the command to remove.
remove
public void remove(Command command,
boolean rebuild)
Removes this specified command from the group and optionally rebuilds all dependant widgets.
command
- the command to remove.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.
removeGroupListener
public void removeGroupListener(GroupListener l)
l
- the listener to remove.
reset
public void reset()
Resest this group back to its original state before any commands were programatically added.
This is only useful if the group contains an expansion point.
reset
public void reset(boolean rebuild)
Resest this group back to its original state before any commands were programatically added.
This is only useful if the group contains an expansion point.
visit
public void visit(GroupVisitor visitor)
Visits this group. This method does not automatically traverse the children of the
group, to do this the visitor can call
visitChildren(GroupVisitor)
.
visitChildren
public void visitChildren(GroupVisitor visitor)
Accepts a
GroupVisitor
to this group. For each active member of this group the
org.pietschy.command.GroupVisitor.visit
will be called. Only active members will be visited, that is
commands that have been exported or explicitly added to the group.