|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.gui.dock.station.screen.magnet.MagnetController
public class MagnetController
Each ScreenDockStation uses one MagnetController to calculate attractions
between its children. The MagnetController makes use of a MagnetStrategy
and of several AttractorStrategys to modify the location and size of the currently
moved ScreenDockWindow.
ScreenDockWindows have to call start(ScreenDockWindow) when they start
moving or resizing.
| Constructor Summary | |
|---|---|
MagnetController(ScreenDockStation station)
Creates a new MagnetController. |
|
| Method Summary | |
|---|---|
int |
distance(ScreenDockWindow windowA,
MagnetRequest.Side sideA,
ScreenDockWindow windowB,
MagnetRequest.Side sideB,
boolean initialBoundaries)
Calculates the distance between sideA of windowA to sideB of windowB. |
ScreenDockWindow[] |
getAttracted(ScreenDockWindow window)
Gets all the ScreenDockWindows of the station that are attracted to window. |
AttractorStrategy.Attraction |
getAttraction(Dockable moved,
Dockable fixed)
Tells whether fixed and moved attract each other. |
AttractorStrategy |
getAttractorStrategy()
Gets the currently used AttractorStrategy. |
DockController |
getController()
Gets the DockController that is currently used by this MagnetController. |
ScreenDockWindow |
getCurrent()
Gets the window that is currently moved. |
ScreenDockStation |
getStation()
Gets the ScreenDockStation which is using this MagnetController. |
AttractorStrategy.Attraction |
getStickiness(Dockable moved,
Dockable fixed)
Tells whether fixed and moved stick to each other. |
MagnetStrategy |
getStrategy()
Gets the MagnetStrategy that is currently used by this controller. |
int |
getValue(Rectangle rectangle,
MagnetRequest.Side side)
Gets the location of the side side of rectangle. |
int |
getValue(ScreenDockWindow window,
MagnetRequest.Side side,
boolean initialBoundaries)
Gets the location of the side side of window. |
ScreenDockWindow[] |
getWindows()
Gets an array containing all the ScreenDockWindows that are currently shown by the station. |
boolean |
intersectHorizontally(ScreenDockWindow windowA,
ScreenDockWindow windowB,
boolean initialBoundaries)
Tells whether the y coordinate and the height of windowA and windowB
are such that they have at least one pixel at the same height. |
boolean |
intersectVertically(ScreenDockWindow windowA,
ScreenDockWindow windowB,
boolean initialBoundaries)
Tells whether the x coordinate and the width of windowA and windowB
are such that they have at least one pixel at the same width. |
void |
setAttractorStrategy(AttractorStrategy strategy)
Sets the AttractorStrategy to use. |
void |
setController(DockController controller)
Sets the DockController which is to be used by this MagnetController. |
void |
setStrategy(MagnetStrategy strategy)
Sets the MagnetStrategy that is to be used by this controller. |
MagnetizedOperation |
start(ScreenDockWindow window)
Starts a move or resize operation that involves window. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MagnetController(ScreenDockStation station)
MagnetController.
station - the station using this controller, not null| Method Detail |
|---|
@FrameworkOnly public void setController(DockController controller)
DockController which is to be used by this MagnetController.
controller - the controller to use or nullpublic DockController getController()
DockController that is currently used by this MagnetController.
nullpublic ScreenDockStation getStation()
ScreenDockStation which is using this MagnetController.
nullpublic MagnetizedOperation start(ScreenDockWindow window)
window. Only
one operation can be running at the same time.
window - the window which is moved or resized
window further
changes position or size
public AttractorStrategy.Attraction getAttraction(Dockable moved,
Dockable fixed)
fixed and moved attract each other.
moved - the dockable that has movedfixed - the dockable that has not moved
AttractorStrategys
public AttractorStrategy.Attraction getStickiness(Dockable moved,
Dockable fixed)
fixed and moved stick to each other.
moved - the dockable that has movedfixed - the dockable that has not moved
AttractorStrategyspublic ScreenDockWindow getCurrent()
nullpublic ScreenDockWindow[] getWindows()
ScreenDockWindows that are currently shown by the station.
public ScreenDockWindow[] getAttracted(ScreenDockWindow window)
ScreenDockWindows of the station that are attracted to window.
window - the window that has moved and whose partners are searched
null, does not contain window
public int distance(ScreenDockWindow windowA,
MagnetRequest.Side sideA,
ScreenDockWindow windowB,
MagnetRequest.Side sideB,
boolean initialBoundaries)
sideA of windowA to sideB of windowB.
If either window is the current window, then its base boundaries
are used instead of its current boundaires.
windowA - the first windowsideA - the side of the window to checkwindowB - the second windowsideB - the side of the second window to checkinitialBoundaries - if true, then the initial boundaries of window is used
IllegalArgumentException - if sideA and sideB are neither equal nor opposite
public boolean intersectHorizontally(ScreenDockWindow windowA,
ScreenDockWindow windowB,
boolean initialBoundaries)
y coordinate and the height of windowA and windowB
are such that they have at least one pixel at the same height.
windowA - the first windowwindowB - the second windowinitialBoundaries - if true, then the initial boundaries of window is used
true if both windows have at least one pixel on the same height
public boolean intersectVertically(ScreenDockWindow windowA,
ScreenDockWindow windowB,
boolean initialBoundaries)
x coordinate and the width of windowA and windowB
are such that they have at least one pixel at the same width.
windowA - the first windowwindowB - the second windowinitialBoundaries - if true, then the initial boundaries of window is used
true if both windows have at least one pixel on the same width
public int getValue(ScreenDockWindow window,
MagnetRequest.Side side,
boolean initialBoundaries)
side of window. If window is the
current window, then its base boundaries are used
to calculate the coordinates, otherwise ScreenDockWindow.getWindowBounds() is used.
window - some windowside - the side to readinitialBoundaries - if true, then the initial boundaries of window is used
side
public int getValue(Rectangle rectangle,
MagnetRequest.Side side)
side of rectangle.
rectangle - some rectangleside - the side to read
sidepublic MagnetStrategy getStrategy()
MagnetStrategy that is currently used by this controller.
null if no DockController is setpublic void setStrategy(MagnetStrategy strategy)
MagnetStrategy that is to be used by this controller.
strategy - the strategy, a value of null reinstalles the default strategypublic AttractorStrategy getAttractorStrategy()
AttractorStrategy.
Dockables attract each otherpublic void setAttractorStrategy(AttractorStrategy strategy)
AttractorStrategy to use.
strategy - the strategy, a value of null reinstalles the default strategy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||