Source Code Cross Referenced for HoSwingContainer.java in  » J2EE » WiSerFramework » de » ug2t » channel » ho » client » swing » 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.client.swing 
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.client.swing;
032:
033:        import java.awt.*;
034:        import java.awt.event.*;
035:
036:        import javax.swing.*;
037:
038:        import de.ug2t.channel.ho.*;
039:        import de.ug2t.channel.ho.session.*;
040:        import de.ug2t.kernel.*;
041:        import de.ug2t.unifiedGui.*;
042:        import de.ug2t.unifiedGui.interfaces.*;
043:        import de.ug2t.xmlScript.*;
044:
045:        /**
046:         * 
047:         * HoSwingContainer
048:         * 
049:         * @author dvonderweiden
050:         * 
051:         * Created: 09:01:40, 2003 Comment: Klasse enthält die Methode setPos, die Logik
052:         * für GridBag oder Absolute positionieren Das Panel, die ScrollPane sowie die
053:         * notwendige Logik für addNode und AddElement
054:         */
055:        public class HoSwingContainer extends HoSwingComponent implements 
056:                IUnContainer, IUnLayouted, IUnComponent {
057:            protected JScrollPane pdm_mainPane = new JScrollPane();
058:            protected MyPanel pdm_mainPanel = new MyPanel();
059:            protected GridBagLayout pdm_layout = null;
060:            protected IUnImage pdm_bgImg = null;
061:
062:            private int pem_ins1 = 4;
063:            private int pem_ins2 = 4;
064:            private int pem_ins3 = 4;
065:            private int pem_ins4 = 4;
066:
067:            private boolean pem_isWeight = true;
068:
069:            /**
070:             * @param xName
071:             * @param xAppl
072:             * @throws Exception
073:             */
074:            protected class MyPanel extends JPanel {
075:                private ImageIcon pem_bg = null;
076:
077:                /**
078:                 * <p>
079:                 * Does...
080:                 * </p>
081:                 * <p>
082:                 * 
083:                 * @return a Type with
084:                 *         </p>
085:                 *         <p>
086:                 * @param
087:                 *         </p>
088:                 */
089:                protected void paintComponent(Graphics g) {
090:                    if (this .pem_bg != null) {
091:                        int hi = (int) this .getHeight();
092:                        int wi = (int) this .getWidth();
093:                        if (hi != 0 && wi != 0) {
094:                            Image l_img = this .pem_bg.getImage()
095:                                    .getScaledInstance(wi, hi,
096:                                            Image.SCALE_DEFAULT);
097:                            new ImageIcon(l_img).paintIcon(this , g, 0, 0);
098:                        }
099:                    } else
100:                        super .paintComponent(g);
101:
102:                    // @@
103:                }
104:
105:                public void pcmf_setBgImage(IUnImage xImg) {
106:                    this .pem_bg = (ImageIcon) ((HoSwingImage) xImg)
107:                            .pcmf_getIcon();
108:                }
109:            }
110:
111:            public HoSwingContainer(String xName, IUnApplication xAppl)
112:                    throws Exception {
113:                super (xName, xAppl);
114:                super .pdm_realSwingCmp = this .pdm_mainPane;
115:
116:                pdm_layout = new GridBagLayout();
117:                pdm_mainPanel.setLayout(pdm_layout);
118:                pdm_mainPanel.setOpaque(true);
119:
120:                pdm_mainPane.setViewportView(pdm_mainPanel);
121:
122:                this .pdm_mainPane.getViewport().setScrollMode(
123:                        JViewport.BACKINGSTORE_SCROLL_MODE);
124:                this .pemf_addScrollListeners();
125:
126:                return;
127:            }
128:
129:            /**
130:             * @param xName
131:             * @param xAppl
132:             * @param xSess
133:             * @throws Exception
134:             */
135:            public HoSwingContainer(String xName, IUnApplication xAppl,
136:                    IHoSession xSess) throws Exception {
137:                super (xName, xAppl, xSess);
138:                super .pdm_realSwingCmp = this .pdm_mainPane;
139:
140:                pdm_layout = new GridBagLayout();
141:                pdm_mainPanel.setLayout(pdm_layout);
142:                pdm_mainPane.setViewportView(pdm_mainPanel);
143:                pdm_mainPanel.setOpaque(true);
144:
145:                this .pdm_mainPane.getViewport().setScrollMode(
146:                        JViewport.BACKINGSTORE_SCROLL_MODE);
147:                this .pemf_addScrollListeners();
148:
149:                return;
150:            }
151:
152:            private void pemf_addScrollListeners() {
153:                AdjustmentListener l_listen = new AdjustmentListener() {
154:                    private int pem_x = 0;
155:                    private int pem_y = 0;
156:                    private HoDelayedCall pem_call = null;
157:
158:                    public void adjustmentValueChanged(AdjustmentEvent e) {
159:                        if (this .pem_x == HoSwingContainer.this .pdm_mainPane
160:                                .getHorizontalScrollBar().getValue()
161:                                && this .pem_y == HoSwingContainer.this .pdm_mainPane
162:                                        .getVerticalScrollBar().getValue())
163:                            return;
164:
165:                        if (pem_session != null) {
166:                            KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
167:                                    "");
168:
169:                            if (HoSwingContainer.this .pem_session
170:                                    .pcmf_isInTransaction()) {
171:                                ScXmlScript.pcmf_createPBody(l_remCall);
172:                            } else {
173:                                ScXmlScript.pcmf_createxScriptString(l_remCall,
174:                                        null);
175:                                ScXmlScript.pcmf_addProc(l_remCall, null);
176:                            }
177:                            ;
178:
179:                            this .pem_x = HoSwingContainer.this .pdm_mainPane
180:                                    .getHorizontalScrollBar().getValue();
181:                            this .pem_y = HoSwingContainer.this .pdm_mainPane
182:                                    .getVerticalScrollBar().getValue();
183:
184:                            ScXmlScript.pcmf_addCall(l_remCall, null,
185:                                    HoSwingContainer.this .pcmf_getObjName(),
186:                                    "pcmf_setScrollInfo");
187:                            ScXmlScript.pcmf_addCallPar(l_remCall, Integer
188:                                    .toString(this .pem_x), "false", "int");
189:                            ScXmlScript.pcmf_addCallPar(l_remCall, Integer
190:                                    .toString(this .pem_y), "false", "int");
191:                            ScXmlScript.pcmf_endAll(l_remCall);
192:
193:                            if (this .pem_call == null
194:                                    || this .pem_call.pcmf_isReady())
195:                                this .pem_call = new HoDelayedCall(l_remCall
196:                                        .toString(),
197:                                        HoSwingContainer.this .pem_session,
198:                                        IUnComponent.EVENT_LATENCY_SCROLL,
199:                                        HoSwingContainer.this , false);
200:                            else
201:                                this .pem_call.pcmf_refreshCall(l_remCall
202:                                        .toString());
203:                        }
204:                        ;
205:                    }
206:                };
207:                this .pdm_mainPane.getHorizontalScrollBar()
208:                        .addAdjustmentListener(l_listen);
209:                this .pdm_mainPane.getVerticalScrollBar().addAdjustmentListener(
210:                        l_listen);
211:            }
212:
213:            public int pcmf_getCommonLayout() {
214:                if (this .pdm_mainPanel.getLayout() == null)
215:                    return (IUnLayouted.LAYOUT_ABSOLUTE);
216:                else if (this .pdm_mainPanel.getLayout() instanceof  FlowLayout)
217:                    return (IUnLayouted.LAYOUT_FLOW);
218:                else if (this .pdm_mainPanel.getLayout() instanceof  GridBagLayout)
219:                    return (IUnLayouted.LAYOUT_GRIDBAG);
220:                else
221:                    return (-1);
222:            }
223:
224:            public void pcmf_setCommonLayout(int xLayout) {
225:                switch (xLayout) {
226:                case IUnLayouted.LAYOUT_ABSOLUTE:
227:                    this .pdm_layout = null;
228:                    this .pdm_mainPanel.setLayout(null);
229:                    break;
230:                case IUnLayouted.LAYOUT_FLOW:
231:                    this .pdm_layout = null;
232:                    this .pdm_mainPanel.setLayout(new FlowLayout());
233:                    break;
234:                case IUnLayouted.LAYOUT_GRIDBAG:
235:                    this .pdm_layout = new GridBagLayout();
236:                    this .pdm_mainPanel.setLayout(this .pdm_layout);
237:                    break;
238:                }
239:            }
240:
241:            public void pcmf_setGuiObjNoLayout(boolean xLayout) {
242:                if (xLayout) {
243:                    this .pdm_layout = null;
244:                    pdm_mainPanel.setLayout(null);
245:                    pdm_mainPanel.setMinimumSize(new Dimension(800, 600));
246:                    pdm_mainPanel.setMaximumSize(new Dimension(1024, 768));
247:                    pdm_mainPanel.setPreferredSize(new Dimension(1000, 680));
248:                    pdm_mainPane.setViewportView(pdm_mainPanel);
249:                }
250:                ;
251:
252:                return;
253:            }
254:
255:            public UnComponent pcmf_setPosition(String xName, int xPos,
256:                    int yPos, int xWidth, int xHeight, int xAlign) {
257:                HoSwingComponent l_obj = null;
258:
259:                l_obj = (HoSwingComponent) this .pcmf_getSubNode(xName);
260:                if (l_obj == null)
261:                    l_obj = (HoSwingComponent) this .pcmf_getSubElement(xName);
262:
263:                return (this .pcmf_setPosition(l_obj, xPos, yPos, xWidth,
264:                        xHeight, xAlign));
265:            };
266:
267:            public UnComponent pcmf_setPosition(UnComponent xObj, int xPos,
268:                    int yPos, int xWidth, int xHeight, int xAlign) {
269:                GridBagConstraints l_constr = null;
270:                HoSwingComponent l_obj = null;
271:
272:                l_obj = (HoSwingComponent) xObj;
273:
274:                try {
275:                    if (this .pdm_mainPanel.getLayout() instanceof  FlowLayout)
276:                        return (l_obj);
277:
278:                    if (this .pdm_layout == null && l_obj != null) {
279:                        Component l_cont = l_obj.pcmf_getRealSwingObj();
280:                        l_cont.setBounds(xPos, yPos, xWidth, xHeight);
281:
282:                        return (l_obj);
283:                    }
284:                    ;
285:
286:                    if (l_obj != null) {
287:                        l_constr = this .pdm_layout.getConstraints(l_obj
288:                                .pcmf_getRealSwingObj());
289:                        if (l_constr == null)
290:                            l_constr = new GridBagConstraints();
291:
292:                        if (xPos > 100 || yPos > 100 || xHeight > 100
293:                                || xWidth > 100)
294:                            throw (new Exception());
295:
296:                        l_constr.gridx = xPos;
297:                        l_constr.gridy = yPos;
298:                        l_constr.gridheight = xHeight;
299:                        l_constr.gridwidth = xWidth;
300:                        if (xAlign == -1)
301:                            xAlign = GridBagConstraints.WEST;
302:
303:                        l_constr.anchor = xAlign;
304:
305:                        l_constr.insets = new Insets(pem_ins1, pem_ins2,
306:                                pem_ins3, pem_ins4);
307:
308:                        if (this .pem_isWeight
309:                                && (l_obj instanceof  HoSwingForm
310:                                        || l_obj instanceof  HoSwingBorder
311:                                        || l_obj instanceof  HoSwingListBox
312:                                        || l_obj instanceof  HoSwingTreeView
313:                                        || l_obj instanceof  HoSwingTabbedPane
314:                                        || l_obj instanceof  HoSwingEditor
315:                                        || l_obj instanceof  HoSwingSplitPane || l_obj instanceof  HoSwingTable)) {
316:                            l_constr.weightx = 1;
317:                            l_constr.weighty = 1;
318:                            l_constr.fill = GridBagConstraints.BOTH;
319:                            if (l_obj instanceof  HoSwingContainer) {
320:                                ((HoSwingContainer) l_obj).pdm_mainPanel
321:                                        .setPreferredSize(null);
322:                                ((HoSwingContainer) l_obj).pdm_mainPanel
323:                                        .setMinimumSize(null);
324:                                ((HoSwingContainer) l_obj).pdm_mainPanel
325:                                        .setMaximumSize(null);
326:                                ((HoSwingContainer) l_obj).pdm_mainPane
327:                                        .repaint();
328:                            }
329:                        }
330:
331:                        this .pdm_layout.setConstraints(l_obj
332:                                .pcmf_getRealSwingObj(), l_constr);
333:                    }
334:                    ;
335:                } catch (Exception e) {
336:                    KeLog
337:                            .pcmf_log(
338:                                    "ug2t",
339:                                    "error setting position, values maybe out of range",
340:                                    this , KeLog.MESSAGE);
341:                }
342:
343:                return (l_obj);
344:            };
345:
346:            public KeTreeNode pcmf_addNode(String xName, KeTreeNode xNode,
347:                    int xIdx) {
348:                if (xNode instanceof  HoSwingComponent
349:                        && xNode instanceof  IUnMenu != true
350:                        && xNode instanceof  IUnFileChooser != true
351:                        && xNode.pcmf_isHidden() == false)
352:                    this .pdm_mainPanel.add(
353:                            ((HoSwingComponent) xNode).pdm_realSwingCmp, xIdx);
354:
355:                return (super .pcmf_addNode(xName, xNode, xIdx));
356:            }
357:
358:            public KeTreeNode pcmf_addNode(String xName, KeTreeNode xNode) {
359:                if (xNode instanceof  HoSwingComponent
360:                        && xNode instanceof  IUnMenu != true
361:                        && xNode instanceof  IUnFileChooser != true
362:                        && xNode.pcmf_isHidden() == false)
363:                    this .pdm_mainPanel
364:                            .add(((HoSwingComponent) xNode).pdm_realSwingCmp);
365:
366:                return (super .pcmf_addNode(xName, xNode));
367:            };
368:
369:            public KeTreeNode pcmf_removeNode(String xName) {
370:                KeTreeNode l_ret = super .pcmf_removeNode(xName);
371:                if (l_ret instanceof  HoSwingComponent) {
372:                    this .pdm_mainPanel
373:                            .remove(((HoSwingComponent) l_ret).pdm_realSwingCmp);
374:                    if (this .pdm_layout != null)
375:                        this .pdm_layout
376:                                .removeLayoutComponent(((HoSwingComponent) l_ret).pdm_realSwingCmp);
377:                }
378:
379:                return (l_ret);
380:            };
381:
382:            public KeTreeNode pcmf_removeNode(KeTreeNode xNode) {
383:                KeTreeNode l_ret = super .pcmf_removeNode(xNode);
384:                if (l_ret instanceof  HoSwingComponent) {
385:                    this .pdm_mainPanel
386:                            .remove(((HoSwingComponent) l_ret).pdm_realSwingCmp);
387:                    if (this .pdm_layout != null)
388:                        this .pdm_layout
389:                                .removeLayoutComponent(((HoSwingComponent) l_ret).pdm_realSwingCmp);
390:                }
391:
392:                return (l_ret);
393:            };
394:
395:            public KeTreeElement pcmf_addElement(String xName,
396:                    KeTreeElement xNode) {
397:                if (xNode instanceof  HoSwingComponent
398:                        && xNode instanceof  IUnMenu != true
399:                        && xNode instanceof  IUnFileChooser != true)
400:                    this .pdm_mainPanel
401:                            .add(((HoSwingComponent) xNode).pdm_realSwingCmp);
402:
403:                return (super .pcmf_addElement(xName, xNode));
404:            };
405:
406:            public KeTreeElement pcmf_removeElement(String xName) {
407:                KeTreeElement l_ret = super .pcmf_removeElement(xName);
408:                if (l_ret instanceof  HoSwingComponent) {
409:                    this .pdm_mainPanel
410:                            .remove(((HoSwingComponent) l_ret).pdm_realSwingCmp);
411:                    if (this .pdm_layout != null)
412:                        this .pdm_layout
413:                                .removeLayoutComponent(((HoSwingComponent) l_ret).pdm_realSwingCmp);
414:                }
415:
416:                return (l_ret);
417:            };
418:
419:            public void pcmf_setFgColor(String xCol) {
420:                try {
421:                    String l_org = xCol;
422:
423:                    if (xCol.charAt(0) == '#') {
424:                        xCol = xCol.substring(1, xCol.length());
425:                        int r = Integer.parseInt(xCol.substring(0, 2), 16);
426:                        int g = Integer.parseInt(xCol.substring(2, 4), 16);
427:                        int b = Integer.parseInt(xCol.substring(4, 6), 16);
428:                        ((JComponent) this .pdm_mainPanel)
429:                                .setForeground(new Color(r, g, b));
430:                    } else
431:                        ((JComponent) this .pdm_mainPanel)
432:                                .setForeground((Color) java.awt.Color.class
433:                                        .getDeclaredField(xCol).get(null));
434:
435:                    super .pcmf_setFgColor(l_org);
436:                } catch (Exception e) {
437:                    KeLog.pcmf_logException("ug2t", this , e);
438:                }
439:                ;
440:
441:                return;
442:            };
443:
444:            public void pcmf_setBgColor(String xCol) {
445:                try {
446:                    String l_org = xCol;
447:
448:                    if (xCol.equals("transparent")) {
449:                        ((JComponent) this .pdm_mainPanel).setOpaque(false);
450:                        return;
451:                    }
452:
453:                    ((JComponent) this .pdm_mainPanel).setOpaque(true);
454:
455:                    if (xCol.charAt(0) == '#') {
456:                        xCol = xCol.substring(1, xCol.length());
457:                        int r = Integer.parseInt(xCol.substring(0, 2), 16);
458:                        int g = Integer.parseInt(xCol.substring(2, 4), 16);
459:                        int b = Integer.parseInt(xCol.substring(4, 6), 16);
460:                        ((JComponent) this .pdm_mainPanel)
461:                                .setBackground(new Color(r, g, b));
462:                    } else
463:                        ((JComponent) this .pdm_mainPanel)
464:                                .setBackground((Color) java.awt.Color.class
465:                                        .getDeclaredField(xCol).get(null));
466:
467:                    super .pcmf_setBgColor(l_org);
468:                } catch (Exception e) {
469:                    KeLog.pcmf_logException("ug2t", this , e);
470:                }
471:                ;
472:
473:                return;
474:            };
475:
476:            public void pcmf_repaint() {
477:                try {
478:                    this .pdm_mainPanel.validate();
479:                    this .pdm_mainPanel.repaint();
480:                } catch (Exception e) {
481:                    KeLog.pcmf_log("ug2t", "error repainting container", this ,
482:                            KeLog.MESSAGE);
483:                }
484:                return;
485:            };
486:
487:            public void pcmf_setPSize(int xWi, int xHi) {
488:                pdm_mainPanel.setPreferredSize(new Dimension(xWi, xHi));
489:            }
490:
491:            public void pcmf_setBgImage(IUnImage xImg) {
492:                this .pdm_bgImg = xImg;
493:                this .pdm_mainPanel.pcmf_setBgImage(xImg);
494:            }
495:
496:            public IUnImage pcmf_getBgImage() {
497:                return (this .pdm_bgImg);
498:            };
499:
500:            public void pcmf_setInsets(int xIns1, int xIns2, int xIns3,
501:                    int xIns4) {
502:                this .pem_ins1 = xIns1;
503:                this .pem_ins2 = xIns2;
504:                this .pem_ins3 = xIns3;
505:                this .pem_ins4 = xIns4;
506:            }
507:
508:            public void pcmf_setWeights(boolean xWgt) {
509:                this .pem_isWeight = xWgt;
510:            }
511:
512:            public void pcmf_setWeights(String xName, int xW, int yW) {
513:                HoSwingComponent l_obj = null;
514:
515:                l_obj = (HoSwingComponent) this .pcmf_getSubNode(xName);
516:                if (l_obj == null)
517:                    l_obj = (HoSwingComponent) this .pcmf_getSubElement(xName);
518:
519:                this .pcmf_setWeights(l_obj, xW, yW);
520:            }
521:
522:            public void pcmf_setWeights(UnComponent xObj, int xW, int yW) {
523:                GridBagConstraints l_constr = null;
524:                HoSwingComponent l_obj = null;
525:
526:                l_obj = (HoSwingComponent) xObj;
527:
528:                if (this .pdm_layout == null || l_obj == null) {
529:                    KeLog
530:                            .pcmf_log(
531:                                    "ug2t",
532:                                    "cannot set weights due to object not found or no active layout",
533:                                    this , KeLog.ERROR);
534:                    return;
535:                }
536:                ;
537:                l_constr = pdm_layout.getConstraints(l_obj
538:                        .pcmf_getRealSwingObj());
539:                if (l_constr == null)
540:                    l_constr = new GridBagConstraints();
541:
542:                l_constr.weightx = xW;
543:                l_constr.weighty = yW;
544:
545:                this .pdm_layout.setConstraints(l_obj.pcmf_getRealSwingObj(),
546:                        l_constr);
547:            }
548:
549:            public void pcmf_setFill(String xName, boolean xH, boolean xV) {
550:                HoSwingComponent l_obj = null;
551:
552:                l_obj = (HoSwingComponent) this .pcmf_getSubNode(xName);
553:                if (l_obj == null)
554:                    l_obj = (HoSwingComponent) this .pcmf_getSubElement(xName);
555:
556:                this .pcmf_setFill(l_obj, xH, xV);
557:            }
558:
559:            public void pcmf_setFill(UnComponent xObj, boolean xH, boolean xV) {
560:                GridBagConstraints l_constr = null;
561:                HoSwingComponent l_obj = null;
562:
563:                l_obj = (HoSwingComponent) xObj;
564:
565:                if (this .pdm_layout == null || l_obj == null) {
566:                    KeLog
567:                            .pcmf_log(
568:                                    "ug2t",
569:                                    "cannot set weights due to object not found or no active layout",
570:                                    this , KeLog.ERROR);
571:                    return;
572:                }
573:                ;
574:                l_constr = pdm_layout.getConstraints(l_obj
575:                        .pcmf_getRealSwingObj());
576:                if (l_constr == null)
577:                    l_constr = new GridBagConstraints();
578:
579:                if (xH && !xV)
580:                    l_constr.fill = GridBagConstraints.HORIZONTAL;
581:                else if (!xH && xV)
582:                    l_constr.fill = GridBagConstraints.VERTICAL;
583:                else if (xH && xV)
584:                    l_constr.fill = GridBagConstraints.BOTH;
585:                else
586:                    l_constr.fill = GridBagConstraints.NONE;
587:
588:                this .pdm_layout.setConstraints(l_obj.pcmf_getRealSwingObj(),
589:                        l_constr);
590:            }
591:
592:            public void pcmf_setInsets(UnComponent xObj, int xIns1, int xIns2,
593:                    int xIns3, int xIns4) {
594:                GridBagConstraints l_constr = null;
595:                HoSwingComponent l_obj = null;
596:
597:                l_obj = (HoSwingComponent) xObj;
598:
599:                if (this .pdm_layout == null || l_obj == null) {
600:                    KeLog
601:                            .pcmf_log(
602:                                    "ug2t",
603:                                    "cannot set weights due to object not found or no active layout",
604:                                    this , KeLog.ERROR);
605:                    return;
606:                }
607:                ;
608:                l_constr = pdm_layout.getConstraints(l_obj
609:                        .pcmf_getRealSwingObj());
610:                if (l_constr == null)
611:                    l_constr = new GridBagConstraints();
612:
613:                l_constr.insets = new Insets(xIns1, xIns2, xIns3, xIns4);
614:                this .pdm_layout.setConstraints(l_obj.pcmf_getRealSwingObj(),
615:                        l_constr);
616:            }
617:
618:            public void pcmf_setInsets(String xName, int xIns1, int xIns2,
619:                    int xIns3, int xIns4) {
620:                HoSwingComponent l_obj = null;
621:
622:                l_obj = (HoSwingComponent) this .pcmf_getSubNode(xName);
623:                if (l_obj == null)
624:                    l_obj = (HoSwingComponent) this .pcmf_getSubElement(xName);
625:
626:                this .pcmf_setInsets(l_obj, xIns1, xIns2, xIns3, xIns4);
627:            }
628:
629:            protected GridBagConstraints pcmf_getConstraints(Container xCont) {
630:                if (this .pdm_layout != null)
631:                    return (this .pdm_layout.getConstraints(xCont));
632:                else
633:                    return (null);
634:            }
635:
636:            protected void pcmf_setConstraints(Container xCont,
637:                    GridBagConstraints xConst) {
638:                if (this .pdm_layout != null)
639:                    this .pdm_layout.setConstraints(xCont, xConst);
640:                else
641:                    return;
642:            }
643:
644:            public java.awt.Container pcmf_getSwingWidget() {
645:                return (this .pdm_mainPanel);
646:            };
647:
648:            public void pcmf_setScroll(boolean xScroll) {
649:                if (xScroll == true) {
650:                    super .pdm_realSwingCmp = this .pdm_mainPane;
651:                    this .pdm_mainPane.setViewportView(this .pdm_mainPanel);
652:                } else {
653:                    super .pdm_realSwingCmp = this .pdm_mainPanel;
654:                    this .pdm_mainPane.setViewportView(null);
655:                }
656:            };
657:
658:            public boolean pcmf_getScroll() {
659:                return (this .pdm_mainPane.getViewport() == null ? false : true);
660:            }
661:
662:            public void pcmf_addWidget(String xName, UnComponent xObj) {
663:                this .pcmf_addNode(xName, xObj);
664:            };
665:
666:            public UnComponent pcmf_removeWidget(String xName) {
667:                return ((UnComponent) this .pcmf_removeNode(xName));
668:            };
669:
670:            public UnComponent pcmf_removeWidget(UnComponent xObj) {
671:                return ((UnComponent) this .pcmf_removeNode(xObj));
672:            };
673:
674:            public UnComponent pcmf_getWidget(String xName) {
675:                return ((UnComponent) this .pcmf_getSubNode(xName));
676:            };
677:
678:            public boolean pcmf_contains(UnComponent xObj) {
679:                return (super .pcmf_contains(xObj));
680:            };
681:
682:            /**
683:             * <p>
684:             * Does...
685:             * </p>
686:             * <p>
687:             * 
688:             * @return a Type with
689:             *         </p>
690:             *         <p>
691:             * @param
692:             *         </p>
693:             */
694:            public void pcmf_setGuiObjPosition(UnComponent xObj, int xPos,
695:                    int yPos, int xWi, int xHi, String xAlign) {
696:                try {
697:                    this .pcmf_setPosition(xObj, xPos, yPos, xWi, xHi,
698:                            java.awt.GridBagConstraints.class.getDeclaredField(
699:                                    xAlign).getInt(null));
700:                } catch (Exception e) {
701:                    KeLog.pcmf_log("ug2t", "no valid alignment: " + xAlign,
702:                            this , KeLog.ERROR);
703:                }
704:            }
705:
706:            /**
707:             * <p>
708:             * Does...
709:             * </p>
710:             * <p>
711:             * 
712:             * @return a Type with
713:             *         </p>
714:             *         <p>
715:             * @param
716:             *         </p>
717:             */
718:            public void pcmf_setGuiObjPosition(String xName, int xPos,
719:                    int yPos, int xWi, int xHi, String xAlign) {
720:                try {
721:                    this .pcmf_setPosition(xName, xPos, yPos, xWi, xHi,
722:                            java.awt.GridBagConstraints.class.getDeclaredField(
723:                                    xAlign).getInt(null));
724:                } catch (Exception e) {
725:                    KeLog.pcmf_log("ug2t", "no valid alignment: " + xAlign,
726:                            this , KeLog.ERROR);
727:                }
728:            }
729:
730:            // New methods (delegates only) due to interface harmonisation
731:            public void pcmf_addWidget(String xName, IUnComponent xObj) {
732:                this .pcmf_addWidget(xName, (UnComponent) xObj);
733:            }
734:
735:            public boolean pcmf_contains(IUnComponent xObj) {
736:                return (this .pcmf_contains((UnComponent) xObj));
737:            }
738:
739:            public IUnComponent pcmf_getWidgetbyName(String xName) {
740:                return ((IUnComponent) this .pcmf_getWidget(xName));
741:            }
742:
743:            public IUnComponent pcmf_removeWidget(IUnComponent xObj) {
744:                return ((IUnComponent) this 
745:                        .pcmf_removeWidget((UnComponent) xObj));
746:            }
747:
748:            public void pcmf_setGuiObjPosition(IUnComponent xObj, int xPos,
749:                    int yPos, int xWi, int xHi, String xAlign) {
750:                this .pcmf_setGuiObjPosition((UnComponent) xObj, xPos, yPos,
751:                        xWi, xHi, xAlign);
752:            }
753:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.