fr.emn.lite
Class LiteAttribute

java.lang.Object
  extended byfr.emn.lite.LiteAttribute
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LiteAntiAliasing, LiteColor, LiteComposite, LiteFillColor, LiteHide, LitePixelOperation, LiteStroke

public abstract class LiteAttribute
extends java.lang.Object
implements java.io.Serializable

Lite Attribute (see details)

Examples of how to use LiteAttribute:

Lite parent, child; LiteColor black = new LiteColor(0, 0, 0, 1); LiteColor white = new LiteColor(Color.white); // Sets parent & child's color to black. LiteColor.set(parent.getContext(), black); // Sets child's color to white. LiteColor.set(child.getContext(), white); // Resets child's color to default (parent's color) LiteColor.set(child.getContext(), null);

Lite lite1, lite2; LiteColor acolor = new LiteColor(Color.red); // Sets lite1's color to red LiteColor.set(lite1.getContext(), acolor); // Following is equivalent to : // LiteColor.set(lite2.getContext(), acolor); LiteColor.set(lite2.getContext(), LiteColor.get(lite1.getContext())); // Changes "acolor" to blue in both lite1 & lite2 acolor.replaceBy(new LiteColor(Color.black));

To add new attributes in LiteContexts, just subclass LiteAttribute, implements its abstract methods and add the following code:

public static String id; // Add a unique id (e.g. your class's name) static public Litexxx get(LiteContext lc) { return (Litexxx)lc.getAttributeAt(id); } static public void set(LiteContext lc, Litexxx a) { lc.setAttributeAt(id, a); } You may also add the following method:

public void replaceWith(Litexxx a) { // Replace attribute's value here. }

This method allows an attribute to be replaced by another. This operation affects ALL GRAPHICAL OBJECTS having this attribute. This may reveal useful for changing display options, for example.

See Also:
Serialized Form

Constructor Summary
LiteAttribute()
           
LiteAttribute(java.awt.Graphics2D g)
           
 
Method Summary
abstract  void extract(java.awt.Graphics2D g)
           
abstract  LiteAttribute install(java.awt.Graphics2D g)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteAttribute

public LiteAttribute()

LiteAttribute

public LiteAttribute(java.awt.Graphics2D g)
Method Detail

extract

public abstract void extract(java.awt.Graphics2D g)

install

public abstract LiteAttribute install(java.awt.Graphics2D g)