KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtriver > open > vectorvisuals > persistence > RectangularShapePersistenceDelegate


1 /*
2  * RectangularShapePersistenceDelegate.java
3  *
4  * Created on Oct 24, 2005, 23:56
5  */

6 package com.thoughtriver.open.vectorvisuals.persistence;
7
8 import java.awt.geom.*;
9 import java.beans.*;
10
11 /**
12  * This delegate provides base persistence capability for most <CODE>RectangularShape</CODE>
13  * concrete subclasses.
14  *
15  * @author Brandon Franklin
16  * @version $Date: 2006/11/25 09:08:28 $
17  */

18 public class RectangularShapePersistenceDelegate extends DefaultPersistenceDelegate {
19
20     /**
21      * {@inheritDoc}
22      */

23     @Override JavaDoc
24     protected void initialize(final Class JavaDoc<?> type, final Object JavaDoc oldInstance, final Object JavaDoc newInstance, final Encoder out) {
25         super.initialize(type, oldInstance, newInstance, out);
26         RectangularShape shape = (RectangularShape) oldInstance;
27         Rectangle2D frame = shape.getFrame();
28         out.writeStatement(new Statement(oldInstance, "setFrame", new Object JavaDoc[] {
29                 frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight()
30         }));
31     }
32
33 }
34
Popular Tags