Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.group.impl
Class AbstractGroupBuilder

    java.lang.Object
      com.pietschy.command.group.impl.AbstractGroupBuilder

All Implemented Interfaces:
  GroupBuilder

    public abstract class AbstractGroupBuilder

extends java.lang.Object
implements GroupBuilder

Base implementation of `GroupBuilder`. This class provides the core functionality, sub classes need to implement `#applyChanges(Collection)` and `GroupBuilder.discard()`.

Constructor Summary
`protected` | `AbstractGroupBuilder(CommandGroup parent, java.util.Collection<GroupMember> members, ExpansionPointMember expansionMember)` Creates a new builder instance.

Method Summary
`void` | `add(ActionCommand command)` Adds the specified command.
`void` | `add(CommandGroup group)` Adds the specified group.
`void` | `add(java.lang.String id)` Adds the command with the specified id.
`void` | `addExpansionPoint(SeparatorMode mode)` Adds an expansion point to the group using the specified `SeparatorMode`.
`void` | `addGlue()` Adds a glue member to the group.
`void` | `addInline(CommandGroup group)` Adds the specified group as an inline member.
`void` | `addInline(java.lang.String id)` Adds the group with the specified id as an inline member.
`void` | `addSeparator()` Adds a separator member to the group.
`void` | `applyChanges()` Applies the current builder state to the group and discards the builder.
`protected abstract void` | `applyChanges(java.util.Collection<GroupMember> members)`
`void` | `clear()` Clears the group.
`boolean` | `contains(ActionCommand command)` Checks if the builder contains the specified command.
`boolean` | `contains(CommandGroup group)` Checks if the builder contains the specified group.
`boolean` | `contains(java.lang.String id)` Checks if the builder contains the command or group with the specified id.
`protected GroupMember` | `getMemberFor(java.lang.String id)`
`void` | `remove(ActionCommand command)` Removes the specified command from the group.
`void` | `remove(CommandGroup group)` Removes the specified command from the group.
`void` | `remove(java.lang.String id)` Removes the member with the specified id.
`void` | `removeExpansionPoint()` Removes the expasion point.
`protected void` | `validate(Command command)` Validates the the command is non-null and that it's not already a member.
`protected void` | `validate(java.lang.String id)` Validates the specified command id.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.pietschy.command.group.GroupBuilder
`discard`

Constructor Detail

### AbstractGroupBuilder

    protected AbstractGroupBuilder(CommandGroup parent,
                                   java.util.Collection<GroupMember> members,
                                   ExpansionPointMember expansionMember)

  Creates a new builder instance.

  Parameters:
    `parent` - the parent group that is being built.
    `members` - the parent groups existing members.
    `expansionMember` - the parent groups expansion point.

Method Detail

### applyChanges

    public void applyChanges()

  Description copied from interface: `GroupBuilder`
  Applies the current builder state to the group and discards the builder. Further changes to the group will require a new builder instance.

  Specified by:
    `applyChanges` in interface `GroupBuilder`

### applyChanges

    protected abstract void applyChanges(java.util.Collection<GroupMember> members)

### add

    public void add(java.lang.String id)

  Description copied from interface: `GroupBuilder`
  Adds the command with the specified id. The id can be that of an ActionCommand or CommandGroup.

  The group will use it's current binding to locate the actual command instance.

  Specified by:
    `add` in interface `GroupBuilder`
  Parameters:
    `id` - the id of the command or group to add.

### addInline

    public void addInline(java.lang.String id)

  Description copied from interface: `GroupBuilder`
  Adds the group with the specified id as an inline member. Inline members have thier contents embedded directly in the parent group instead of as a sub menu.

  The group will use it's current binding to locate the actual group instance.

  Specified by:
    `addInline` in interface `GroupBuilder`
  Parameters:
    `id` - the id of the group to add.

### add

    public void add(ActionCommand command)

  Description copied from interface: `GroupBuilder`
  Adds the specified command. The command can be anonymous and does not need to be bound.

  Specified by:
    `add` in interface `GroupBuilder`
  Parameters:
    `command` - the command to add.

### add

    public void add(CommandGroup group)

  Description copied from interface: `GroupBuilder`
  Adds the specified group. The added group can be anonymous and does not need to be bound.

  Specified by:
    `add` in interface `GroupBuilder`
  Parameters:
    `group` - the group to add.

### addInline

    public void addInline(CommandGroup group)

  Description copied from interface: `GroupBuilder`
  Adds the specified group as an inline member. Inline members have thier contents embedded directly in the parent group instead of as a sub menu. The added group can be anonymous and does not need to be bound.

  The group will use it's current binding to locate the actual group instance.

  Specified by:
    `addInline` in interface `GroupBuilder`
  Parameters:
    `group` - the group to add.

### addGlue

    public void addGlue()

  Description copied from interface: `GroupBuilder`
  Adds a glue member to the group. Glue members function equivalently to `Box.createGlue()`.

  Glue members are ignored for menu bars on the Mac OS plaform.

  Specified by:
    `addGlue` in interface `GroupBuilder`

### addSeparator

    public void addSeparator()

  Description copied from interface: `GroupBuilder`
  Adds a separator member to the group.

  Specified by:
    `addSeparator` in interface `GroupBuilder`

### remove

    public void remove(java.lang.String id)

  Description copied from interface: `GroupBuilder`
  Removes the member with the specified id.

  Specified by:
    `remove` in interface `GroupBuilder`
  Parameters:
    `id` - the id of the command to remove.

### getMemberFor

    protected GroupMember getMemberFor(java.lang.String id)

### remove

    public void remove(ActionCommand command)

  Description copied from interface: `GroupBuilder`
  Removes the specified command from the group.

  Specified by:
    `remove` in interface `GroupBuilder`
  Parameters:
    `command` - the command to remove.

### remove

    public void remove(CommandGroup group)

  Description copied from interface: `GroupBuilder`
  Removes the specified command from the group.

  Specified by:
    `remove` in interface `GroupBuilder`
  Parameters:
    `group` - the group to remove.

### contains

    public boolean contains(ActionCommand command)

  Description copied from interface: `GroupBuilder`
  Checks if the builder contains the specified command.

  Specified by:
    `contains` in interface `GroupBuilder`
  Parameters:
    `command` - the command to check.
  Returns:
    `true` if the builder already contains the command, `false` otherwise.

### contains

    public boolean contains(CommandGroup group)

  Description copied from interface: `GroupBuilder`
  Checks if the builder contains the specified group.

  Specified by:
    `contains` in interface `GroupBuilder`
  Parameters:
    `group` - the group to check.
  Returns:
    `true` if the builder already contains the group, `false` otherwise.

### contains

    public boolean contains(java.lang.String id)

  Description copied from interface: `GroupBuilder`
  Checks if the builder contains the command or group with the specified id.

  Specified by:
    `contains` in interface `GroupBuilder`
  Parameters:
    `id` - the id of the command or group to check.
  Returns:
    `true` if the builder already contains the command or group, `false` otherwise.

### clear

    public void clear()

  Description copied from interface: `GroupBuilder`
  Clears the group.

  Specified by:
    `clear` in interface `GroupBuilder`

### addExpansionPoint

    public void addExpansionPoint(SeparatorMode mode)

  Description copied from interface: `GroupBuilder`
  Adds an expansion point to the group using the specified `SeparatorMode`. The expansion point will only render it's separators if it contains one or more members.

  Specified by:
    `addExpansionPoint` in interface `GroupBuilder`
  Parameters:
    `mode` - the separator mode to use.
  See Also:
    `CommandGroup.getExpansionPointBuilder()`

### removeExpansionPoint

    public void removeExpansionPoint()

  Description copied from interface: `GroupBuilder`
  Removes the expasion point.

  If not explicitly added again, the expansion point will be automatically inserted at the end of the group with the separator mode `SeparatorMode.NONE`.

  Specified by:
    `removeExpansionPoint` in interface `GroupBuilder`

### validate

    protected void validate(Command command)

  Validates the the command is non-null and that it's not already a member.

  Parameters:
    `command` - the command to validate.

### validate

    protected void validate(java.lang.String id)

  Validates the specified command id. It ensures the id is non-null and that there is not already an existing member with that id.

  Parameters:
    `id` - the id to validate.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch