dks.src.gradientEditor
Class CGradient

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<CGradientColor>
              extended by dks.src.gradientEditor.CGradient
All Implemented Interfaces:
Changeable, XMLWritable, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<CGradientColor>, java.util.Collection<CGradientColor>, java.util.List<CGradientColor>, java.util.RandomAccess

public class CGradient
extends java.util.ArrayList<CGradientColor>
implements XMLWritable, Changeable

This class implements a gradient which can be saved in a XML format
date : 3 sept. 07

Author:
DarK Sidious
See Also:
Serialized Form

Constructor Summary
CGradient()
           
CGradient(int angle, boolean radial)
           
 
Method Summary
 boolean add(CGradientColor color)
           
 void add(int index, CGradientColor color)
           
 boolean addAll(java.util.Collection<? extends CGradientColor> colors)
           
 boolean addAll(int index, java.util.Collection<? extends CGradientColor> colors)
           
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Add a ChangeListener which will notify when the object change
 CGradient clone()
           
 boolean equals(java.lang.Object obj)
           
 int getAngle()
           
 java.awt.MultipleGradientPaint getPaint(java.awt.Rectangle position)
           
 int hashCode()
           
 boolean isRadial()
           
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Remove a ChangeListener
 CGradientColor set(int index, CGradientColor color)
           
 void setAngle(int angle)
           
 void setRadial(boolean radial)
           
 java.lang.String toString()
           
 void XMLload(org.jdom.Element root)
          Construct the object with the data contains in the root DOM Element
 void XMLsave(org.jdom.Element root)
          Generate a DOM Element containing the children make by the object
 
Methods inherited from class java.util.ArrayList
clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

CGradient

public CGradient()

CGradient

public CGradient(int angle,
                 boolean radial)
Parameters:
angle - the angle of the gradient's line
radial - if true, the gradiant is a radial gradient
Method Detail

add

public boolean add(CGradientColor color)
Specified by:
add in interface java.util.Collection<CGradientColor>
Specified by:
add in interface java.util.List<CGradientColor>
Overrides:
add in class java.util.ArrayList<CGradientColor>

add

public void add(int index,
                CGradientColor color)
Specified by:
add in interface java.util.List<CGradientColor>
Overrides:
add in class java.util.ArrayList<CGradientColor>

addAll

public boolean addAll(java.util.Collection<? extends CGradientColor> colors)
Specified by:
addAll in interface java.util.Collection<CGradientColor>
Specified by:
addAll in interface java.util.List<CGradientColor>
Overrides:
addAll in class java.util.ArrayList<CGradientColor>

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends CGradientColor> colors)
Specified by:
addAll in interface java.util.List<CGradientColor>
Overrides:
addAll in class java.util.ArrayList<CGradientColor>

set

public CGradientColor set(int index,
                          CGradientColor color)
Specified by:
set in interface java.util.List<CGradientColor>
Overrides:
set in class java.util.ArrayList<CGradientColor>

clone

public CGradient clone()
Overrides:
clone in class java.util.ArrayList<CGradientColor>
Returns:
the clone of the object
See Also:
ArrayList.clone()

getAngle

public int getAngle()
Returns:
the angle of the gradient's line

setAngle

public void setAngle(int angle)
Parameters:
angle - the angle of the gradient's line

isRadial

public boolean isRadial()
Returns:
if true, the gradient is a radial gradient

setRadial

public void setRadial(boolean radial)
Parameters:
radial - if true, the gradient is a radial gradient

getPaint

public java.awt.MultipleGradientPaint getPaint(java.awt.Rectangle position)
Parameters:
position - the position of the gradient
Returns:
the Paint to use to fill a shape

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Description copied from interface: Changeable
Add a ChangeListener which will notify when the object change

Specified by:
addChangeListener in interface Changeable
Parameters:
listener - the ChangeListener to add

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Description copied from interface: Changeable
Remove a ChangeListener

Specified by:
removeChangeListener in interface Changeable
Parameters:
listener - the ChangeListener to remove

XMLload

public void XMLload(org.jdom.Element root)
             throws org.jdom.JDOMException
Description copied from interface: XMLWritable
Construct the object with the data contains in the root DOM Element

Specified by:
XMLload in interface XMLWritable
Parameters:
root - the XML DOM element to use for loading the properties of the gradient
Throws:
org.jdom.JDOMException
See Also:
XMLWritable.XMLload(org.jdom.Element)

XMLsave

public void XMLsave(org.jdom.Element root)
Description copied from interface: XMLWritable
Generate a DOM Element containing the children make by the object

Specified by:
XMLsave in interface XMLWritable
Parameters:
root - the XML DOM element to use for saving the properties of the gradient
See Also:
XMLWritable.XMLsave(org.jdom.Element)

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<CGradientColor>
Specified by:
hashCode in interface java.util.List<CGradientColor>
Overrides:
hashCode in class java.util.AbstractList<CGradientColor>
Returns:
the hashcode of the object
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection<CGradientColor>
Specified by:
equals in interface java.util.List<CGradientColor>
Overrides:
equals in class java.util.AbstractList<CGradientColor>
Parameters:
obj - the object to compare
Returns:
the equality of the object
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<CGradientColor>