bibliothek.gui.dock.control.relocator
Interface Merger

All Known Implementing Classes:
MultiMerger, StackMerger, TabMerger

public interface Merger

An algorithm used during drag and drop to merge two DockStations. The Merger usually is not accessed by the involved DockStations or Dockables directly, rather it is accessed by the DockRelocator once a StationDropOperation has been found.

Author:
Benjamin Sigg
See Also:
Combiner, Inserter

Method Summary
 boolean canMerge(StationDropOperation operation, DockStation parent, DockStation child)
          Checks whether merge(StationDropOperation, DockStation, DockStation) will succeed or not.
 void merge(StationDropOperation operation, DockStation parent, DockStation child)
          Moves all children of child to parent, leaving child empty.
 

Method Detail

canMerge

boolean canMerge(StationDropOperation operation,
                 DockStation parent,
                 DockStation child)
Checks whether 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.

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 merge(StationDropOperation, DockStation, DockStation) will succeed

merge

void merge(StationDropOperation operation,
           DockStation parent,
           DockStation child)
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.

Parameters:
operation - the operation that would be executed, can be null
parent - the new parent of the children
child - the station to disolve