com.pietschy.command.group.impl
Class StaticMember

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

public class StaticMember
extends AbstractCommandMember

The standard GroupMember implementation for commands and groups.


Constructor Summary
StaticMember(CommandGroup parent, Command command)
          Creates a new instance that adds the specified command to the parent.
 
Method Summary
 void acceptVisitor(GroupVisitor visitor)
          Accepts a visitor to the members command or commands.
 int addComponentTo(javax.swing.JComponent container, 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.
protected  java.lang.String getCommandId()
           
 boolean isMemberFor(java.lang.String id)
          Checks if this member represents the command with the specified id.
protected  java.awt.Component prepareComponent(java.util.List<java.awt.Component> previous, Factory factory, java.lang.String faceContext)
          Prepares the component to add to the parent.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class com.pietschy.command.group.impl.AbstractCommandMember
addNotify, getCommand, getId, getParent, removeNotify, size
 
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, wait, wait, wait
 

Constructor Detail

StaticMember

public StaticMember(CommandGroup parent,
                    Command command)
Creates a new instance that adds the specified command to the parent.

Parameters:
parent - the parent group.
command - the command to add.
Method Detail

getCommandId

protected java.lang.String getCommandId()

addComponentTo

public int addComponentTo(javax.swing.JComponent container,
                          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:
container - 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.

prepareComponent

protected java.awt.Component prepareComponent(java.util.List<java.awt.Component> previous,
                                              Factory factory,
                                              java.lang.String faceContext)
Prepares the component to add to the parent. This method will scan the list of previous components to see if it can reuse any.

Parameters:
previous - the components that were previously added.
factory - the factory to create the component.
faceContext - the context to use.
Returns:
the component to add.

isMemberFor

public boolean isMemberFor(java.lang.String id)
Description copied from interface: GroupMember
Checks if this member represents the command with the specified id.

Parameters:
id - the command id.
Returns:
true if this member represents the specified command, false otherwise.

acceptVisitor

public void acceptVisitor(GroupVisitor visitor)
Description copied from interface: GroupMember
Accepts a visitor to the members command or commands.

Parameters:
visitor - the visitor.

toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.


Copyright © 2006 - 2007 Andrew Pietsch