public class DefaultMagnetStrategy extends Object implements MagnetStrategy
DefaultMagnetStrategy is based on the DefaultMagnetOperation. It searches the nearest
attracted ScreenDockWindow to a moved side and if that other window is nearer than a given threshold
then the moved window is attracted.| Constructor and Description |
|---|
DefaultMagnetStrategy() |
| Modifier and Type | Method and Description |
|---|---|
int |
getThreshold()
Tells how many pixels two sides can be apart and still attract each other.
|
void |
install(MagnetController controller)
Informs this
MagnetStrategy that it will be used by controller. |
void |
setThreshold(int threshold)
Sets how many pixels two sides can be apart and still attract each other.
|
MagnetOperation |
start(MagnetController controller,
MagnetRequest request)
Called by
controller after a ScreenDockWindow moved or changed
its size (or both). |
void |
uninstall(MagnetController controller)
Informs this
MagnetStrategy that it is no longer used by controller. |
public void setThreshold(int threshold)
threshold - the maximal distance, at least 1public int getThreshold()
public void install(MagnetController controller)
MagnetStrategyMagnetStrategy that it will be used by controller.install in interface MagnetStrategycontroller - the controller using this strategy, not nullpublic void uninstall(MagnetController controller)
MagnetStrategyMagnetStrategy that it is no longer used by controller.uninstall in interface MagnetStrategycontroller - the controller which no longer uses this strategypublic MagnetOperation start(MagnetController controller, MagnetRequest request)
MagnetStrategycontroller after a ScreenDockWindow moved or changed
its size (or both). This method creates a new MagnetOperation which is tied to
request. The MagnetOperation will then find out which Dockable
is attracted to which other Dockable.start in interface MagnetStrategycontroller - the caller of this method, may be used to find other ScreenDockWindowsrequest - detailed information about the eventCopyright © 2017 Docking Frames. All rights reserved.