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.html.renderer;
032:
033: import java.awt.*;
034: import java.util.*;
035:
036: import de.ug2t.channel.markup.generic.*;
037: import de.ug2t.channel.markup.html.*;
038: import de.ug2t.kernel.*;
039: import de.ug2t.unifiedGui.*;
040: import de.ug2t.unifiedGui.interfaces.*;
041: import de.ug2t.unifiedGui.views.*;
042:
043: public final class HtmlTableRenderer implements IKeView {
044: MuGenericApplication pem_appl = null;
045: private String pem_selCol = null;
046:
047: public void pcmf_activateCache(boolean xAc) {
048: this .pem_cache.pcmf_activateThisCache(xAc);
049: return;
050: }
051:
052: public void pcmf_reset() {
053: this .pem_appl = null;
054: this .pem_selCol = null;
055: };
056:
057: private KeStringTemplate pcmf_insertFont(KeStringTemplate xString,
058: UnFontDescriptor xFont) {
059: KeStringTemplate l_ret = null;
060: UnFontDescriptor l_font = xFont;
061:
062: if (l_font == null)
063: l_font = this .pem_appl.pcmf_getFont();
064:
065: if (l_font == null) {
066: l_ret = KeTools.pcmf_stringSubst(xString, "$FONT", "");
067: } else {
068: l_ret = KeTools.pcmf_stringSubst(xString, "$FONT", pem_appl
069: .pcmf_getTemplateKit().getFONT());
070:
071: l_ret.pcmf_beginTR();
072:
073: KeTools.pcmf_stringSubst(l_ret, "$FNAME", l_font
074: .pcmf_getFontName());
075: KeTools.pcmf_stringSubst(l_ret, "$FSIZE", Integer
076: .toString(l_font.pcmf_getFontSize()));
077:
078: switch (l_font.pcmf_getFontStyle()) {
079: case Font.ITALIC:
080: KeTools.pcmf_stringSubst(l_ret, "$FSTYLE", "italic");
081: KeTools.pcmf_stringSubst(l_ret, "$BOLD", "normal");
082: break;
083: case Font.BOLD:
084: KeTools.pcmf_stringSubst(l_ret, "$BOLD", "bold");
085: KeTools.pcmf_stringSubst(l_ret, "$FSTYLE", "normal");
086: break;
087: default:
088: KeTools.pcmf_stringSubst(l_ret, "$BOLD", "normal");
089: KeTools.pcmf_stringSubst(l_ret, "$FSTYLE", "normal");
090: }
091:
092: l_ret.pcmf_endTR(true);
093: }
094:
095: return l_ret;
096: }
097:
098: private KeStringTemplate pcmf_buildCell(KeStringTemplate xTpl,
099: KeStringTemplate xSelTpl, KeStringTemplate xHeadTpl,
100: KeStringTemplate xNHeadTpl, KeStringTemplate xDefcTpl,
101: KeStringTemplate xBoTpl, KeStringTemplate xPadTpl,
102: KeStringTemplate xMarTpl, KeStringTemplate xNsCol,
103: Iterator xIt, MuGenericTable xTab, int xIdx,
104: boolean xSelected) {
105: MuGenericTableCell l_cell = null;
106: Object l_obj = null;
107: String l_body = null;
108: KeStringTemplate l_retval = new KeStringTemplate("");
109: KeStringTemplate l_cellStr = null;
110:
111: int l_cnt = 0;
112:
113: while (xIt.hasNext()) {
114: if (xTab.pcmf_isSelectable() && l_cnt++ == 0) {
115: if (xIdx != 0)
116: l_cellStr = new KeStringTemplate(xTpl);
117: else
118: l_cellStr = new KeStringTemplate(xHeadTpl);
119:
120: if (xTab.pcmf_isNonScrollingSelectors())
121: KeTools.pcmf_stringSubst(l_cellStr, "$NSCOL",
122: new KeStringTemplate(xNsCol));
123: else
124: KeTools.pcmf_stringSubst(l_cellStr, "$NSCOL", "");
125:
126: if (xTab.pcmf_isMultiSelection()) {
127: if (xIdx != 0) {
128: MuGenericCheckBox l_cb = (MuGenericCheckBox) xTab
129: .pcmf_getSelectors().get(xIdx - 1);
130:
131: if (xTab.pcmf_isDisabled())
132: l_cb.pcmf_disable();
133: else
134: l_cb.pcmf_enable();
135:
136: l_body = l_cb.pcmf_execView().toString();
137: } else
138: l_body = "";
139: } else {
140: if (xIdx != 0) {
141: KeStringTemplate l_selbody = new KeStringTemplate(
142: xSelTpl);
143:
144: l_selbody.pcmf_beginTR();
145:
146: KeTools.pcmf_stringSubst(l_selbody, "$IDX",
147: Integer.toString(xIdx - 1));
148: KeTools.pcmf_stringSubst(l_selbody, "$NAME",
149: xTab.pcmf_getObjName());
150:
151: if (xTab.pcmf_getValue().equals(
152: Integer.toString(xIdx - 1)))
153: KeTools.pcmf_stringSubst(l_selbody,
154: "$CHECKED", "checked");
155: else
156: KeTools.pcmf_stringSubst(l_selbody,
157: "$CHECKED", "");
158:
159: if (xTab.pcmf_isDisabled())
160: KeTools.pcmf_stringSubst(l_selbody,
161: "$DISABLED", "disabled");
162: else
163: KeTools.pcmf_stringSubst(l_selbody,
164: "$DISABLED", "");
165:
166: if (xTab.pcmf_isSubmit())
167: KeTools.pcmf_stringSubst(l_selbody,
168: "$SUBMIT", pem_appl
169: .pcmf_getTemplateKit()
170: .getSUBMIT());
171: else
172: KeTools.pcmf_stringSubst(l_selbody,
173: "$SUBMIT", "");
174:
175: l_selbody.pcmf_endTR(true);
176:
177: l_body = l_selbody.toString();
178: } else
179: l_body = "";
180: }
181:
182: l_cellStr.pcmf_beginTR();
183:
184: KeTools.pcmf_stringSubst(l_cellStr, "$BORDERSTYLES",
185: new KeStringTemplate(xDefcTpl));
186: KeTools.pcmf_stringSubst(l_cellStr, "$MARGIN", "");
187: KeTools.pcmf_stringSubst(l_cellStr, "$PADDING", "");
188: KeTools.pcmf_stringSubst(l_cellStr, "$HALIGN", "left");
189: KeTools
190: .pcmf_stringSubst(l_cellStr, "$VALIGN",
191: "middle");
192:
193: KeTools.pcmf_stringSubst(l_cellStr, "$TDCLASS", "");
194: KeTools.pcmf_stringSubst(l_cellStr, "$SPAN", "");
195: KeTools
196: .pcmf_stringSubst(
197: l_cellStr,
198: "$TDBGCOL",
199: xSelected
200: && !xTab
201: .pcmf_getDifferentialRepaint() ? this .pem_selCol
202: : xTab.pcmf_getBgColor());
203: KeTools.pcmf_stringSubst(l_cellStr, "$TDFGCOL", xTab
204: .pcmf_getFgColor());
205: KeTools.pcmf_stringSubst(l_cellStr, "$NAME", xTab
206: .pcmf_getObjName());
207: KeTools.pcmf_stringSubst(l_cellStr, "$BORDER", Integer
208: .toString(xTab.pcmf_getTableBorder()));
209:
210: l_cellStr.pcmf_endTR(true);
211:
212: l_cellStr = this .pcmf_insertFont(l_cellStr, null);
213: } else {
214: l_cell = (MuGenericTableCell) xIt.next();
215:
216: UnTableCellSpan l_span = l_cell.pcmf_getSpan();
217: if (l_span == null && l_cell.pcmf_isSpaned())
218: continue;
219:
220: l_obj = l_cell.pcmf_getItem();
221: l_body = l_obj.toString();
222:
223: if (xIdx != 0)
224: l_cellStr = new KeStringTemplate(xTpl);
225: else if (l_obj instanceof IUnComponent
226: && l_obj instanceof IUnImage == false)
227: l_cellStr = new KeStringTemplate(xNHeadTpl);
228: else
229: l_cellStr = new KeStringTemplate(xHeadTpl);
230:
231: if (l_cell.pcmf_getXDirStatic() == true)
232: KeTools.pcmf_stringSubst(l_cellStr, "$NSCOL",
233: new KeStringTemplate(xNsCol));
234: else
235: KeTools.pcmf_stringSubst(l_cellStr, "$NSCOL", "");
236:
237: if (l_obj instanceof MuGenericComponent
238: && !(l_obj instanceof MuGenericTable))
239: l_body = (String) ((MuGenericComponent) l_obj)
240: .pcmf_execView();
241: else if (l_obj instanceof IKeViewable
242: && !(l_obj instanceof MuGenericTable)) {
243: IKeViewable xTreeEl = (IKeViewable) l_obj;
244: IKeView l_view = xTreeEl.pcmf_getView();
245: if (l_view instanceof UnIconValueView) {
246: UnIconValueView l_iv = (UnIconValueView) l_view;
247:
248: if (l_iv.pcmf_getStdIcon() != null)
249: l_body = l_iv.pcmf_getStdIcon()
250: .pcmf_getUnComponent()
251: .pcmf_execView()
252: + l_obj.toString();
253:
254: l_cellStr = this .pcmf_insertFont(l_cellStr,
255: l_iv.pcmf_getFontDesc());
256:
257: if (l_iv.pcmf_getFg() != null)
258: KeTools.pcmf_stringSubst(l_cellStr,
259: "$TDFGCOL", l_iv.pcmf_getFg());
260: else
261: KeTools.pcmf_stringSubst(l_cellStr,
262: "$TDFGCOL", l_cell
263: .pcmf_getFgColor());
264:
265: if (l_iv.pcmf_getBg() != null)
266: KeTools
267: .pcmf_stringSubst(
268: l_cellStr,
269: "$TDBGCOL",
270: xSelected
271: && !xTab
272: .pcmf_getDifferentialRepaint() ? this .pem_selCol
273: : l_iv.pcmf_getBg());
274: else
275: KeTools
276: .pcmf_stringSubst(
277: l_cellStr,
278: "$TDBGCOL",
279: xSelected
280: && !xTab
281: .pcmf_getDifferentialRepaint() ? this .pem_selCol
282: : l_cell
283: .pcmf_getBgColor());
284: }
285: } else {
286: Object l_deref = null;
287: l_obj = l_cell.pcmf_getItem();
288: l_body = l_obj.toString();
289: l_deref = KeTools.pcmf_deRefObj(l_body);
290: if (l_deref instanceof MuGenericComponent
291: && !(l_obj instanceof MuGenericTable)) {
292: xTab
293: .pcmf_removeNode((MuGenericComponent) l_deref);
294: xTab.pcmf_addNode(
295: ((MuGenericComponent) l_deref)
296: .pcmf_getName(),
297: (MuGenericComponent) l_deref);
298: KeLog.pcmf_log("ug2t",
299: "late add (during render) of item in table, cache does not Work: "
300: + l_body, this , KeLog.MESSAGE);
301:
302: l_body = (String) ((MuGenericComponent) l_deref)
303: .pcmf_execView();
304: } else if (l_deref instanceof IKeViewable
305: && !(l_deref instanceof MuGenericTable)) {
306: IKeView l_view = ((IKeViewable) l_deref)
307: .pcmf_getView();
308: if (l_view instanceof UnIconValueView
309: && ((UnIconValueView) l_view)
310: .pcmf_getStdIcon() != null) {
311: UnIconValueView l_iv = (UnIconValueView) l_view;
312:
313: l_cellStr = this .pcmf_insertFont(l_cellStr,
314: l_iv.pcmf_getFontDesc());
315: l_body = l_iv.pcmf_getStdIcon()
316: .pcmf_getUnComponent()
317: .pcmf_execView()
318: + l_deref.toString();
319:
320: if (l_iv.pcmf_getFg() != null)
321: KeTools.pcmf_stringSubst(l_cellStr,
322: "$TDFGCOL", l_iv.pcmf_getFg());
323: else
324: KeTools.pcmf_stringSubst(l_cellStr,
325: "$TDFGCOL", l_cell
326: .pcmf_getFgColor());
327:
328: if (l_iv.pcmf_getBg() != null)
329: KeTools.pcmf_stringSubst(l_cellStr,
330: "$TDBGCOL", l_iv.pcmf_getBg());
331: else
332: KeTools.pcmf_stringSubst(l_cellStr,
333: "$TDBGCOL", l_cell
334: .pcmf_getBgColor());
335: }
336: }
337: }
338: ;
339:
340: l_cellStr.pcmf_beginTR();
341:
342: if (l_cell.pcmf_getBoxStyle() != null) {
343: UnBoxBorder l_bl = l_cell.pcmf_getBoxStyle()
344: .pcmf_getBorder(IUnBox.LEFT);
345: UnBoxBorder l_br = l_cell.pcmf_getBoxStyle()
346: .pcmf_getBorder(IUnBox.RIGHT);
347: UnBoxBorder l_bb = l_cell.pcmf_getBoxStyle()
348: .pcmf_getBorder(IUnBox.BOTTOM);
349: UnBoxBorder l_bt = l_cell.pcmf_getBoxStyle()
350: .pcmf_getBorder(IUnBox.TOP);
351:
352: if (l_bl == null && l_br == null && l_bb == null
353: && l_bt == null)
354: l_cellStr.pcmf_stringSubst("$BORDERSTYLES", "");
355: else {
356: l_cellStr.pcmf_stringdirectSubst(
357: "$BORDERSTYLES", new KeStringTemplate(
358: xBoTpl));
359:
360: if (l_bl != null) {
361: l_cellStr = l_cellStr.pcmf_stringSubst(
362: "$BWL", Integer
363: .toString(l_bl.pcm_width));
364: l_cellStr = l_cellStr.pcmf_stringSubst(
365: "$BCL", l_bl.pcm_color);
366: l_cellStr = l_cellStr
367: .pcmf_stringSubst(
368: "$BSL",
369: IUnBox.BORDER_STYLES[l_bl.pcm_style]);
370: } else {
371: l_cellStr = l_cellStr.pcmf_stringSubst(
372: "$BWL", "0");
373: l_cellStr = l_cellStr.pcmf_stringSubst(
374: "$BCL", "black");
375: l_cellStr = l_cellStr.pcmf_stringSubst(
376: "$BSL", "none");
377: }
378:
379: if (l_br != null) {
380: l_cellStr = l_cellStr.pcmf_stringSubst(
381: "$BWR", Integer
382: .toString(l_br.pcm_width));
383: l_cellStr = l_cellStr.pcmf_stringSubst(
384: "$BCR", l_br.pcm_color);
385: l_cellStr = l_cellStr
386: .pcmf_stringSubst(
387: "$BSR",
388: IUnBox.BORDER_STYLES[l_br.pcm_style]);
389: } else {
390: l_cellStr = l_cellStr.pcmf_stringSubst(
391: "$BWR", "0");
392: l_cellStr = l_cellStr.pcmf_stringSubst(
393: "$BCR", "black");
394: l_cellStr = l_cellStr.pcmf_stringSubst(
395: "$BSR", "none");
396: }
397:
398: if (l_bt != null) {
399: l_cellStr = l_cellStr.pcmf_stringSubst(
400: "$BWT", Integer
401: .toString(l_bt.pcm_width));
402: l_cellStr = l_cellStr.pcmf_stringSubst(
403: "$BCT", l_bt.pcm_color);
404: l_cellStr = l_cellStr
405: .pcmf_stringSubst(
406: "$BST",
407: IUnBox.BORDER_STYLES[l_bt.pcm_style]);
408: } else {
409: l_cellStr = l_cellStr.pcmf_stringSubst(
410: "$BWT", "0");
411: l_cellStr = l_cellStr.pcmf_stringSubst(
412: "$BCT", "black");
413: l_cellStr = l_cellStr.pcmf_stringSubst(
414: "$BST", "none");
415: }
416:
417: if (l_bb != null) {
418: l_cellStr = l_cellStr.pcmf_stringSubst(
419: "$BWB", Integer
420: .toString(l_bb.pcm_width));
421: l_cellStr = l_cellStr.pcmf_stringSubst(
422: "$BCB", l_bb.pcm_color);
423: l_cellStr = l_cellStr
424: .pcmf_stringSubst(
425: "$BSB",
426: IUnBox.BORDER_STYLES[l_bb.pcm_style]);
427: } else {
428: l_cellStr = l_cellStr.pcmf_stringSubst(
429: "$BWB", "0");
430: l_cellStr = l_cellStr.pcmf_stringSubst(
431: "$BCB", "black");
432: l_cellStr = l_cellStr.pcmf_stringSubst(
433: "$BSB", "none");
434: }
435: }
436:
437: if (l_cell.pcmf_getBoxStyle().pcmf_getMargin(
438: IUnBox.LEFT) != 0
439: || l_cell.pcmf_getBoxStyle()
440: .pcmf_getMargin(IUnBox.TOP) != 0
441: || l_cell.pcmf_getBoxStyle()
442: .pcmf_getMargin(IUnBox.RIGHT) != 0
443: || l_cell.pcmf_getBoxStyle()
444: .pcmf_getMargin(IUnBox.BOTTOM) != 0) {
445: l_cellStr.pcmf_stringdirectSingleSubst(
446: "$MARGIN",
447: new KeStringTemplate(xMarTpl));
448:
449: l_cellStr = l_cellStr.pcmf_stringSubst("$ML",
450: Integer.toString(l_cell
451: .pcmf_getBoxStyle()
452: .pcmf_getMargin(IUnBox.LEFT)));
453: l_cellStr = l_cellStr.pcmf_stringSubst("$MT",
454: Integer.toString(l_cell
455: .pcmf_getBoxStyle()
456: .pcmf_getMargin(IUnBox.TOP)));
457: l_cellStr = l_cellStr
458: .pcmf_stringSubst("$MB", Integer
459: .toString(l_cell
460: .pcmf_getBoxStyle()
461: .pcmf_getMargin(
462: IUnBox.BOTTOM)));
463: l_cellStr = l_cellStr.pcmf_stringSubst("$MR",
464: Integer.toString(l_cell
465: .pcmf_getBoxStyle()
466: .pcmf_getMargin(IUnBox.RIGHT)));
467: } else
468: l_cellStr.pcmf_stringdirectSingleSubst(
469: "$MARGIN", "");
470:
471: if (l_cell.pcmf_getBoxStyle().pcmf_getPadding(
472: IUnBox.LEFT) != 0
473: || l_cell.pcmf_getBoxStyle()
474: .pcmf_getPadding(IUnBox.TOP) != 0
475: || l_cell.pcmf_getBoxStyle()
476: .pcmf_getPadding(IUnBox.RIGHT) != 0
477: || l_cell.pcmf_getBoxStyle()
478: .pcmf_getPadding(IUnBox.BOTTOM) != 0) {
479: l_cellStr.pcmf_stringdirectSingleSubst(
480: "$PADDING", new KeStringTemplate(
481: xPadTpl));
482:
483: l_cellStr = l_cellStr.pcmf_stringSubst("$PL",
484: Integer.toString(l_cell
485: .pcmf_getBoxStyle()
486: .pcmf_getPadding(IUnBox.LEFT)));
487: l_cellStr = l_cellStr.pcmf_stringSubst("$PT",
488: Integer.toString(l_cell
489: .pcmf_getBoxStyle()
490: .pcmf_getPadding(IUnBox.TOP)));
491: l_cellStr = l_cellStr
492: .pcmf_stringSubst("$PB", Integer
493: .toString(l_cell
494: .pcmf_getBoxStyle()
495: .pcmf_getPadding(
496: IUnBox.BOTTOM)));
497: l_cellStr = l_cellStr
498: .pcmf_stringSubst("$PR", Integer
499: .toString(l_cell
500: .pcmf_getBoxStyle()
501: .pcmf_getPadding(
502: IUnBox.RIGHT)));
503: } else
504: l_cellStr.pcmf_stringdirectSingleSubst(
505: "$PADDING", "");
506:
507: l_cellStr = l_cellStr.pcmf_stringSubst("$VALIGN",
508: HtmlTools
509: .pcmf_getAlignCssVertical(l_cell
510: .pcmf_getBoxStyle()
511: .pcmf_getAlign()));
512: l_cellStr = l_cellStr.pcmf_stringSubst("$HALIGN",
513: HtmlTools
514: .pcmf_getAlignCssText(l_cell
515: .pcmf_getBoxStyle()
516: .pcmf_getAlign()));
517: } else {
518: KeTools.pcmf_stringSubst(l_cellStr,
519: "$BORDERSTYLES", new KeStringTemplate(
520: xDefcTpl));
521: KeTools.pcmf_stringSubst(l_cellStr, "$MARGIN", "");
522: KeTools.pcmf_stringSubst(l_cellStr, "$PADDING", "");
523: KeTools.pcmf_stringSubst(l_cellStr, "$HALIGN",
524: "left");
525: KeTools.pcmf_stringSubst(l_cellStr, "$VALIGN",
526: "middle");
527: }
528:
529: KeTools.pcmf_stringSubst(l_cellStr, "$TDCLASS", l_cell
530: .pcmf_getClass());
531: KeTools
532: .pcmf_stringSubst(
533: l_cellStr,
534: "$TDBGCOL",
535: xSelected
536: && !xTab
537: .pcmf_getDifferentialRepaint() ? this .pem_selCol
538: : l_cell.pcmf_getBgColor());
539: KeTools.pcmf_stringSubst(l_cellStr, "$TDFGCOL", l_cell
540: .pcmf_getFgColor());
541: KeTools.pcmf_stringSubst(l_cellStr, "$NAME", xTab
542: .pcmf_getObjName());
543: KeTools.pcmf_stringSubst(l_cellStr, "$BORDER", Integer
544: .toString(xTab.pcmf_getTableBorder()));
545:
546: if (l_span != null) {
547: KeStringTemplate l_tplSpan = pem_appl
548: .pcmf_getTemplateKit().getSPAN();
549: KeTools.pcmf_stringSingleSubst(l_tplSpan, "$RSP",
550: Integer.toString(l_span.pcmf_getRowSpan()));
551: KeTools.pcmf_stringSingleSubst(l_tplSpan, "$CSP",
552: Integer.toString(l_span
553: .pcmf_getColumnSpan()));
554:
555: KeTools.pcmf_stringSubst(l_cellStr, "$SPAN",
556: l_tplSpan.toString());
557: } else
558: KeTools.pcmf_stringSubst(l_cellStr, "$SPAN", "");
559:
560: l_cellStr.pcmf_endTR(true);
561:
562: l_cellStr = this .pcmf_insertFont(l_cellStr, null);
563: }
564: ;
565:
566: if (l_body == null)
567: l_body = MuGenericTableCell.pcmf_getNullReplacement()
568: .toString();
569:
570: l_retval.pcmf_stringAddEnd(KeTools.pcmf_stringSubst(
571: l_cellStr, "$VALUE",
572: l_body.trim().equals("") ? " " : l_body));
573: }
574: ;
575:
576: return (l_retval);
577: };
578:
579: private String pcmf_buildRow(KeStringTemplate xHeadRow,
580: KeStringTemplate xTplRow, KeStringTemplate xTplRow_e,
581: KeStringTemplate xTplSelRow, KeStringTemplate xTplCell,
582: KeStringTemplate xSelTpl, KeStringTemplate xHeadTpl,
583: KeStringTemplate xNHeadTpl, KeStringTemplate xDefcTpl,
584: KeStringTemplate xBoTpl, KeStringTemplate xPadTpl,
585: KeStringTemplate xMarTpl, KeStringTemplate xNsCol,
586: Iterator xIt, MuGenericTableRow xRow, MuGenericTable xTab,
587: int xIdx) {
588: KeStringTemplate l_retval = null;
589: KeStringTemplate l_rowtpl = null;
590:
591: boolean l_selected = false;
592:
593: if (xIdx == 0) {
594: l_rowtpl = new KeStringTemplate(xHeadRow);
595: } else if (xTab.pcmf_isMultiSelection()) {
596: if (xTab.pcmf_getValues().pcmf_contains(
597: Integer.toString(xIdx - 1))) {
598: if (!xTab.pcmf_getDifferentialRepaint())
599: l_rowtpl = new KeStringTemplate(xTplSelRow);
600: else {
601: if (xIdx % 2 != 0)
602: l_rowtpl = new KeStringTemplate(xTplRow);
603: else
604: l_rowtpl = new KeStringTemplate(xTplRow_e);
605: }
606: l_selected = true;
607: } else {
608: if (xIdx % 2 != 0)
609: l_rowtpl = new KeStringTemplate(xTplRow);
610: else
611: l_rowtpl = new KeStringTemplate(xTplRow_e);
612: }
613: } else {
614: if (Integer.toString(xIdx - 1).equals(xTab.pcmf_getValue())
615: && xTab.pcmf_isSelectable()) {
616: l_rowtpl = new KeStringTemplate(xTplSelRow);
617: l_selected = true;
618: } else {
619: if (xIdx % 2 != 0)
620: l_rowtpl = new KeStringTemplate(xTplRow);
621: else
622: l_rowtpl = new KeStringTemplate(xTplRow_e);
623: }
624: }
625:
626: l_retval = pcmf_buildCell(xTplCell, xSelTpl, xHeadTpl,
627: xNHeadTpl, xDefcTpl, xBoTpl, xPadTpl, xMarTpl, xNsCol,
628: xIt, xTab, xIdx, l_selected);
629:
630: if (xRow.pem_hide)
631: return ("");
632:
633: l_rowtpl.pcmf_beginTR();
634:
635: KeTools.pcmf_stringSubst(l_rowtpl, "$TRALIGN", xRow.pem_align);
636: KeTools.pcmf_stringSubst(l_rowtpl, "$TRCLASS", xRow.pem_class);
637: KeTools.pcmf_stringSubst(l_rowtpl, "$TRBGCOL", xRow.pem_color);
638: KeTools.pcmf_stringSubst(l_rowtpl, "$NAME", xTab
639: .pcmf_getObjName());
640: KeTools
641: .pcmf_stringSubst(l_rowtpl, "$COLS", l_retval
642: .toString());
643:
644: l_rowtpl.pcmf_endTR(true);
645:
646: return (l_rowtpl.toString());
647: };
648:
649: private MuGenericCache pem_cache = new MuGenericCache();
650:
651: public void pcmf_clearCache() {
652: this .pem_cache.pcmf_clearCache();
653: }
654:
655: public boolean pcmf_supportsCaching() {
656: return (true);
657: }
658:
659: public Object pcmf_output(KeTreeElement xTreeEl) {
660: MuGenericTable html_xTreeEl = (MuGenericTable) xTreeEl;
661:
662: // @@
663:
664: if (pem_appl == null) {
665: Object l_appl = KeRegisteredObject
666: .pcmf_getObjByName(IUnApplication.MY_APPL);
667: if (l_appl instanceof MuGenericApplication)
668: pem_appl = (MuGenericApplication) l_appl;
669: else
670: pem_appl = (MuGenericApplication) html_xTreeEl
671: .pcmf_getAppl();
672: }
673:
674: this .pem_appl.pcmf_getRenderer().pcmf_addScrollPos(
675: html_xTreeEl.pcmf_getScrollCrt());
676:
677: // @@
678:
679: KeStringTemplate l_seltpl = null;
680: KeStringTemplate l_celltpl = null;
681: KeStringTemplate l_rowtpl = null;
682: KeStringTemplate l_rowtpl_e = null;
683: KeStringTemplate l_selrowtpl = null;
684: KeStringTemplate l_headtpl = null;
685: KeStringTemplate l_nheadtpl = null;
686: KeStringTemplate l_headrowtpl = null;
687:
688: KeStringTemplate l_defctpl = null;
689: KeStringTemplate l_botpl = null;
690: KeStringTemplate l_padtpl = null;
691: KeStringTemplate l_martpl = null;
692: KeStringTemplate l_nscol = null;
693:
694: StringBuffer l_rows = new StringBuffer(html_xTreeEl
695: .pcmf_getRowCount());
696: Iterator l_it = html_xTreeEl.pcmf_getRows();
697: int l_idx = 0;
698:
699: l_headrowtpl = html_xTreeEl.pcmf_getMarkupString("HEADROW");
700: l_headtpl = html_xTreeEl.pcmf_getMarkupString("HEAD");
701: l_nheadtpl = html_xTreeEl.pcmf_getMarkupString("NHEAD");
702: l_rowtpl = html_xTreeEl.pcmf_getMarkupString("ROWS_ODD");
703: l_rowtpl_e = html_xTreeEl.pcmf_getMarkupString("ROWS_EVEN");
704: l_selrowtpl = html_xTreeEl.pcmf_getMarkupString("SELROWS");
705: l_celltpl = html_xTreeEl.pcmf_getMarkupString("COLS");
706: l_seltpl = html_xTreeEl.pcmf_getMarkupString("SEL");
707:
708: l_defctpl = html_xTreeEl.pcmf_getMarkupString("DCELL");
709: l_botpl = html_xTreeEl.pcmf_getMarkupString("BORDERSTYLES");
710: l_martpl = html_xTreeEl.pcmf_getMarkupString("MARGIN");
711: l_padtpl = html_xTreeEl.pcmf_getMarkupString("PADDING");
712: l_nscol = html_xTreeEl.pcmf_getMarkupString("NSCOL");
713:
714: if (this .pem_selCol == null)
715: this .pem_selCol = html_xTreeEl.pcmf_getMarkupString(
716: "SELCOLOR").toString().trim();
717:
718: KeStringTemplate l_string = html_xTreeEl
719: .pcmf_getMarkupString("MAIN");
720:
721: l_string = html_xTreeEl.pcmf_insertToolTip(l_string);
722: l_string = html_xTreeEl
723: .pcmf_insertColorandFontandBorder(l_string);
724: l_string = html_xTreeEl.pcmf_insertPosition(l_string);
725: l_string = html_xTreeEl.pcmf_insertChannelandMenu(l_string);
726:
727: l_string.pcmf_beginTR();
728:
729: KeTools.pcmf_stringSubst(l_string, "$URL", pem_appl
730: .pcmf_getHostName()
731: + ":"
732: + Integer.toString(pem_appl.pcmf_getPort())
733: + "/"
734: + pem_appl.pcmf_getRootUrl());
735: KeTools.pcmf_stringSubst(l_string, "$NAME", html_xTreeEl
736: .pcmf_getObjName());
737: KeTools.pcmf_stringSubst(l_string, "$OID", html_xTreeEl
738: .pcmf_getObjName());
739: KeTools.pcmf_stringSubst(l_string, "$PNAME", html_xTreeEl
740: .pcmf_getScrollCrt().pcmf_getObjName());
741: KeTools.pcmf_stringSubst(l_string, "$POS_SCROLL", html_xTreeEl
742: .pcmf_getScrollCrt().pcmf_getValue().toString());
743:
744: KeTools.pcmf_stringSubst(l_string, "$BORDER", Integer
745: .toString(html_xTreeEl.pcmf_getTableBorder()));
746: KeTools.pcmf_stringSubst(l_string, "$SPACE", Integer
747: .toString(html_xTreeEl.pcmf_getSpacing()));
748: KeTools.pcmf_stringSubst(l_string, "$PAD", Integer
749: .toString(html_xTreeEl.pcmf_getPadding()));
750:
751: l_string.pcmf_endTR(true);
752:
753: if (xTreeEl instanceof KeTreeNode) {
754: MuGenericTableRow aktrow = null;
755:
756: while (l_it.hasNext()) {
757: aktrow = (MuGenericTableRow) l_it.next();
758: l_rows.append(pcmf_buildRow(l_headrowtpl, l_rowtpl,
759: l_rowtpl_e, l_selrowtpl, l_celltpl, l_seltpl,
760: l_headtpl, l_nheadtpl, l_defctpl, l_botpl,
761: l_padtpl, l_martpl, l_nscol, aktrow.pem_items
762: .iterator(), aktrow, html_xTreeEl,
763: l_idx++));
764: }
765: ;
766: }
767: ;
768:
769: KeTools.pcmf_stringSubst(l_string, "$ROWS", l_rows.toString());
770:
771: // @@
772:
773: return (l_string);
774: };
775:
776: public Object pcmf_execView(KeTreeElement xTreeEl) {
777: return (xTreeEl.pcmf_execView());
778: };
779: };
|