ilog.views.prototypes
Class IlvInvertBehavior

java.lang.Object
  extended by ilog.views.prototypes.IlvBehavior
      extended by ilog.views.prototypes.IlvSingleBehavior
          extended by ilog.views.prototypes.IlvAnimationBehavior
              extended by ilog.views.prototypes.IlvInvertBehavior
All Implemented Interfaces:
IlvPersistentObject, Serializable

public class IlvInvertBehavior
extends IlvAnimationBehavior

The class IlvInvertBehavior is a subclass of IlvAnimationBehavior that inverts two values of an object at a specified time interval. It can be used, for example, to invert two colors.

See Also:
Serialized Form

Constructor Summary
IlvInvertBehavior(IlvInputStream in)
          Reads the behavior from an IlvInputStream stream.
IlvInvertBehavior(IlvInvertBehavior source)
          Creates a new behavior object by copying an existing one.
IlvInvertBehavior(String name, String period, String value1, String value2)
          Creates a new IlvInvertBehavior object that inverts the values of two properties at a specified time interval.
 
Method Summary
 IlvBehavior copy()
          Returns a copy of the behavior.
protected  void doit()
          Inverts the values specified by the value1 and value2 parameters passed to the constructor.
 int getSynchronizationCount()
          Implementation of the Timer interface.
 String getValue1()
          Gets the name of the first value to be inverted.
 String getValue2()
          Gets the name of the second value to be inverted.
 void setValue1(String value1)
          Sets the name of the first value to be inverted.
 void setValue2(String value2)
          Sets the name of the second value to be inverted.
 String toString()
          Returns a short text describing this behavior object.
 void write(IlvOutputStream out)
          Writes the behavior to an IlvOutputStream.
 
Methods inherited from class ilog.views.prototypes.IlvAnimationBehavior
attach, detach, get, getPeriod, getTimerPeriod, set, setPeriod, start, stop, timerTicked
 
Methods inherited from class ilog.views.prototypes.IlvSingleBehavior
get, getName, getValueNames, set, setName
 
Methods inherited from class ilog.views.prototypes.IlvBehavior
getParameter, isOutput, isReadable, isWritable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvInvertBehavior

public IlvInvertBehavior(String name,
                         String period,
                         String value1,
                         String value2)
Creates a new IlvInvertBehavior object that inverts the values of two properties at a specified time interval.

Parameters:
name - the name of the property defined by this behavior, which is a boolean value used to start or stop the animation.
period - the animation period in milliseconds. This value can be either an immediate value (for example, 100), or the name of another behavior which will be read to get the actual period value.
value1 - the name of the first value to be inverted.
value2 - the name of the second value to be inverted.

IlvInvertBehavior

public IlvInvertBehavior(IlvInvertBehavior source)
Creates a new behavior object by copying an existing one.

Parameters:
source - the behavior object to be copied.

IlvInvertBehavior

public IlvInvertBehavior(IlvInputStream in)
                  throws IlvReadFileException
Reads the behavior from an IlvInputStream stream. This constructor must be called by the input constructors of subclasses.

Parameters:
in - The input stream.
Throws:
IlvReadFileException - if the stream format is not correct.
Method Detail

write

public void write(IlvOutputStream out)
           throws IOException
Writes the behavior to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvAnimationBehavior
Parameters:
out - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

copy

public IlvBehavior copy()
Returns a copy of the behavior.

Specified by:
copy in class IlvBehavior

toString

public String toString()
Returns a short text describing this behavior object. This text can be used by GUI editors to display the behavior description.

Specified by:
toString in class IlvBehavior

doit

protected void doit()
             throws IlvValueException
Inverts the values specified by the value1 and value2 parameters passed to the constructor.

Specified by:
doit in class IlvAnimationBehavior
Throws:
IlvValueException - if an error occurred while setting or reading a value.

setValue1

public void setValue1(String value1)
Sets the name of the first value to be inverted.


getValue1

public String getValue1()
Gets the name of the first value to be inverted.


setValue2

public void setValue2(String value2)
Sets the name of the second value to be inverted.


getValue2

public String getValue2()
Gets the name of the second value to be inverted.


getSynchronizationCount

public int getSynchronizationCount()
Implementation of the Timer interface. This method returns 2 to ensure that the object's values will be inverted an even number of times, so that the object is left in its initial state.

Overrides:
getSynchronizationCount in class IlvAnimationBehavior


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.