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 de.ug2t.channel.markup.html.renderer.*;
034: import de.ug2t.connector.*;
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.*;
037: import de.ug2t.unifiedGui.interfaces.*;
038:
039: public final class MuGenericSplitPane extends MuGenericComponent
040: implements IUnSplitPane, IKePoolable {
041: private IKeView pem_view = new HtmlSplitPaneRenderer();
042:
043: protected int pdm_firstPercent = -1;
044: private int pem_percent = 30;
045: private int pem_mode = VSPLIT;
046: private int pem_slider = 2;
047: private int pem_step = 5;
048:
049: protected IUnButton pdm_submitW1 = null;
050: protected IUnButton pdm_submitW2 = null;
051: protected IUnButton pdm_submitW3 = null;
052: protected IUnButton pdm_submitW4 = null;
053: protected IUnButton pdm_submitW5 = null;
054:
055: class MuSplitPaneIncListener implements IUnGuiEventListener {
056: private MuGenericSplitPane pem_myWidget = null;
057:
058: public MuSplitPaneIncListener(MuGenericSplitPane xMyWidget) {
059: this .pem_myWidget = xMyWidget;
060:
061: return;
062: }
063:
064: public void pcmf_execListener(UnComponent xParam) {
065: if (this .pem_myWidget.pcmf_getSplitPercent() > (100 - this .pem_myWidget
066: .pcmf_getSliderPercent() - this .pem_myWidget
067: .pcmf_getSliderStep()))
068: return;
069:
070: this .pem_myWidget.pcmf_setSplitPercent(this .pem_myWidget
071: .pcmf_getSplitPercent()
072: + this .pem_myWidget.pcmf_getSliderStep());
073:
074: try {
075: this .pem_myWidget.pcmf_dispatchEvent();
076: } catch (Exception e) {
077: KeLog.pcmf_logException("ug2t", this , e);
078: }
079:
080: return;
081: };
082: };
083:
084: class MuSplitPaneDecListener implements IUnGuiEventListener {
085: private MuGenericSplitPane pem_myWidget = null;
086:
087: public MuSplitPaneDecListener(MuGenericSplitPane xMyWidget) {
088: this .pem_myWidget = xMyWidget;
089:
090: return;
091: }
092:
093: public void pcmf_execListener(UnComponent xParam) {
094: if (this .pem_myWidget.pcmf_getSplitPercent() < this .pem_myWidget
095: .pcmf_getSliderStep())
096: return;
097:
098: this .pem_myWidget.pcmf_setSplitPercent(this .pem_myWidget
099: .pcmf_getSplitPercent()
100: - this .pem_myWidget.pcmf_getSliderStep());
101:
102: try {
103: this .pem_myWidget.pcmf_dispatchEvent();
104: } catch (Exception e) {
105: KeLog.pcmf_logException("ug2t", this , e);
106: }
107:
108: return;
109: };
110: };
111:
112: class MuSplitPaneResetListener implements IUnGuiEventListener {
113: private MuGenericSplitPane pem_myWidget = null;
114:
115: public MuSplitPaneResetListener(MuGenericSplitPane xMyWidget) {
116: this .pem_myWidget = xMyWidget;
117:
118: return;
119: }
120:
121: public void pcmf_execListener(UnComponent xParam) {
122: this .pem_myWidget
123: .pcmf_setSplitPercent(this .pem_myWidget.pdm_firstPercent != -1 ? this .pem_myWidget.pdm_firstPercent
124: : 30);
125:
126: try {
127: this .pem_myWidget.pcmf_dispatchEvent();
128: } catch (Exception e) {
129: KeLog.pcmf_logException("ug2t", this , e);
130: }
131:
132: return;
133: };
134: };
135:
136: class MuSplitPaneMaxListener implements IUnGuiEventListener {
137: private MuGenericSplitPane pem_myWidget = null;
138:
139: public MuSplitPaneMaxListener(MuGenericSplitPane xMyWidget) {
140: this .pem_myWidget = xMyWidget;
141:
142: return;
143: }
144:
145: public void pcmf_execListener(UnComponent xParam) {
146: this .pem_myWidget
147: .pcmf_setSplitPercent(100 - this .pem_myWidget
148: .pcmf_getSliderPercent() - 1);
149:
150: try {
151: this .pem_myWidget.pcmf_dispatchEvent();
152: } catch (Exception e) {
153: KeLog.pcmf_logException("ug2t", this , e);
154: }
155:
156: return;
157: };
158: };
159:
160: class MuSplitPaneMinListener implements IUnGuiEventListener {
161: private MuGenericSplitPane pem_myWidget = null;
162:
163: public MuSplitPaneMinListener(MuGenericSplitPane xMyWidget) {
164: this .pem_myWidget = xMyWidget;
165:
166: return;
167: }
168:
169: public void pcmf_execListener(UnComponent xParam) {
170: this .pem_myWidget.pcmf_setSplitPercent(1);
171:
172: try {
173: this .pem_myWidget.pcmf_dispatchEvent();
174: } catch (Exception e) {
175: KeLog.pcmf_logException("ug2t", this , e);
176: }
177:
178: return;
179: };
180: };
181:
182: public MuGenericSplitPane(String xName, ACoDataGetter xTplGetter,
183: Object xTplName, MuGenericApplication xAppl)
184: throws Exception {
185: super (xName, xTplGetter, xTplName, xAppl);
186:
187: this .pdm_submitW1 = this .pcmf_getAppl()
188: .pcmf_getComponentFactory().pcmf_createButton(
189: UnComponentFactory.MARKUP, "",
190: this .pcmf_getAppl());
191: this .pdm_submitW2 = this .pcmf_getAppl()
192: .pcmf_getComponentFactory().pcmf_createButton(
193: UnComponentFactory.MARKUP, "",
194: this .pcmf_getAppl());
195: this .pdm_submitW3 = this .pcmf_getAppl()
196: .pcmf_getComponentFactory().pcmf_createButton(
197: UnComponentFactory.MARKUP, "",
198: this .pcmf_getAppl());
199: this .pdm_submitW4 = this .pcmf_getAppl()
200: .pcmf_getComponentFactory().pcmf_createButton(
201: UnComponentFactory.MARKUP, "",
202: this .pcmf_getAppl());
203: this .pdm_submitW5 = this .pcmf_getAppl()
204: .pcmf_getComponentFactory().pcmf_createButton(
205: UnComponentFactory.MARKUP, "",
206: this .pcmf_getAppl());
207:
208: this .pdm_submitW1.pcmf_addListener(new MuSplitPaneDecListener(
209: this ));
210: this .pdm_submitW2.pcmf_addListener(new MuSplitPaneIncListener(
211: this ));
212: this .pdm_submitW3.pcmf_addListener(new MuSplitPaneMinListener(
213: this ));
214: this .pdm_submitW4.pcmf_addListener(new MuSplitPaneMaxListener(
215: this ));
216: this .pdm_submitW5
217: .pcmf_addListener(new MuSplitPaneResetListener(this ));
218:
219: this .pcmf_setView(pem_view);
220: this .pcmf_setFill(true, true);
221:
222: // Debug
223: // this.pcmf_addListener(new UnPrintValueListener());
224: }
225:
226: // @@
227:
228: public void pcmf_addFirst(IUnForm xForm) {
229: this .pcmf_removeFirst();
230: this .pcmf_addNode(FNAME, xForm.pcmf_getUnComponent());
231: return;
232: }
233:
234: public void pcmf_addSecond(IUnForm xForm) {
235: this .pcmf_removeSecond();
236: this .pcmf_addNode(SNAME, xForm.pcmf_getUnComponent());
237: return;
238: }
239:
240: public void pcmf_removeFirst() {
241: this .pcmf_removeNode(FNAME);
242: return;
243: }
244:
245: public void pcmf_removeSecond() {
246: this .pcmf_removeNode(SNAME);
247: return;
248: }
249:
250: public IUnButton pcmf_getSubmitW1() {
251: return (this .pdm_submitW1);
252: }
253:
254: public IUnButton pcmf_getSubmitW2() {
255: return (this .pdm_submitW2);
256: }
257:
258: public IUnButton pcmf_getSubmitW3() {
259: return (this .pdm_submitW3);
260: }
261:
262: public IUnButton pcmf_getSubmitW4() {
263: return (this .pdm_submitW4);
264: }
265:
266: public IUnButton pcmf_getSubmitW5() {
267: return (this .pdm_submitW5);
268: }
269:
270: public void pcmf_setSplitPercent(int xPercent) {
271: if (this .pdm_firstPercent == -1)
272: this .pdm_firstPercent = xPercent;
273:
274: if (this .pem_percent == xPercent)
275: return;
276:
277: this .pcmf_setPropChanged(true);
278: this .pem_percent = xPercent;
279: if (this .pdm_firstPercent == -1)
280: this .pdm_firstPercent = xPercent;
281:
282: this .pdm_Element = Integer.toString(xPercent);
283: }
284:
285: public void pcmf_setSplitMode(int xSplit) {
286: if (this .pem_mode == xSplit)
287: return;
288:
289: this .pcmf_setPropChanged(true);
290:
291: if (xSplit == IUnSplitPane.VSPLIT) {
292: ((MuGenericComponent) this .pdm_submitW1).pcmf_setFill(
293: false, true);
294: ((MuGenericComponent) this .pdm_submitW2).pcmf_setFill(
295: false, true);
296: } else {
297: ((MuGenericComponent) this .pdm_submitW1).pcmf_setFill(true,
298: false);
299: ((MuGenericComponent) this .pdm_submitW2).pcmf_setFill(true,
300: false);
301: }
302: this .pem_mode = xSplit;
303: }
304:
305: public int pcmf_getSplitPercent() {
306: return (this .pem_percent);
307: }
308:
309: public int pcmf_getSplitMode() {
310: return (this .pem_mode);
311: }
312:
313: public void pcmf_delete() throws Exception {
314: if (this .pdm_deleted == true)
315: return;
316:
317: pdm_submitW1.pcmf_getUnComponent().pcmf_delete();
318: pdm_submitW2.pcmf_getUnComponent().pcmf_delete();
319: pdm_submitW3.pcmf_getUnComponent().pcmf_delete();
320: pdm_submitW4.pcmf_getUnComponent().pcmf_delete();
321: pdm_submitW5.pcmf_getUnComponent().pcmf_delete();
322:
323: super .pcmf_delete();
324:
325: return;
326: };
327:
328: public void pcmf_setSliderPercent(int xPercent) {
329: this .pem_slider = xPercent;
330: return;
331: }
332:
333: public int pcmf_getSliderPercent() {
334: return (this .pem_slider);
335: }
336:
337: public void pcmf_setSliderStep(int xStep) {
338: this .pem_step = xStep;
339: return;
340: }
341:
342: public int pcmf_getSliderStep() {
343: return (this .pem_step);
344: }
345:
346: public int pcmf_getSliderAbs() {
347: KeLog
348: .pcmf_log(
349: "ug2t",
350: "MARKUP splitPane does not support absolute slider size",
351: this , KeLog.MESSAGE);
352: return (-1);
353: }
354:
355: public void pcmf_setSliderAbs(int xPixel) {
356: KeLog
357: .pcmf_log(
358: "ug2t",
359: "MARKUP splitPane does not support absolute slider size",
360: this , KeLog.MESSAGE);
361: }
362:
363: // @@
364: }
|