com.pietschy.command.group.impl
Class ExpansionPointMember

java.lang.Object
  extended by com.pietschy.command.group.impl.AbstractGroupMember
      extended by com.pietschy.command.group.impl.ExpansionPointMember
All Implemented Interfaces:
GroupMember

public class ExpansionPointMember
extends AbstractGroupMember

A GroupMember implementation for handling a groups expansion point.

Version:
$Revision: 1.2 $
Author:
andrewp

Field Summary
protected  java.lang.String name
           
 
Constructor Summary
protected ExpansionPointMember(java.lang.String name)
          Creates a new instance.
 
Method Summary
 void acceptVisitor(GroupVisitor visitor)
          Visits all this expansion points commands and groups.
 void acceptVisitor(Visitor<GroupMember> visitor)
          Visits the expansion point member objects (i.e.
 void add(GroupMember member)
          Adds a member to the expansion point.
 int addComponentTo(javax.swing.JComponent parent, Factory factory, java.lang.String faceContext, java.util.List<java.awt.Component> previousComponents, int buttonIndex)
          Invoked to add this members content to the specified component.
 void addNotify()
          Invoked to notify that this member has been added to its parent group.
 void clear()
          Removes all members from the expansion point.
 void configureSeparators(SeparatorMode mode)
           
 java.lang.Object getId()
          Expasion points don't represent a command to they return themselves.
 GroupMember getMemberFor(java.lang.String id)
          Gets the member for the specified command id.
 java.util.Collection<GroupMember> getMembers()
          Gets the expansion point members.
 java.lang.String getName()
          Gets the name of the expansion point.
 boolean isEmpty()
          Checks if the expansion point is empty.
 boolean isMemberFor(java.lang.String id)
          Checks if this group member represents the specified command.
 boolean isSeparatorAfter()
          Returns true if the expasion point should include a separator after any of it's members.
 boolean isSeparatorBefore()
          Returns true if the expasion point should include a separator before any of it's members.
 boolean isSeparatorBetween()
          Returns true if the expasion point should include a separator between each of it's members.
 java.util.Iterator<GroupMember> iterator()
          Returns an iterator over the expansion points members.
 void remove(GroupMember member)
          Removes a member from the expansion point.
 void removeNotify()
          Invoked to notify that this member has been removed from its parent group.
 void setSeparatorAfter(boolean separatorAfter)
          Configures the expansion point to include a separator after any of it's members.
 void setSeparatorBefore(boolean separatorBefore)
          Configures the expansion point to include a separator before any of it's members.
 void setSeparatorBetween(boolean separatorBetween)
          Configures the expansion point to include a separator between each of it's members.
 int size()
          Returns the sum of all the expansion point members.
 
Methods inherited from class com.pietschy.command.group.impl.AbstractGroupMember
addChangeListener, fireChanged, notifyCommandContainerHierarchyChanged, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Constructor Detail

ExpansionPointMember

protected ExpansionPointMember(java.lang.String name)
Creates a new instance.

Parameters:
name - the expansion points name.
Method Detail

getId

public java.lang.Object getId()
Expasion points don't represent a command to they return themselves.

Returns:
this.

configureSeparators

public void configureSeparators(SeparatorMode mode)

add

public void add(GroupMember member)
Adds a member to the expansion point.

Parameters:
member - the member to add.

remove

public void remove(GroupMember member)
Removes a member from the expansion point.

Parameters:
member - the member to remove.

clear

public void clear()
Removes all members from the expansion point.


getMembers

public java.util.Collection<GroupMember> getMembers()
Gets the expansion point members.

Returns:
the expansion point members.

iterator

public java.util.Iterator<GroupMember> iterator()
Returns an iterator over the expansion points members.

Returns:
an iterator over the expansion points members.

acceptVisitor

public void acceptVisitor(Visitor<GroupMember> visitor)
Visits the expansion point member objects (i.e. not the commands). The visitor is passed to each of the members.

Parameters:
visitor - the visitor to accept.

acceptVisitor

public void acceptVisitor(GroupVisitor visitor)
Visits all this expansion points commands and groups.

Parameters:
visitor - the visitor.

size

public int size()
Returns the sum of all the expansion point members.

Returns:
the sum of all the expansion point members.

getMemberFor

public GroupMember getMemberFor(java.lang.String id)
Gets the member for the specified command id.

Parameters:
id - the command id.
Returns:
the member for the specified command id, or null if there isn't any such member.

isEmpty

public boolean isEmpty()
Checks if the expansion point is empty.

Returns:
true if the expansion point has no members, false otherwise.

getName

public java.lang.String getName()
Gets the name of the expansion point.

Returns:
the name of the expansion point.

isSeparatorBefore

public boolean isSeparatorBefore()
Returns true if the expasion point should include a separator before any of it's members.

Returns:
true if the expasion point should include a separator before any of it's members, false otherwise.

setSeparatorBefore

public void setSeparatorBefore(boolean separatorBefore)
Configures the expansion point to include a separator before any of it's members.

Parameters:
separatorBefore - true to insert a separator before, false otherwise.

isSeparatorAfter

public boolean isSeparatorAfter()
Returns true if the expasion point should include a separator after any of it's members.

Returns:
true if the expasion point should include a separator after any of it's members, false otherwise.

setSeparatorAfter

public void setSeparatorAfter(boolean separatorAfter)
Configures the expansion point to include a separator after any of it's members.

Parameters:
separatorAfter - true to insert a separator after, false otherwise.

isSeparatorBetween

public boolean isSeparatorBetween()
Returns true if the expasion point should include a separator between each of it's members.

Returns:
true if the expasion point should include a separator between each of it's members, false otherwise.

setSeparatorBetween

public void setSeparatorBetween(boolean separatorBetween)
Configures the expansion point to include a separator between each of it's members.

Parameters:
separatorBetween - true to insert a separator between each member, false otherwise.

isMemberFor

public boolean isMemberFor(java.lang.String id)
Checks if this group member represents the specified command. Always returns false.

Parameters:
id - the command id.
Returns:
false.

addComponentTo

public int addComponentTo(javax.swing.JComponent parent,
                          Factory factory,
                          java.lang.String faceContext,
                          java.util.List<java.awt.Component> previousComponents,
                          int buttonIndex)
Description copied from interface: GroupMember
Invoked to add this members content to the specified component.

Parameters:
parent - the component to add the component to.
factory - the factory to be used, either a ButtonFactory or MenuFactory.
faceContext - the context to use when adding the component.
previousComponents - the list of previsous components built by the parent. The member should reuse and components in preference to creating new ones.
buttonIndex - the index that of the member in the parent group.
Returns:
the number of components added by this member.

addNotify

public void addNotify()
Description copied from interface: GroupMember
Invoked to notify that this member has been added to its parent group.


removeNotify

public void removeNotify()
Description copied from interface: GroupMember
Invoked to notify that this member has been removed from its parent group.



Copyright © 2006 - 2007 Andrew Pietsch