001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 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.ho.client.swing;
032:
033: import java.awt.*;
034:
035: import javax.swing.*;
036:
037: import de.ug2t.channel.ho.*;
038: import de.ug2t.kernel.*;
039: import de.ug2t.unifiedGui.*;
040: import de.ug2t.unifiedGui.interfaces.*;
041:
042: public final class HoSwingPage extends HoSwingContainer implements
043: IUnPage {
044: // Hält alle Werte der Seite um diese nach Art MARKUP zum Server zu übertragen
045: private IHoRequest pem_submitValues = null;
046: private UnComponent pem_stdFocus = null;
047: private HoSwingImage pem_image = null;
048: private boolean pem_ownMenu = false;
049: private boolean pem_submitReshapes = false;
050:
051: private int pem_xPos = 0;
052: private int pem_yPos = 0;
053: private int pem_hi = 600;
054: private int pem_wi = 400;
055: private boolean pem_maximized = false;
056:
057: public void pcmf_setInnerPosition(int xPos, int yPos, int xWi,
058: int xHi) {
059: this .pem_xPos = xPos;
060: this .pem_yPos = yPos;
061: this .pem_hi = xHi;
062: this .pem_wi = xWi;
063:
064: return;
065: }
066:
067: public int pcmf_getXPos() {
068: return (this .pem_xPos);
069: };
070:
071: public int pcmf_getYPos() {
072: return (this .pem_yPos);
073: };
074:
075: public int pcmf_getHi() {
076: return (this .pem_hi);
077: };
078:
079: public int pcmf_getWi() {
080: return (this .pem_wi);
081: };
082:
083: private IHoRequest pemf_getSubmitValues() {
084: if (this .pcmf_getAppl().pcmf_isMDI())
085: return (((HoSwingClient) this .pcmf_getAppl())
086: .pcmf_getSubmitValues());
087: else
088: return (this .pem_submitValues);
089: }
090:
091: public HoSwingPage(String xName, boolean xNoLayout,
092: IUnApplication xAppl) throws Exception {
093: super (xName, xAppl);
094: this .pem_submitValues = new HoRequest(this .pem_session, xAppl);
095: super .pcmf_setGuiObjNoLayout(xNoLayout);
096: ((HoSwingClient) xAppl).pcmf_addKeyDispatcher(this );
097:
098: return;
099: };
100:
101: public void pcmf_setGrid(int xCells, int yCells, boolean xDebug) {
102: if (this .pdm_layout == null) {
103: KeLog.pcmf_log(this .pcmf_getUnComponent().pcmf_getAppl()
104: .toString(), "sorry, no layout enabled", this ,
105: KeLog.MESSAGE);
106: return;
107: }
108: ;
109:
110: GridBagConstraints l_constr = new GridBagConstraints();
111: JLabel l_gridHelper = null;
112:
113: for (int x = 0; x < xCells; x++) {
114: if (xDebug)
115: l_gridHelper = new JLabel(Integer.toString(x) + "+");
116: else
117: l_gridHelper = new JLabel(" ");
118:
119: this .pdm_mainPanel.add(l_gridHelper);
120: l_constr.gridx = x;
121: l_constr.gridy = 0;
122: l_constr.anchor = GridBagConstraints.WEST;
123:
124: this .pdm_layout.setConstraints(l_gridHelper, l_constr);
125: }
126: ;
127:
128: for (int y = 1; y < yCells; y++) {
129: if (xDebug)
130: l_gridHelper = new JLabel(Integer.toString(y));
131: else
132: l_gridHelper = new JLabel(" ");
133:
134: this .pdm_mainPanel.add(l_gridHelper);
135: l_constr.gridx = 0;
136: l_constr.gridy = y;
137: l_constr.anchor = GridBagConstraints.WEST;
138:
139: this .pdm_layout.setConstraints(l_gridHelper, l_constr);
140: }
141: ;
142: };
143:
144: public synchronized Object pcmf_setSubmitValue(String xKey,
145: String xValue) {
146: return (this .pem_submitValues.pcmf_setSubmitValue(xKey, xValue));
147: };
148:
149: public synchronized void pcmf_clearSubmitValues() {
150: this .pemf_getSubmitValues().pcmf_clearSubmitValues();
151:
152: return;
153: };
154:
155: public synchronized void pcmf_submit() {
156: this .pem_submitValues.pcmf_submit();
157: };
158:
159: public IUnImage pcmf_getIcon() {
160: return (pem_image);
161: }
162:
163: public void pcmf_setIcon(IUnImage xIcon) {
164: Container l_parent = null;
165: try {
166: l_parent = this .pdm_mainPane.getParent().getParent()
167: .getParent().getParent();
168: } catch (Exception e) {
169: try {
170: l_parent = this .pdm_mainPanel.getParent().getParent()
171: .getParent().getParent();
172: } catch (Exception e2) {
173: KeLog
174: .pcmf_log(
175: this .pcmf_getUnComponent()
176: .pcmf_getAppl().toString(),
177: "no MDI Client or unexpected container-parent, cannot set icon",
178: this , KeLog.MESSAGE);
179: return;
180: }
181: }
182: ;
183:
184: if (l_parent instanceof JInternalFrame) {
185: pem_image = (HoSwingImage) xIcon;
186: ((JInternalFrame) l_parent)
187: .setFrameIcon((ImageIcon) ((JLabel) pem_image
188: .pcmf_getRealSwingObj()).getIcon());
189: }
190: ;
191: };
192:
193: public void pcmf_maximize(boolean xMax) {
194: Container l_parent = null;
195: try {
196: l_parent = this .pdm_mainPane.getParent().getParent()
197: .getParent().getParent();
198: } catch (Exception e) {
199: try {
200: l_parent = this .pdm_mainPanel.getParent().getParent()
201: .getParent().getParent();
202: } catch (Exception e2) {
203: KeLog
204: .pcmf_log(
205: this .pcmf_getUnComponent()
206: .pcmf_getAppl().toString(),
207: "no MDI Client or unexpected container-parent, cannot set icon",
208: this , KeLog.MESSAGE);
209: return;
210: }
211: }
212: ;
213:
214: if (l_parent instanceof JInternalFrame) {
215: try {
216: ((JInternalFrame) l_parent).setMaximum(xMax);
217: this .pem_maximized = xMax;
218: } catch (Exception e2) {
219: KeLog.pcmf_log(this .pcmf_getUnComponent()
220: .pcmf_getAppl().toString(),
221: "cannot set internal frame to maximum", this ,
222: KeLog.MESSAGE);
223: return;
224: }
225: }
226: ;
227: };
228:
229: public String pcmf_getTitle() {
230: Container l_parent = null;
231: try {
232: l_parent = this .pdm_mainPane.getParent().getParent()
233: .getParent().getParent();
234: } catch (Exception e) {
235: try {
236: l_parent = this .pdm_mainPanel.getParent().getParent()
237: .getParent().getParent();
238: } catch (Exception e2) {
239: KeLog
240: .pcmf_log(
241: this .pcmf_getUnComponent()
242: .pcmf_getAppl().toString(),
243: "no MDI Client or unexpected container-parent, cannot set icon",
244: this , KeLog.MESSAGE);
245: return ("");
246: }
247: }
248: ;
249:
250: if (l_parent instanceof JInternalFrame) {
251: try {
252: return (((JInternalFrame) l_parent).getTitle());
253: } catch (Exception e2) {
254: KeLog.pcmf_log(this .pcmf_getUnComponent()
255: .pcmf_getAppl().toString(),
256: "cannot set internal frame to maximum", this ,
257: KeLog.MESSAGE);
258: return ("");
259: }
260: }
261: ;
262:
263: return ("");
264: }
265:
266: public void pcmf_setTitle(String xTitle) {
267: Container l_parent = null;
268: try {
269: l_parent = this .pdm_mainPane.getParent().getParent()
270: .getParent().getParent();
271: } catch (Exception e) {
272: try {
273: l_parent = this .pdm_mainPanel.getParent().getParent()
274: .getParent().getParent();
275: } catch (Exception e2) {
276: KeLog
277: .pcmf_log(
278: this .pcmf_getUnComponent()
279: .pcmf_getAppl().toString(),
280: "no MDI Client or unexpected container-parent, cannot set icon",
281: this , KeLog.MESSAGE);
282: return;
283: }
284: }
285: ;
286:
287: if (l_parent instanceof JInternalFrame) {
288: try {
289: ((JInternalFrame) l_parent).setTitle(xTitle);
290: return;
291: } catch (Exception e2) {
292: KeLog.pcmf_log(this .pcmf_getUnComponent()
293: .pcmf_getAppl().toString(),
294: "cannot set internal frame to maximum", this ,
295: KeLog.MESSAGE);
296: return;
297: }
298: }
299: ;
300:
301: return;
302: }
303:
304: public boolean pcmf_isMaximized() {
305: return (this .pem_maximized);
306: }
307:
308: protected void pdmf_setMaximizedFlag(boolean xMax) {
309: this .pem_maximized = xMax;
310: }
311:
312: public void pcmf_setDefaultFocusWdg(UnComponent xWdg) {
313: this .pem_stdFocus = xWdg;
314: };
315:
316: public void pcmf_setDefaultFocus() {
317: if (this .pem_stdFocus != null)
318: this .pem_stdFocus.pcmf_requestFocus();
319: };
320:
321: public void pcmf_execListener(UnComponent xParam) throws Exception {
322: xParam.pcmf_getAppl().pcmf_setActive(this .pcmf_getName());
323: }
324:
325: public void pcmf_ownsMenu(boolean xOwns) {
326: pem_ownMenu = xOwns;
327: return;
328: }
329:
330: public boolean pcmf_getOwnsMenu() {
331: return (pem_ownMenu);
332: }
333:
334: public void pcmf_setGenerateReshapeEvents(boolean xReshapes) {
335: this .pem_submitReshapes = xReshapes;
336: return;
337: }
338:
339: public boolean pcmf_getGenerateReshapeEvents() {
340: return (this .pem_submitReshapes);
341: }
342:
343: public void pcmf_setExternalCss(String xCss) {
344: }
345:
346: public String pcmf_getExternalCss() {
347: return (null);
348: }
349:
350: public boolean pcmf_isCssSupported() {
351: return (false);
352: }
353: }
|