DESY ACOP Beans Home

com.cosylab.gui.components.range2
Class ShiftValuePolicy

java.lang.Object
  extended by com.cosylab.gui.components.range2.RangedValuePolicy
      extended by com.cosylab.gui.components.range2.ShiftValuePolicy

public class ShiftValuePolicy
extends RangedValuePolicy

Defines value policy that maintains constant span. Whenever value moves outside the bounds of the range, min and max will be adjusted to follow the value or will be set to limit of the range.

Version:
$id$
Author:
Ales Pucelj

Constructor Summary
ShiftValuePolicy()
          Default constructor for ShiftValuePolicy.
ShiftValuePolicy(double factor)
          Default constructor for ShiftValuePolicy.
 
Method Summary
 double getFactor()
          Returns factor ammount.
 void setFactor(double factor)
          Sets new shift factor.
 RangedValue validate(RangedValue params)
          Calculates new limits for the range.
 
Methods inherited from class com.cosylab.gui.components.range2.RangedValuePolicy
addPeerPolicy, getPeerPolicy, insertPeerPolicy, removePeerPolicy, removePeerPolicyByType, validatePeerPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShiftValuePolicy

public ShiftValuePolicy()
Default constructor for ShiftValuePolicy.


ShiftValuePolicy

public ShiftValuePolicy(double factor)
Default constructor for ShiftValuePolicy.

Parameters:
factor - double
Method Detail

validate

public RangedValue validate(RangedValue params)
Calculates new limits for the range. If possible, the scale will only be shifted by ammount specified by factor. In case that is insufficient, the limit will be adjusted so the new limit is offset from value by factor ammount.

Specified by:
validate in class RangedValuePolicy
Parameters:
params - RangedValueHolder
Returns:
if the validation require the change of value or bounds of the RangedValue a new RangedValue with appropriate values should be returned
See Also:
com.cosylab.gui.components.range.RangedValuePolicy#validate(RangedValueHolder)

getFactor

public double getFactor()
Returns factor ammount.

Returns:
double current factor ammount.

setFactor

public void setFactor(double factor)
Sets new shift factor. This ammount will be between 0 and 1 and will be adjusted to fit into this range.

Parameters:
factor - double


Copyright © 2010. All Rights Reserved.