bibliothek.gui.dock.control.relocator
Class MultiMerger

java.lang.Object
  extended by bibliothek.gui.dock.control.relocator.MultiMerger
All Implemented Interfaces:
Merger

public class MultiMerger
extends Object
implements Merger

A set of Mergers.

Author:
Benjamin Sigg

Constructor Summary
MultiMerger()
           
 
Method Summary
 void add(Merger merger)
          Adds a new algorithm to this merger.
 boolean canMerge(StationDropOperation operation, DockStation parent, DockStation child)
          Checks whether Merger.merge(StationDropOperation, DockStation, DockStation) will succeed or not.
 Merger get(int index)
          Gets the index'th merger in this list of mergers.
 void merge(StationDropOperation operation, DockStation parent, DockStation child)
          Moves all children of child to parent, leaving child empty.
 void remove(Merger merger)
          Removes merger from this MultiMerger.
 int size()
          Gets the total number of mergers in this set of mergers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiMerger

public MultiMerger()
Method Detail

add

public void add(Merger merger)
Adds a new algorithm to this merger.

Parameters:
merger - the new algorithm, not null

remove

public void remove(Merger merger)
Removes merger from this MultiMerger.

Parameters:
merger - the item to remove

size

public int size()
Gets the total number of mergers in this set of mergers.

Returns:
the size

get

public Merger get(int index)
Gets the index'th merger in this list of mergers.

Parameters:
index - the location
Returns:
the merger, not null

canMerge

public boolean canMerge(StationDropOperation operation,
                        DockStation parent,
                        DockStation child)
Description copied from interface: Merger
Checks whether Merger.merge(StationDropOperation, DockStation, DockStation) will succeed or not. This method will only be called if parent would accept all children of child. This method may be called during "drop" and during "move" operations.

Specified by:
canMerge in interface Merger
Parameters:
operation - the operation that would be executed, can be null
parent - an existing station
child - a station that is dragged around and may be dropped onto parent
Returns:
whether Merger.merge(StationDropOperation, DockStation, DockStation) will succeed

merge

public void merge(StationDropOperation operation,
                  DockStation parent,
                  DockStation child)
Description copied from interface: Merger
Moves all children of child to parent, leaving child empty. This method is only called if canMerge returned true and if the accept-methods allow the operation.
If the parent of child is not parent, then child will be removed from its parent. Otherwise the child remains, allowing this Merger to reuse it.

Specified by:
merge in interface Merger
Parameters:
operation - the operation that would be executed, can be null
parent - the new parent of the children
child - the station to disolve