KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > toolbar > ScriptButtonModel


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.toolbar;
14
15 import com.tonbeller.wcf.controller.RequestContext;
16
17 /**
18  * Toolbar button associated with a property of a session bean. The property is addressed via
19  * a script string.
20  *
21  * @author av
22  */

23 public class ScriptButtonModel implements ToolButtonModel {
24   String JavaDoc modelReference;
25   
26
27   /**
28    * Constructor for ScriptModel.
29    */

30   public ScriptButtonModel(String JavaDoc modelReference) {
31     this.modelReference = modelReference;
32   }
33
34   /**
35    * @see com.tonbeller.wcf.toolbar.ToolButtonModel#isPressed(RequestContext)
36    */

37   public boolean isPressed(RequestContext context) {
38     Boolean JavaDoc value = (Boolean JavaDoc)context.getModelReference(modelReference);
39     return value.booleanValue();
40   }
41
42   /**
43    * @see com.tonbeller.wcf.toolbar.ToolButtonModel#setPressed(RequestContext, boolean)
44    */

45   public void setPressed(RequestContext context, boolean value) {
46     context.setModelReference(modelReference, new Boolean JavaDoc(value));
47   }
48
49 }
50
Popular Tags