|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pietschy.command.Command
org.pietschy.command.CommandGroup
public class CommandGroup
GroupCommands provide collections of other ActionCommand
and ToggleCommandGroup
s.
Field Summary | |
---|---|
protected org.pietschy.command.MemberList |
memberList
|
Fields inherited from class org.pietschy.command.Command |
---|
internalLog, listenerList, pcs |
Constructor Summary | |
---|---|
CommandGroup(CommandManager commandManager)
Creates a new anonymous GroupCommand. |
|
CommandGroup(CommandManager commandManager,
java.lang.String groupId)
Creates a new command groups with the specified id. |
|
CommandGroup(java.lang.String id)
Creates a group that is bound to CommandManager.defaultInstance . |
Method Summary | |
---|---|
void |
acceptVisitor(GroupVisitor visitor)
Deprecated. use visit(GroupVisitor) or visitChildren(GroupVisitor)
instead. |
void |
add(Command command)
Adds a command to the groups expansion point and rebuilds all dependant widgets. |
void |
add(Command command,
boolean rebuild)
Adds a command to the groups expansion point and optionally rebuilds all dependant widgets. |
void |
addGlue()
Inserts a glue member into the group and rebuilds all dependant widgets. |
void |
addGlue(boolean rebuild)
Inserts a glue member into the group and optionally rebuilds all dependant widgets. |
void |
addGroupListener(GroupListener l)
Adds a GroupListener to the group. |
void |
addInline(CommandGroup group)
Adds the specified group to this groups expansion point as an inline member. |
void |
addInline(CommandGroup group,
boolean rebuild)
Adds the specified group to this groups expansion point as an inline member. |
void |
addSeparator()
Inserts a separator into the command list and rebuilds all the groups dependant widgets. |
void |
addSeparator(boolean rebuild)
Inserts a separator into the command list and optionally rebuilds all the groups dependant widgets. |
protected void |
bindMembers(javax.swing.JComponent container,
ButtonFactory factory,
java.lang.String faceName)
Binds this group to the specified container. |
protected void |
bindMembers(javax.swing.JComponent container,
MenuFactory factory,
java.lang.String faceName)
Binds this group to the specified container. |
void |
commandRegistered(CommandManagerEvent event)
CommandManagerListener implementation. |
boolean |
contains(Command c)
Checks if this group contains the specified command. |
javax.swing.AbstractButton |
createButton(ButtonFactory factory,
java.lang.String faceName)
Create a new button for this command using the specified ButtonFactory
and Face . |
javax.swing.AbstractButton |
createButton(ButtonFactory buttonFactory,
java.lang.String buttonFaceName,
MenuFactory menuFactory,
java.lang.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. |
javax.swing.JMenuBar |
createMenuBar()
|
javax.swing.JMenuBar |
createMenuBar(MenuFactory factory)
|
javax.swing.JMenuBar |
createMenuBar(java.lang.String faceName)
|
javax.swing.JMenuBar |
createMenuBar(java.lang.String faceName,
MenuFactory factory)
|
javax.swing.JMenuItem |
createMenuItem(MenuFactory factory,
java.lang.String faceName)
Creates a new menu item for this command. |
javax.swing.JPopupMenu |
createPopupMenu()
Creates a popup menu using Face.MENU and the default MenuFactory . |
javax.swing.JPopupMenu |
createPopupMenu(java.lang.String faceName,
MenuFactory factory)
Creates a popup menu for this group using the specified Face id and MenuFactory . |
javax.swing.JToolBar |
createToolBar()
Creates a new JToolBar bound to this GroupCommand. |
javax.swing.JToolBar |
createToolBar(java.lang.String faceName)
|
javax.swing.JToolBar |
createToolBar(java.lang.String faceName,
ToolbarFactory factory)
Creates a toolbar using the specified facename for the toolbar and the specified toolbar factory for the buttons. |
javax.swing.JToolBar |
createToolBar(ToolbarFactory factory)
|
protected void |
fireMembersChanged()
|
int |
getMemberCount()
Returns the number of members in this group. |
protected GroupMemberFactory |
getMemberFactory()
Gets the groups GroupMemberFactory . |
protected org.pietschy.command.MemberList |
getMemberList()
|
boolean |
isAllowableMember(Command prospectiveMember)
Checks if the specified Command can be added to this group. |
boolean |
isInlineMember(CommandGroup group)
|
boolean |
isMember(CommandGroup group)
|
protected void |
rebuildAllPopups()
|
void |
remove(Command command)
Removes this specified command from the group and rebuilds all dependant widgets. |
void |
remove(Command command,
boolean rebuild)
Removes this specified command from the group and optionally rebuilds all dependant widgets. |
void |
removeGroupListener(GroupListener l)
Removes a GroupListener from the group. |
void |
reset()
Resest this group back to its original state before any commands were programatically added. |
void |
reset(boolean rebuild)
Resest this group back to its original state before any commands were programatically added. |
void |
visit(GroupVisitor visitor)
Visits this group. |
void |
visitChildren(GroupVisitor visitor)
Accepts a GroupVisitor to this group. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected org.pietschy.command.MemberList memberList
Constructor Detail |
---|
public CommandGroup(CommandManager commandManager)
public CommandGroup(java.lang.String id)
CommandManager.defaultInstance
.
id
- the id of the group.public CommandGroup(CommandManager commandManager, java.lang.String groupId)
CommandManager
to obtain commands.
groupId
- this groups unique id.Method Detail |
---|
public javax.swing.JMenuItem createMenuItem(MenuFactory factory, java.lang.String faceName)
createMenuItem
in class Command
public javax.swing.AbstractButton createButton(ButtonFactory factory, java.lang.String faceName)
ButtonFactory
and Face
.
createButton
in class Command
public javax.swing.AbstractButton createButton(ButtonFactory buttonFactory, java.lang.String buttonFaceName, MenuFactory menuFactory, java.lang.String menuFaceName)
public javax.swing.JPopupMenu createPopupMenu()
Face.MENU
and the default MenuFactory
.
public javax.swing.JPopupMenu createPopupMenu(java.lang.String faceName, MenuFactory factory)
Face
id and MenuFactory
.
faceName
- the id of the Face
to use.factory
- the MenuFactory
to use to generate the menu items.
public javax.swing.JToolBar createToolBar()
JToolBar
bound to this GroupCommand.
public javax.swing.JToolBar createToolBar(ToolbarFactory factory)
public javax.swing.JToolBar createToolBar(java.lang.String faceName)
public javax.swing.JToolBar createToolBar(java.lang.String faceName, ToolbarFactory factory)
faceName
- the face name to use for the toolbar name.factory
- the ButtonFactory
to use to create the toolbar buttons.
public javax.swing.JMenuBar createMenuBar()
public javax.swing.JMenuBar createMenuBar(java.lang.String faceName)
public javax.swing.JMenuBar createMenuBar(MenuFactory factory)
public javax.swing.JMenuBar createMenuBar(java.lang.String faceName, MenuFactory factory)
protected void bindMembers(javax.swing.JComponent container, MenuFactory factory, java.lang.String faceName)
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.protected void bindMembers(javax.swing.JComponent container, ButtonFactory factory, java.lang.String faceName)
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.public int getMemberCount()
public void acceptVisitor(GroupVisitor visitor)
visit(GroupVisitor)
or visitChildren(GroupVisitor)
instead.
visitor
- the visitor.public void visit(GroupVisitor visitor)
visitChildren(GroupVisitor)
.
visitor
- the visitior.public void visitChildren(GroupVisitor visitor)
GroupVisitor
to this group. For each active member of this group the
GroupVisitor.visit(org.pietschy.command.ActionCommand)
will be called. Only active members will be visited, that is
commands that have been exported or explicitly added to the group.
visitor
- the visitor.public boolean isMember(CommandGroup group)
public boolean isInlineMember(CommandGroup group)
public void commandRegistered(CommandManagerEvent event)
CommandManagerListener
implementation.
commandRegistered
in interface CommandManagerListener
event
- the event detailing the registered command.protected void rebuildAllPopups()
public boolean contains(Command c)
ToggleCommandGroup
children if they have been added
inline.
c
- the command to check
public void reset()
public void reset(boolean rebuild)
public void add(Command command)
command
- the command to installFace.add(org.pietschy.command.Command, boolean)
public void add(Command command, boolean rebuild)
command
- the command to installFace.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.public void addInline(CommandGroup group)
group
- the group to installFace inline.public void addInline(CommandGroup group, boolean rebuild)
group
- the group to installFace inline.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.public void remove(Command command)
command
- the command to remove.public void remove(Command command, boolean rebuild)
command
- the command to remove.rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.public void addSeparator()
public void addSeparator(boolean rebuild)
rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.public void addGlue()
public void addGlue(boolean rebuild)
rebuild
- true to rebuild all the groups widgets, false to postpone
the rebuild to some later time.lprotected org.pietschy.command.MemberList getMemberList()
protected GroupMemberFactory getMemberFactory()
GroupMemberFactory
. This is a convenience method that delegates directly to
CommandManager.getGroupMemberFactory()
GroupMemberFactory
this group is to use.CommandManager.getGroupMemberFactory()
public void addGroupListener(GroupListener l)
GroupListener
to the group.
l
- the listener to installFace.public void removeGroupListener(GroupListener l)
GroupListener
from the group.
l
- the listener to remove.protected void fireMembersChanged()
public boolean isAllowableMember(Command prospectiveMember)
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.
ToggleCommandGroup.isAllowableMember(org.pietschy.command.Command)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |