Source Code Cross Referenced for RootPanel.java in  » J2EE » enhydra-IDE-plugin » org » enhydra » kelp » common » importer » 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 » enhydra IDE plugin » org.enhydra.kelp.common.importer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         *
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         *
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         *
019:         * Contributor(s):
020:         * Paul Mahar
021:         *
022:         */
023:        package org.enhydra.kelp.common.importer;
024:
025:        // ToolBox imports
026:        import org.enhydra.tool.common.SwingUtil;
027:        import org.enhydra.tool.common.PathHandle;
028:
029:        // Kelp imports
030:        import org.enhydra.kelp.common.ValidationUtil;
031:        import org.enhydra.kelp.common.ValidationException;
032:
033:        // Standard imports
034:        import javax.swing.*;
035:        import javax.swing.border.*;
036:        import java.awt.*;
037:        import java.awt.event.ActionEvent;
038:        import java.awt.event.ActionListener;
039:        import java.beans.*;
040:        import java.io.File;
041:        import java.util.ResourceBundle;
042:
043:        /**
044:         * Panel for entering the default options: project name, package
045:         * and destination.
046:         *
047:         * @author Paul Mahar
048:         */
049:        public class RootPanel extends ImporterPanel {
050:            static ResourceBundle res = ResourceBundle
051:                    .getBundle("org.enhydra.kelp.common.Res"); // nores
052:            transient private JPanel panelRoot;
053:            transient private JTextField textRoot;
054:            transient private JButton buttonRoot;
055:
056:            //
057:            transient private JPanel panelFiller;
058:            transient private GridBagLayout layoutMain;
059:            transient private GridBagLayout layoutRoot;
060:            transient private LocalButtonListener buttonListener;
061:            transient private TitledBorder borderRoot;
062:
063:            /**
064:             * Create default option panel 1 for entering the
065:             * following default options: project name, package and
066:             * destination.
067:             */
068:            public RootPanel() {
069:                try {
070:                    jbInit();
071:                    pmInit();
072:                } catch (Exception ex) {
073:                    ex.printStackTrace();
074:                }
075:            }
076:
077:            /**
078:             * Read project name, package and destination values from the
079:             * option set into the swing controls.
080:             *
081:             * @exception GeneratorException
082:             * Thrown if unable to update Swing controls with option set values.
083:             */
084:            public void readOptions() {
085:                String path;
086:
087:                // project root
088:                path = getPaths().getRootPath();
089:                if (path == null) {
090:                    textRoot.setText(new String());
091:                } else {
092:                    textRoot.setText(path);
093:                }
094:            }
095:
096:            /**
097:             * Write project name, package and destination values from the
098:             * swing controls into the option set.
099:             *
100:             * @exception GeneratorException
101:             * Thrown if unable to update option set from Swing control values.
102:             */
103:            public void writeOptions() throws ValidationException {
104:                String path = null;
105:
106:                if (getPaths() == null) {
107:                    throw new ValidationException(res
108:                            .getString("Import_paths_not_set1"));
109:                }
110:
111:                // root
112:                path = textRoot.getText();
113:                getPaths().setRootPath(path);
114:            }
115:
116:            /**
117:             * Validate project name, package and destination values
118:             * in the swing controls.
119:             *
120:             * @exception ValidationException
121:             * Thrown if swing control values are not valid for the
122:             * current option set.
123:             */
124:            public void validateOptions() throws ValidationException {
125:                String value = new String();
126:
127:                // project name
128:                value = textRoot.getText().trim();
129:                if (!ValidationUtil.isDirectory(value)) {
130:                    throw new ValidationException(res
131:                            .getString("Project_directory_is")
132:                            + res.getString("Directory_not_found_"));
133:                }
134:            }
135:
136:            /**
137:             * Get the title to use on the current page.
138:             *
139:             * @return
140:             * A string to place at the top of a CodeGen wizard panel.
141:             */
142:            public String getPageTitle() {
143:                return res.getString("Project_Directory");
144:            }
145:
146:            /**
147:             * Get the instructions for entering option values for the
148:             * current page.
149:             *
150:             * @return
151:             * A string to place below the page title.
152:             */
153:            public String getInstructions() {
154:                StringBuffer buf = new StringBuffer();
155:
156:                buf.append(res.getString("RootInstruct1"));
157:                buf.append(res.getString("RootInstruct2"));
158:                buf.append(res.getString("RootInstruct3"));
159:                return buf.toString();
160:            }
161:
162:            //
163:            // PRIVATE
164:            //
165:
166:            /**
167:             * Method declaration
168:             *
169:             *
170:             * @exception Exception
171:             */
172:            private void jbInit() throws Exception {
173:                textRoot = (JTextField) Beans.instantiate(getClass()
174:                        .getClassLoader(), JTextField.class.getName());
175:                panelRoot = (JPanel) Beans.instantiate(getClass()
176:                        .getClassLoader(), JPanel.class.getName());
177:                layoutRoot = (GridBagLayout) Beans.instantiate(getClass()
178:                        .getClassLoader(), GridBagLayout.class.getName());
179:                buttonRoot = (JButton) Beans.instantiate(getClass()
180:                        .getClassLoader(), JButton.class.getName());
181:                layoutMain = (GridBagLayout) Beans.instantiate(getClass()
182:                        .getClassLoader(), GridBagLayout.class.getName());
183:                panelFiller = (JPanel) Beans.instantiate(getClass()
184:                        .getClassLoader(), JPanel.class.getName());
185:                buttonRoot.setText("..."); // nores
186:                panelRoot.setLayout(layoutRoot);
187:                panelRoot.add(textRoot, new GridBagConstraints(0, 0, 1, 1, 0.1,
188:                        0.1, GridBagConstraints.WEST,
189:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
190:                        0, 0));
191:                panelRoot
192:                        .add(buttonRoot, new GridBagConstraints(1, 0, 1, 2,
193:                                0.0, 0.0, GridBagConstraints.CENTER,
194:                                GridBagConstraints.NONE,
195:                                new Insets(5, 5, 5, 20), 0, 0));
196:                this .setLayout(layoutMain);
197:                this .add(panelRoot, new GridBagConstraints(0, 0, 1, 1, 0.1,
198:                        0.1, GridBagConstraints.CENTER,
199:                        GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
200:            }
201:
202:            /**
203:             */
204:            private void pmInit() {
205:                Border border = BorderFactory.createEtchedBorder();
206:
207:                borderRoot = BorderFactory.createTitledBorder(border);
208:                borderRoot.setTitle(res.getString("borderRoot_Title"));
209:                panelRoot.setBorder(borderRoot);
210:                buttonListener = new LocalButtonListener();
211:                buttonRoot.addActionListener(buttonListener);
212:                textRoot.setText(new String());
213:            }
214:
215:            /**
216:             */
217:            private void browseForDirectory() {
218:                File dir = null;
219:
220:                dir = SwingUtil.getDirectoryChoice(this , textRoot.getText(),
221:                        res.getString("Choose_the_project"));
222:                if (dir != null) {
223:                    textRoot.setText(PathHandle.createPathString(dir));
224:                }
225:            }
226:
227:            /**
228:             */
229:            private class LocalButtonListener implements  ActionListener {
230:                public void actionPerformed(ActionEvent event) {
231:                    browseForDirectory();
232:                }
233:
234:            }
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.