bibliothek.gui.dock.station.screen.magnet
Class StickMagnetGraphConstraint

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.magnet.StickMagnetGraphConstraint

public class StickMagnetGraphConstraint
extends Object

A constraint tells how much a side of a ScreenDockWindow has to move. Constraints are used by the StickMagnetGraph during calucaltions.

Author:
Benjamin Sigg

Constructor Summary
StickMagnetGraphConstraint()
          Creates a new constraint
 
Method Summary
 int get(MagnetRequest.Side side)
          Gets the value that was set earlier for side.
 boolean isDirect(MagnetRequest.Side side)
          Tells whether side is a directly set side.
 boolean isHard(MagnetRequest.Side side)
          Tells whether side is a hard side.
 boolean isSet(MagnetRequest.Side side)
          Tells whether set(MagnetRequest.Side, int) was called for side.
 void reset()
          Unsets all values of this constraint.
 void set(MagnetRequest.Side side, int delta)
          Sets how much side has to be moved.
 void set(MagnetRequest.Side side, int delta, boolean direct, boolean hard)
          Calls set(MagnetRequest.Side, int), setDirect(MagnetRequest.Side, boolean) and setHard(MagnetRequest.Side, boolean).
 void setDirect(MagnetRequest.Side side, boolean direct)
          Marks side to be set directly.
 void setHard(MagnetRequest.Side side, boolean hard)
          Marks side as a hard side.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StickMagnetGraphConstraint

public StickMagnetGraphConstraint()
Creates a new constraint

Method Detail

reset

public void reset()
Unsets all values of this constraint.


toString

public String toString()
Overrides:
toString in class Object

set

public void set(MagnetRequest.Side side,
                int delta)
Sets how much side has to be moved.

Parameters:
side - the side to move
delta - the amount of pixels to move

set

public void set(MagnetRequest.Side side,
                int delta,
                boolean direct,
                boolean hard)
Calls set(MagnetRequest.Side, int), setDirect(MagnetRequest.Side, boolean) and setHard(MagnetRequest.Side, boolean).

Parameters:
side - the side to change
delta - the amount of pixels to move side
direct - whether the side was calculated or just guessed
hard - whether the side depends directly from user input

isSet

public boolean isSet(MagnetRequest.Side side)
Tells whether set(MagnetRequest.Side, int) was called for side.

Parameters:
side - the side to check
Returns:
true if set(MagnetRequest.Side, int) was called at least once

get

public int get(MagnetRequest.Side side)
Gets the value that was set earlier for side.

Parameters:
side - the side to get
Returns:
the amount of pixels to move this side
Throws:
IllegalArgumentException - if side was not set

setHard

public void setHard(MagnetRequest.Side side,
                    boolean hard)
Marks side as a hard side. A hard side depends directly from the user input.

Parameters:
side - the side to change
hard - whether the side is hard or not

isHard

public boolean isHard(MagnetRequest.Side side)
Tells whether side is a hard side. A hard side depends directly from the user input.

Parameters:
side - the side to access
Returns:
whether the side is hard

setDirect

public void setDirect(MagnetRequest.Side side,
                      boolean direct)
Marks side to be set directly. A direct side is actually calculated, an indirect side is just guessed.

Parameters:
side - the side to change
direct - whether the side was set directly

isDirect

public boolean isDirect(MagnetRequest.Side side)
Tells whether side is a directly set side.

Parameters:
side - the side to access
Returns:
whether the side was set directly