View Javadoc

1   /*
2      Copyright 2002-2006 Martin van den Bemt
3   
4      Licensed under the Apache License, Version 2.0 (the "License");
5      you may not use this file except in compliance with the License.
6      You may obtain a copy of the License at
7   
8          http://www.apache.org/licenses/LICENSE-2.0
9   
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15  */
16  package org.xulux.guilayer.swing.models;
17  
18  import org.xulux.api.core.IPart;
19  import org.xulux.api.core.ISession;
20  import org.xulux.api.core.PartRequest;
21  import org.xulux.api.gui.IWidget;
22  
23  /**
24   * The cellpartrequest. Used for calling rules in models and renderers.
25   *
26   * @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
27   * @version $Id: CellPartRequest.java,v 1.1 2005/12/18 12:58:21 mvdb Exp $
28   */
29  public class CellPartRequest implements PartRequest {
30  
31      /**
32       * the widget
33       */
34      private IWidget widget;
35      /**
36       * the value
37       */
38      private Object value;
39    
40      /**
41       * @param widget the widget
42       */
43      public CellPartRequest(IWidget widget) {
44          this.widget = widget;
45      }
46    
47      /**
48       * @see org.xulux.nyx.context.PartRequest#getName()
49       */
50      public String getName() {
51          return widget.getName();
52      }
53    
54      /**
55       * @see org.xulux.nyx.context.PartRequest#getPart()
56       */
57      public IPart getPart() {
58          return widget.getPart();
59      }
60    
61      /**
62       * @see org.xulux.nyx.context.PartRequest#getSession()
63       */
64      public ISession getSession() {
65          return getPart().getSession();
66      }
67    
68      /**
69       * @see org.xulux.nyx.context.PartRequest#getType()
70       */
71      public int getType() {
72          return PartRequest.NO_ACTION;
73      }
74    
75      /**
76       * @see org.xulux.nyx.context.PartRequest#getValue()
77       */
78      public Object getValue() {
79          return value;
80      }
81    
82      /**
83       * @see org.xulux.nyx.context.PartRequest#getValue(java.lang.String)
84       */
85      public Object getValue(String field) {
86          return getPart().getWidget(field).getValue();
87      }
88    
89      /**
90       * @see org.xulux.nyx.context.PartRequest#getWidget()
91       */
92      public IWidget getWidget() {
93          return widget;
94      }
95    
96      /**
97       * @see org.xulux.nyx.context.PartRequest#getWidget(java.lang.String)
98       */
99      public IWidget getWidget(String name) {
100         return getPart().getWidget(name);
101     }
102   
103     /**
104      * @see org.xulux.nyx.context.PartRequest#setValue(java.lang.Object)
105      */
106     public void setValue(Object value) {
107         this.value = value;
108     }
109   
110     /**
111      * @see java.lang.Object#clone()
112      */
113     public Object clone() {
114         return null;
115     }
116 
117 }