Source Code Cross Referenced for ImportMapPanel.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:        // Kelp imports
026:        import org.enhydra.kelp.common.ValidationException;
027:        import org.enhydra.kelp.common.ValidationUtil;
028:        import org.enhydra.kelp.common.xmlc.MapPanel;
029:        import org.enhydra.kelp.common.xmlc.MapDialog;
030:
031:        // Standard imports
032:        import javax.swing.*;
033:        import javax.swing.border.*;
034:        import java.awt.*;
035:        import java.beans.*;
036:        import java.io.File;
037:        import java.awt.event.*;
038:        import java.util.ResourceBundle;
039:
040:        /**
041:         * Panel for entering the default options: project name, package
042:         * and destination.
043:         *
044:         * @author Paul Mahar
045:         */
046:        public class ImportMapPanel extends ImporterPanel {
047:            static ResourceBundle res = ResourceBundle
048:                    .getBundle("org.enhydra.kelp.common.Res"); // nores
049:            transient private MapPanel mapPanel;
050:            transient private JPanel panelPack;
051:            transient private JTextField textPack;
052:
053:            //
054:            transient private JPanel panelEdit;
055:            transient private GridBagLayout layoutMain;
056:            transient private GridBagLayout layoutPack;
057:            transient private TitledBorder borderPack;
058:            transient private JButton buttonEdit;
059:            transient private GridBagLayout layoutEdit;
060:
061:            /**
062:             * Create default option panel 1 for entering the
063:             * following default options: project name, package and
064:             * destination.
065:             */
066:            public ImportMapPanel() {
067:                try {
068:                    jbInit();
069:                    pmInit();
070:                } catch (Exception ex) {
071:                    ex.printStackTrace();
072:                }
073:            }
074:
075:            /**
076:             * Read project name, package and destination values from the
077:             * option set into the swing controls.
078:             *
079:             * @exception GeneratorException
080:             * Thrown if unable to update Swing controls with option set values.
081:             */
082:            public void readOptions() {
083:                String pack = null;
084:                String map[][] = new String[0][2];
085:
086:                pack = getPaths().getPackage();
087:                if (pack != null) {
088:                    textPack.setText(pack);
089:                }
090:                map = getPaths().getPackageMap();
091:                mapPanel.setMap(map);
092:            }
093:
094:            /**
095:             * Method declaration
096:             *
097:             *
098:             * @see
099:             */
100:            public void activated() {
101:                initPacks();
102:            }
103:
104:            /**
105:             * Write project name, package and destination values from the
106:             * swing controls into the option set.
107:             *
108:             * @exception GeneratorException
109:             * Thrown if unable to update option set from Swing control values.
110:             */
111:            public void writeOptions() throws ValidationException {
112:                String pack = new String();
113:                String[][] map = new String[0][2];
114:
115:                if (getPaths() == null) {
116:                    throw new ValidationException(res
117:                            .getString("ImportPaths_not_set"));
118:                }
119:                pack = textPack.getText().trim();
120:                getPaths().setPackage(pack);
121:                map = mapPanel.getMap();
122:                getPaths().setPackageMap(map);
123:            }
124:
125:            /**
126:             * Validate project name, package and destination values
127:             * in the swing controls.
128:             *
129:             * @exception ValidationException
130:             * Thrown if swing control values are not valid for the
131:             * current option set.
132:             */
133:            public void validateOptions() throws ValidationException {
134:                String value = new String();
135:
136:                // package
137:                value = textPack.getText().trim();
138:                if (!ValidationUtil.isJavaPackage(value)) {
139:                    throw new ValidationException(res
140:                            .getString("Root_invalid_java"));
141:                }
142:            }
143:
144:            /**
145:             * Get the title to use on the current page.
146:             *
147:             * @return
148:             * A string to place at the top of a CodeGen wizard panel.
149:             */
150:            public String getPageTitle() {
151:                return res.getString("Package_details");
152:            }
153:
154:            /**
155:             * Get the instructions for entering option values for the
156:             * current page.
157:             *
158:             * @return
159:             * A string to place below the page title.
160:             */
161:            public String getInstructions() {
162:                StringBuffer buf = new StringBuffer();
163:
164:                buf.append(res.getString("Enter_package_details"));
165:                buf.append(res.getString("All_the_application"));
166:                buf.append(res.getString("defined_at_or_below"));
167:                buf.append(res.getString("The_package_map_is"));
168:                buf.append(res.getString("for_source_files"));
169:                return buf.toString();
170:            }
171:
172:            // /
173:            // /
174:
175:            /**
176:             * Method declaration
177:             *
178:             *
179:             * @exception Exception
180:             *
181:             * @see
182:             */
183:            private void jbInit() throws Exception {
184:                textPack = (JTextField) Beans.instantiate(getClass()
185:                        .getClassLoader(), JTextField.class.getName());
186:                panelPack = (JPanel) Beans.instantiate(getClass()
187:                        .getClassLoader(), JPanel.class.getName());
188:                mapPanel = (MapPanel) Beans.instantiate(getClass()
189:                        .getClassLoader(), MapPanel.class.getName());
190:                layoutPack = (GridBagLayout) Beans.instantiate(getClass()
191:                        .getClassLoader(), GridBagLayout.class.getName());
192:                layoutMain = (GridBagLayout) Beans.instantiate(getClass()
193:                        .getClassLoader(), GridBagLayout.class.getName());
194:                panelEdit = (JPanel) Beans.instantiate(getClass()
195:                        .getClassLoader(), JPanel.class.getName());
196:                buttonEdit = (JButton) Beans.instantiate(getClass()
197:                        .getClassLoader(), JButton.class.getName());
198:                layoutEdit = (GridBagLayout) Beans.instantiate(getClass()
199:                        .getClassLoader(), GridBagLayout.class.getName());
200:                panelPack.setLayout(layoutPack);
201:                buttonEdit.setText(res.getString("buttonEdit_Text"));
202:                buttonEdit
203:                        .addActionListener(new java.awt.event.ActionListener() {
204:                            public void actionPerformed(ActionEvent e) {
205:                                editPackageMap();
206:                            }
207:
208:                        });
209:                panelEdit.setLayout(layoutEdit);
210:                panelEdit.add(buttonEdit, new GridBagConstraints(0, 0, 1, 1,
211:                        0.0, 0.0, GridBagConstraints.CENTER,
212:                        GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
213:                panelPack.add(textPack, new GridBagConstraints(0, 0, 1, 1, 0.1,
214:                        0.1, GridBagConstraints.WEST,
215:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
216:                        0, 0));
217:                this .setLayout(layoutMain);
218:                this .add(panelPack, new GridBagConstraints(0, 0, 1, 1, 0.1,
219:                        0.0, GridBagConstraints.CENTER,
220:                        GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
221:                this .add(mapPanel, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1,
222:                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
223:                        new Insets(5, 5, 5, 5), 0, 0));
224:                this .add(panelEdit, new GridBagConstraints(0, 2, 1, 1, 0.0,
225:                        0.0, GridBagConstraints.CENTER,
226:                        GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
227:            }
228:
229:            /**
230:             * Method declaration
231:             *
232:             *
233:             * @see
234:             */
235:            private void pmInit() {
236:                Border border = BorderFactory.createEtchedBorder();
237:
238:                borderPack = BorderFactory.createTitledBorder(border);
239:                borderPack.setTitle(res.getString("borderPack_Title"));
240:                panelPack.setBorder(borderPack);
241:                textPack.setText(new String());
242:            }
243:
244:            /**
245:             * Method declaration
246:             *
247:             *
248:             * @see
249:             */
250:            private void initPacks() {
251:                String pack = null;
252:                String[][] map = new String[0][2];
253:
254:                if (textPack.getText().trim().length() == 0) {
255:                    pack = getPaths().getDefaultPackage();
256:                    if (pack != null) {
257:                        try {
258:                            getPaths().setPackage(pack);
259:                        } catch (ValidationException e) {
260:                            e.printStackTrace();
261:                        }
262:                        textPack.setText(pack);
263:                    }
264:                }
265:                if (mapPanel.getMap().length == 0) {
266:                    getPaths().initPackageMap(false);
267:                    map = getPaths().getPackageMap();
268:                    mapPanel.setMap(map);
269:                }
270:            }
271:
272:            private void editPackageMap() {
273:                MapDialog dialog = new MapDialog(((JDialog) this 
274:                        .getTopLevelAncestor()), res
275:                        .getString("Edit_Package_Map"), true);
276:
277:                getPaths().getProject().setPackageMap(mapPanel.getMap());
278:                dialog.setProject(getPaths().getProject());
279:                dialog.show();
280:                mapPanel.setMap(getPaths().getProject().getPackageMap());
281:                getPaths().setPackageMap(mapPanel.getMap());
282:            }
283:
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.