public class Docker extends Object implements ComponentListener
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRIORITY
Default window docking priority.
|
protected Vector |
docked
For each window, the set of windows docked to it.
|
protected boolean |
edges
Whether to snap to the edges of the screen.
|
protected boolean |
enabled
Whether to perform docking operations at all.
|
static int |
HIGH_PRIORITY
A docking priority higher than the default.
|
protected Vector |
locations
List of window locations.
|
static int |
LOW_PRIORITY
A docking priority lower than the default.
|
protected Vector |
priorities
List of window docking priorities.
|
protected int |
thresh
Pixel threshold for windows to snap next to one another.
|
protected Vector |
windows
List of windows able to be docked to one another.
|
Constructor and Description |
---|
Docker() |
Modifier and Type | Method and Description |
---|---|
protected static int |
abs(int value)
Integer absolute value function.
|
void |
addWindow(Window w)
Adds a window to the dockable group.
|
void |
addWindow(Window w,
int priority)
Adds a window to the dockable group, at the given docking priority.
|
protected void |
buildGroup(int ndx,
Vector group)
Recursively builds a list of windows docked together into a group.
|
void |
componentHidden(ComponentEvent e)
Called when a window is hidden.
|
void |
componentMoved(ComponentEvent e)
Called when a window is moved.
|
void |
componentResized(ComponentEvent e)
Called when a window is resized.
|
void |
componentShown(ComponentEvent e)
Called when a window is shown.
|
protected Point |
computeDistance(Rectangle a,
Rectangle b)
Computes the distance rectangle A must snap to adjoin rectangle B.
|
protected Point |
computeDistance(Window a,
Window b)
Computes the distance window A must snap to adjoin window B.
|
protected Point |
computeSnap(Window w,
Vector non)
Computes the X and Y distances the docked group should snap.
|
protected void |
dock(Window a,
Window b)
Docks window A to window B.
|
protected HashSet |
getDockSet(int ndx)
Gets the set of docked windows for the window at the specified index.
|
protected HashSet |
getDockSet(Window w)
Gets the set of docked windows for the given window.
|
protected int |
getIndex(Window w)
Gets the given window's index.
|
protected Point |
getLocation(int ndx)
Gets the last recorded location of the window at the specified index.
|
protected Point |
getLocation(Window w)
Gets the given window's last recorded location.
|
protected int |
getPriority(int ndx)
Gets the docking priority for the window at the specified index.
|
protected int |
getPriority(Window w)
Gets the docking priority for the given window.
|
protected Window |
getWindow(int ndx)
Gets the window at the specified index.
|
static void |
main(String[] args)
Tests the Docker class.
|
void |
removeAllWindows()
Removes all windows from the dockable group.
|
void |
removeWindow(Window w)
Removes a window from the dockable group.
|
void |
setEnabled(boolean enabled)
Sets whether docker should perform docking operations.
|
void |
setSnapThreshold(int pixels)
Sets the docking threshold in pixels.
|
void |
setSnapToScreenEdges(boolean snap)
Sets whether windows should snap to the screen edges when close.
|
protected void |
shiftLocation(Window w,
int px,
int py)
Shifts the given window's location by the given amount, without generating
a ComponentEvent.
|
protected void |
undock(Window a,
Window b)
Undocks window A from window B.
|
public static final int DEFAULT_PRIORITY
public static final int LOW_PRIORITY
public static final int HIGH_PRIORITY
protected Vector windows
protected Vector locations
protected Vector docked
protected Vector priorities
protected boolean enabled
protected int thresh
protected boolean edges
public void addWindow(Window w)
public void addWindow(Window w, int priority)
public void removeWindow(Window w)
public void removeAllWindows()
public void setEnabled(boolean enabled)
public void setSnapThreshold(int pixels)
public void setSnapToScreenEdges(boolean snap)
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
protected Window getWindow(int ndx)
protected Point getLocation(int ndx)
protected HashSet getDockSet(int ndx)
protected int getPriority(int ndx)
protected int getIndex(Window w)
protected HashSet getDockSet(Window w)
protected int getPriority(Window w)
protected static int abs(int value)
protected Point computeDistance(Rectangle a, Rectangle b)
protected Point computeDistance(Window a, Window b)
protected Point computeSnap(Window w, Vector non)
protected void shiftLocation(Window w, int px, int py)
protected void buildGroup(int ndx, Vector group)
public static void main(String[] args)
Copyright © 2015–2022 SciJava. All rights reserved.