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.channel.markup.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.channel.markup.html.renderer.*;
036: import de.ug2t.connector.*;
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.interfaces.*;
039:
040: public final class MuGenericRepetition extends MuGenericComponent
041: implements IUnRepetition {
042: private IKeView pem_view = new HtmlRepetitionRenderer();
043: private Iterator pem_it = null;
044:
045: public MuGenericRepetition(String xName, Iterator xIt,
046: ACoDataGetter xTplGetter, Object xTplName,
047: MuGenericApplication xAppl) throws Exception {
048: super (xName, xTplGetter, xTplName, xAppl);
049:
050: pem_it = xIt;
051: this .pcmf_setView(pem_view);
052: this .pcmf_setValue(xName);
053:
054: return;
055: };
056:
057: public Object pcmf_execView() {
058: try {
059: if (this .pcmf_isHidden() || this .pcmf_isDisabled()) {
060: this .pcmf_setPropChanged(false);
061: Iterator l_it = this .pcmf_getDeepSubNodeIt();
062: while (l_it.hasNext())
063: ((KeTreeElement) l_it.next())
064: .pcmf_setPropChanged(false);
065:
066: return (((MuGenericApplication) this .pcmf_getAppl())
067: .pcmf_getRenderer().pcmf_wrapMarkup("", this ));
068: }
069:
070: KeStringTemplate l_retval = new KeStringTemplate("");
071: String l_body = null;
072: Iterator it = this .pcmf_getSubIterator();
073: KeStringTemplate l_tpl = (KeStringTemplate) pdm_NodeView
074: .pcmf_output(this );
075: Object l_obj = null;
076:
077: while (it.hasNext()) {
078: l_body = (String) ((KeTreeElement) it.next())
079: .pcmf_execView();
080: l_retval.pcmf_stringAddEnd(KeTools.pcmf_stringSubst(
081: l_tpl, "$BODY", l_body));
082: }
083: ;
084:
085: if (pem_it != null) {
086: while (pem_it.hasNext()) {
087: l_obj = pem_it.next();
088:
089: if (l_obj instanceof MuGenericComponent)
090: l_body = (String) ((MuGenericComponent) l_obj)
091: .pcmf_execView();
092: else
093: l_body = l_obj.toString();
094:
095: l_retval.pcmf_stringAddEnd(KeTools
096: .pcmf_stringSubst(l_tpl, "$BODY", l_body));
097: }
098: ;
099: }
100: ;
101: return (((MuGenericApplication) this .pcmf_getAppl())
102: .pcmf_getRenderer().pcmf_wrapMarkup(l_retval
103: .toString(), this ));
104: } catch (Exception e) {
105: KeLog.pcmf_logException("ug2t", this , e);
106: return ("ERROR");
107: }
108: };
109:
110: public void pcmf_refresh(Iterator xIt) {
111: pem_it = xIt;
112: };
113: }
|