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.connector.*;
036: import de.ug2t.kernel.*;
037:
038: public final class MuGenericTemplateSection extends MuGenericComponent
039: implements IKePoolable, IMuGenericLayoutManager {
040: private KeStringTemplate pem_markup = null;
041: private CoTextFileGetter pem_tfg = null;
042: private boolean pem_handleVaribles = false;
043:
044: // @@
045:
046: public MuGenericTemplateSection(String xName, String xHtml,
047: boolean xIsExtRef, MuGenericApplication xAppl)
048: throws Exception {
049: super (xName, null, null, xAppl);
050:
051: if (xHtml == null)
052: xHtml = "";
053: else {
054: if (xIsExtRef) {
055: // @@
056: this .pem_tfg = new CoTextFileGetter();
057: String l_html = pem_tfg.pcmf_getString(xHtml);
058: this .pem_markup = new KeStringTemplate(l_html);
059:
060: // @@
061: return;
062: // @@
063: }
064: }
065: pem_markup = new KeStringTemplate(xHtml);
066:
067: return;
068: };
069:
070: // @@
071:
072: public Object pcmf_execView() {
073: return (this .pcmf_execView(this ));
074: }
075:
076: public Object pcmf_execView(KeTreeNode xRenderNode) {
077: if (this .pcmf_isHidden() && !this .pcmf_getRenderIfHidden()) {
078: this .pcmf_setPropChanged(false);
079: Iterator l_it = this .pcmf_getDeepSubNodeIt();
080: while (l_it.hasNext())
081: ((KeTreeElement) l_it.next())
082: .pcmf_setPropChanged(false);
083:
084: return (((MuGenericApplication) this .pcmf_getAppl())
085: .pcmf_getRenderer().pcmf_wrapMarkup("", this ));
086: }
087:
088: IKeView l_view = this .pcmf_getView();
089: this .pcmf_setPropChanged(false);
090:
091: if (l_view != null)
092: return (l_view.pcmf_output(this ));
093: else {
094: String l_sbody = null;
095: String l_key = null;
096:
097: Iterator it = null;
098: Iterator itK = null;
099:
100: KeStringTemplate xBody = new KeStringTemplate(
101: this .pem_markup);
102: xBody.pcmf_beginTR();
103:
104: if (xRenderNode.pcmf_getChildCount() > 0) {
105: it = xRenderNode.pcmf_getAllSubs().iterator();
106: itK = xRenderNode.pcmf_getAllSubNames().iterator();
107: while (it.hasNext()) {
108: l_key = (String) itK.next();
109: l_sbody = ((KeTreeNode) it.next()).pcmf_execView()
110: .toString();
111: xBody.pcmf_stringSubst(l_key, l_sbody);
112: }
113: ;
114: }
115: xBody.pcmf_endTR(true);
116:
117: if (this .pem_handleVaribles) {
118: if (xBody.pcmf_setRegVals())
119: xRenderNode.pcmf_setPropChanged(true);
120: }
121:
122: return (((MuGenericApplication) this .pcmf_getAppl())
123: .pcmf_getRenderer().pcmf_wrapMarkup(xBody
124: .toString()
125: + pcmf_evChannelandMenuOut(), this ));
126: }
127: };
128:
129: public void pcmf_setHandleVariables(boolean xHdl) {
130: this .pem_handleVaribles = xHdl;
131: }
132:
133: public boolean pcmf_isHandleVariables() {
134: return (this .pem_handleVaribles);
135: }
136:
137: // @@
138:
139: public void pcmf_delete() throws Exception {
140: super .pcmf_delete();
141: if (this .pem_tfg != null)
142: this .pem_tfg.pcmf_delete();
143: }
144:
145: // as layoutmanager
146: private MuGenericComponent pem_toLayout = null;
147:
148: public void pcmf_addConstraints(MuGenericComponent xObj,
149: IMuGenericLayoutConstraints xConst) {
150: return;
151: }
152:
153: public IMuGenericLayoutConstraints pcmf_getConstraints(
154: MuGenericComponent xObj) {
155: return null;
156: }
157:
158: public String pcmf_getMarkupString() {
159: return (this .pcmf_execView(this .pem_toLayout).toString());
160: }
161:
162: public void pcmf_layout() {
163: }
164:
165: public IMuGenericLayoutConstraints pcmf_removeConstraint(
166: MuGenericComponent xObj) {
167: return null;
168: }
169:
170: public void pcmf_setInsets(int xIns) {
171: }
172:
173: public void pcmf_setLayoutObj(MuGenericComponent xToLayout) {
174: this .pem_toLayout = xToLayout;
175: }
176:
177: public boolean pcmf_supportContraints() {
178: return false;
179: }
180:
181: public boolean pcmf_supportDefaultInsets() {
182: return false;
183: }
184:
185: public static void pcmf_reload() throws Exception {
186: // @@
187: }
188: }
|