01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: **/package org.araneaframework.uilib.form.control;
16:
17: /**
18: * This class represents a read only control, that is technically it is not a
19: * true control, but just a label displaying the text to the user.
20: *
21: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
22: *
23: */
24: public class DisplayControl extends BaseControl {
25: /**
26: * Returns <code>false</code>.
27: * @return <code>false</code>.
28: */
29: public boolean isRead() {
30: return false;
31: }
32:
33: public String getRawValueType() {
34: return "Object";
35: }
36:
37: //*********************************************************************
38: //* INTERNAL METHODS
39: //*********************************************************************
40:
41: /**
42: * Returns {@link ViewModel}.
43: * @return {@link ViewModel}.
44: */
45: public Object getViewModel() {
46: return new ViewModel();
47: }
48:
49: //*********************************************************************
50: //* VIEW MODEL
51: //*********************************************************************
52:
53: /**
54: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
55: *
56: */
57: public class ViewModel extends BaseControl.ViewModel {
58:
59: private Object value;
60:
61: /**
62: * Takes an outer class snapshot.
63: */
64: public ViewModel() {
65: //XXX: hack emulating process()
66: innerData = DisplayControl.this .getRawValue();
67: this .value = innerData;
68: }
69:
70: /**
71: * Returns value.
72: * @return value.
73: */
74: public Object getValue() {
75: return value;
76: }
77:
78: }
79: }
|