Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ContextImpl.java

Go to the documentation of this file.
00001 
00066 package com.arcle.rmt.superwaba.model.imp.rqml;
00067 
00068 import superwaba.ext.xplat.io.Storable;
00069 import superwaba.ext.xplat.io.DataStream;
00070 
00071 import com.arcle.rmt.superwaba.model.imp.*;
00072 import com.arcle.rmt.rqml.*;
00073 
00079 public class ContextImpl extends RQMLFirstClassImpl implements Context {
00080     public GenericMemento createMemento() {
00081         return new Memento(this);
00082     }
00083 
00084     //-----------------------------------------------------------------------
00085     // Context implementations
00086 
00087     public Origin getOrigin() {
00088         if (origin == null) {
00089             origin = createOriginImpl();
00090         }
00091         return origin;
00092     }
00093 
00094 
00095 
00096     public TextualData getTextualData() {
00097         if (textualData == null) {
00098             textualData = createTextualDataImpl();
00099         }
00100         return textualData;
00101     }
00102 
00103     //-----------------------------------------------------------------------
00104     // Factory Methods
00105 
00106     protected TextualDataImpl createTextualDataImpl() {
00107         return new TextualDataImpl();
00108     }
00109 
00110     protected OriginImpl createOriginImpl() {
00111         return new OriginImpl();
00112     }
00113 
00114     //-----------------------------------------------------------------------
00115     // Member Variables
00116 
00117     private TextualDataImpl textualData = null;
00118 
00119     private OriginImpl origin = null;
00120 
00121 
00122     //-----------------------------------------------------------------------
00123     // Inner Classes
00124 
00125     protected static class Memento extends RQMLFirstClassImpl.Memento {
00126         public Memento(ContextImpl originator) {
00127             super(originator);
00128         }
00129 
00130         public Storable getInstance() {
00131             // This memento is not directly stored in the Catalog as an
00132             // object, so this factory method is not required.
00133             return null;
00134         }
00135 
00136         public byte getID() {
00137             return DocumentImpl.CONTEXT_ID;
00138         }
00139 
00140         public void saveState(DataStream data) {
00141             super.saveState(data);
00142             final ContextImpl org = (ContextImpl) getOriginator();
00143             saveMementoable(org.origin, data);
00144             saveMementoable(org.textualData, data);
00145 
00146         }
00147 
00148         public void loadState(DataStream data) {
00149             super.loadState(data);
00150             final ContextImpl org = (ContextImpl) getOriginator();
00151 
00152             org.origin = (OriginImpl) loadMementoable(data, new MementoableFactory() {
00153                 public Mementoable createOriginator() {
00154                     return org.createOriginImpl();
00155                 }
00156             });
00157 
00158             org.textualData = (TextualDataImpl) loadMementoable(data, new MementoableFactory() {
00159                 public Mementoable createOriginator() {
00160                     return org.createTextualDataImpl();
00161                 }
00162             });
00163         }
00164 
00165     }
00166 }

Generated on Fri Jun 18 19:51:10 2004 for Arcle Rambutan by doxygen 1.3.5