KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > StatefulComponent


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 15, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 /**
17  * Codehaus.org.
18  *
19  * @author Ben Yu
20  *
21  */

22 final class StatefulComponent extends ClosureableComponent {
23   private final Object JavaDoc state;
24   /**
25    * @param cc
26    */

27   public StatefulComponent(Component cc, Object JavaDoc obj) {
28     super(cc);
29     this.state = obj;
30   }
31   public final Object JavaDoc getState(){
32     return state;
33   }
34   public String JavaDoc toString(){
35     return "withState (" + getDelegateTarget() + ","+ state + ")";
36   }
37   public Component decorate(Component c){
38     return new StatefulComponent(c, state);
39   }
40 }
41
Popular Tags