001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.model.values;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.*;
036: import de.ug2t.model.*;
037: import de.ug2t.unifiedGui.*;
038: import de.ug2t.unifiedGui.transformer.*;
039: import de.ug2t.unifiedGui.validator.*;
040:
041: public class MoLwSingleValue extends MoLwValue implements
042: IMoSingleValue {
043: private Object pem_value = null;
044: private IMoValueContainer pem_parent = null;
045:
046: /**
047: * @param xVal
048: * @param xTr
049: * @param xObs
050: * @param xUiMap
051: * @param xUiErr
052: */
053: public MoLwSingleValue(IUnValidator xVal, IUnTransformer xTr,
054: Vector xObs, UnComponent xUiMap,
055: IMoMappingErrorHandler xUiErr) {
056: super (xVal, xTr, xObs, xUiMap, xUiErr);
057: }
058:
059: public MoLwSingleValue(Object xValue, IUnValidator xVal,
060: IUnTransformer xTr, Vector xObs, UnComponent xUiMap,
061: IMoMappingErrorHandler xUiErr) {
062: super (xVal, xTr, xObs, xUiMap, xUiErr);
063: this .pcmf_setValueValidate(xValue);
064: }
065:
066: public MoLwSingleValue(Object xValue) {
067: this .pcmf_setValueValidate(xValue);
068: }
069:
070: /**
071: *
072: */
073: public MoLwSingleValue() {
074: super ();
075: }
076:
077: /**
078: * <p>
079: * This function returns the stored value
080: * </p>
081: * <p>
082: *
083: *
084: * @return a Object with the stored value
085: * </p>
086: */
087: public Object pcmf_getValue() {
088: return (this .pem_value);
089: } // end pcmf_getValue
090:
091: /**
092: * <p>
093: * This function sets the value of the value object. This value is not valid
094: * (and will not be return by the getValue method) until the validator is
095: * called
096: * </p>
097: * <p>
098: *
099: *
100: * @return a Object with the previous value stored in the value object
101: * </p>
102: * <p>
103: * @param xValue
104: * is the value which is stored by the value object
105: * </p>
106: */
107: public void pcmf_setValue(Object xValue) {
108: this .pem_value = xValue;
109: } // end pcmf_setValue
110:
111: /**
112: * <p>
113: * This function sets the value of the value object. The validator is called
114: * immediately
115: * </p>
116: * <p>
117: *
118: *
119: * @return a Object with the previous value stored in the value object
120: * </p>
121: * <p>
122: * @param xValue
123: * is the value which is stored by the value object
124: * </p>
125: */
126: public Object pcmf_setValueValidate(Object xValue) {
127: Object l_oldV = this .pem_value;
128:
129: this .pem_value = xValue;
130: return (l_oldV);
131: } // end pcmf_setValue
132:
133: /**
134: * <p>
135: * Gets the validator of this value
136: * </p>
137: * <p>
138: *
139: *
140: * @return a IUnValidator
141: * </p>
142: */
143: public IUnValidator pcmf_getValidator() {
144: return (null);
145: } // end pcmf_getValidator
146:
147: /**
148: * <p>
149: * Does ...
150: * </p>
151: * <p>
152: *
153: *
154: * @return a boolean with ...
155: * </p>
156: */
157: public boolean pcmf_model2UI() {
158: if (this .pdm_uiMap == null)
159: return (false);
160:
161: this .pdm_uiMap.pcmf_setValue(this .pem_value);
162:
163: return (true);
164: } // end pcmf_model2UI
165:
166: /**
167: * <p>
168: * Does ...
169: * </p>
170: * <p>
171: *
172: *
173: * @return a boolean with ...
174: * </p>
175: */
176: public boolean pcmf_UI2Model() {
177: if (this .pdm_uiMap == null)
178: return (false);
179:
180: Object l_value = this .pdm_uiMap.pcmf_getValue();
181: this .pcmf_setValue(l_value);
182:
183: return (true);
184: } // end pcmf_UI2Model
185:
186: /**
187: * <p>
188: * Does ...
189: * </p>
190: * <p>
191: *
192: * @return a IMoValue with ...
193: * </p>
194: */
195: public IMoValue pcmf_cloneModelValue(boolean xChilds, boolean xFull) {
196: MoLwSingleValue l_new = new MoLwSingleValue(null, null, null,
197: this .pdm_uiMap, null);
198:
199: l_new.pdm_myTemplateObj = this .pdm_myTemplateObj;
200: l_new.pdm_myTemplate = this .pdm_myTemplate;
201:
202: l_new.pcmf_setValue(this .pem_value);
203: l_new.pcmf_validate();
204:
205: return (l_new);
206: } // end pcmf_cloneModelValue
207:
208: public IMoValue pcmf_cloneModelValue(boolean xChilds) {
209: return (pcmf_cloneModelValue(true, true));
210: }
211:
212: /**
213: * <p>
214: * Does...
215: * </p>
216: * <p>
217: *
218: * @return a Type with
219: * </p>
220: * <p>
221: * @param
222: * </p>
223: */
224: public boolean pcmf_validate() {
225: return (true);
226: }
227:
228: public String toString() {
229: return (this .pem_value.toString());
230: }
231:
232: public IUnTransformer pcmf_setToUITransformer(IUnTransformer xTrans) {
233: KeLog.pcmf_logNotSupportedFatal();
234: return (null);
235: }
236:
237: public IUnTransformer pcmf_setFromUITransformer(
238: IUnTransformer xTrans) {
239: KeLog.pcmf_logNotSupportedFatal();
240: return (null);
241: }
242:
243: public void pcmf_setParent(IMoValueContainer xParent) {
244: this .pem_parent = xParent;
245: }
246:
247: public IMoValueContainer pcmf_getParent() {
248: return (this .pem_parent);
249: }
250: } // end MoSingleValue
|