Source Code Cross Referenced for HoSrvGenericSnapShopComponent.java in  » J2EE » WiSerFramework » de » ug2t » channel » ho » server » generic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » WiSerFramework » de.ug2t.channel.ho.server.generic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.server.generic;
032:
033:        import java.awt.*;
034:        import java.awt.image.*;
035:        import java.io.*;
036:
037:        import javax.imageio.*;
038:        import javax.swing.*;
039:
040:        import de.ug2t.kernel.*;
041:        import de.ug2t.unifiedGui.*;
042:        import de.ug2t.unifiedGui.interfaces.*;
043:        import de.ug2t.xmlScript.*;
044:
045:        /**
046:         * @author Dirk
047:         * 
048:         * date: 30.01.2005
049:         * 
050:         * <p>
051:         * Purpose:
052:         * </p>
053:         */
054:        public final class HoSrvGenericSnapShopComponent extends
055:                AHoSrvGenericComponent implements  IUnSnapShotComponent {
056:            private BufferedImage pem_image = null;
057:            private int pem_width = 100;
058:            private int pem_height = 50;
059:            private String pem_imageName = "";
060:            private String pem_imageNameURL = "";
061:            private Component pem_wdg = null;
062:
063:            /**
064:             * @param xName
065:             * @throws Exception
066:             */
067:            public HoSrvGenericSnapShopComponent(String xName,
068:                    IUnApplication xAppl, String xClass) throws Exception {
069:                super (xName);
070:                this .pcmf_setAppl(xAppl);
071:
072:                this .pem_imageNameURL = this .pcmf_buildUrl(this 
073:                        .pcmf_getUniqueName());
074:                this .pem_imageName = KeEnvironment.pcmf_getTmpDir()
075:                        + this .pcmf_getUniqueName() + ".jpg";
076:                this .pcmf_setLocalValue(pem_imageNameURL);
077:
078:                this .pem_image = new BufferedImage(this .pem_width,
079:                        this .pem_height, BufferedImage.TYPE_INT_RGB);
080:
081:                if (xClass == null)
082:                    pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingSnapShotComponent";
083:                else
084:                    pdm_clientClass = xClass;
085:
086:                KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
087:                        "");
088:
089:                if (this .pdm_session.pcmf_isInTransaction()) {
090:                    ScXmlScript.pcmf_createPBody(l_remCall);
091:                } else {
092:                    ScXmlScript.pcmf_createxScriptString(l_remCall, null);
093:                    ScXmlScript.pcmf_addProc(l_remCall, null);
094:                }
095:                ;
096:                ScXmlScript
097:                        .pcmf_addDecl(
098:                                l_remCall,
099:                                this .pcmf_getRemName(),
100:                                "de.ug2t.channel.ho.client.swing.HoSwingSnapShotComponent",
101:                                "global");
102:                ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
103:                        "java.lang.String");
104:                ScXmlScript.pcmf_addDeclPar(l_remCall, this .pem_imageNameURL,
105:                        "false", "java.lang.String");
106:                ScXmlScript.pcmf_addDeclPar(l_remCall,
107:                        ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
108:                        "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
109:
110:                ScXmlScript.pcmf_endAll(l_remCall);
111:
112:                this .pdm_session.pcmf_call(l_remCall.toString(), this );
113:
114:                this .pem_wdg = new JLabel("SnapShot");
115:                ((JComponent) this .pem_wdg).setOpaque(true);
116:
117:                this .pcmf_commitWidget();
118:
119:                return;
120:            }
121:
122:            /**
123:             * <p>
124:             * Does...
125:             * </p>
126:             * <p>
127:             * 
128:             * @return a Type with
129:             *         </p>
130:             *         <p>
131:             * @param
132:             *         </p>
133:             */
134:            public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
135:                AHoSrvGenericComponent l_obj = new HoSrvGenericSnapShopComponent(
136:                        this .pcmf_getValue().toString(), this .pcmf_getAppl(),
137:                        this .pdm_clientClass);
138:                l_obj.pcmf_setGlobal(true);
139:                this .pcmf_setGlobal(true);
140:                l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
141:                l_obj.pcmf_setRefFrom(this );
142:                this .pcmf_addRef(l_obj);
143:
144:                return l_obj;
145:            }
146:
147:            /**
148:             * <p>
149:             * Does...
150:             * </p>
151:             * <p>
152:             * 
153:             * @return a Type with
154:             *         </p>
155:             *         <p>
156:             * @param
157:             *         </p>
158:             */
159:            public void pcmf_setSnapShotRoot(Component xWdg) {
160:                if (this .pem_wdg != null)
161:                    IUnSnapShotComponent.VWin.pcmf_remove(this .pem_wdg);
162:
163:                this .pem_wdg = xWdg;
164:            }
165:
166:            /**
167:             * <p>
168:             * Does...
169:             * </p>
170:             * <p>
171:             * 
172:             * @return a Type with
173:             *         </p>
174:             *         <p>
175:             * @param
176:             *         </p>
177:             */
178:            public void pcmf_setWidgetSize(int x, int y) {
179:                this .pem_width = x;
180:                this .pem_height = y;
181:                this .pem_image = new BufferedImage(x, y,
182:                        BufferedImage.TYPE_INT_RGB);
183:                this .pcmf_commitWidget();
184:            }
185:
186:            /**
187:             * <p>
188:             * Does...
189:             * </p>
190:             * <p>
191:             * 
192:             * @return a Type with
193:             *         </p>
194:             *         <p>
195:             * @param
196:             *         </p>
197:             */
198:            public int pcmf_getWidgetSizeX() {
199:                return (this .pem_width);
200:            }
201:
202:            /**
203:             * <p>
204:             * Does...
205:             * </p>
206:             * <p>
207:             * 
208:             * @return a Type with
209:             *         </p>
210:             *         <p>
211:             * @param
212:             *         </p>
213:             */
214:            public int pcmf_getWidgetSizeY() {
215:                return (this .pem_height);
216:            }
217:
218:            private String pcmf_buildUrl(String xValue) {
219:                HoSrvGenericApplication l_appl = (HoSrvGenericApplication) this 
220:                        .pcmf_getAppl();
221:
222:                if (l_appl.pcmf_isMixedMode()) {
223:                    String l_tmp = KeEnvironment.pcmf_getTmpDir();
224:                    String l_root = KeEnvironment.pcmf_getRootDir();
225:                    l_tmp = l_tmp.replace('\\', '/');
226:                    l_root = l_root.replace('\\', '/');
227:                    l_tmp = KeTools.pcmf_stringSubst(l_tmp, l_root, "");
228:
229:                    return ("http://" + l_appl.pcmf_getHostName() + ":"
230:                            + Integer.toString(l_appl.pcmf_getPort()) + "/"
231:                            + l_appl.pcmf_getRootUrl() + "/" + l_tmp + xValue + ".jpg");
232:                } else
233:                    return ("file:" + KeEnvironment.pcmf_getTmpDir() + xValue + ".jpg");
234:            }
235:
236:            public void pcmf_commitWidget() {
237:                try {
238:                    this .pem_wdg.setSize(this .pem_width, this .pem_height);
239:                    IUnSnapShotComponent.VWin.pcmf_remove(this .pem_wdg);
240:                    IUnSnapShotComponent.VWin.pcmf_add(this .pem_wdg);
241:
242:                    this .pem_wdg.print(this .pem_image.getGraphics());
243:
244:                    ImageIO.write(this .pem_image, "jpg", new File(
245:                            this .pem_imageName));
246:                } catch (Exception e) {
247:                    KeLog.pcmf_log("ug2t",
248:                            "error writing widget image to temp", this ,
249:                            KeLog.ERROR);
250:                    return;
251:                }
252:
253:                KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
254:                        "");
255:
256:                if (this .pdm_session.pcmf_isInTransaction()) {
257:                    ScXmlScript.pcmf_createPBody(l_remCall);
258:                } else {
259:                    ScXmlScript.pcmf_createxScriptString(l_remCall, null);
260:                    ScXmlScript.pcmf_addProc(l_remCall, null);
261:                }
262:                ;
263:                ScXmlScript.pcmf_addCall(l_remCall, null, this 
264:                        .pcmf_getRemName(), "pcmf_commitWidget");
265:                ScXmlScript.pcmf_endAll(l_remCall);
266:
267:                this .pdm_session.pcmf_call(l_remCall.toString(), this );
268:
269:                return;
270:            }
271:
272:            public void pcmf_setFixedSize(int w, int h, int type) {
273:                super .pcmf_setFixedSize(w, h, type);
274:                this .pcmf_setWidgetSize(w, h);
275:            }
276:
277:            /**
278:             * <p>
279:             * Does...
280:             * </p>
281:             * <p>
282:             * 
283:             * @return a Type with
284:             *         </p>
285:             *         <p>
286:             * @param
287:             *         </p>
288:             */
289:            public void pcmf_setBgColor(String xCol) {
290:                try {
291:                    if (xCol.charAt(0) == '#') {
292:                        xCol = xCol.substring(1, xCol.length());
293:                        int r = Integer.parseInt(xCol.substring(0, 2), 16);
294:                        int g = Integer.parseInt(xCol.substring(2, 4), 16);
295:                        int b = Integer.parseInt(xCol.substring(4, 6), 16);
296:                        this .pem_wdg.setForeground(new Color(r, g, b));
297:                    } else
298:                        this .pem_wdg.setBackground((Color) java.awt.Color.class
299:                                .getDeclaredField(xCol).get(null));
300:                } catch (Exception e) {
301:                    KeLog.pcmf_logException("ug2t", this , e);
302:                }
303:                ;
304:
305:                super .pcmf_setBgColor(xCol);
306:                this .pcmf_commitWidget();
307:
308:                return;
309:            }
310:
311:            /**
312:             * <p>
313:             * Does...
314:             * </p>
315:             * <p>
316:             * 
317:             * @return a Type with
318:             *         </p>
319:             *         <p>
320:             * @param
321:             *         </p>
322:             */
323:            public void pcmf_setFgColor(String xCol) {
324:                try {
325:                    if (xCol.charAt(0) == '#') {
326:                        xCol = xCol.substring(1, xCol.length());
327:                        int r = Integer.parseInt(xCol.substring(0, 2), 16);
328:                        int g = Integer.parseInt(xCol.substring(2, 4), 16);
329:                        int b = Integer.parseInt(xCol.substring(4, 6), 16);
330:                        this .pem_wdg.setForeground(new Color(r, g, b));
331:                    } else
332:                        this .pem_wdg.setForeground((Color) java.awt.Color.class
333:                                .getDeclaredField(xCol).get(null));
334:                } catch (Exception e) {
335:                    KeLog.pcmf_logException("ug2t", this , e);
336:                }
337:                ;
338:
339:                super .pcmf_setFgColor(xCol);
340:                this .pcmf_commitWidget();
341:
342:                return;
343:            }
344:
345:            /**
346:             * <p>
347:             * Does...
348:             * </p>
349:             * <p>
350:             * 
351:             * @return a Type with
352:             *         </p>
353:             *         <p>
354:             * @param
355:             *         </p>
356:             */
357:            public void pcmf_setFont(UnFontDescriptor xFont) {
358:                Font l_font = Font.getFont(xFont.pcmf_getFontFullSpec(),
359:                        new Font(null, xFont.pcmf_getFontStyle(), xFont
360:                                .pcmf_getFontSize()));
361:                this .pem_wdg.setFont(l_font);
362:                super .pcmf_setFont(xFont);
363:                this .pcmf_commitWidget();
364:
365:                return;
366:            }
367:
368:            public void pcmf_delete() throws Exception {
369:                if (this .pdm_deleted == true)
370:                    return;
371:
372:                this .pem_image.flush();
373:                new File(this.pem_imageName).delete();
374:
375:                if (this.pem_wdg != null)
376:                    IUnSnapShotComponent.VWin.pcmf_remove(this.pem_wdg);
377:
378:                super.pcmf_delete();
379:            };
380:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.