Source Code Cross Referenced for UnFontDescriptor.java in  » J2EE » WiSerFramework » de » ug2t » unifiedGui » 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.unifiedGui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.unifiedGui;
032:
033:        import java.awt.*;
034:        import java.io.*;
035:
036:        import de.ug2t.channel.ho.session.*;
037:        import de.ug2t.kernel.*;
038:        import de.ug2t.unifiedGui.interfaces.*;
039:        import de.ug2t.xmlScript.*;
040:
041:        /**
042:         * @author Dirk
043:         * 
044:         * date: 30.09.2003 project: WiSer-Framework
045:         * 
046:         * <p>
047:         * UnFontDescriptor describes a screen-font including attributes like style and
048:         * size
049:         * </p>
050:         */
051:        public class UnFontDescriptor extends KeRegisteredObject implements 
052:                IKeAttachable, IUnLazyComponent {
053:            private transient IHoSession pem_session = null;
054:
055:            private String pem_fontName = "arial";
056:            private int pem_fontSize = 10;
057:            private int pem_fontStyle = Font.PLAIN;
058:
059:            // @@
060:
061:            /**
062:             * Clones a font-descriptor
063:             * 
064:             * @return cloned descriptor
065:             */
066:            public UnFontDescriptor pcmf_clone() {
067:                return (new UnFontDescriptor(this .pcmf_getFontName(), this 
068:                        .pcmf_getFontSize(), this .pcmf_getFontStyle()));
069:            }
070:
071:            /**
072:             * Creates a font-descriptor
073:             * 
074:             * @param xFont
075:             *          name of the font like arial or comic etc
076:             * @param xSize
077:             *          size of the font int pixel
078:             * @param xStyle
079:             *          style of the font 'bold', 'italic' and 'normal' are supported
080:             */
081:            public UnFontDescriptor(String xFont, int xSize, int xStyle) {
082:                this .pem_session = (IHoSession) KeRegisteredObject
083:                        .pcmf_getObjByName(IHoSession.SESSION_NAME);
084:
085:                if (xFont != null)
086:                    this .pem_fontName = xFont;
087:                if (xSize != -1)
088:                    this .pem_fontSize = xSize;
089:                if (xStyle != -1)
090:                    this .pem_fontStyle = xStyle;
091:
092:                if (this .pem_session != null
093:                        && !this .pem_session.pcmf_isClientSide()) {
094:                    KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
095:                            "");
096:                    // Deklaration
097:                    if (this .pem_session.pcmf_isInTransaction()) {
098:                        ScXmlScript.pcmf_createPBody(l_remCall);
099:                    } else {
100:                        ScXmlScript.pcmf_createxScriptString(l_remCall, null);
101:                        ScXmlScript.pcmf_addProc(l_remCall, null);
102:                    }
103:                    ;
104:                    ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
105:                            "de.ug2t.unifiedGui.UnFontDescriptor", "global");
106:                    ScXmlScript.pcmf_addDeclPar(l_remCall, xFont, "false",
107:                            "java.lang.String");
108:                    ScXmlScript.pcmf_addDeclPar(l_remCall, Integer
109:                            .toString(xSize), "false", "int");
110:                    ScXmlScript.pcmf_addDeclPar(l_remCall, Integer
111:                            .toString(xStyle), "false", "int");
112:                    ScXmlScript.pcmf_endAll(l_remCall);
113:                    this .pem_session.pcmf_call(l_remCall.toString(), this );
114:                }
115:                return;
116:            }
117:
118:            /**
119:             * Creates a default font-descriptor with the following info 'arial', '10px',
120:             * 'normal'
121:             */
122:            public UnFontDescriptor() {
123:                this .pem_session = (IHoSession) KeRegisteredObject
124:                        .pcmf_getObjByName(IHoSession.SESSION_NAME);
125:
126:                if (this .pem_session != null
127:                        && !this .pem_session.pcmf_isClientSide()) {
128:                    KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
129:                            "");
130:                    // Deklaration
131:                    if (this .pem_session.pcmf_isInTransaction()) {
132:                        ScXmlScript.pcmf_createPBody(l_remCall);
133:                    } else {
134:                        ScXmlScript.pcmf_createxScriptString(l_remCall, null);
135:                        ScXmlScript.pcmf_addProc(l_remCall, null);
136:                    }
137:                    ;
138:                    ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
139:                            "de.ug2t.unifiedGui.UnFontDescriptor", "global");
140:                    ScXmlScript.pcmf_endAll(l_remCall);
141:                    this .pem_session.pcmf_call(l_remCall.toString(), this );
142:                }
143:                return;
144:            }
145:
146:            /**
147:             * <p>
148:             * Gets the name of the font
149:             * </p>
150:             * <p>
151:             * 
152:             * @return font name
153:             *         </p>
154:             *         <p>
155:             *         </p>
156:             */
157:            public String pcmf_getFontName() {
158:                return pem_fontName;
159:            }
160:
161:            public void pcmf_setFontName(String xString) {
162:                pem_fontName = xString;
163:            }
164:
165:            /**
166:             * <p>
167:             * Gets the size of the font in pixel
168:             * </p>
169:             * <p>
170:             * 
171:             * @return font size
172:             *         </p>
173:             *         <p>
174:             *         </p>
175:             */
176:            public int pcmf_getFontSize() {
177:                return pem_fontSize;
178:            }
179:
180:            public void pcmf_setFontSize(int xSize) {
181:                pem_fontSize = xSize;
182:            }
183:
184:            /**
185:             * <p>
186:             * Gets the style of the font
187:             * </p>
188:             * <p>
189:             * 
190:             * @return font style
191:             *         </p>
192:             *         <p>
193:             *         </p>
194:             */
195:            public int pcmf_getFontStyle() {
196:                return pem_fontStyle;
197:            }
198:
199:            public void pcmf_setFontStyle(int xStyle) {
200:                pem_fontStyle = xStyle;
201:            }
202:
203:            /**
204:             * <p>
205:             * Deletes the object from the registry
206:             * </p>
207:             * <p>
208:             * </p>
209:             * <p>
210:             * </p>
211:             */
212:            public void pcmf_delete() throws Exception {
213:                synchronized (this ) {
214:                    if (this .pdm_deleted == true || this .pem_refcount > 0)
215:                        return;
216:
217:                    String l_remName = this .pcmf_getRemName();
218:                    super .pcmf_delete();
219:
220:                    if (pem_session != null
221:                            && pem_session.pcmf_isClientSide() == false) {
222:                        if (l_remName != null) {
223:                            KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
224:                                    "");
225:
226:                            if (this .pem_session.pcmf_isInTransaction()) {
227:                                ScXmlScript.pcmf_createPBody(l_remCall);
228:                            } else {
229:                                ScXmlScript.pcmf_createxScriptString(l_remCall,
230:                                        null);
231:                                ScXmlScript.pcmf_addProc(l_remCall, null);
232:                            }
233:                            ;
234:
235:                            ScXmlScript.pcmf_addCall(l_remCall, null,
236:                                    l_remName, "pcmf_delete");
237:                            ScXmlScript.pcmf_endAll(l_remCall);
238:
239:                            this .pem_session.pcmf_call(l_remCall.toString(),
240:                                    this );
241:                        }
242:                    }
243:                }
244:            }
245:
246:            private int pem_refcount = 0;
247:
248:            /**
249:             * <p>
250:             * Internal use for garbage collection, do not call manually
251:             * </p>
252:             * <p>
253:             * 
254:             * </p>
255:             * <p>
256:             * </p>
257:             */
258:            public final void pcmf_attach() {
259:                synchronized (this ) {
260:                    if (this .pdm_deleted)
261:                        KeLog
262:                                .pcmf_log(
263:                                        "ug2t",
264:                                        "attach a deleted ressource, error in synchronisation",
265:                                        this , KeLog.FATAL);
266:
267:                    this .pem_refcount++;
268:                }
269:            }
270:
271:            /**
272:             * <p>
273:             * Internal use for garbage collection, do not call manually
274:             * </p>
275:             * <p>
276:             * 
277:             * </p>
278:             * <p>
279:             * </p>
280:             */
281:            public final void pcmf_detach() {
282:                synchronized (this ) {
283:                    if (this .pem_refcount > 0)
284:                        this .pem_refcount--;
285:                }
286:            }
287:
288:            /**
289:             * <p>
290:             * Internal use for garbage collection, do not call manually (forces detach)
291:             * </p>
292:             * <p>
293:             * 
294:             * </p>
295:             * <p>
296:             * </p>
297:             */
298:            public void pcmf_forceDetach() {
299:                synchronized (this ) {
300:                    if (pem_session != null
301:                            && pem_session.pcmf_isClientSide() == false) {
302:                        String l_remName = this .pcmf_getRemName();
303:                        if (l_remName != null) {
304:                            KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
305:                                    "");
306:
307:                            if (this .pem_session.pcmf_isInTransaction()) {
308:                                ScXmlScript.pcmf_createPBody(l_remCall);
309:                            } else {
310:                                ScXmlScript.pcmf_createxScriptString(l_remCall,
311:                                        null);
312:                                ScXmlScript.pcmf_addProc(l_remCall, null);
313:                            }
314:                            ;
315:
316:                            ScXmlScript.pcmf_addCall(l_remCall, null,
317:                                    l_remName, "pcmf_forceDetach");
318:                            ScXmlScript.pcmf_endAll(l_remCall);
319:
320:                            this .pem_session.pcmf_call(l_remCall.toString(),
321:                                    this );
322:                        }
323:                    }
324:
325:                    this .pem_refcount = 0;
326:                }
327:            }
328:
329:            /**
330:             * <p>
331:             * Attaches a font for preventing it from beeing deleted when not in use
332:             * </p>
333:             * <p>
334:             * 
335:             * </p>
336:             * <p>
337:             * </p>
338:             */
339:            public void pcmf_attachFont() {
340:                synchronized (this ) {
341:                    if (this .pdm_deleted)
342:                        KeLog
343:                                .pcmf_log(
344:                                        "ug2t",
345:                                        "attach a deleted ressource, error in synchronisation",
346:                                        this , KeLog.FATAL);
347:                    else {
348:                        if (pem_session != null
349:                                && pem_session.pcmf_isClientSide() == false) {
350:                            String l_remName = this .pcmf_getRemName();
351:                            if (l_remName != null) {
352:                                KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
353:                                        "");
354:
355:                                if (this .pem_session.pcmf_isInTransaction()) {
356:                                    ScXmlScript.pcmf_createPBody(l_remCall);
357:                                } else {
358:                                    ScXmlScript.pcmf_createxScriptString(
359:                                            l_remCall, null);
360:                                    ScXmlScript.pcmf_addProc(l_remCall, null);
361:                                }
362:                                ;
363:
364:                                ScXmlScript.pcmf_addCall(l_remCall, null,
365:                                        l_remName, "pcmf_attachFont");
366:                                ScXmlScript.pcmf_endAll(l_remCall);
367:
368:                                this .pem_session.pcmf_call(
369:                                        l_remCall.toString(), this );
370:                            }
371:                        }
372:                    }
373:
374:                    this .pem_refcount++;
375:                }
376:            }
377:
378:            /**
379:             * <p>
380:             * Releases a font for beeing deleted when not in use
381:             * </p>
382:             * <p>
383:             * 
384:             * </p>
385:             * <p>
386:             * </p>
387:             */
388:            public void pcmf_detachFont() {
389:                if (pem_session != null
390:                        && pem_session.pcmf_isClientSide() == false) {
391:                    String l_remName = this .pcmf_getRemName();
392:                    if (l_remName != null) {
393:                        KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
394:                                "");
395:
396:                        if (this .pem_session.pcmf_isInTransaction()) {
397:                            ScXmlScript.pcmf_createPBody(l_remCall);
398:                        } else {
399:                            ScXmlScript.pcmf_createxScriptString(l_remCall,
400:                                    null);
401:                            ScXmlScript.pcmf_addProc(l_remCall, null);
402:                        }
403:                        ;
404:
405:                        ScXmlScript.pcmf_addCall(l_remCall, null, l_remName,
406:                                "pcmf_detachFont");
407:                        ScXmlScript.pcmf_endAll(l_remCall);
408:
409:                        this .pem_session.pcmf_call(l_remCall.toString(), this );
410:                    }
411:                }
412:
413:                synchronized (this ) {
414:                    if (this .pem_refcount > 0)
415:                        this .pem_refcount--;
416:                }
417:            }
418:
419:            /**
420:             * <p>
421:             * Releases a font for beeing deleted when not in use - delegate to fit
422:             * interface
423:             * </p>
424:             * <p>
425:             * 
426:             * </p>
427:             * <p>
428:             * </p>
429:             */
430:            public void pcmf_attachExtern() {
431:                this .pcmf_attachFont();
432:            }
433:
434:            /**
435:             * <p>
436:             * Releases a font for beeing deleted when not in use - delegate to fit
437:             * interface
438:             * </p>
439:             * <p>
440:             * 
441:             * </p>
442:             * <p>
443:             * </p>
444:             */
445:            public void pcmf_detachExtern() {
446:                this .pcmf_detachFont();
447:            }
448:
449:            /**
450:             * <p>
451:             * Returns the font style as string
452:             * </p>
453:             * <p>
454:             * 
455:             * </p>
456:             * <p>
457:             * 
458:             * @return font style
459:             *         </p>
460:             */
461:            public String pcmf_getFontStyleName() {
462:                switch (this .pem_fontStyle) {
463:                case Font.PLAIN:
464:                    return ("");
465:                case Font.BOLD:
466:                    return ("BOLD");
467:                case Font.ITALIC:
468:                    return ("ITALIC");
469:                }
470:                ;
471:
472:                return ("");
473:            }
474:
475:            /**
476:             * <p>
477:             * Returns the font the font in the following form Name-Style-PtSize"
478:             * </p>
479:             * <p>
480:             * 
481:             * </p>
482:             * <p>
483:             * 
484:             * @return font spec
485:             *         </p>
486:             */
487:            public String pcmf_getFontFullSpec() {
488:                StringBuffer l_ret = new StringBuffer(80);
489:                l_ret.append(this .pem_fontName);
490:
491:                String l_style = this .pcmf_getFontStyleName();
492:                if (l_style.equals("") != true) {
493:                    l_ret.append("-");
494:                    l_ret.append(l_style);
495:                }
496:                l_ret.append("-");
497:                l_ret.append(Integer.toString(this.pem_fontSize));
498:
499:                return (l_ret.toString());
500:            }
501:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.