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.model.persistence.*;
038: import de.ug2t.unifiedGui.*;
039: import de.ug2t.unifiedGui.transformer.*;
040: import de.ug2t.unifiedGui.validator.*;
041:
042: public abstract class MoValue implements IMoValue {
043: protected IUnValidator pdm_validator = null;
044: protected IUnTransformer pdm_transformer = null;
045: protected Vector pdm_observers = null;
046: protected UnComponent pdm_uiMap = null;
047: protected IMoMappingErrorHandler pdm_uiErr = null;
048: protected IMoReader pdm_reader = null;
049: protected IMoWriter pdm_writer = null;
050: protected String pdm_myTemplate = null;
051: protected IMoValue pdm_myTemplateObj = null;
052: protected Object pdm_addInfo = null;
053:
054: /**
055: *
056: */
057: protected MoValue() {
058: super ();
059: }
060:
061: /**
062: *
063: */
064: protected MoValue(IUnValidator xVal, IUnTransformer xTr,
065: Vector xObs, UnComponent xUiMap,
066: IMoMappingErrorHandler xUiErr) {
067: this .pdm_validator = xVal;
068: this .pdm_transformer = xTr;
069: this .pdm_observers = xObs;
070: this .pdm_uiMap = xUiMap;
071: this .pdm_uiErr = xUiErr;
072: this .pdm_myTemplate = null;
073: this .pdm_myTemplateObj = this ;
074:
075: return;
076: }
077:
078: /**
079: * <p>
080: * ...
081: * </p>
082: * <p>
083: *
084: * </p>
085: */
086: protected void pemf_callObservers() {
087: if (this .pdm_observers != null) {
088: Iterator l_it = this .pdm_observers.iterator();
089: while (l_it.hasNext())
090: ((IMoObserver) l_it.next()).pcmf_modelChanged(this );
091: }
092: }
093:
094: /**
095: * <p>
096: * Does...
097: * </p>
098: * <p>
099: *
100: * @return a Type with
101: * </p>
102: * <p>
103: * @param
104: * </p>
105: */
106: public IUnValidator pcmf_setValidator(IUnValidator xValidator) {
107: IUnValidator l_val = this .pdm_validator;
108: this .pdm_validator = xValidator;
109:
110: return (l_val);
111: }
112:
113: /**
114: * <p>
115: * Does...
116: * </p>
117: * <p>
118: *
119: * @return a Type with
120: * </p>
121: * <p>
122: * @param
123: * </p>
124: */
125: public UnComponent pcmf_setUiMap(UnComponent xMap) {
126: UnComponent l_ui = this .pdm_uiMap;
127: this .pdm_uiMap = xMap;
128:
129: return (l_ui);
130: }
131:
132: /**
133: * <p>
134: * Does...
135: * </p>
136: * <p>
137: *
138: * @return a Type with
139: * </p>
140: * <p>
141: * @param
142: * </p>
143: */
144: public IUnTransformer pcmf_setTransformer(IUnTransformer xTr) {
145: IUnTransformer l_tr = this .pdm_transformer;
146: this .pdm_transformer = xTr;
147:
148: return (l_tr);
149: }
150:
151: /**
152: * <p>
153: * Does...
154: * </p>
155: * <p>
156: *
157: * @return a Type with
158: * </p>
159: * <p>
160: * @param
161: * </p>
162: */
163: public IMoObserver pcmf_addObserver(IMoObserver xObserv) {
164: if (this .pdm_observers == null)
165: this .pdm_observers = new Vector();
166:
167: this .pdm_observers.add(xObserv);
168:
169: return (xObserv);
170: }
171:
172: /**
173: * <p>
174: * Does...
175: * </p>
176: * <p>
177: *
178: * @return a Type with
179: * </p>
180: * <p>
181: * @param
182: * </p>
183: */
184: public IMoObserver pcmf_removeObserver(IMoObserver xObs) {
185: if (this .pdm_observers == null)
186: return (null);
187:
188: return (this .pdm_observers.remove(xObs) ? xObs : null);
189: }
190:
191: /**
192: * <p>
193: * Does...
194: * </p>
195: * <p>
196: *
197: * @return a Type with
198: * </p>
199: * <p>
200: * @param
201: * </p>
202: */
203: public IMoReader pcmf_setReader(IMoReader xReader) {
204: IMoReader l_pr = this .pdm_reader;
205: this .pdm_reader = xReader;
206:
207: return (l_pr);
208: }
209:
210: /**
211: * <p>
212: * Does...
213: * </p>
214: * <p>
215: *
216: * @return a Type with
217: * </p>
218: * <p>
219: * @param
220: * </p>
221: */
222: public IMoWriter pcmf_setWriter(IMoWriter xWriter) {
223: IMoWriter l_pw = this .pdm_writer;
224: this .pdm_writer = xWriter;
225:
226: return (l_pw);
227: }
228:
229: /**
230: * <p>
231: * Does...
232: * </p>
233: * <p>
234: *
235: * @return a Type with
236: * </p>
237: * <p>
238: * @param
239: * </p>
240: */
241: public boolean pcmf_read(IMoValue xTpl) {
242: if (this .pdm_reader == null)
243: return (false);
244:
245: return (this .pdm_reader.pcmf_tplRead(xTpl, this ));
246: }
247:
248: /**
249: * <p>
250: * Does...
251: * </p>
252: * <p>
253: *
254: * @return a Type with
255: * </p>
256: * <p>
257: * @param
258: * </p>
259: */
260: public boolean pcmf_write() {
261: if (this .pdm_writer == null)
262: return (false);
263:
264: return (this .pdm_writer.pcmf_writeModel(this ));
265: }
266:
267: /**
268: * <p>
269: * Does...
270: * </p>
271: * <p>
272: *
273: * @return a Type with
274: * </p>
275: * <p>
276: * @param
277: * </p>
278: */
279: public IMoMappingErrorHandler pcmf_setUiErrorGW(
280: IMoMappingErrorHandler xGw) {
281: IMoMappingErrorHandler l_gw = this .pdm_uiErr;
282: this .pdm_uiErr = xGw;
283:
284: return (l_gw);
285: }
286:
287: /**
288: * <p>
289: * Does...
290: * </p>
291: * <p>
292: *
293: * @return a Type with
294: * </p>
295: * <p>
296: * @param
297: * </p>
298: */
299: public IMoReader pcmf_getReader() {
300: return (this .pdm_reader);
301: }
302:
303: /**
304: * <p>
305: * Does ...
306: * </p>
307: * <p>
308: *
309: *
310: *
311: * @return a IUnTransformer with ...
312: * </p>
313: * <p>
314: * @param xTr
315: * ...
316: * </p>
317: */
318: public IUnTransformer pcmf_getTransformer() {
319: return (this .pdm_transformer);
320: }
321:
322: /**
323: * <p>
324: * Does ...
325: * </p>
326: * <p>
327: *
328: *
329: *
330: * @return a Type with ...
331: * </p>
332: * <p>
333: * @param ...
334: * </p>
335: */
336: public IMoMappingErrorHandler pcmf_getUiErrorGW() {
337: return (this .pdm_uiErr);
338: }
339:
340: /**
341: * <p>
342: * Does ...
343: * </p>
344: * <p>
345: *
346: *
347: *
348: * @return a UnComponent with ...
349: * </p>
350: * <p>
351: * @param xMap
352: * ...
353: * </p>
354: */
355: public UnComponent pcmf_getUiMap() {
356: return (this .pdm_uiMap);
357: }
358:
359: /**
360: * <p>
361: * Does ...
362: * </p>
363: * <p>
364: *
365: *
366: *
367: * @return a UnComponent with ...
368: * </p>
369: * <p>
370: * @param xMap
371: * ...
372: * </p>
373: */
374: public Vector pcmf_getObservers() {
375: return (this .pdm_observers);
376: }
377:
378: /**
379: * <p>
380: * Does...
381: * </p>
382: * <p>
383: *
384: * @return a Type with
385: * </p>
386: * <p>
387: * @param
388: * </p>
389: */
390: public IMoWriter pcmf_getWriter() {
391: return (this .pdm_writer);
392: }
393:
394: /**
395: * <p>
396: * Does...
397: * </p>
398: * <p>
399: *
400: * @return a Type with
401: * </p>
402: * <p>
403: * @param
404: * </p>
405: */
406: public String pcmf_getMyTemplate() {
407: return (this .pdm_myTemplate);
408: }
409:
410: /**
411: * <p>
412: * Does...
413: * </p>
414: * <p>
415: *
416: * @return a Type with
417: * </p>
418: * <p>
419: * @param
420: * </p>
421: */
422: public String pcmf_setMyTemplate(String xTpl) {
423: String l_old = this .pdm_myTemplate;
424: this .pdm_myTemplate = xTpl;
425:
426: return (l_old);
427: }
428:
429: /**
430: * <p>
431: * Does...
432: * </p>
433: * <p>
434: *
435: * @return a Type with
436: * </p>
437: * <p>
438: * @param
439: * </p>
440: */
441: public IMoValue pcmf_cloneModelValue(boolean xChilds) {
442: return (pcmf_cloneModelValue(true, true));
443: }
444:
445: public IMoValue pcmf_cloneModelValue(boolean xChilds, boolean xFull) {
446: try {
447: MoValue l_ret = (MoValue) this .clone();
448: return (l_ret);
449: } catch (Exception e) {
450: KeLog.pcmf_logException("ug2t", this , e);
451: return (null);
452: }
453: }
454:
455: /**
456: * <p>
457: * Does...
458: * </p>
459: * <p>
460: *
461: * @return a Type with
462: * </p>
463: * <p>
464: * @param
465: * </p>
466: */
467: public boolean pcmf_model2UI() {
468: throw (new UnsupportedOperationException());
469: }
470:
471: /**
472: * <p>
473: * Does...
474: * </p>
475: * <p>
476: *
477: * @return a Type with
478: * </p>
479: * <p>
480: * @param
481: * </p>
482: */
483: public boolean pcmf_UI2Model() {
484: throw (new UnsupportedOperationException());
485: }
486:
487: /**
488: * <p>
489: * Does...
490: * </p>
491: * <p>
492: *
493: * @return a Type with
494: * </p>
495: * <p>
496: * @param
497: * </p>
498: */
499: public boolean pcmf_validate() {
500: throw (new UnsupportedOperationException());
501: }
502:
503: public IMoValue pcmf_getMyTemplateObj() {
504: return (this .pdm_myTemplateObj);
505: }
506:
507: public IMoValue pcmf_setMyTemplateObj(IMoValue xTpl) {
508: IMoValue l_old = this .pdm_myTemplateObj;
509: this .pdm_myTemplateObj = xTpl;
510:
511: return (l_old);
512: }
513:
514: public Object pcmf_getAdditionalnfo() {
515: return (this .pdm_addInfo);
516: }
517:
518: public void pcmf_setAdditionalInfo(Object xInfo) {
519: this .pdm_addInfo = xInfo;
520: }
521:
522: public IMoValueContainer pcmf_getParent() {
523: KeLog
524: .pcmf_logNotSupportedFatal("IMoValueContainer pcmf_getParent()");
525: return (null);
526: }
527:
528: public Object pcmf_getValue() {
529: KeLog
530: .pcmf_logNotSupportedFatal("IMoValueContainer pcmf_getParent()");
531: return (null);
532: }
533:
534: public void pcmf_setValue(Object xValue) {
535: KeLog
536: .pcmf_logNotSupportedFatal("IMoValueContainer pcmf_getParent()");
537: }
538: }
|