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.kernel;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.interfaces.*;
036: import de.ug2t.unifiedGui.transformer.*;
037: import de.ug2t.unifiedGui.views.*;
038:
039: /**
040: * @author Dirk
041: *
042: * date: 02.01.2004 project: WiSer-Framework
043: *
044: * <p>
045: * This object represents a tree element. A tree element is the leaf of a tree.
046: * It is able to contain a value. It might be enabled or disabled. It is used to
047: * implement the widget tree of an application and to implement different model
048: * classes.
049: * </p>
050: */
051: public class KeTreeElement extends KeRegisteredObject implements
052: IKeViewable, IKeTreeElement {
053: protected String pdm_Name = null;
054: protected Object pdm_Element = null;
055: protected KeTreeNode pdm_parentNode = null;
056: protected IKeView pdm_NodeView = null;
057: protected Object pdm_default = null;
058: private boolean pem_defSet = false;
059: private boolean pem_disabled = false;
060: private boolean pem_propChanged = true;
061: private boolean pem_myPropChanged = true;
062: private boolean pem_owner = false;
063:
064: private ArrayList pem_pcListeners = null;
065:
066: private KeStringTemplate pem_localTpl = null;
067: private IUnTransformer pem_stringTransformer = null;
068: private boolean pem_multipleParents = true;
069:
070: private ArrayList pem_parentNodes = null;
071:
072: /**
073: * @param xName
074: * name of the node
075: * @param xParent
076: * parent of the node or null
077: * @throws Exception
078: */
079: public KeTreeElement(String xName, KeTreeNode xParent)
080: throws Exception {
081: pdm_Name = xName;
082: pdm_parentNode = xParent;
083:
084: if (xParent != null && this .pem_multipleParents) {
085: this .pem_parentNodes = new ArrayList(1);
086: pdm_parentNode.pcmf_addElement(xName, this );
087: }
088:
089: return;
090: }
091:
092: /**
093: * @param xName
094: * name of the node
095: * @param xParent
096: * parent of the node or null
097: * @param xValue
098: * value of the node
099: * @throws Exception
100: */
101: public KeTreeElement(String xName, KeTreeNode xParent, Object xValue)
102: throws Exception {
103: pdm_Name = xName;
104: pdm_parentNode = xParent;
105:
106: if (xParent != null && this .pem_multipleParents) {
107: this .pem_parentNodes = new ArrayList(1);
108: pdm_parentNode.pcmf_addElement(xName, this );
109: }
110:
111: this .pcmf_setValue(xValue);
112:
113: return;
114: }
115:
116: /* (non-Javadoc)
117: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setPropChanged(boolean)
118: */
119: public void pcmf_setPropChanged(boolean xPc) {
120: this .pem_myPropChanged = xPc;
121: this .pdmf_setPropChanged(xPc);
122: }
123:
124: /* (non-Javadoc)
125: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setMultipleParents(boolean)
126: */
127: public void pcmf_setMultipleParents(boolean xMp) {
128: this .pem_multipleParents = xMp;
129: }
130:
131: /* (non-Javadoc)
132: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getMultipleParents()
133: */
134: public boolean pcmf_getMultipleParents() {
135: return (this .pem_multipleParents);
136: }
137:
138: protected void pdmf_execPcListeners() {
139: if (this .pem_pcListeners != null) {
140: try {
141: Iterator l_it = this .pem_pcListeners.iterator();
142: while (l_it.hasNext())
143: ((IKePropertyChangeListener) l_it.next())
144: .pcmf_execListener(this );
145: } catch (Exception e) {
146: KeLog
147: .pcmf_log(
148: "ug2t",
149: "error during dispatch of property changed events",
150: this , KeLog.ERROR);
151: }
152: }
153: }
154:
155: /**
156: * <p>
157: * For internal use only
158: * </p>
159: */
160: protected final void pdmf_setPropChanged(boolean xPc) {
161: if (!this .pem_propChanged && xPc) {
162: this .pem_propChanged = true;
163:
164: this .pcmf_clearCache();
165: this .pdmf_execPcListeners();
166:
167: if (this .pdm_parentNode != null) {
168: Iterator l_it = this .pcmf_getParents();
169: while (l_it.hasNext()) {
170: KeTreeElement l_p = (KeTreeElement) l_it.next();
171: if (!l_p.pcmf_getPropChanged())
172: l_p.pdmf_setPropChanged(true);
173: }
174: }
175: } else
176: this .pem_propChanged = xPc;
177: }
178:
179: /* (non-Javadoc)
180: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getPropChanged()
181: */
182: public boolean pcmf_getPropChanged() {
183: return (this .pem_propChanged);
184: }
185:
186: /* (non-Javadoc)
187: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getMyPropChanged()
188: */
189: public boolean pcmf_getMyPropChanged() {
190: return (this .pem_myPropChanged);
191: }
192:
193: protected KeTreeElement() {
194: return;
195: };
196:
197: /* (non-Javadoc)
198: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setDefaultValue(java.lang.Object)
199: */
200: public void pcmf_setDefaultValue(Object xObj) {
201: if (xObj == this .pdm_default)
202: return;
203:
204: this .pem_defSet = true;
205: this .pcmf_setPropChanged(true);
206: this .pdm_default = xObj;
207:
208: return;
209: };
210:
211: /* (non-Javadoc)
212: * @see de.ug2t.kernel.IKeTreeElement#pcmf_unsetDefaultValue()
213: */
214: public void pcmf_unsetDefaultValue() {
215: if (!this .pem_defSet)
216: return;
217:
218: this .pem_defSet = false;
219: this .pcmf_setPropChanged(true);
220: this .pdm_default = "";
221:
222: return;
223: };
224:
225: /* (non-Javadoc)
226: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getDefaultValue()
227: */
228: public Object pcmf_getDefaultValue() {
229: return (this .pdm_default);
230: };
231:
232: /* (non-Javadoc)
233: * @see de.ug2t.kernel.IKeTreeElement#pcmf_isDefSet()
234: */
235: public final boolean pcmf_isDefSet() {
236: return (this .pem_defSet);
237: }
238:
239: /* (non-Javadoc)
240: * @see de.ug2t.kernel.IKeTreeElement#pcmf_reset()
241: */
242: public Object pcmf_reset() {
243: Object l_obj = this .pdm_Element;
244:
245: if (this .pem_defSet)
246: this .pcmf_setValue(pdm_default);
247:
248: return (l_obj);
249: };
250:
251: /* (non-Javadoc)
252: * @see de.ug2t.kernel.IKeTreeElement#pcmf_resetRecursive()
253: */
254: public Object pcmf_resetRecursive() {
255: return (this .pcmf_reset());
256: };
257:
258: /* (non-Javadoc)
259: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setStringValue(java.lang.Object)
260: */
261: public void pcmf_setStringValue(Object xObj) {
262: this .pcmf_setValue(xObj.toString());
263: }
264:
265: /* (non-Javadoc)
266: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setValue(java.lang.Object)
267: */
268: public void pcmf_setValue(Object xObj) {
269: if (this .pdm_Element != null
270: && this .pdm_Element.equals(xObj) == false
271: || (this .pdm_Element == null && xObj != null))
272: this .pcmf_setPropChanged(true);
273:
274: pdm_Element = xObj;
275:
276: return;
277: };
278:
279: /* (non-Javadoc)
280: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setName(java.lang.String)
281: */
282: public void pcmf_setName(String xName) {
283: if (xName == this .pdm_Name || xName != null
284: && xName.equals(this .pdm_Name))
285: return;
286:
287: this .pdm_Name = xName;
288:
289: if (this .pdm_parentNode != null)
290: KeLog.pcmf_log("ug2t", "cannot set name, parent is set",
291: this , KeLog.DEBUG);
292:
293: this .pcmf_setPropChanged(true);
294:
295: return;
296: };
297:
298: /* (non-Javadoc)
299: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getValue()
300: */
301: public Object pcmf_getValue() {
302: return (pdm_Element);
303: };
304:
305: /* (non-Javadoc)
306: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getParentNodeCount()
307: */
308: public final int pcmf_getParentNodeCount() {
309: int i = 0;
310:
311: if (pdm_parentNode != null) {
312: i = 1;
313: i += pdm_parentNode.pcmf_getParentNodeCount();
314: }
315: ;
316:
317: return (i);
318: };
319:
320: /* (non-Javadoc)
321: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getParentGeneration(int)
322: */
323: public final KeTreeElement pcmf_getParentGeneration(int xGeneration) {
324: KeTreeElement l_element = this ;
325:
326: if (pdm_parentNode != null && xGeneration != 0) {
327: xGeneration--;
328: l_element = pdm_parentNode
329: .pcmf_getParentGeneration(xGeneration);
330: }
331: ;
332:
333: return (l_element);
334: };
335:
336: /* (non-Javadoc)
337: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setView(de.ug2t.kernel.IKeView)
338: */
339: public void pcmf_setView(IKeView xView) {
340: if (xView == this .pdm_NodeView)
341: return;
342:
343: this .pcmf_setPropChanged(true);
344:
345: if (xView != null) {
346: if (this .pdm_NodeView instanceof UnIconValueView)
347: ((UnIconValueView) this .pdm_NodeView).pcmf_detach();
348:
349: if (xView instanceof IKeTemplateView) {
350: this .pcmf_setTpl(((IKeTemplateView) xView)
351: .pcmf_getTpl());
352: this
353: .pcmf_setStringTransformer(((UnIconValueView) xView)
354: .pcmf_getTransformer());
355: }
356:
357: if (xView instanceof UnIconValueView)
358: ((UnIconValueView) xView).pcmf_attach();
359: }
360:
361: pdm_NodeView = xView;
362:
363: return;
364: };
365:
366: /* (non-Javadoc)
367: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getView()
368: */
369: public IKeView pcmf_getView() {
370: return (pdm_NodeView);
371: };
372:
373: /* (non-Javadoc)
374: * @see de.ug2t.kernel.IKeTreeElement#pcmf_execView()
375: */
376: public Object pcmf_execView() {
377: this .pcmf_setPropChanged(false);
378: return (pdm_NodeView.pcmf_output(this ));
379: };
380:
381: /**
382: * <p>
383: * Generates a string representation of this element
384: * </p>
385: * <p>
386: *
387: * @return string
388: * </p>
389: * <p>
390: * </p>
391: */
392: public String toString() {
393: if (this .pem_localTpl == null)
394: return (pdm_Name);
395: else {
396: KeStringTemplate l_new = new KeStringTemplate(
397: this .pem_localTpl);
398: l_new.pcmf_stringSubst("$NAME", pdm_Name);
399: Object l_value = this .pcmf_getValue();
400: if (l_value != null) {
401: if (this .pem_stringTransformer != null)
402: l_new.pcmf_stringSubst("$VALUE",
403: this .pem_stringTransformer.pcmf_transform(
404: this ).toString());
405: else
406: l_new
407: .pcmf_stringSubst("$VALUE", l_value
408: .toString());
409: } else
410: l_new.pcmf_stringSubst("$VALUE", "null");
411:
412: return (l_new.toString());
413: }
414: };
415:
416: /* (non-Javadoc)
417: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getPath()
418: */
419: public final String pcmf_getPath() {
420: return (this .pcmf_buildPath());
421: };
422:
423: /**
424: * <p>
425: * Returns the absolute path of this node
426: * </p>
427: * <p>
428: *
429: * @return path
430: * </p>
431: * <p>
432: * </p>
433: */
434: protected String pcmf_buildPath() {
435: String l_name = pdm_Name;
436: KeTreeElement l_parent = pcmf_getParentNode();
437:
438: if (l_parent != null)
439: l_name = l_parent.pcmf_buildPath() + ":" + l_name;
440:
441: return (l_name);
442: };
443:
444: /* (non-Javadoc)
445: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getParentNode()
446: */
447: public final KeTreeNode pcmf_getParentNode() {
448: return (pdm_parentNode);
449: };
450:
451: /* (non-Javadoc)
452: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getLastParentNode()
453: */
454: public final KeTreeNode pcmf_getLastParentNode() {
455: if (this .pem_parentNodes == null
456: || this .pem_parentNodes.size() == 0)
457: return (null);
458:
459: return ((KeTreeNode) this .pem_parentNodes
460: .get(this .pem_parentNodes.size() - 1));
461: };
462:
463: /* (non-Javadoc)
464: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getRootNode()
465: */
466: public KeTreeElement pcmf_getRootNode() {
467: return (this .pcmf_getParentGeneration(this
468: .pcmf_getParentNodeCount()));
469: };
470:
471: /* (non-Javadoc)
472: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getChildCount()
473: */
474: public int pcmf_getChildCount() {
475: return (0);
476: };
477:
478: /* (non-Javadoc)
479: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getAllSubCount(boolean)
480: */
481: public int pcmf_getAllSubCount(boolean xCountHide) {
482: return (0);
483: };
484:
485: /**
486: * <p>
487: * For internal use only
488: * </p>
489: */
490: protected void pcmf_removeParent(KeTreeNode xParent) {
491: if (this .pem_parentNodes == null)
492: return;
493:
494: this .pem_parentNodes.remove(xParent);
495: if (this .pdm_parentNode == xParent) {
496: if (this .pem_parentNodes.size() > 0)
497: this .pdm_parentNode = (KeTreeNode) this .pem_parentNodes
498: .get(0);
499: else
500: this .pdm_parentNode = null;
501: }
502:
503: this .pcmf_setPropChanged(true);
504:
505: return;
506: }
507:
508: /**
509: * <p>
510: * For internal use only
511: * </p>
512: */
513: protected final void pdmf_setParent(KeTreeNode xParent) {
514: if (this .pdm_parentNode == xParent)
515: return;
516:
517: if (this .pem_parentNodes == null && this .pem_multipleParents)
518: this .pem_parentNodes = new ArrayList(1);
519:
520: if (xParent == null) {
521: if (this .pem_multipleParents)
522: pem_parentNodes.clear();
523:
524: pdm_parentNode = null;
525: } else if (this .pem_multipleParents
526: && pem_parentNodes.contains(xParent) == false) {
527: if (this .pdm_parentNode == null)
528: pdm_parentNode = xParent;
529:
530: pem_parentNodes.add(xParent);
531: }
532:
533: this .pcmf_setPropChanged(true);
534:
535: return;
536: };
537:
538: /* (non-Javadoc)
539: * @see de.ug2t.kernel.IKeTreeElement#pcmf_releaseSubs()
540: */
541: public void pcmf_releaseSubs() {
542: try {
543: this .pcmf_delete();
544: } catch (Exception e) {
545: KeLog.pcmf_logException("ug2t",
546: "error during releasing sub-nodes", e);
547: }
548: return;
549: };
550:
551: /* (non-Javadoc)
552: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getName()
553: */
554: public final String pcmf_getName() {
555: return (pdm_Name);
556: };
557:
558: /* (non-Javadoc)
559: * @see de.ug2t.kernel.IKeTreeElement#pcmf_isChildOf(de.ug2t.kernel.KeTreeNode)
560: */
561: public boolean pcmf_isChildOf(KeTreeNode xNode) {
562: if (this .pdm_parentNode == null)
563: return (false);
564: else if (this .pdm_parentNode == xNode)
565: return (true);
566: else
567: return (this .pdm_parentNode.pcmf_isChildOf(xNode));
568: }
569:
570: /* (non-Javadoc)
571: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getParents()
572: */
573: public final Iterator pcmf_getParents() {
574: if (this .pem_parentNodes == null)
575: this .pem_parentNodes = new ArrayList(1);
576:
577: return (pem_parentNodes.iterator());
578: };
579:
580: /* (non-Javadoc)
581: * @see de.ug2t.kernel.IKeTreeElement#pcmf_disable()
582: */
583: public void pcmf_disable() {
584: this .pcmf_disableThis();
585: return;
586: };
587:
588: /* (non-Javadoc)
589: * @see de.ug2t.kernel.IKeTreeElement#pcmf_enable()
590: */
591: public void pcmf_enable() {
592: this .pcmf_enableThis();
593: return;
594: };
595:
596: /* (non-Javadoc)
597: * @see de.ug2t.kernel.IKeTreeElement#pcmf_disableThis()
598: */
599: public void pcmf_disableThis() {
600: if (this .pem_disabled)
601: return;
602:
603: this .pcmf_setPropChanged(true);
604: this .pem_disabled = true;
605:
606: return;
607: };
608:
609: /* (non-Javadoc)
610: * @see de.ug2t.kernel.IKeTreeElement#pcmf_enableThis()
611: */
612: public void pcmf_enableThis() {
613: if (this .pem_disabled == false)
614: return;
615:
616: this .pcmf_setPropChanged(true);
617: this .pem_disabled = false;
618:
619: return;
620: };
621:
622: /* (non-Javadoc)
623: * @see de.ug2t.kernel.IKeTreeElement#pcmf_isDisabled()
624: */
625: public boolean pcmf_isDisabled() {
626: return (this .pem_disabled);
627: };
628:
629: /* (non-Javadoc)
630: * @see de.ug2t.kernel.IKeTreeElement#pcmf_delete()
631: */
632: public void pcmf_delete() throws Exception {
633: if (this .pdm_deleted == true)
634: return;
635:
636: if (this .pem_parentNodes != null && this .pdm_parentNode != null) {
637: Iterator l_it = new ArrayList(this .pem_parentNodes)
638: .iterator();
639: Object l_obj = null;
640: while (l_it.hasNext()) {
641: l_obj = l_it.next();
642: if (((KeTreeNode) l_obj).isDeleted() == false) {
643: if (this instanceof KeTreeNode)
644: ((KeTreeNode) l_obj)
645: .pcmf_removeNode((KeTreeNode) this );
646: else
647: ((KeTreeNode) l_obj).pcmf_removeElement(this );
648: }
649: }
650: }
651: if (this .pdm_NodeView instanceof KeRegisteredObject) {
652: if (this .pdm_NodeView instanceof UnIconValueView)
653: ((UnIconValueView) this .pdm_NodeView).pcmf_detach();
654:
655: ((KeRegisteredObject) this .pdm_NodeView).pcmf_delete();
656: }
657:
658: if (this .pem_owner
659: && this .pdm_Element instanceof KeRegisteredObject)
660: ((KeRegisteredObject) this .pdm_Element).pcmf_delete();
661:
662: super .pcmf_delete();
663: }
664:
665: /* (non-Javadoc)
666: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setStringTransformer(de.ug2t.unifiedGui.transformer.IUnTransformer)
667: */
668: public IUnTransformer pcmf_setStringTransformer(
669: IUnTransformer xTrans) {
670: if (xTrans == this .pem_stringTransformer)
671: return (xTrans);
672:
673: this .pcmf_setPropChanged(true);
674: IUnTransformer l_trans = this .pem_stringTransformer;
675:
676: this .pem_stringTransformer = xTrans;
677:
678: return (l_trans);
679: }
680:
681: /* (non-Javadoc)
682: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setTpl(java.lang.String)
683: */
684: public void pcmf_setTpl(String xTpl) {
685: this .pcmf_setPropChanged(true);
686:
687: if (xTpl == null) {
688: this .pem_localTpl = null;
689: return;
690: }
691: ;
692:
693: this .pem_localTpl = new KeStringTemplate(xTpl);
694: }
695:
696: /* (non-Javadoc)
697: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setTpl()
698: */
699: public void pcmf_setTpl() {
700: if (this .pem_localTpl == null)
701: return;
702:
703: this .pcmf_setPropChanged(true);
704: this .pem_localTpl = null;
705: }
706:
707: public final int pcmf_register(String xName) {
708: String l_name = this .pcmf_getObjName();
709:
710: if (l_name != null && !l_name.equals(xName))
711: this .pcmf_setPropChanged(true);
712:
713: return (super .pcmf_register(xName));
714: }
715:
716: /* (non-Javadoc)
717: * @see de.ug2t.kernel.IKeTreeElement#pcmf_setValueOwnerShip(boolean)
718: */
719: public final void pcmf_setValueOwnerShip(boolean xOwn) {
720: this .pem_owner = xOwn;
721: }
722:
723: // @@
724:
725: /**
726: * <p>
727: * For internal use only
728: * </p>
729: */
730: protected KeTreeElement pcmf_getByPath(ArrayList xPath, int offset) {
731: if (xPath.size() != offset)
732: KeLog.pcmf_log("ug2t", "path has more entries", this ,
733: KeLog.ERROR);
734:
735: return (this );
736: };
737:
738: /* (non-Javadoc)
739: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getAllParentGenerations(java.util.ArrayList)
740: */
741: public final void pcmf_getAllParentGenerations(ArrayList xToAdd) {
742: ArrayList l_myParents = this .pcmf_getParentsList();
743: Iterator l_it = l_myParents.iterator();
744: while (l_it.hasNext())
745: ((KeTreeElement) l_it.next())
746: .pcmf_getAllParentGenerations(xToAdd);
747:
748: xToAdd.addAll(l_myParents);
749:
750: return;
751: }
752:
753: /* (non-Javadoc)
754: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getParentsList()
755: */
756: public final ArrayList pcmf_getParentsList() {
757: if (this .pem_parentNodes == null)
758: this .pem_parentNodes = new ArrayList(1);
759:
760: return (new ArrayList(this .pem_parentNodes));
761: }
762:
763: /* (non-Javadoc)
764: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getAllEnabled(java.util.ArrayList)
765: */
766: public void pcmf_getAllEnabled(ArrayList xRes) {
767: if (this .pem_disabled == false)
768: xRes.add(this );
769:
770: return;
771: }
772:
773: /* (non-Javadoc)
774: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getAllDisabled(java.util.ArrayList)
775: */
776: public void pcmf_getAllDisabled(ArrayList xRes) {
777: if (this .pem_disabled)
778: xRes.add(this );
779:
780: return;
781: }
782:
783: /* (non-Javadoc)
784: * @see de.ug2t.kernel.IKeTreeElement#pcmf_isParentDisabled()
785: */
786: public boolean pcmf_isParentDisabled() {
787: KeTreeElement l_p = this ;
788:
789: while (l_p != null) {
790: l_p = l_p.pcmf_getParentNode();
791: if (l_p != null && l_p.pcmf_isDisabled())
792: return (true);
793: }
794: return (false);
795: }
796:
797: /* (non-Javadoc)
798: * @see de.ug2t.kernel.IKeTreeElement#pcmf_addPropertyChangedListener(de.ug2t.kernel.IKePropertyChangeListener)
799: */
800: public void pcmf_addPropertyChangedListener(
801: IKePropertyChangeListener xListen) {
802: if (this .pem_pcListeners == null)
803: this .pem_pcListeners = new ArrayList();
804:
805: this .pem_pcListeners.add(xListen);
806: }
807:
808: /* (non-Javadoc)
809: * @see de.ug2t.kernel.IKeTreeElement#pcmf_removePropertyChangedListener(de.ug2t.kernel.IKePropertyChangeListener)
810: */
811: public void pcmf_removePropertyChangedListener(
812: IKePropertyChangeListener xListen) {
813: if (this .pem_pcListeners == null)
814: return;
815:
816: this .pem_pcListeners.remove(xListen);
817: }
818:
819: /* (non-Javadoc)
820: * @see de.ug2t.kernel.IKeTreeElement#pcmf_getPropertyChangedListeners()
821: */
822: public ArrayList pcmf_getPropertyChangedListeners() {
823: if (this .pem_pcListeners == null)
824: return (null);
825:
826: return (new ArrayList(this .pem_pcListeners));
827: };
828:
829: /**
830: * <p>
831: * If the tree element is bound to a view object which supports caching, this
832: * method clears the cache.
833: * </p>
834: * <p>
835: *
836: * @param xListen
837: * listener object to remove
838: * </p>
839: */
840: public void pcmf_clearCache() {
841: IKeView l_view = this.pcmf_getView();
842: if (l_view != null && l_view.pcmf_supportsCaching())
843: l_view.pcmf_clearCache();
844: }
845: };
|