fr.emn.lite
Class LiteContext

java.lang.Object
  extended byfr.emn.lite.LiteContext
All Implemented Interfaces:
java.io.Serializable

public class LiteContext
extends java.lang.Object
implements java.io.Serializable

LiteAttribute provides static methods to modify or initialize a LiteContext.

This allows LiteContext to accept new subclassed LiteAttributes. You must assign a DIFFERENT ID to each LiteAttribute subclass.

Examples of use:

LiteColor.set(context, new LiteColor(Color.black)); LiteColor.set(context, null); // unset LiteColor c = LiteColor.get(context);

To make a context the current context, use install: context.install(g);

Or, if you want to install a context temporarily:

LiteContext old = context.install(g); ... old.install(g);

See Also:
Serialized Form

Constructor Summary
LiteContext()
           
 
Method Summary
 java.util.Map attributes()
           
 void extract(java.awt.Graphics2D g)
          Updates from Graphics2D all attributes that are already defined.
 LiteAttribute getAttribute(java.lang.String id)
           
 LiteContext install(java.awt.Graphics2D g)
          Installs all defined attributes in Graphics2D and returns Graphics2D's old attributes.
 void setAttribute(java.lang.String id, LiteAttribute a)
          call setAttribute(id, null) to unset an attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteContext

public LiteContext()
Method Detail

attributes

public java.util.Map attributes()

extract

public void extract(java.awt.Graphics2D g)
Updates from Graphics2D all attributes that are already defined.

This has NO EFFECT on an empty instance.


getAttribute

public LiteAttribute getAttribute(java.lang.String id)

install

public LiteContext install(java.awt.Graphics2D g)
Installs all defined attributes in Graphics2D and returns Graphics2D's old attributes.


setAttribute

public void setAttribute(java.lang.String id,
                         LiteAttribute a)
call setAttribute(id, null) to unset an attribute