com.imagero.swing.drag
Class MagnetManager

java.lang.Object
  extended bycom.imagero.swing.drag.AbstractMagnetManager
      extended bycom.imagero.swing.drag.MagnetManager
Direct Known Subclasses:
ComponentMagnetManager

public class MagnetManager
extends AbstractMagnetManager

MagnetManager.java


Field Summary
static java.lang.String SNAP_RELEASED
           
static java.lang.String SNAP_STARTED
           
 
Constructor Summary
MagnetManager()
           
 
Method Summary
protected  boolean canSnap(int a, int b, int c)
          determine if one Component can snapX to another side effects - determine if snapX was released or/and achieved
protected  void checkDockBottomRight(int a, int b, java.lang.String side)
          determine if one Component can dock to another
protected  void checkDockTopLeft(int a, int b, java.lang.String side)
          determine if one Component can dock to another
protected  boolean checkRectX(java.awt.Rectangle r0, java.awt.Rectangle r1)
           
protected  boolean checkRectY(java.awt.Rectangle r0, java.awt.Rectangle r1)
           
protected  java.awt.Rectangle checkSnapRect(java.awt.Rectangle rect00, java.awt.Rectangle rect0, java.awt.Rectangle rect1)
           
 java.awt.Rectangle computeRect(java.awt.Component comp0)
          compute new bounds for Component
 java.awt.Rectangle computeRect(java.awt.Component comp0, java.awt.Rectangle rect0)
          compute new bounds for component
 com.imagero.eventmgr.ActionManager getActionManager()
          get ActionManager
protected  java.awt.Rectangle getClosestRect(java.awt.Rectangle r0, java.util.Vector rects)
          create Rectangle which position is closest to position of reference Rectangle
 int getSnapReleaseSize()
          if distance between 2 Components more then snapReleaseSize then they can't snapX together
 int getSnapStartSize()
          if distance between 2 Components less then snapStartSize then they can snapX together
 void setSnapReleaseSize(int snapReleaseSize)
          snapStartSize must be less or equals to snapReleaseSize
 void setSnapStartSize(int snapStartSize)
          snapStartSize must be less or equals to snapReleaseSize
 
Methods inherited from class com.imagero.swing.drag.AbstractMagnetManager
add, add, add, add, isActive, remove, remove, remove, removeAll, setActive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNAP_STARTED

public static final java.lang.String SNAP_STARTED
See Also:
Constant Field Values

SNAP_RELEASED

public static final java.lang.String SNAP_RELEASED
See Also:
Constant Field Values
Constructor Detail

MagnetManager

public MagnetManager()
Method Detail

getSnapReleaseSize

public int getSnapReleaseSize()
if distance between 2 Components more then snapReleaseSize then they can't snapX together


setSnapReleaseSize

public void setSnapReleaseSize(int snapReleaseSize)
snapStartSize must be less or equals to snapReleaseSize


getSnapStartSize

public int getSnapStartSize()
if distance between 2 Components less then snapStartSize then they can snapX together


setSnapStartSize

public void setSnapStartSize(int snapStartSize)
snapStartSize must be less or equals to snapReleaseSize


getActionManager

public com.imagero.eventmgr.ActionManager getActionManager()
get ActionManager

Returns:
ActionManager
See Also:
ActionManager

computeRect

public java.awt.Rectangle computeRect(java.awt.Component comp0)
compute new bounds for Component


computeRect

public java.awt.Rectangle computeRect(java.awt.Component comp0,
                                      java.awt.Rectangle rect0)
compute new bounds for component

Parameters:
comp0 - Component
rect0 - future Component's bounds to verify

getClosestRect

protected java.awt.Rectangle getClosestRect(java.awt.Rectangle r0,
                                            java.util.Vector rects)
create Rectangle which position is closest to position of reference Rectangle

Parameters:
r0 - reference Rectangle
rects - Vector which contains some Rectangles

checkSnapRect

protected java.awt.Rectangle checkSnapRect(java.awt.Rectangle rect00,
                                           java.awt.Rectangle rect0,
                                           java.awt.Rectangle rect1)
Parameters:
rect00 - current bounds of our Component
rect0 - new (future) bounds of our Component
rect1 - bounds of another Component

canSnap

protected boolean canSnap(int a,
                          int b,
                          int c)
determine if one Component can snapX to another side effects - determine if snapX was released or/and achieved

Parameters:
a - future coordinate of moving Component
b - current coordinate of static Component
c - current coordinate of moving Component

checkDockTopLeft

protected void checkDockTopLeft(int a,
                                int b,
                                java.lang.String side)
determine if one Component can dock to another

Parameters:
a - future coordinate of moving Component
b - current coordinate of static Component
side - String which identified possible argument for docking

checkDockBottomRight

protected void checkDockBottomRight(int a,
                                    int b,
                                    java.lang.String side)
determine if one Component can dock to another

Parameters:
a - future coordinate of moving Component
b - current coordinate of static Component
side - String which identified possible argument for docking

checkRectY

protected boolean checkRectY(java.awt.Rectangle r0,
                             java.awt.Rectangle r1)

checkRectX

protected boolean checkRectX(java.awt.Rectangle r0,
                             java.awt.Rectangle r1)