Source Code Cross Referenced for GridBagPanelComponent.java in  » XML-UI » SwingML » org » swingml » component » 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 » XML UI » SwingML » org.swingml.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* SwingML
002:         * Copyright (C) 2002 Robert Morris.
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the
016:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017:         * Boston, MA 02111-1307, USA.
018:         *
019:         * Authors:
020:         *     Robert Morris <robertj@morris.net>
021:         *
022:         */
023:
024:        package org.swingml.component;
025:
026:        import java.awt.Component;
027:        import java.awt.Container;
028:        import java.awt.GridBagLayout;
029:        import java.util.Vector;
030:
031:        import javax.swing.JPanel;
032:        import javax.swing.border.BevelBorder;
033:        import javax.swing.border.EtchedBorder;
034:        import javax.swing.border.TitledBorder;
035:
036:        import org.swingml.Constants;
037:        import org.swingml.RenderingThread;
038:        import org.swingml.SubmittingThread;
039:        import org.swingml.event.EventHandler;
040:        import org.swingml.model.GridBagPanelModel;
041:
042:        /**
043:         * This class provides the actual instantiation and management of the 
044:         * &lt;GRIDBAG-PANEL&gt; tag on the rendered form.  This class operates
045:         * essentially as a SwingML-style wrapper around a standard JPanel 
046:         * that lays out its child components using GridBagLayout.
047:         * The overridden add() method accepts GridBagRowComponents that in 
048:         * turn contain GridBagCell components which themselves contain the actual 
049:         * references to the component to display within the GridBagPanelComponent
050:         * instance.  The detailed parameters regarding the layout settings for each 
051:         * component are hierarchically stored within the GridBagRowModel and GridBagCellModel
052:         * components passed in during the add() invocation.
053:         */
054:        public class GridBagPanelComponent extends JPanel {
055:            private EventHandler eventHandler = EventHandler.getInstance();
056:            private GridBagPanelModel m_model = null;
057:            private Vector m_rows = new Vector();
058:
059:            /**
060:             * This overridden method handles the addition of GridBagRow components.
061:             * It is also important to note that after rendering is complete, it is possible 
062:             * for InvokableEvent instances to call add() with other component instances.
063:             * 
064:             * @param	component	The component to add to the current GridBagPanelComponent instance.
065:             * 
066:             * @return	The component that was added to the GridBagPanelComponent.
067:             * 
068:             * @see org.swingml.component.GridBagRowComponent
069:             * 
070:             */
071:            public Component add(Component aComponent) {
072:                if (aComponent instanceof  GridBagRowComponent) {
073:                    GridBagRowComponent theComponent = (GridBagRowComponent) aComponent;
074:                    theComponent.setParentPanel(this );
075:                    this .m_rows.add(aComponent);
076:                } else {
077:                    super .add(aComponent);
078:                }
079:                return aComponent;
080:            }
081:
082:            /**
083:             * @see javax.swing.JPanel#add(Component, Object)
084:             */
085:            public void add(Component aComponent, Object aConstraints) {
086:                super .add(aComponent, aConstraints);
087:            }
088:
089:            public void submit(String anAddress) {
090:                SubmittingThread theThread = new SubmittingThread(anAddress,
091:                        this , this , true);
092:                theThread.start();
093:            }
094:
095:            public void submit(String anAddress, String aTargetContainer,
096:                    boolean aRepaint) {
097:                Component theTargetContainer = this .eventHandler
098:                        .findActionTarget(super .getTopLevelAncestor(),
099:                                aTargetContainer);
100:                SubmittingThread theThread = new SubmittingThread(anAddress,
101:                        this , (Container) theTargetContainer, aRepaint);
102:                theThread.start();
103:            }
104:
105:            public void render(String aUrl, String aParent) {
106:                Component theParentComponent = this .eventHandler
107:                        .findActionTarget(super .getTopLevelAncestor(), aParent);
108:                RenderingThread theThread = new RenderingThread(aUrl,
109:                        (Container) theParentComponent);
110:                theThread.start();
111:            }
112:
113:            /**
114:             * Constructor for GridBagPanelComponent.  This 
115:             * constructor essentially sets the layout to GridBagLayout
116:             * and assigns the necessary model information to properties 
117:             * of this component.
118:             * 
119:             * @param	model	A valid reference to an instance of the GridBagPanelModel class.
120:             * 
121:             * @see org.swingml.model.GridBagPanelModel
122:             */
123:            public GridBagPanelComponent(GridBagPanelModel aModel) {
124:                this .m_model = aModel;
125:                super .setLayout(new GridBagLayout());
126:                super .setName(this .m_model.getName());
127:                String theBorder = this .m_model.getBorder();
128:                String theTitle = this .m_model.getTitle();
129:                int theBevelType = this .m_model.getBevelType();
130:
131:                if (theBorder.equalsIgnoreCase(Constants.ETCHEDBORDER)) {
132:                    if (theTitle == null) {
133:                        super .setBorder(new EtchedBorder());
134:                    } else {
135:                        super .setBorder(new TitledBorder(new EtchedBorder(),
136:                                theTitle));
137:                    }
138:                }
139:                if (theBorder.equalsIgnoreCase(Constants.BEVELBORDER)) {
140:                    if (theTitle == null) {
141:                        super .setBorder(new BevelBorder(theBevelType));
142:                    } else {
143:                        super .setBorder(new TitledBorder(new BevelBorder(
144:                                theBevelType), theTitle));
145:                    }
146:                }
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.