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 de.ug2t.channel.markup.generic.*;
034: import de.ug2t.kernel.*;
035: import de.ug2t.unifiedGui.interfaces.*;
036: import de.ug2t.xmlScript.*;
037:
038: public final class HtmlInputFieldRenderer implements IKeView {
039: private MuGenericCache pem_cache = new MuGenericCache();
040:
041: public boolean pcmf_supportsCaching() {
042: return (true);
043: }
044:
045: public void pcmf_clearCache() {
046: this .pem_cache.pcmf_clearCache();
047: }
048:
049: public void pcmf_activateCache(boolean xAc) {
050: this .pem_cache.pcmf_activateThisCache(xAc);
051: return;
052: }
053:
054: public Object pcmf_output(KeTreeElement xTreeEl) {
055: MuGenericInputField html_xTreeEl = (MuGenericInputField) xTreeEl;
056:
057: // @@
058:
059: KeStringTemplate l_string = html_xTreeEl
060: .pcmf_getMarkupString("MAIN");
061:
062: l_string = html_xTreeEl.pcmf_insertToolTip(l_string);
063: l_string = html_xTreeEl
064: .pcmf_insertColorandFontandBorder(l_string);
065: l_string = html_xTreeEl.pcmf_insertPosition(l_string);
066: l_string = html_xTreeEl.pcmf_insertChannelandMenu(l_string);
067: l_string = html_xTreeEl.pcmf_insertTabIndex(l_string);
068:
069: l_string.pcmf_beginTR();
070:
071: Object l_obj = html_xTreeEl.pcmf_getValue();
072: if (l_obj == null)
073: l_obj = "";
074:
075: String l_value = l_obj.toString();
076:
077: l_string = KeTools.pcmf_stringSubst(l_string, "$NAME",
078: html_xTreeEl.pcmf_getObjName());
079: l_string = KeTools.pcmf_stringSubst(l_string, "$VALUE",
080: ScXmlScript.pcmf_filterSignsHTML(l_value));
081: l_string = KeTools.pcmf_stringSubst(l_string, "$SIZE", Integer
082: .toString(html_xTreeEl.pcmf_getSize()));
083: l_string = KeTools.pcmf_stringSubst(l_string, "$MAXLEN",
084: Integer.toString(html_xTreeEl.pcmf_getMaxLen()));
085: l_string = KeTools.pcmf_stringSubst(l_string, "$OID",
086: html_xTreeEl.pcmf_getObjName());
087:
088: int l_talign = html_xTreeEl.pcmf_getTextAlign();
089: if (l_talign == IUnInputField.TEXT_ALIGN_EAST)
090: l_string = KeTools.pcmf_stringSubst(l_string, "$TALIGN",
091: "right");
092: else if (l_talign == IUnInputField.TEXT_ALIGN_CENTER)
093: l_string = KeTools.pcmf_stringSubst(l_string, "$TALIGN",
094: "center");
095: else
096: l_string = KeTools.pcmf_stringSubst(l_string, "$TALIGN",
097: "left");
098:
099: if (html_xTreeEl.pcmf_isPwd())
100: l_string = KeTools.pcmf_stringSubst(l_string, "$TYPE",
101: "password");
102: else
103: l_string = KeTools.pcmf_stringSubst(l_string, "$TYPE",
104: "text");
105:
106: if (html_xTreeEl.pcmf_isDisabled())
107: l_string = KeTools.pcmf_stringSubst(l_string, "$DISABLED",
108: "disabled");
109: else
110: l_string = KeTools.pcmf_stringSubst(l_string, "$DISABLED",
111: "");
112:
113: if (html_xTreeEl.pcmf_isReadOnly())
114: l_string = KeTools.pcmf_stringSubst(l_string, "$READONLY",
115: "readonly");
116: else
117: l_string = KeTools.pcmf_stringSubst(l_string, "$READONLY",
118: "");
119:
120: if (html_xTreeEl.pcmf_isSelected())
121: l_string = KeTools.pcmf_stringSubst(l_string, "$SELECT",
122: html_xTreeEl.pcmf_getMarkupString("SEL"));
123: else
124: l_string = KeTools
125: .pcmf_stringSubst(l_string, "$SELECT", "");
126:
127: IUnTextInputComponent.SelectionInterval l_iv = html_xTreeEl
128: .pcmf_getSelectionInterval();
129: if (l_iv != null) {
130: KeStringTemplate l_sTpl = html_xTreeEl
131: .pcmf_getMarkupString("SELIV");
132: l_sTpl.pcmf_stringdirectSingleSubst("$B", Integer
133: .toString(l_iv.pcm_begin));
134: l_sTpl.pcmf_stringdirectSingleSubst("$L", Integer
135: .toString(l_iv.pcm_len));
136: l_string = KeTools.pcmf_stringSubst(l_string, "$SELECT",
137: l_sTpl.toString());
138: }
139:
140: if (html_xTreeEl.pcmf_getInputFilter() != null) {
141: l_string = KeTools.pcmf_stringSubst(l_string, "$KEYS",
142: html_xTreeEl.pcmf_getInputFilter());
143: l_string = KeTools.pcmf_stringSubst(l_string, "$VALSIGNS",
144: html_xTreeEl.pcmf_getMarkupString("VALSIGNS"));
145: } else {
146: l_string = KeTools.pcmf_stringSubst(l_string, "$KEYS", "");
147: l_string = KeTools.pcmf_stringSubst(l_string, "$VALSIGNS",
148: "");
149: }
150:
151: if (html_xTreeEl.pcmf_isSubmit()) {
152: KeStringTemplate l_stpl = html_xTreeEl
153: .pcmf_getMarkupString("SUBMIT");
154: if (l_stpl != null)
155: l_string = KeTools.pcmf_stringSubst(l_string,
156: "$SUBMIT", l_stpl);
157: else
158: l_string = KeTools.pcmf_stringSubst(l_string,
159: "$SUBMIT", html_xTreeEl.pcmf_getKit()
160: .getSUBMIT_T());
161: } else
162: l_string = KeTools
163: .pcmf_stringSubst(l_string, "$SUBMIT", "");
164:
165: l_string.pcmf_endTR(true);
166:
167: // @@
168:
169: return (l_string);
170: };
171:
172: public Object pcmf_execView(KeTreeElement xTreeEl) {
173: return (xTreeEl.pcmf_execView());
174: };
175: };
|