Source Code Cross Referenced for JagGenerator.java in  » J2EE » jag » com » finalist » jaggenerator » 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 » jag » com.finalist.jaggenerator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*   Copyright (C) 2003 Finalist IT Group
0002:         *
0003:         *   This file is part of JAG - the Java J2EE Application Generator
0004:         *
0005:         *   JAG is free software; you can redistribute it and/or modify
0006:         *   it under the terms of the GNU General Public License as published by
0007:         *   the Free Software Foundation; either version 2 of the License, or
0008:         *   (at your option) any later version.
0009:         *   JAG is distributed in the hope that it will be useful,
0010:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012:         *   GNU General Public License for more details.
0013:         *   You should have received a copy of the GNU General Public License
0014:         *   along with JAG; if not, write to the Free Software
0015:         *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0016:         */
0017:
0018:        package com.finalist.jaggenerator;
0019:
0020:        import com.finalist.jag.JApplicationGen;
0021:        import com.finalist.jag.uml.Jag2UMLGenerator;
0022:        import com.finalist.jag.uml.UML2JagGenerator;
0023:        import com.finalist.jag.util.TemplateString;
0024:        import com.finalist.jaggenerator.modules.*;
0025:        import com.finalist.jaggenerator.template.Template;
0026:        import org.apache.commons.logging.Log;
0027:        import org.apache.commons.logging.LogFactory;
0028:        import org.apache.log4j.lf5.LogLevel;
0029:        import org.w3c.dom.Document;
0030:        import org.w3c.dom.Element;
0031:
0032:        import javax.swing.*;
0033:        import javax.swing.event.TreeSelectionEvent;
0034:        import javax.swing.tree.*;
0035:        import javax.xml.parsers.DocumentBuilder;
0036:        import javax.xml.parsers.DocumentBuilderFactory;
0037:        import javax.xml.parsers.ParserConfigurationException;
0038:        import javax.xml.transform.OutputKeys;
0039:        import javax.xml.transform.Transformer;
0040:        import javax.xml.transform.TransformerFactory;
0041:        import javax.xml.transform.dom.DOMSource;
0042:        import javax.xml.transform.stream.StreamResult;
0043:        import java.awt.*;
0044:        import java.awt.event.KeyEvent;
0045:        import java.io.File;
0046:        import java.io.FileWriter;
0047:        import java.io.IOException;
0048:        import java.io.StringWriter;
0049:        import java.net.URL;
0050:        import java.util.*;
0051:        import java.util.List;
0052:
0053:        /**
0054:         * Main class for the JAG GUI.
0055:         *
0056:         * @author Hillebrand Gelderblom, Rudie Ekkelenkamp, Michael O'Connor - Finalist IT Group
0057:         * @version $Revision: 1.73 $, $Date: 2006/05/24 15:47:03 $
0058:         */
0059:        public class JagGenerator extends JFrame {
0060:
0061:            static Log log = LogFactory.getLog(JagGenerator.class);
0062:            private ConsoleLogger logger;
0063:            private boolean offlineMode = false;
0064:
0065:            private DefaultTreeModel treeModel = null;
0066:            public Root root = null;
0067:            private File file = null;
0068:            private File outputDir = null;
0069:            private static File applicationFileDir = new File(".");
0070:            public static JagGenerator jagGenerator;
0071:            private static GenericJdbcManager conManager;
0072:            private static final int SPLIT_PANE_WIDTH = 400;
0073:            private static boolean relationsEnabled = true;
0074:            private static Thread runningThread;
0075:            private static final Icon CANCEL_ICON = new ImageIcon(
0076:                    "../images/cancel.png");
0077:            private static final Icon RUN_ICON = new ImageIcon(
0078:                    "../images/execute.png");
0079:            private static final String RUN_ACTION = "run";
0080:            private static final String STOP_ACTION = "stop";
0081:            private static final HashMap entities = new HashMap();
0082:            private static final HashMap entitiesByTableName = new HashMap();
0083:            private static final String XMI_SUFFIX = ".xmi";
0084:
0085:            private static final HashMap FILECHOOSER_START_DIR = new HashMap();
0086:            private static final String FILECHOOSER_UMLEXPORT = "UML export";
0087:            private static final String FILECHOOSER_UMLIMPORT = "UML import";
0088:            public static final String FILECHOOSER_APPFILE_OPEN = "AppFile open";
0089:            private static final String FILECHOOSER_APPFILE_SAVE = "AppFile save";
0090:
0091:            public final static String TEMPLATE_USE_RELATIONS = "useRelations";
0092:            public final static String TEMPLATE_USE_MOCK = "useMock";
0093:            public final static String TEMPLATE_USE_JAVA5 = "useJava5";
0094:            public final static String TEMPLATE_USE_WEB_SERVICE = "useWebService";
0095:            public final static String TEMPLATE_USE_SECURITY = "useSecurity";
0096:
0097:            public final static String TEMPLATE_WEB_TIER = "webTier";
0098:            public final static String TEMPLATE_WEB_TIER_STRUTS1_2 = "Struts 1.2";
0099:            public final static String TEMPLATE_WEB_TIER_TAPESTRY4 = "Tapestry 4";
0100:            public final static String TEMPLATE_WEB_TIER_SWING = "Swing";
0101:
0102:            public final static String TEMPLATE_BUSINESS_TIER = "businessTier";
0103:            public final static String TEMPLATE_BUSINESS_TIER_EJB2 = "EJB 2.0";
0104:            public final static String TEMPLATE_BUSINESS_TIER_EJB3 = "EJB 3.0";
0105:            public final static String TEMPLATE_BUSINESS_TIER_HIBERNATE2 = "Hibernate 2";
0106:            public final static String TEMPLATE_BUSINESS_TIER_HIBERNATE3 = "Hibernate 3";
0107:            public final static String TEMPLATE_BUSINESS_TIER_MOCK = "Mock";
0108:
0109:            public final static String TEMPLATE_SERVICE_TIER = "serviceTier";
0110:            public final static String TEMPLATE_SERVICE_TIER_SERVICE_LOCATOR = "ServiceLocator";
0111:            public final static String TEMPLATE_SERVICE_TIER_SPRING = "Spring";
0112:
0113:            public final static String TEMPLATE_APPLICATION_SERVER = "appserver";
0114:            public final static String TEMPLATE_APPLICATION_SERVER_JBOSS_4_X = "JBoss 4.x";
0115:            public final static String TEMPLATE_APPLICATION_SERVER_JBOSS_3_2_2_7 = "JBoss 3.2.2-7";
0116:            public final static String TEMPLATE_APPLICATION_SERVER_JBOSS_3_2_0_1 = "JBoss 3.2.0-1";
0117:            public final static String TEMPLATE_APPLICATION_SERVER_JBOSS_3_0 = "JBoss 3.0";
0118:            public final static String TEMPLATE_APPLICATION_SERVER_TOMCAT_5 = "Tomcat 5";
0119:            public final static String TEMPLATE_APPLICATION_SERVER_SUN_ONE_7 = "Sun ONE Application Server 7";
0120:            public final static String TEMPLATE_APPLICATION_SERVER_WEBLOGIC_8_1 = "BEA WebLogic 8.1";
0121:            public final static String TEMPLATE_APPLICATION_SERVER_WEBLOGIC_EJBGEN_8_1 = "BEA WebLogic 8.1 (Workshop EJBGen)";
0122:            public final static String TEMPLATE_APPLICATION_SERVER_IBM_WEBSPERE = "IBM WebSphere";
0123:            public final static String TEMPLATE_APPLICATION_SERVER_ORACLE = "Oracle Application Server";
0124:
0125:            /**
0126:             * Runs the JaGGenerator.
0127:             *
0128:             * @param args the command line arguments
0129:             */
0130:            public static void main(String args[]) {
0131:                // Initialize commons logging..
0132:                log.info("Starting jag...");
0133:                jagGenerator = new JagGenerator();
0134:                jagGenerator.setVisible(true);
0135:            }
0136:
0137:            /**
0138:             * Get the current logger.
0139:             * @return the logger.
0140:             */
0141:            public ConsoleLogger getLogger() {
0142:                return logger;
0143:            }
0144:
0145:            /**
0146:             * Set the console logger.
0147:             * @param logger
0148:             */
0149:            public void setLogger(ConsoleLogger logger) {
0150:                this .logger = logger;
0151:            }
0152:
0153:            /**
0154:             * Creates new form jagGenerator
0155:             */
0156:            public JagGenerator() {
0157:                // Read user-prefs
0158:                Settings.read();
0159:
0160:                // Setup main Window
0161:                try {
0162:                    UIManager.setLookAndFeel(UIManager
0163:                            .getSystemLookAndFeelClassName());
0164:                } catch (Exception e) {
0165:                }
0166:                // Initialize the Netbeans form components.
0167:                initComponents();
0168:                // Initilize our custom components that aren't managed by the form editor.
0169:                initCustomComponents();
0170:                logger = new ConsoleLogger(console);
0171:                consoleScrollPane.setViewportView(console);
0172:
0173:                logger.log("Java Application Generator - console output:\n");
0174:                initDesktop();
0175:                fileNameLabel.setToolTipText("No application file selected.");
0176:                root = new Root();
0177:                treeModel = new DefaultTreeModel(root);
0178:                treeModel.addTreeModelListener(new JagTreeModelListener());
0179:                tree.setCellRenderer(new JagTreeCellRenderer());
0180:                tree.setModel(treeModel);
0181:                tree.setSelectionPath(new TreePath(
0182:                        ((DefaultMutableTreeNode) root.getFirstChild())
0183:                                .getPath()));
0184:
0185:                // Set divider-locations to the place they were when user closed program
0186:                splitPane.setDividerLocation(Settings
0187:                        .getVerticalDividerPosition());
0188:                desktopConsoleSplitPane.setDividerLocation(Settings
0189:                        .getHorizontalDividerPosition());
0190:                // Give the Window the last known position and size again.
0191:                setBounds(Settings.getUserWindowBounds(this ));
0192:                // If user was previously working in a maximized Window, return to maximized state
0193:                if (Settings.isMaximized()) {
0194:                    setExtendedState(MAXIMIZED_BOTH);
0195:                }
0196:            }
0197:
0198:            /**
0199:             * Gets the connection manager, the means by which the database is accessed.  If no connection has
0200:             * yet been set up, a dialogue will be displayed to the user with the DB settings and following this,
0201:             * a connection is attempted.
0202:             *
0203:             * @return Value of property conManager.
0204:             */
0205:            public static GenericJdbcManager getConManager() {
0206:                if (conManager == null) {
0207:                    JDialog dialog = new ConnectDialog(jagGenerator);
0208:                    dialog.setVisible(true); //necessary as of kestrel
0209:                }
0210:                if (conManager != null) {
0211:                    jagGenerator.disconnectMenuItem.setEnabled(true);
0212:                }
0213:                return conManager;
0214:            }
0215:
0216:            /**
0217:             * Checks whether the database has been connected yet.
0218:             *
0219:             * @return <code>true</code> if connected.
0220:             */
0221:            public static boolean isDatabaseConnected() {
0222:                return conManager != null;
0223:            }
0224:
0225:            /**
0226:             * Check if JAG is running in offline mode (no database connection).
0227:             */
0228:            public boolean isOfflineMode() {
0229:                return offlineMode;
0230:            }
0231:
0232:            /**
0233:             * Set JAG in offline mode. This allows for adding Entties without a databse connection.
0234:             */
0235:            public void setOfflineMode(boolean offlineMode) {
0236:                this .offlineMode = offlineMode;
0237:            }
0238:
0239:            /**
0240:             * Enables the presentation layer to specify that a given field within a given entity is a foreign key field.
0241:             *
0242:             * @param tableName the name of the table whose entity contains the field we're interested in.
0243:             * @param fieldName the foreign key field.
0244:             */
0245:            public static void setForeignKeyInField(String tableName,
0246:                    String fieldName) {
0247:                TreeModel model = jagGenerator.tree.getModel();
0248:                for (int i = 0; i < model.getChildCount(model.getRoot()); i++) {
0249:                    Object kid = model.getChild(model.getRoot(), i);
0250:                    if (kid instanceof  Entity) {
0251:                        Entity entity = (Entity) kid;
0252:                        if (entity.getLocalTableName().equals(tableName)) {
0253:                            for (int j = 0; j < entity.getChildCount(); j++) {
0254:                                Object kid2 = entity.getChildAt(j);
0255:                                if (kid2 instanceof  Field) {
0256:                                    Field field = (Field) kid2;
0257:                                    if (field.getName().toString().equals(
0258:                                            fieldName)) {
0259:                                        field.setForeignKey(true);
0260:                                    }
0261:                                }
0262:                            }
0263:                        }
0264:                    }
0265:                }
0266:            }
0267:
0268:            public static boolean isRelationsEnabled() {
0269:                return relationsEnabled;
0270:            }
0271:
0272:            public static void logToConsole(Object o) {
0273:                logToConsole(o, LogLevel.INFO);
0274:            }
0275:
0276:            public static void stateChanged(boolean updateTree) {
0277:                setFileNeedsSavingIndicator(true);
0278:                if (updateTree) {
0279:                    jagGenerator.tree.updateUI();
0280:                }
0281:            }
0282:
0283:            public static void finishedGeneration() {
0284:                jagGenerator.executeButton.setIcon(RUN_ICON);
0285:                jagGenerator.executeButton.setActionCommand(RUN_ACTION);
0286:            }
0287:
0288:            public static Template getTemplate() {
0289:                Enumeration children = jagGenerator.root.children();
0290:                while (children.hasMoreElements()) {
0291:                    DefaultMutableTreeNode child = (DefaultMutableTreeNode) children
0292:                            .nextElement();
0293:                    if (child instanceof  Config) {
0294:                        return ((Config) child).getTemplate();
0295:                    }
0296:                }
0297:                return null;
0298:            }
0299:
0300:            public static List getObjectsFromTree(Class clazz) {
0301:                ArrayList list = new ArrayList();
0302:                Enumeration children = jagGenerator.root.children();
0303:                while (children.hasMoreElements()) {
0304:                    DefaultMutableTreeNode child = (DefaultMutableTreeNode) children
0305:                            .nextElement();
0306:                    if (child != null && child.getClass().equals(clazz)) {
0307:                        list.add(child);
0308:                    }
0309:                }
0310:                return list;
0311:            }
0312:
0313:            public static void addEntity(String refName, Entity entity) {
0314:                entities.put(refName, entity);
0315:                entitiesByTableName.put(entity.getTableName(), entity);
0316:            }
0317:
0318:            public static Entity getEntityByRefName(String refName) {
0319:                return (Entity) entities.get(refName);
0320:            }
0321:
0322:            public static Entity getEntityByTableName(String tableName) {
0323:                return (Entity) entitiesByTableName.get(tableName);
0324:            }
0325:
0326:            /**
0327:             * When the table name associated with an entity has been updated, calling this method
0328:             * updates the cache.
0329:             *
0330:             * @param entityName
0331:             * @param newTableName
0332:             */
0333:            public static void entityHasupdatedTableName(String entityName,
0334:                    String newTableName) {
0335:                synchronized (entitiesByTableName) {
0336:                    Iterator i = entitiesByTableName.entrySet().iterator();
0337:                    while (i.hasNext()) {
0338:                        Map.Entry entry = (Map.Entry) i.next();
0339:                        Entity entity = (Entity) entry.getValue();
0340:                        if (entity.getName().equals(entityName)) {
0341:                            entitiesByTableName.remove(entry.getKey());
0342:                            entitiesByTableName.put(newTableName, entity);
0343:                        }
0344:                    }
0345:                }
0346:            }
0347:
0348:            /**
0349:             * Makes sure that the SQL types of the fields within this application are compatible with the chosen DB.
0350:             */
0351:            public static void normaliseSQLTypesWithChosenDatabase() {
0352:                //I don't think this functionality is really necessary.
0353:
0354:                //      if (jagGenerator.root.datasource.getMapping().toString().equals(Datasource.MYSQL)) {
0355:                //         replaceSQLTypeInAllFields("NUMBER(\\([0-9\\s]+,[0-9\\s]+\\))", "FLOAT$1"); //NUMBER with TWO comma-seperated args
0356:                //         replaceSQLTypeInAllFields("NUMBER", "INT"); //all other NUMBER
0357:                //         replaceSQLTypeInAllFields("VARCHAR2", "VARCHAR");
0358:                //      }
0359:                //
0360:                //      if (jagGenerator.root.datasource.getMapping().toString().equals(Datasource.ORACLE8)) {
0361:                //         replaceSQLTypeInAllFields("INT", "NUMBER");
0362:                //      }
0363:            }
0364:
0365:            /**
0366:             * A record is kept of the last-accessed directory for every FileChooser, this method gets that record.
0367:             *
0368:             * @param filechooserKey A unique key.
0369:             * @return File
0370:             */
0371:            public static File getFileChooserStartDir(String filechooserKey) {
0372:                File dir = (File) FILECHOOSER_START_DIR.get(filechooserKey);
0373:                return dir == null ? applicationFileDir : dir;
0374:            }
0375:
0376:            /**
0377:             * A record is kept of the last-accessed directory for every FileChooser, this method sets that record.
0378:             *
0379:             * @param filechooserKey A unique key.
0380:             * @param dir            The new directory.
0381:             */
0382:            public static void setFileChooserStartDir(String filechooserKey,
0383:                    File dir) {
0384:                FILECHOOSER_START_DIR.put(filechooserKey, dir);
0385:            }
0386:
0387:            private static void saveGuiSettings() {
0388:                // Store divier locations
0389:                Settings.setVerticalDividerPosition(jagGenerator.splitPane
0390:                        .getDividerLocation());
0391:                Settings
0392:                        .setHorizontalDividerPosition(jagGenerator.desktopConsoleSplitPane
0393:                                .getDividerLocation());
0394:                // Store window's maximized state and/or it's size and location
0395:                int extendedState = jagGenerator.getExtendedState();
0396:                boolean isMaximized = ((extendedState & MAXIMIZED_BOTH) == MAXIMIZED_BOTH);
0397:                if (!isMaximized) {
0398:                    // The current Window-dimensions are only valid if not maximized
0399:                    Settings.setUserWindowBounds(jagGenerator.getBounds());
0400:                }
0401:                Settings.setMaximized(isMaximized);
0402:            }
0403:
0404:            /**
0405:             * Causes JAG to die.
0406:             *
0407:             * @param error if not <code>null</code>, forces an error dialogue before death.
0408:             */
0409:            public static void kickTheBucket(String error) {
0410:                if (error == null) {
0411:                    // Store GUI-settings in user-preferences
0412:                    saveGuiSettings();
0413:                    Settings.write();
0414:                    // Make sure the current database-settings are stored as well
0415:                    ConfigManager.getInstance().save();
0416:                    //todo: prompt to save application file!
0417:                    //todo: Make sure prompt allows you to check "don't show this again"
0418:                    System.exit(0);
0419:                } else {
0420:                    //something went horribly wrong..
0421:                    JOptionPane.showMessageDialog(jagGenerator, error,
0422:                            "JAG - Fatal error!", JOptionPane.ERROR_MESSAGE);
0423:                    System.exit(1);
0424:                }
0425:            }
0426:
0427:            /**
0428:             * Setter for property conManager.
0429:             *
0430:             * @param conManager New value of property conManager.
0431:             */
0432:            public void setConManager(GenericJdbcManager conManager) {
0433:                JagGenerator.conManager = conManager;
0434:            }
0435:
0436:            private void initDesktop() {
0437:                desktopPane.setLayout(new GridBagLayout());
0438:                this .setTitle("Java Application Generator - Finalist IT Group");
0439:                GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
0440:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
0441:                gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
0442:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0443:                gridBagConstraints.ipadx = 1;
0444:                gridBagConstraints.ipady = 1;
0445:                gridBagConstraints.weightx = 1.0;
0446:                gridBagConstraints.weighty = 1.0;
0447:                desktopPane.add(splitPane, gridBagConstraints);
0448:                pack();
0449:            }
0450:
0451:            private void newRelationMenuItemActionPerformed() {
0452:                DefaultMutableTreeNode selected = (DefaultMutableTreeNode) tree
0453:                        .getLastSelectedPathComponent();
0454:                if (!(selected instanceof  Entity)) {
0455:                    //see if the parent is an Entity..
0456:                    TreePath selectedPath = tree.getSelectionPath();
0457:                    selected = (DefaultMutableTreeNode) selectedPath
0458:                            .getParentPath().getLastPathComponent();
0459:                    if (!(selected instanceof  Entity)) {
0460:                        JOptionPane
0461:                                .showMessageDialog(
0462:                                        this ,
0463:                                        "A relation can only be added to an entity bean.  Please first select an entity in the application tree.",
0464:                                        "Can't add relation!",
0465:                                        JOptionPane.ERROR_MESSAGE);
0466:                        return;
0467:                    }
0468:                }
0469:                Entity selectedEntity = (Entity) selected;
0470:
0471:                DefaultMutableTreeNode newNode = new Relation(selectedEntity);
0472:                selectedEntity.addRelation((Relation) newNode);
0473:                tree.setSelectionPath(new TreePath(newNode.getPath()));
0474:                tree.updateUI();
0475:            }
0476:
0477:            /**
0478:             * Updates objects concerned with 'local' side CMR relations, namely:
0479:             * 1: for every foreign key Field object within an entity that takes part in a relation, set its Relation object.
0480:             * 2: for every Relation object, set the Relation's local-side foreign key Field object.
0481:             */
0482:            private void updateLocalSideRelations() {
0483:                Iterator entities = root.getEntityEjbs().iterator();
0484:                while (entities.hasNext()) {
0485:                    Entity entity = (Entity) entities.next();
0486:                    //for every entity..
0487:                    for (int i = 0; i < entity.getChildCount(); i++) {
0488:                        TreeNode child = entity.getChildAt(i);
0489:                        //for every relation in that entity..
0490:                        if (child instanceof  Relation) {
0491:                            Relation relation = (Relation) child;
0492:                            String fkFieldName = relation.getFieldName()
0493:                                    .toString();
0494:                            for (int j = 0; j < entity.getChildCount(); j++) {
0495:                                TreeNode child2 = entity.getChildAt(j);
0496:                                //iterate through all this entity's Fields..
0497:                                if (child2 instanceof  Field) {
0498:                                    Field field = (Field) child2;
0499:                                    //until we find the Field that matches the relation's fkFieldName
0500:                                    if (field.getName().equals(fkFieldName)) {
0501:                                        field.setRelation(relation);
0502:                                        field.setForeignKey(true);
0503:                                        relation.setFieldName(field.getName()
0504:                                                .toString());
0505:                                        relation.setFkField(field);
0506:                                        if (relation.getLocalColumn() == null) {
0507:                                            relation.setLocalColumn(relation
0508:                                                    .getFkField()
0509:                                                    .getColumnName());
0510:                                        }
0511:                                        logToConsole("relation " + relation
0512:                                                + ": local-side fk field is "
0513:                                                + entity.getName() + ":"
0514:                                                + field);
0515:                                    }
0516:                                }
0517:                            }
0518:                        }
0519:                    }
0520:                }
0521:            }
0522:
0523:            /**
0524:             * Updates objects concerned with the 'foreign' side of CMR relations, namely:
0525:             * 1: for every Relation, set the foreign-side primary key Field object (the primary key of the entity on the
0526:             * foreign side of the relation).
0527:             */
0528:            private void updateForeignSideRelations() {
0529:                Iterator entities = root.getEntityEjbs().iterator();
0530:                while (entities.hasNext()) {
0531:                    Entity entity = (Entity) entities.next();
0532:                    for (int i = 0; i < entity.getChildCount(); i++) {
0533:                        TreeNode child = entity.getChildAt(i);
0534:                        if (child instanceof  Relation) {
0535:                            Relation relation = (Relation) child;
0536:                            Entity relatedEntity = relation.getRelatedEntity();
0537:                            String column = relation.getForeignColumn();
0538:                            for (int j = 0; j < relatedEntity.getChildCount(); j++) {
0539:                                TreeNode child2 = relatedEntity.getChildAt(j);
0540:                                if (child2 instanceof  Field) {
0541:                                    Field field = (Field) child2;
0542:                                    if (field.getColumnName().equals(column)) {
0543:                                        relation.setForeignPkField(field);
0544:                                        logToConsole("relation " + relation
0545:                                                + ": foreign-side pk is "
0546:                                                + relatedEntity + ":" + field);
0547:                                    }
0548:                                }
0549:                            }
0550:                        }
0551:                    }
0552:                }
0553:            }
0554:
0555:            /**
0556:             * Sometimes a relation specifies an entity that hasn't been added to a session bean (all related entities
0557:             * must be represented in the session fa?ade).  This method adds those entities automatically.
0558:             *
0559:             * @return <code>false</code> if a related entity couldn't be imported into the application.
0560:             */
0561:            private boolean addRelatedEntitiesToSessionBeans() {
0562:                boolean somethingAdded = false;
0563:                //1: create a map of entity name --> set of related foreign tables, and
0564:                //            map of local table --> entity bean name, and
0565:                //            map of entity bean name --> local table
0566:                HashMap relatedTablesPerEB = new HashMap();
0567:                HashMap entityPerTable = new HashMap();
0568:                HashMap tablePerEntity = new HashMap();
0569:                Iterator entities = root.getEntityEjbs().iterator();
0570:                while (entities.hasNext()) {
0571:                    Entity entity = (Entity) entities.next();
0572:                    entityPerTable.put(entity.getLocalTableName().toString(),
0573:                            entity.getRefName());
0574:                    tablePerEntity.put(entity.getRefName(), entity
0575:                            .getLocalTableName().toString());
0576:                    for (int i = 0; i < entity.getChildCount(); i++) {
0577:                        TreeNode child = entity.getChildAt(i);
0578:                        if (child instanceof  Relation) {
0579:                            Relation relation = (Relation) child;
0580:                            String relatedTableName = relation
0581:                                    .getForeignTable();
0582:                            Set existing = (Set) relatedTablesPerEB.get(entity
0583:                                    .getRefName());
0584:                            if (existing == null) {
0585:                                existing = new HashSet();
0586:                            }
0587:                            existing.add(relatedTableName);
0588:                            relatedTablesPerEB.put(entity.getRefName(),
0589:                                    existing);
0590:
0591:                        }
0592:                    }
0593:                }
0594:
0595:                //2: remove all related foreign tables from the map, where the table is the local table of an entity that already
0596:                //   appears within a session bean.
0597:                Iterator sessions = root.getSessionEjbs().iterator();
0598:                while (sessions.hasNext()) {
0599:                    Session session = (Session) sessions.next();
0600:                    Iterator entitiesWithinSession = session.getEntityRefs()
0601:                            .iterator();
0602:                    while (entitiesWithinSession.hasNext()) {
0603:                        String localTable = (String) tablePerEntity
0604:                                .get(entitiesWithinSession.next());
0605:                        Iterator relatedEntitySets = relatedTablesPerEB
0606:                                .values().iterator();
0607:                        while (relatedEntitySets.hasNext()) {
0608:                            Set set = (Set) relatedEntitySets.next();
0609:                            set.remove(localTable);
0610:                        }
0611:                    }
0612:                }
0613:
0614:                //3: for each session bean, add any related entities not already contained within a session bean.
0615:                HashSet addedTables = new HashSet();
0616:                sessions = root.getSessionEjbs().iterator();
0617:                while (sessions.hasNext()) {
0618:                    Session session = (Session) sessions.next();
0619:                    Iterator entitiesWithinSession = session.getEntityRefs()
0620:                            .iterator();
0621:                    while (entitiesWithinSession.hasNext()) {
0622:                        String entityName = (String) entitiesWithinSession
0623:                                .next();
0624:                        Set tablesToBeAdded = (Set) relatedTablesPerEB
0625:                                .get(entityName);
0626:                        if (tablesToBeAdded != null) {
0627:                            Iterator i = tablesToBeAdded.iterator();
0628:                            while (i.hasNext()) {
0629:                                String table = (String) i.next();
0630:                                if (!addedTables.contains(table)) {
0631:                                    String entity = (String) entityPerTable
0632:                                            .get(table);
0633:                                    if (entity == null) {
0634:                                        JOptionPane
0635:                                                .showMessageDialog(
0636:                                                        this ,
0637:                                                        "Entity '"
0638:                                                                + entityName
0639:                                                                + "' contains a relation to a table '"
0640:                                                                + table
0641:                                                                + "'\n"
0642:                                                                + "for which no entity bean exists in the current application.\n"
0643:                                                                + "Please either create a new entity bean for this table, or delete the relation.",
0644:                                                        "Invalid Container-managed relation!",
0645:                                                        JOptionPane.ERROR_MESSAGE);
0646:                                        return false;
0647:                                    } else {
0648:                                        session.addRelationRef(entity);
0649:                                        addedTables.add(table);
0650:                                        somethingAdded = true;
0651:                                        JOptionPane
0652:                                                .showMessageDialog(
0653:                                                        this ,
0654:                                                        "Entity '"
0655:                                                                + entityName
0656:                                                                + "' added to the service bean '"
0657:                                                                + session
0658:                                                                        .getRefName()
0659:                                                                + "' contains a relation to the entity '"
0660:                                                                + entity
0661:                                                                + "', which doesn't appear in any service beans.\n"
0662:                                                                + "The relation requires accessor methods to '"
0663:                                                                + entity
0664:                                                                + "', so these were automatically added to the service bean.",
0665:                                                        "Service bean modified",
0666:                                                        JOptionPane.INFORMATION_MESSAGE);
0667:                                    }
0668:                                }
0669:                            }
0670:                        }
0671:                    }
0672:                }
0673:
0674:                //recursively call this method if an entity had to be added, because possible that entity also contains
0675:                //relation references to other entities that need to be imported into a session bean...
0676:                if (somethingAdded) {
0677:                    addRelatedEntitiesToSessionBeans();
0678:                }
0679:                return true;
0680:            }
0681:
0682:            private File selectJagOutDirectory(String startDir) {
0683:                File directory = null;
0684:                int fileChooserStatus;
0685:                JFileChooser fileChooser = new JFileChooser();
0686:                fileChooser
0687:                        .setDialogTitle("Select an ouput directory for the generated application..");
0688:                fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
0689:                fileChooser.setCurrentDirectory(new File(startDir));
0690:                fileChooserStatus = fileChooser.showOpenDialog(this );
0691:                if (fileChooserStatus == JFileChooser.APPROVE_OPTION) {
0692:                    directory = fileChooser.getSelectedFile();
0693:                    String projectName = root.app.nameText.getText();
0694:                    directory = new File(directory.getAbsoluteFile(),
0695:                            projectName);
0696:                }
0697:                return directory;
0698:
0699:            }
0700:
0701:            /**
0702:             * Generates relations for a specified entity by reading foreign key info from the database.
0703:             *
0704:             * @param entity the Entity whose relations will be generated.
0705:             */
0706:            private boolean generateRelationsFromDB(Entity entity) {
0707:                if (getConManager() == null) {
0708:                    logger.log("Can't regenerate relations - no database!");
0709:                    return false;
0710:                }
0711:                log.debug("Get the foreign keys for table: "
0712:                        + entity.getTableName());
0713:                List fkeys = DatabaseUtils
0714:                        .getForeignKeys(entity.getTableName());
0715:                HashMap foreignTablesTally = new HashMap();
0716:                Set foreignKeyFieldNames = new HashSet(fkeys.size());
0717:                Iterator i = fkeys.iterator();
0718:                while (i.hasNext()) {
0719:                    ForeignKey fk = (ForeignKey) i.next();
0720:                    foreignKeyFieldNames
0721:                            .add(Utils.format(fk.getFkColumnName()));
0722:                    Relation relation = new Relation(entity, fk);
0723:                    String foreignTable = fk.getPkTableName();
0724:
0725:                    // Default to unidirectional:
0726:                    relation.setBidirectional(false);
0727:                    // No support for one-to-one relations yet. So default to many-to-one
0728:                    relation.setTargetMultiple(true);
0729:                    /*
0730:                    if (relation.getFkField() != null && relation.getFkField().isPrimaryKey()) {
0731:                       // In case the local side is a primary key, we have a one to one relation
0732:                       relation.setTargetMultiple(false);
0733:                    } else {
0734:                       // In case the local side isn't a primary key, we asume to have a many to one relation.
0735:                       relation.setTargetMultiple(true);
0736:                    }
0737:                     */
0738:
0739:                    if (foreignTablesTally.keySet().contains(foreignTable)) {
0740:                        int tally = ((Integer) foreignTablesTally
0741:                                .get(foreignTable)).intValue() + 1;
0742:                        relation.setName(relation.getName() + tally);
0743:                        foreignTablesTally
0744:                                .put(foreignTable, new Integer(tally));
0745:                    } else {
0746:                        foreignTablesTally.put(foreignTable, new Integer(1));
0747:                    }
0748:                    addObject(entity, relation, false, true);
0749:                }
0750:                return true;
0751:            }
0752:
0753:            private ArrayList sortColumns(ArrayList columns, ArrayList pKeys,
0754:                    Entity entity, String pKey) {
0755:                ArrayList sortedColumns = new ArrayList();
0756:                // Make sure the primary key will be the first field!
0757:                ArrayList primaryKeyColumns = new ArrayList();
0758:                Column primaryKeyColumn = null;
0759:                for (Iterator colIt = columns.iterator(); colIt.hasNext();) {
0760:                    Column column = (Column) colIt.next();
0761:                    if (pKeys.contains(column.getName())) {
0762:                        // We found the primary key column!
0763:                        primaryKeyColumn = column;
0764:                        primaryKeyColumn.setPrimaryKey(true);
0765:                        primaryKeyColumns.add(primaryKeyColumn);
0766:                    } else {
0767:                        column.setPrimaryKey(false);
0768:                        sortedColumns.add(column);
0769:                    }
0770:                }
0771:                if (pKeys.size() > 1) {
0772:                    // We have a composite primary key!
0773:                    entity.isCompositeCombo.setSelectedItem("true");
0774:                    String compositePK = entity.rootPackageText.getText() + "."
0775:                            + entity.nameText.getText() + "PK";
0776:                    entity.pKeyTypeText.setText(compositePK);
0777:                    entity.pKeyText.setText("");// name is irrelevant now.
0778:                } else {
0779:                    entity.isCompositeCombo.setSelectedItem("false");
0780:                    if (pKeys.size() == 1) {
0781:                        entity.pKeyText.setText(Utils.format(pKey));// name is irrelevant now.
0782:
0783:                    }
0784:                }
0785:                // If a primary key column was found, we put it in front of the list.
0786:                columns = new ArrayList();
0787:                if (primaryKeyColumn != null)
0788:                    columns.addAll(primaryKeyColumns);
0789:                columns.addAll(sortedColumns);
0790:                return columns;
0791:            }
0792:
0793:            private void addObject(DefaultMutableTreeNode parent,
0794:                    DefaultMutableTreeNode child, boolean forceUpdate,
0795:                    boolean topOfQueue) {
0796:                if (parent == null) {
0797:                    parent = root;
0798:                }
0799:                treeModel.insertNodeInto(child, parent, topOfQueue ? 0 : parent
0800:                        .getChildCount());
0801:                if (forceUpdate) {
0802:                    tree.setSelectionPath(new TreePath(child.getPath()));
0803:                }
0804:            }
0805:
0806:            public boolean save() {
0807:                //the object graph is incomplete at this stage, so finalise it now:
0808:                updateLocalSideRelations();
0809:                updateForeignSideRelations();
0810:
0811:                if (!addRelatedEntitiesToSessionBeans()) {
0812:                    return false;
0813:                }
0814:
0815:                try {
0816:                    DocumentBuilderFactory dbf = DocumentBuilderFactory
0817:                            .newInstance();
0818:                    DocumentBuilder builder = dbf.newDocumentBuilder();
0819:                    Document doc = builder.newDocument();
0820:                    Element skelet = doc.createElement("skelet");
0821:                    doc.appendChild(skelet);
0822:                    root.getXML(skelet);
0823:                    String XMLDoc = outXML(doc);
0824:                    String fileName = file.getName();
0825:                    if (fileName != null) {
0826:                        if (fileName.indexOf(".xml") == -1) {
0827:                            file = new File(file.getAbsolutePath() + ".xml");
0828:                        }
0829:                    }
0830:                    FileWriter fw = new FileWriter(file);
0831:                    fw.write(XMLDoc);
0832:                    fw.close();
0833:                    fileNameLabel
0834:                            .setText("Application file: " + file.getName());
0835:                    fileNameLabel.setToolTipText(file.getAbsolutePath());
0836:
0837:                } catch (ParserConfigurationException e) {
0838:                    e.printStackTrace();
0839:                } catch (IOException e) {
0840:                    e.printStackTrace();
0841:                }
0842:
0843:                setFileNeedsSavingIndicator(false);
0844:                return true;
0845:            }
0846:
0847:            /* Use the JAXB JDK1.4 parser to serialize to XML. */
0848:            public static String outXML(Document doc) {
0849:                try {
0850:                    DOMSource domSource = new DOMSource(doc);
0851:                    StringWriter sw = new StringWriter();
0852:                    StreamResult streamResult = new StreamResult(sw);
0853:                    TransformerFactory tf = TransformerFactory.newInstance();
0854:                    Transformer serializer = tf.newTransformer();
0855:                    serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
0856:                    serializer.setOutputProperty(OutputKeys.INDENT, "yes");
0857:                    serializer.transform(domSource, streamResult);
0858:                    return sw.toString();
0859:                } catch (Exception e) {
0860:                    e.printStackTrace();
0861:                }
0862:                return null;
0863:            }
0864:
0865:            private static void setFileNeedsSavingIndicator(boolean sterretje) {
0866:                if (jagGenerator != null && jagGenerator.file != null) {
0867:                    String filename = jagGenerator.fileNameLabel.getText();
0868:                    if (sterretje
0869:                            && filename.charAt(filename.length() - 1) != '*') {
0870:                        jagGenerator.fileNameLabel.setText(filename + '*');
0871:                    } else if (!sterretje
0872:                            && filename.charAt(filename.length() - 1) == '*') {
0873:                        jagGenerator.fileNameLabel.setText(filename.substring(
0874:                                0, filename.length() - 1));
0875:                    }
0876:                }
0877:            }
0878:
0879:            private void initCustomComponents() {
0880:                // Since a custom menu can't be added using Netbeans form editor,
0881:                // We add it just after the initComponents.
0882:                recentMenu = new com.finalist.jaggenerator.menu.RecentMenu();
0883:                recentMenu.setMnemonic(KeyEvent.VK_R);
0884:                recentMenu.setText("Recent...");
0885:                recentMenu.setMainApp(this );
0886:                fileMenu.insert(recentMenu, 2);
0887:            }
0888:
0889:            //###########################################################################################
0890:            // All method signatures and "// doc" below here are automatically created
0891:            // by NetBeans (we used version 5.0).  Only change the method BODIES please,
0892:            // as this will enable later re-use the NetBeans form editor to make changes in the GUI!
0893:            //###########################################################################################
0894:
0895:            /**
0896:             * This method is called from within the constructor to
0897:             * initialize the form.
0898:             * WARNING: Do NOT modify this code. The content of this method is
0899:             * always regenerated by the Form Editor.
0900:             */
0901:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0902:            private void initComponents() {
0903:                splitPane = new javax.swing.JSplitPane();
0904:                treeScrollPane = new javax.swing.JScrollPane();
0905:                tree = new javax.swing.JTree();
0906:                toolBar = new javax.swing.JToolBar();
0907:                newButton = new javax.swing.JButton();
0908:                openButton = new javax.swing.JButton();
0909:                saveButton = new javax.swing.JButton();
0910:                entityButton = new javax.swing.JButton();
0911:                sessionButton = new javax.swing.JButton();
0912:                relationButton = new javax.swing.JButton();
0913:                businessMethodButton = new javax.swing.JButton();
0914:                fieldButton = new javax.swing.JButton();
0915:                deleteButton = new javax.swing.JButton();
0916:                executeButton = new javax.swing.JButton();
0917:                helpButton = new javax.swing.JButton();
0918:                spacer = new javax.swing.JPanel();
0919:                applicationFileInfoPanel = new javax.swing.JPanel();
0920:                fileNameLabel = new javax.swing.JLabel();
0921:                databaseConnectionInfoPanel = new javax.swing.JPanel();
0922:                databaseConnectionLabel = new javax.swing.JLabel();
0923:                desktopConsoleSplitPane = new javax.swing.JSplitPane();
0924:                desktopPane = new javax.swing.JDesktopPane();
0925:                consoleScrollPane = new javax.swing.JScrollPane();
0926:                console = new javax.swing.JTextPane();
0927:                textConsole = new javax.swing.JTextArea();
0928:                menuBar = new javax.swing.JMenuBar();
0929:                fileMenu = new javax.swing.JMenu();
0930:                newMenuItem = new javax.swing.JMenuItem();
0931:                openMenuItem = new javax.swing.JMenuItem();
0932:                importMenuItem = new javax.swing.JMenuItem();
0933:                jSeparator1 = new javax.swing.JSeparator();
0934:                saveMenuItem = new javax.swing.JMenuItem();
0935:                saveAsMenuItem = new javax.swing.JMenuItem();
0936:                exportMenuItem = new javax.swing.JMenuItem();
0937:                jSeparator2 = new javax.swing.JSeparator();
0938:                generateJavaApplicationAsMenuItem = new javax.swing.JMenuItem();
0939:                jSeparator3 = new javax.swing.JSeparator();
0940:                exitMenuItem = new javax.swing.JMenuItem();
0941:                editMenu = new javax.swing.JMenu();
0942:                addSubMenu = new javax.swing.JMenu();
0943:                addEntityMenuItem = new javax.swing.JMenuItem();
0944:                addSessionMenuItem = new javax.swing.JMenuItem();
0945:                addRelationMenuItem = new javax.swing.JMenuItem();
0946:                addBusinessMenuItem = new javax.swing.JMenuItem();
0947:                addFieldMenuItem = new javax.swing.JMenuItem();
0948:                deleteMenuItem = new javax.swing.JMenuItem();
0949:                connectionMenu = new javax.swing.JMenu();
0950:                driverManagerMenuItem = new javax.swing.JMenuItem();
0951:                jSeparator4 = new javax.swing.JSeparator();
0952:                connectMenuItem = new javax.swing.JMenuItem();
0953:                disconnectMenuItem = new javax.swing.JMenuItem();
0954:                helpMenu = new javax.swing.JMenu();
0955:                aboutMenuItem = new javax.swing.JMenuItem();
0956:                contentMenuItem = new javax.swing.JMenuItem();
0957:
0958:                splitPane.setBorder(null);
0959:                splitPane.setDividerLocation(400);
0960:                splitPane.setDividerSize(3);
0961:                splitPane.setContinuousLayout(true);
0962:                splitPane.setOpaque(false);
0963:                splitPane.setVerifyInputWhenFocusTarget(false);
0964:                tree
0965:                        .addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
0966:                            public void valueChanged(
0967:                                    javax.swing.event.TreeSelectionEvent evt) {
0968:                                treeValueChanged(evt);
0969:                            }
0970:                        });
0971:
0972:                treeScrollPane.setViewportView(tree);
0973:
0974:                splitPane.setLeftComponent(treeScrollPane);
0975:
0976:                addWindowListener(new java.awt.event.WindowAdapter() {
0977:                    public void windowClosing(java.awt.event.WindowEvent evt) {
0978:                        exitForm(evt);
0979:                    }
0980:                });
0981:
0982:                toolBar.setBorder(javax.swing.BorderFactory
0983:                        .createEtchedBorder());
0984:                toolBar.setFloatable(false);
0985:                toolBar.setName("toolBar");
0986:                newButton
0987:                        .setIcon(new javax.swing.ImageIcon("../images/new.png"));
0988:                newButton.setText(" ");
0989:                newButton.setToolTipText("New JAG application");
0990:                newButton.setBorder(null);
0991:                newButton
0992:                        .addActionListener(new java.awt.event.ActionListener() {
0993:                            public void actionPerformed(
0994:                                    java.awt.event.ActionEvent evt) {
0995:                                newMenuItemActionPerformed(evt);
0996:                            }
0997:                        });
0998:
0999:                toolBar.add(newButton);
1000:
1001:                openButton.setIcon(new javax.swing.ImageIcon(
1002:                        "../images/open.png"));
1003:                openButton.setText(" ");
1004:                openButton.setToolTipText("Open a JAG application file");
1005:                openButton.setBorder(null);
1006:                openButton
1007:                        .addActionListener(new java.awt.event.ActionListener() {
1008:                            public void actionPerformed(
1009:                                    java.awt.event.ActionEvent evt) {
1010:                                openMenuItemActionPerformed(evt);
1011:                            }
1012:                        });
1013:
1014:                toolBar.add(openButton);
1015:
1016:                saveButton.setIcon(new javax.swing.ImageIcon(
1017:                        "../images/save.png"));
1018:                saveButton.setText(" ");
1019:                saveButton.setToolTipText("Save");
1020:                saveButton.setBorder(null);
1021:                saveButton
1022:                        .addActionListener(new java.awt.event.ActionListener() {
1023:                            public void actionPerformed(
1024:                                    java.awt.event.ActionEvent evt) {
1025:                                saveButtonActionPerformed(evt);
1026:                            }
1027:                        });
1028:
1029:                toolBar.add(saveButton);
1030:
1031:                toolBar.addSeparator();
1032:                entityButton.setIcon(new javax.swing.ImageIcon(
1033:                        "../images/entity.png"));
1034:                entityButton.setText(" ");
1035:                entityButton.setToolTipText("New entity bean");
1036:                entityButton.setBorder(null);
1037:                entityButton
1038:                        .addActionListener(new java.awt.event.ActionListener() {
1039:                            public void actionPerformed(
1040:                                    java.awt.event.ActionEvent evt) {
1041:                                addEntityMenuItemActionPerformed(evt);
1042:                            }
1043:                        });
1044:
1045:                toolBar.add(entityButton);
1046:
1047:                sessionButton.setIcon(new javax.swing.ImageIcon(
1048:                        "../images/session.png"));
1049:                sessionButton.setText(" ");
1050:                sessionButton.setToolTipText("New service bean");
1051:                sessionButton.setBorder(null);
1052:                sessionButton
1053:                        .addActionListener(new java.awt.event.ActionListener() {
1054:                            public void actionPerformed(
1055:                                    java.awt.event.ActionEvent evt) {
1056:                                addSessionMenuItemActionPerformed(evt);
1057:                            }
1058:                        });
1059:
1060:                toolBar.add(sessionButton);
1061:
1062:                relationButton.setIcon(new javax.swing.ImageIcon(
1063:                        "../images/relation.png"));
1064:                relationButton.setText(" ");
1065:                relationButton.setToolTipText("New relation");
1066:                relationButton.setBorder(null);
1067:                relationButton
1068:                        .addActionListener(new java.awt.event.ActionListener() {
1069:                            public void actionPerformed(
1070:                                    java.awt.event.ActionEvent evt) {
1071:                                addRelationPopupMenuItemActionPerformed(evt);
1072:                            }
1073:                        });
1074:
1075:                toolBar.add(relationButton);
1076:
1077:                businessMethodButton.setIcon(new javax.swing.ImageIcon(
1078:                        "../images/business.png"));
1079:                businessMethodButton.setText(" ");
1080:                businessMethodButton.setToolTipText("New business method");
1081:                businessMethodButton.setBorder(null);
1082:                businessMethodButton
1083:                        .addActionListener(new java.awt.event.ActionListener() {
1084:                            public void actionPerformed(
1085:                                    java.awt.event.ActionEvent evt) {
1086:                                businessMethodButtonActionPerformed(evt);
1087:                            }
1088:                        });
1089:
1090:                toolBar.add(businessMethodButton);
1091:
1092:                fieldButton.setIcon(new javax.swing.ImageIcon(
1093:                        "../images/field.png"));
1094:                fieldButton.setText(" ");
1095:                fieldButton.setToolTipText("New entity field");
1096:                fieldButton.setBorder(null);
1097:                fieldButton
1098:                        .addActionListener(new java.awt.event.ActionListener() {
1099:                            public void actionPerformed(
1100:                                    java.awt.event.ActionEvent evt) {
1101:                                fieldButtonActionPerformed(evt);
1102:                            }
1103:                        });
1104:
1105:                toolBar.add(fieldButton);
1106:
1107:                deleteButton.setIcon(new javax.swing.ImageIcon(
1108:                        "../images/delete.png"));
1109:                deleteButton.setText(" ");
1110:                deleteButton.setToolTipText("Delete");
1111:                deleteButton.setBorder(null);
1112:                deleteButton
1113:                        .addActionListener(new java.awt.event.ActionListener() {
1114:                            public void actionPerformed(
1115:                                    java.awt.event.ActionEvent evt) {
1116:                                deleteMenuItemActionPerformed(evt);
1117:                            }
1118:                        });
1119:
1120:                toolBar.add(deleteButton);
1121:
1122:                toolBar.addSeparator();
1123:                executeButton.setIcon(new javax.swing.ImageIcon(
1124:                        "../images/execute.png"));
1125:                executeButton.setText(" ");
1126:                executeButton.setToolTipText("Generate the application");
1127:                executeButton.setBorder(null);
1128:                executeButton
1129:                        .addActionListener(new java.awt.event.ActionListener() {
1130:                            public void actionPerformed(
1131:                                    java.awt.event.ActionEvent evt) {
1132:                                generateJavaApplicationAsMenuItemActionPerformed(evt);
1133:                            }
1134:                        });
1135:
1136:                toolBar.add(executeButton);
1137:
1138:                toolBar.addSeparator();
1139:                helpButton.setIcon(new javax.swing.ImageIcon(
1140:                        "../images/help.png"));
1141:                helpButton.setText(" ");
1142:                helpButton.setToolTipText("Help");
1143:                helpButton.setBorder(null);
1144:                helpButton
1145:                        .addActionListener(new java.awt.event.ActionListener() {
1146:                            public void actionPerformed(
1147:                                    java.awt.event.ActionEvent evt) {
1148:                                contentMenuItemActionPerformed(evt);
1149:                            }
1150:                        });
1151:
1152:                toolBar.add(helpButton);
1153:
1154:                spacer.setLayout(null);
1155:
1156:                toolBar.add(spacer);
1157:
1158:                applicationFileInfoPanel.setName("fileStatusComponent");
1159:                fileNameLabel.setText("Application file:");
1160:                fileNameLabel.setToolTipText("File name of the XML skelet");
1161:                fileNameLabel.setName("fileNameLabel");
1162:                applicationFileInfoPanel.add(fileNameLabel);
1163:
1164:                toolBar.add(applicationFileInfoPanel);
1165:
1166:                databaseConnectionInfoPanel
1167:                        .setName("databaseConnectionComponent");
1168:                databaseConnectionLabel.setText("Database Connection:");
1169:                databaseConnectionLabel.setName("databaseConnectionLabel");
1170:                databaseConnectionInfoPanel.add(databaseConnectionLabel);
1171:
1172:                toolBar.add(databaseConnectionInfoPanel);
1173:
1174:                getContentPane().add(toolBar, java.awt.BorderLayout.NORTH);
1175:
1176:                desktopConsoleSplitPane.setDividerLocation(590);
1177:                desktopConsoleSplitPane
1178:                        .setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1179:                desktopConsoleSplitPane.setTopComponent(desktopPane);
1180:
1181:                console.setBackground(new java.awt.Color(204, 204, 204));
1182:                console.setEditable(false);
1183:                console.setFont(new java.awt.Font("Lucida Console", 0, 10));
1184:                console.setForeground(new java.awt.Color(0, 0, 1));
1185:                consoleScrollPane.setViewportView(console);
1186:
1187:                textConsole.setColumns(20);
1188:                textConsole.setRows(5);
1189:                consoleScrollPane.setViewportView(textConsole);
1190:
1191:                desktopConsoleSplitPane.setBottomComponent(consoleScrollPane);
1192:
1193:                getContentPane().add(desktopConsoleSplitPane,
1194:                        java.awt.BorderLayout.CENTER);
1195:
1196:                fileMenu.setMnemonic(KeyEvent.VK_F);
1197:                fileMenu.setText("File");
1198:                newMenuItem.setMnemonic(KeyEvent.VK_N);
1199:                newMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1200:                        KeyEvent.VK_N, KeyEvent.CTRL_MASK));
1201:                newMenuItem.setText("New");
1202:                newMenuItem
1203:                        .addActionListener(new java.awt.event.ActionListener() {
1204:                            public void actionPerformed(
1205:                                    java.awt.event.ActionEvent evt) {
1206:                                newMenuItemActionPerformed(evt);
1207:                            }
1208:                        });
1209:
1210:                fileMenu.add(newMenuItem);
1211:
1212:                openMenuItem.setMnemonic(KeyEvent.VK_O);
1213:                openMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1214:                        KeyEvent.VK_O, KeyEvent.CTRL_MASK));
1215:                openMenuItem.setText("Open");
1216:                openMenuItem
1217:                        .addActionListener(new java.awt.event.ActionListener() {
1218:                            public void actionPerformed(
1219:                                    java.awt.event.ActionEvent evt) {
1220:                                openMenuItemActionPerformed(evt);
1221:                            }
1222:                        });
1223:
1224:                fileMenu.add(openMenuItem);
1225:
1226:                importMenuItem.setMnemonic(KeyEvent.VK_I);
1227:                importMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1228:                        KeyEvent.VK_I, KeyEvent.CTRL_MASK));
1229:                importMenuItem.setText("Import UML model..");
1230:                importMenuItem
1231:                        .addActionListener(new java.awt.event.ActionListener() {
1232:                            public void actionPerformed(
1233:                                    java.awt.event.ActionEvent evt) {
1234:                                importMenuItemActionPerformed(evt);
1235:                            }
1236:                        });
1237:
1238:                fileMenu.add(importMenuItem);
1239:
1240:                fileMenu.add(jSeparator1);
1241:
1242:                saveMenuItem.setMnemonic(KeyEvent.VK_S);
1243:                saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1244:                        KeyEvent.VK_S, KeyEvent.CTRL_MASK));
1245:                saveMenuItem.setText("Save");
1246:                saveMenuItem
1247:                        .addActionListener(new java.awt.event.ActionListener() {
1248:                            public void actionPerformed(
1249:                                    java.awt.event.ActionEvent evt) {
1250:                                saveMenuItemActionPerformed(evt);
1251:                            }
1252:                        });
1253:
1254:                fileMenu.add(saveMenuItem);
1255:
1256:                saveAsMenuItem.setMnemonic(KeyEvent.VK_A);
1257:                saveAsMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1258:                        KeyEvent.VK_F12, 0));
1259:                saveAsMenuItem.setText("Save As ...");
1260:                saveAsMenuItem
1261:                        .addActionListener(new java.awt.event.ActionListener() {
1262:                            public void actionPerformed(
1263:                                    java.awt.event.ActionEvent evt) {
1264:                                saveAsMenuItemActionPerformed(evt);
1265:                            }
1266:                        });
1267:
1268:                fileMenu.add(saveAsMenuItem);
1269:
1270:                exportMenuItem.setMnemonic(KeyEvent.VK_E);
1271:                exportMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1272:                        KeyEvent.VK_E, KeyEvent.CTRL_MASK));
1273:                exportMenuItem.setText("Export UML model..");
1274:                exportMenuItem
1275:                        .addActionListener(new java.awt.event.ActionListener() {
1276:                            public void actionPerformed(
1277:                                    java.awt.event.ActionEvent evt) {
1278:                                exportMenuItemActionPerformed(evt);
1279:                            }
1280:                        });
1281:
1282:                fileMenu.add(exportMenuItem);
1283:
1284:                fileMenu.add(jSeparator2);
1285:
1286:                generateJavaApplicationAsMenuItem.setMnemonic(KeyEvent.VK_G);
1287:                generateJavaApplicationAsMenuItem.setAccelerator(KeyStroke
1288:                        .getKeyStroke(KeyEvent.VK_F5, 0));
1289:                generateJavaApplicationAsMenuItem
1290:                        .setText("Generate application...");
1291:                generateJavaApplicationAsMenuItem
1292:                        .setToolTipText("Generate a J2EE Applicatin");
1293:                generateJavaApplicationAsMenuItem
1294:                        .addActionListener(new java.awt.event.ActionListener() {
1295:                            public void actionPerformed(
1296:                                    java.awt.event.ActionEvent evt) {
1297:                                generateJavaApplicationAsMenuItemActionPerformed(evt);
1298:                            }
1299:                        });
1300:
1301:                fileMenu.add(generateJavaApplicationAsMenuItem);
1302:
1303:                fileMenu.add(jSeparator3);
1304:
1305:                exitMenuItem.setMnemonic(KeyEvent.VK_X);
1306:                exitMenuItem.setText("Exit");
1307:                exitMenuItem
1308:                        .addActionListener(new java.awt.event.ActionListener() {
1309:                            public void actionPerformed(
1310:                                    java.awt.event.ActionEvent evt) {
1311:                                exitMenuItemActionPerformed(evt);
1312:                            }
1313:                        });
1314:
1315:                fileMenu.add(exitMenuItem);
1316:
1317:                menuBar.add(fileMenu);
1318:
1319:                editMenu.setMnemonic(KeyEvent.VK_E);
1320:                editMenu.setText("Edit");
1321:                editMenu.addActionListener(new java.awt.event.ActionListener() {
1322:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
1323:                        editMenuActionPerformed(evt);
1324:                    }
1325:                });
1326:
1327:                addSubMenu.setText("Add");
1328:                addEntityMenuItem.setMnemonic(KeyEvent.VK_1);
1329:                addEntityMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1330:                        KeyEvent.VK_1, KeyEvent.CTRL_MASK));
1331:                addEntityMenuItem.setText("entity bean");
1332:                addEntityMenuItem
1333:                        .addActionListener(new java.awt.event.ActionListener() {
1334:                            public void actionPerformed(
1335:                                    java.awt.event.ActionEvent evt) {
1336:                                addEntityMenuItemActionPerformed(evt);
1337:                            }
1338:                        });
1339:
1340:                addSubMenu.add(addEntityMenuItem);
1341:
1342:                addSessionMenuItem.setMnemonic(KeyEvent.VK_2);
1343:                addSessionMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1344:                        KeyEvent.VK_2, KeyEvent.CTRL_MASK));
1345:                addSessionMenuItem.setText("service bean");
1346:                addSessionMenuItem
1347:                        .addActionListener(new java.awt.event.ActionListener() {
1348:                            public void actionPerformed(
1349:                                    java.awt.event.ActionEvent evt) {
1350:                                addSessionMenuItemActionPerformed(evt);
1351:                            }
1352:                        });
1353:
1354:                addSubMenu.add(addSessionMenuItem);
1355:
1356:                addRelationMenuItem.setMnemonic(KeyEvent.VK_3);
1357:                addRelationMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1358:                        KeyEvent.VK_3, KeyEvent.CTRL_MASK));
1359:                addRelationMenuItem.setText("relation");
1360:                addRelationMenuItem
1361:                        .addActionListener(new java.awt.event.ActionListener() {
1362:                            public void actionPerformed(
1363:                                    java.awt.event.ActionEvent evt) {
1364:                                addRelationPopupMenuItemActionPerformed(evt);
1365:                            }
1366:                        });
1367:
1368:                addSubMenu.add(addRelationMenuItem);
1369:
1370:                addBusinessMenuItem.setMnemonic(KeyEvent.VK_4);
1371:                addBusinessMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1372:                        KeyEvent.VK_4, KeyEvent.CTRL_MASK));
1373:                addBusinessMenuItem.setText("business");
1374:                addBusinessMenuItem
1375:                        .addActionListener(new java.awt.event.ActionListener() {
1376:                            public void actionPerformed(
1377:                                    java.awt.event.ActionEvent evt) {
1378:                                addBusinessMenuItemActionPerformed(evt);
1379:                            }
1380:                        });
1381:
1382:                addSubMenu.add(addBusinessMenuItem);
1383:
1384:                addFieldMenuItem.setMnemonic(KeyEvent.VK_5);
1385:                addFieldMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1386:                        KeyEvent.VK_5, KeyEvent.CTRL_MASK));
1387:                addFieldMenuItem.setText("field");
1388:                addFieldMenuItem
1389:                        .addActionListener(new java.awt.event.ActionListener() {
1390:                            public void actionPerformed(
1391:                                    java.awt.event.ActionEvent evt) {
1392:                                addFieldMenuItemActionPerformed(evt);
1393:                            }
1394:                        });
1395:
1396:                addSubMenu.add(addFieldMenuItem);
1397:
1398:                editMenu.add(addSubMenu);
1399:
1400:                deleteMenuItem.setMnemonic(KeyEvent.VK_D);
1401:                deleteMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1402:                        KeyEvent.VK_DELETE, KeyEvent.CTRL_MASK));
1403:                deleteMenuItem.setText(" Delete");
1404:                deleteMenuItem
1405:                        .addActionListener(new java.awt.event.ActionListener() {
1406:                            public void actionPerformed(
1407:                                    java.awt.event.ActionEvent evt) {
1408:                                deleteMenuItemActionPerformed(evt);
1409:                            }
1410:                        });
1411:
1412:                editMenu.add(deleteMenuItem);
1413:
1414:                menuBar.add(editMenu);
1415:
1416:                connectionMenu.setMnemonic(KeyEvent.VK_D);
1417:                connectionMenu.setText("Database");
1418:                driverManagerMenuItem.setText("Driver Manager..");
1419:                driverManagerMenuItem
1420:                        .addActionListener(new java.awt.event.ActionListener() {
1421:                            public void actionPerformed(
1422:                                    java.awt.event.ActionEvent evt) {
1423:                                driverManagerMenuItemActionPerformed(evt);
1424:                            }
1425:                        });
1426:
1427:                connectionMenu.add(driverManagerMenuItem);
1428:
1429:                connectionMenu.add(jSeparator4);
1430:
1431:                connectMenuItem.setText("Create connection...");
1432:                connectMenuItem
1433:                        .addActionListener(new java.awt.event.ActionListener() {
1434:                            public void actionPerformed(
1435:                                    java.awt.event.ActionEvent evt) {
1436:                                connectMenuItemActionPerformed(evt);
1437:                            }
1438:                        });
1439:
1440:                connectionMenu.add(connectMenuItem);
1441:
1442:                disconnectMenuItem.setText("Disconnect");
1443:                disconnectMenuItem.setEnabled(false);
1444:                disconnectMenuItem
1445:                        .addActionListener(new java.awt.event.ActionListener() {
1446:                            public void actionPerformed(
1447:                                    java.awt.event.ActionEvent evt) {
1448:                                disconnectMenuItemActionPerformed(evt);
1449:                            }
1450:                        });
1451:
1452:                connectionMenu.add(disconnectMenuItem);
1453:
1454:                menuBar.add(connectionMenu);
1455:
1456:                helpMenu.setMnemonic(KeyEvent.VK_H);
1457:                helpMenu.setText("Help");
1458:                aboutMenuItem.setText("About");
1459:                aboutMenuItem
1460:                        .addActionListener(new java.awt.event.ActionListener() {
1461:                            public void actionPerformed(
1462:                                    java.awt.event.ActionEvent evt) {
1463:                                aboutMenuItemActionPerformed(evt);
1464:                            }
1465:                        });
1466:
1467:                helpMenu.add(aboutMenuItem);
1468:
1469:                contentMenuItem.setMnemonic(KeyEvent.VK_C);
1470:                contentMenuItem.setAccelerator(KeyStroke.getKeyStroke(
1471:                        KeyEvent.VK_F1, 0));
1472:                contentMenuItem.setText("Content");
1473:                contentMenuItem
1474:                        .addActionListener(new java.awt.event.ActionListener() {
1475:                            public void actionPerformed(
1476:                                    java.awt.event.ActionEvent evt) {
1477:                                contentMenuItemActionPerformed(evt);
1478:                            }
1479:                        });
1480:
1481:                helpMenu.add(contentMenuItem);
1482:
1483:                menuBar.add(helpMenu);
1484:
1485:                setJMenuBar(menuBar);
1486:
1487:                pack();
1488:            }// </editor-fold>//GEN-END:initComponents
1489:
1490:            private void addFieldMenuItemActionPerformed(
1491:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFieldMenuItemActionPerformed
1492:            // TODO add your handling code here:
1493:                fieldButtonActionPerformed(evt);
1494:            }//GEN-LAST:event_addFieldMenuItemActionPerformed
1495:
1496:            private void fieldButtonActionPerformed(
1497:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fieldButtonActionPerformed
1498:            // TODO add your handling code here:
1499:                DefaultMutableTreeNode selected = (DefaultMutableTreeNode) tree
1500:                        .getLastSelectedPathComponent();
1501:                if (!(selected instanceof  Entity)) {
1502:                    JOptionPane
1503:                            .showMessageDialog(
1504:                                    this ,
1505:                                    "A field can only be added to an entity.  Please first select an entity in the application tree.",
1506:                                    "Can't add field!",
1507:                                    JOptionPane.ERROR_MESSAGE);
1508:                    return;
1509:                }
1510:                Entity selectedEntity = (Entity) selected;
1511:                Field newField = new Field(selectedEntity, new Column());
1512:                selectedEntity.add(newField);
1513:                tree.setSelectionPath(new TreePath(newField.getPath()));
1514:                tree.updateUI();
1515:            }//GEN-LAST:event_fieldButtonActionPerformed
1516:
1517:            private void addBusinessMenuItemActionPerformed(
1518:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBusinessMenuItemActionPerformed
1519:                // TODO add your handling code here:
1520:                businessMethodButtonActionPerformed(evt);
1521:            }//GEN-LAST:event_addBusinessMenuItemActionPerformed
1522:
1523:            private void editMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editMenuActionPerformed
1524:                // TODO add your handling code here:
1525:            }//GEN-LAST:event_editMenuActionPerformed
1526:
1527:            private void businessMethodButtonActionPerformed(
1528:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_businessMethodButtonActionPerformed
1529:                DefaultMutableTreeNode selected = (DefaultMutableTreeNode) tree
1530:                        .getLastSelectedPathComponent();
1531:                if (!(selected instanceof  Session)) {
1532:                    //see if the parent is an Entity..
1533:                    TreePath selectedPath = tree.getSelectionPath();
1534:                    selected = (DefaultMutableTreeNode) selectedPath
1535:                            .getParentPath().getLastPathComponent();
1536:                    if (!(selected instanceof  Session)) {
1537:                        JOptionPane
1538:                                .showMessageDialog(
1539:                                        this ,
1540:                                        "A business method can only be added to a service bean.  Please first select a session in the application tree.",
1541:                                        "Can't add business method!",
1542:                                        JOptionPane.ERROR_MESSAGE);
1543:                        return;
1544:                    }
1545:                }
1546:                Session selectedSession = (Session) selected;
1547:
1548:                BusinessMethod newBusinessMethod = new BusinessMethod(
1549:                        selectedSession);
1550:                selectedSession.add(newBusinessMethod);
1551:                tree
1552:                        .setSelectionPath(new TreePath(newBusinessMethod
1553:                                .getPath()));
1554:                tree.updateUI();
1555:            }//GEN-LAST:event_businessMethodButtonActionPerformed
1556:
1557:            private void driverManagerMenuItemActionPerformed(
1558:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_driverManagerMenuItemActionPerformed
1559:                DatabaseManagerFrame.getInstance().show();
1560:            }//GEN-LAST:event_driverManagerMenuItemActionPerformed
1561:
1562:            private void exportMenuItemActionPerformed(
1563:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportMenuItemActionPerformed
1564:                if (file == null) {
1565:                    logger.log("UML Export: save application file first!");
1566:                    String message = "Before exporting the current application to UML, please save it to an application file.";
1567:                    JOptionPane.showMessageDialog(this , message,
1568:                            "No application file!", JOptionPane.ERROR_MESSAGE);
1569:                    saveButtonActionPerformed(null);
1570:                    if (file == null) {
1571:                        logger.log("Aborted UML Export!");
1572:                        return;
1573:                    }
1574:                } else {
1575:                    saveButtonActionPerformed(null);
1576:                }
1577:
1578:                int fileChooserStatus;
1579:                logToConsole("Exporting application to an XMI file.  Please wait...");
1580:                final JFileChooser fileChooser = new JFileChooser(
1581:                        getFileChooserStartDir(FILECHOOSER_UMLEXPORT));
1582:                fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
1583:                String[] extenstions = { "xmi", "xml" };
1584:                ExtensionsFileFilter filter = new ExtensionsFileFilter(
1585:                        extenstions);
1586:                fileChooser.setFileFilter(filter);
1587:
1588:                fileChooser
1589:                        .setDialogTitle("UML Export: Choose a destination XMI file..");
1590:                fileChooserStatus = fileChooser.showSaveDialog(this );
1591:                if (fileChooserStatus == JFileChooser.APPROVE_OPTION) {
1592:                    File xmiFile = fileChooser.getSelectedFile();
1593:                    if (!xmiFile.getAbsolutePath().endsWith(XMI_SUFFIX)) {
1594:                        xmiFile = new File(xmiFile.getAbsolutePath()
1595:                                + XMI_SUFFIX);
1596:                    }
1597:                    //run the export tool
1598:                    new Jag2UMLGenerator(logger).generateXMI(file
1599:                            .getAbsolutePath(), xmiFile);
1600:                    logToConsole("...UML export complete.");
1601:                    setFileChooserStartDir(FILECHOOSER_UMLEXPORT, xmiFile);
1602:
1603:                } else {
1604:                    logToConsole("...aborted!");
1605:                }
1606:            }//GEN-LAST:event_exportMenuItemActionPerformed
1607:
1608:            private void importMenuItemActionPerformed(
1609:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importMenuItemActionPerformed
1610:                int fileChooserStatus;
1611:                logToConsole("Importing UML model from XMI file.  Please wait...");
1612:                final JFileChooser fileChooser = new JFileChooser(
1613:                        getFileChooserStartDir(FILECHOOSER_UMLIMPORT));
1614:                String[] extenstions = { "xmi", "xml" };
1615:                ExtensionsFileFilter filter = new ExtensionsFileFilter(
1616:                        extenstions);
1617:                fileChooser.setDialogTitle("UML Import: Choose an XMI file..");
1618:                fileChooser.setFileFilter(filter);
1619:                fileChooserStatus = fileChooser.showOpenDialog(this );
1620:                if (fileChooserStatus == JFileChooser.APPROVE_OPTION) {
1621:                    String xmiFile = fileChooser.getSelectedFile()
1622:                            .getAbsolutePath();
1623:                    String outputDir = ".";
1624:                    //run the import tool - creates an XML application file in the output directory
1625:                    File xmi = new UML2JagGenerator(logger).generateXML(
1626:                            xmiFile, outputDir);
1627:                    log
1628:                            .info("Generated the jag project file from the UML Model. Now load the file to JAG.");
1629:                    loadApplicationFile(xmi);
1630:                    log.info("JAG project file was loaded.");
1631:                    xmi.delete(); // delete the generated XML file: give the user the choice of where to store it later.
1632:                    logToConsole("...UML import complete.");
1633:                    setFileChooserStartDir(FILECHOOSER_UMLIMPORT, fileChooser
1634:                            .getSelectedFile());
1635:
1636:                } else {
1637:                    logToConsole("...aborted!");
1638:                }
1639:
1640:            }//GEN-LAST:event_importMenuItemActionPerformed
1641:
1642:            private void saveButtonActionPerformed(
1643:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
1644:                if (file == null) {
1645:                    saveAsMenuItemActionPerformed(evt);
1646:                } else {
1647:                    save();
1648:                }
1649:            }//GEN-LAST:event_saveButtonActionPerformed
1650:
1651:            private void disconnectMenuItemActionPerformed(
1652:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disconnectMenuItemActionPerformed
1653:                conManager = null;
1654:                databaseConnectionLabel
1655:                        .setText("Database Connection: not connected");
1656:                disconnectMenuItem.setEnabled(false);
1657:                DatabaseUtils.clearCache();
1658:            }//GEN-LAST:event_disconnectMenuItemActionPerformed
1659:
1660:            private void addEntityMenuItemActionPerformed(
1661:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addEntityMenuItemActionPerformed
1662:                if (!isOfflineMode()) {
1663:                    getConManager();
1664:                }
1665:                if (isOfflineMode()) {
1666:                    Entity entity = new Entity(root.getRootPackage(), "entity",
1667:                            null);
1668:                    DefaultMutableTreeNode parent = (DefaultMutableTreeNode) treeModel
1669:                            .getRoot();
1670:                    addObject(parent, entity, true, false);
1671:                    tree.updateUI();
1672:                    return;
1673:                }
1674:                if (conManager == null) {
1675:                    logger.log("Can't add entity - no database connection!");
1676:                    return;
1677:                }
1678:                new SelectTablesDialog(this ).show();
1679:
1680:                new Thread(new Runnable() {
1681:                    public void run() {
1682:                        DefaultMutableTreeNode parent = (DefaultMutableTreeNode) treeModel
1683:                                .getRoot();
1684:                        Object referencingModule = tree
1685:                                .getLastSelectedPathComponent();
1686:                        String templateValue = (String) root.config
1687:                                .getTemplateSettings().get(
1688:                                        JagGenerator.TEMPLATE_USE_RELATIONS);
1689:                        if ("true".equalsIgnoreCase(templateValue)) {
1690:                            relationsEnabled = true;
1691:                        } else if ("false".equalsIgnoreCase(templateValue)) {
1692:                            relationsEnabled = false;
1693:                        } else {
1694:                            relationsEnabled = false;
1695:                        }
1696:                        ArrayList createdEntities = new ArrayList();
1697:                        for (Iterator tabIt = SelectTablesDialog.getTablelist()
1698:                                .iterator(); tabIt.hasNext();) {
1699:                            String table = (String) tabIt.next();
1700:                            logger.log("Creating entity for table '" + table
1701:                                    + "'...");
1702:                            ArrayList pKeys = DatabaseUtils
1703:                                    .getPrimaryKeys(table);
1704:                            String pKey = "";
1705:                            if (pKeys.size() == 1) {
1706:                                pKey = (String) pKeys.get(0);
1707:                            } else if (pKeys.size() > 1) {
1708:                                String tableClassName = Utils
1709:                                        .toClassName(table);
1710:                                pKey = root.getRootPackage() + ".entity"
1711:                                        + tableClassName + "PK";
1712:                            }
1713:
1714:                            Entity entity = new Entity(root.getRootPackage(),
1715:                                    table, pKey);
1716:                            entity.setTableName(table);
1717:                            addObject(parent, entity, true, false);
1718:                            if (referencingModule instanceof  Session) {
1719:                                Session session = (Session) referencingModule;
1720:                                session.addRef(entity.getRefName());
1721:                            }
1722:
1723:                            ArrayList columns = sortColumns(DatabaseUtils
1724:                                    .getColumns(table), pKeys, entity, pKey);
1725:                            if (relationsEnabled) {
1726:                                generateRelationsFromDB(entity);
1727:                            }
1728:
1729:                            // Now build the fields.
1730:                            for (Iterator colIt = columns.iterator(); colIt
1731:                                    .hasNext();) {
1732:                                Column column = (Column) colIt.next();
1733:                                Field field = new Field(entity, column);
1734:                                addObject(entity, field, false, false);
1735:                                if (column.getName().equalsIgnoreCase(pKey)) {
1736:                                    entity.setPKeyType(field.getType(column));
1737:                                }
1738:                            }
1739:                            createdEntities.add(entity);
1740:                        }
1741:                        if (relationsEnabled) {
1742:                            checkForAssociationEntities(createdEntities);
1743:                        }
1744:                        // This will make sure the relations are updated correctly in the gui.
1745:                        for (Iterator iterator = createdEntities.iterator(); iterator
1746:                                .hasNext();) {
1747:                            Entity entity = (Entity) iterator.next();
1748:                            entity.notifyRelationsThatConstructionIsFinished();
1749:                        }
1750:                        logger.log("...finished!");
1751:                        tree.updateUI();
1752:                    }
1753:
1754:                }).start();
1755:            }//GEN-LAST:event_addEntityMenuItemActionPerformed
1756:
1757:            /**
1758:             * Check all entities and determine if there is a possible many-to-many relation
1759:             * This is the case if an entity has EXACLTY 2 many-to-one relations.
1760:             * The entity will be marked as "Association entity" and the related entities,
1761:             * that were marked as one-to-many, will be marked as many-to-many.
1762:             */
1763:            private void checkForAssociationEntities(ArrayList createdEntities) {
1764:                for (Iterator iterator = createdEntities.iterator(); iterator
1765:                        .hasNext();) {
1766:                    Entity entity = (Entity) iterator.next();
1767:                    if (entity.getRelations() != null
1768:                            && entity.getRelations().size() == 2
1769:                            && entity.getFields().size() == 2) {
1770:                        // It's an entity with exaclty 2 foreign keys (targetMultiple is false).
1771:                        if (((Relation) entity.getRelations().get(0))
1772:                                .isTargetMultiple()
1773:                                && ((Relation) entity.getRelations().get(1))
1774:                                        .isTargetMultiple()) {
1775:                            // Mark the entity as an assocation entity.
1776:                            entity.setIsAssociationEntity("true");
1777:                        }
1778:                    }
1779:                }
1780:            }
1781:
1782:            private void addRelationPopupMenuItemActionPerformed(
1783:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addRelationPopupMenuItemActionPerformed
1784:                newRelationMenuItemActionPerformed();
1785:            }//GEN-LAST:event_addRelationPopupMenuItemActionPerformed
1786:
1787:            private void contentMenuItemActionPerformed(
1788:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_contentMenuItemActionPerformed
1789:                URL helpURL = null;
1790:                String s = null;
1791:                try {
1792:                    s = "file:" + System.getProperty("user.dir")
1793:                            + System.getProperty("file.separator")
1794:                            + "../doc/help/help.html";
1795:                    helpURL = new URL(s);
1796:                } catch (IOException e) {
1797:                    JagGenerator.logToConsole("Missing help file: " + s,
1798:                            LogLevel.ERROR);
1799:                }
1800:                new HtmlContentPopUp(null, "JAG Help", false, helpURL).show();
1801:            }//GEN-LAST:event_contentMenuItemActionPerformed
1802:
1803:            private void aboutMenuItemActionPerformed(
1804:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
1805:                URL helpURL = null;
1806:                String s = null;
1807:                try {
1808:                    s = "file:" + System.getProperty("user.dir")
1809:                            + System.getProperty("file.separator")
1810:                            + "../doc/help/about.html";
1811:                    helpURL = new URL(s);
1812:                } catch (IOException e) {
1813:                    JagGenerator.logToConsole("Missing help file: " + s,
1814:                            LogLevel.ERROR);
1815:                }
1816:                new HtmlContentPopUp(null, "JAG About", false, helpURL).show();
1817:            }//GEN-LAST:event_aboutMenuItemActionPerformed
1818:
1819:            private void generateJavaApplicationAsMenuItemActionPerformed(
1820:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateJavaApplicationAsMenuItemActionPerformed
1821:                if (evt.getActionCommand() == STOP_ACTION) {
1822:                    runningThread.interrupt();
1823:                    return;
1824:                }
1825:
1826:                if (file == null) {
1827:                    logger.log("No file specified! Save file first.");
1828:                    String message = "No application file (XML skelet) has been selected.\n"
1829:                            + "Please save the current application to a file or open an existing application file.";
1830:                    JOptionPane.showMessageDialog(this , message,
1831:                            "No application file!", JOptionPane.ERROR_MESSAGE);
1832:                } else {
1833:                    SkeletValidator validator = new SkeletValidator(root, tree,
1834:                            entitiesByTableName, logger);
1835:                    String message = validator.validateSkelet();
1836:                    if (message != null) {
1837:                        logger.log("Not a valid application file!");
1838:                        message += "\r\nSelect 'Yes' if you want to generate anyway. This will very probably lead to incorrect code!";
1839:                        //JOptionPane.showMessageDialog(this, message, "Invalid configuration", JOptionPane.YES_NO_OPTION);
1840:                        int rc = JOptionPane.showConfirmDialog(this , message,
1841:                                "Invalid configuration",
1842:                                JOptionPane.YES_NO_OPTION);
1843:                        if (rc != 0) {
1844:                            // 0 is the yes option, which means we want to generate anyway.
1845:                            return;
1846:                        }
1847:                        logger
1848:                                .log("Warning! Code is generated in spite of an invalid project file!");
1849:                    }
1850:                    // Make sure the lates skelet has been saved:
1851:                    if (!save()) {
1852:                        logger
1853:                                .log("Can't generate application - Invalid relation(s).");
1854:                        return;
1855:                    }
1856:
1857:                    String outDir = Settings.getLastSelectedOutputDir();
1858:                    // Now select an output directory for the generated java application.
1859:
1860:                    if (outputDir != null) {
1861:                        outDir = outputDir.getParentFile().getAbsolutePath();
1862:                    }
1863:                    outputDir = selectJagOutDirectory(outDir);
1864:                    if (outputDir == null) {
1865:                        return;
1866:                    }
1867:
1868:                    Settings.setLastSelectedOutputDir(outputDir.getParentFile()
1869:                            .getAbsolutePath());
1870:
1871:                    final String[] args = new String[3];
1872:                    args[0] = outputDir.getAbsolutePath();
1873:                    args[1] = file.getAbsolutePath();
1874:                    runningThread = new Thread() {
1875:                        public void run() {
1876:
1877:                            logger.log("Running jag in the " + args[0]
1878:                                    + " directory for application file: "
1879:                                    + args[1]);
1880:                            JApplicationGen.setLogger(logger);
1881:                            JApplicationGen.main(args);
1882:                        }
1883:                    };
1884:                    runningThread.start();
1885:                    executeButton.setIcon(CANCEL_ICON);
1886:                    executeButton.setActionCommand(STOP_ACTION);
1887:                }
1888:                setFileNeedsSavingIndicator(false);
1889:            }//GEN-LAST:event_generateJavaApplicationAsMenuItemActionPerformed
1890:
1891:            private void deleteMenuItemActionPerformed(
1892:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMenuItemActionPerformed
1893:                TreePath[] sel = tree.getSelectionPaths();
1894:                for (int i = 0; i < sel.length; i++) {
1895:                    Object selectedObject = sel[i].getLastPathComponent();
1896:                    if (!(selectedObject instanceof  Config
1897:                            || selectedObject instanceof  App
1898:                            || selectedObject instanceof  Paths || selectedObject instanceof  Datasource)) {
1899:
1900:                        treeModel
1901:                                .removeNodeFromParent((DefaultMutableTreeNode) selectedObject);
1902:                    }
1903:                    if (selectedObject instanceof  Entity) {
1904:                        TemplateString table = ((Entity) selectedObject)
1905:                                .getLocalTableName();
1906:                        SelectTablesDialog.getAlreadyselected().remove(table);
1907:                        DatabaseUtils.clearColumnsCacheForTable(table
1908:                                .toString());
1909:                    }
1910:                }
1911:                setFileNeedsSavingIndicator(true);
1912:            }//GEN-LAST:event_deleteMenuItemActionPerformed
1913:
1914:            private void newMenuItemActionPerformed(
1915:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newMenuItemActionPerformed
1916:                root = new Root();
1917:                file = null;
1918:                fileNameLabel.setText("Application file:");
1919:                fileNameLabel.setToolTipText("No application file selected");
1920:                disconnectMenuItemActionPerformed(null);
1921:
1922:                treeModel.setRoot(root);
1923:            }//GEN-LAST:event_newMenuItemActionPerformed
1924:
1925:            private void openMenuItemActionPerformed(
1926:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuItemActionPerformed
1927:                int fileChooserStatus;
1928:                JFileChooser fileChooser = new JFileChooser(
1929:                        getFileChooserStartDir(FILECHOOSER_APPFILE_OPEN));
1930:                ExtensionsFileFilter filter = new ExtensionsFileFilter("xml");
1931:                logToConsole("Opening application file..");
1932:
1933:                fileChooser
1934:                        .setDialogTitle("Open an existing application file..");
1935:                fileChooser.setFileFilter(filter);
1936:                fileChooserStatus = fileChooser.showOpenDialog(this );
1937:                if (fileChooserStatus == JFileChooser.APPROVE_OPTION) {
1938:                    file = fileChooser.getSelectedFile();
1939:                    loadApplicationFile(file);
1940:
1941:                } else {
1942:                    logToConsole("..aborted application file load!");
1943:                }
1944:
1945:                if (file != null) {
1946:                    fileNameLabel
1947:                            .setText("Application file: " + file.getName());
1948:                    fileNameLabel.setToolTipText(file.getAbsolutePath());
1949:                    setFileChooserStartDir(FILECHOOSER_APPFILE_OPEN, file);
1950:                }
1951:            }//GEN-LAST:event_openMenuItemActionPerformed
1952:
1953:            public void loadApplicationFile(File file) {
1954:                this .file = file;
1955:                DocumentBuilderFactory dbf = DocumentBuilderFactory
1956:                        .newInstance();
1957:                DocumentBuilder builder = null;
1958:                Document doc = null;
1959:                try {
1960:                    builder = dbf.newDocumentBuilder();
1961:                    doc = builder.parse(file);
1962:                    root = new Root(doc);
1963:                    logToConsole("..application file " + file + " loaded!");
1964:                    treeModel.setRoot(root);
1965:                    tree.setSelectionPath(new TreePath(
1966:                            ((DefaultMutableTreeNode) root.getFirstChild())
1967:                                    .getPath()));
1968:                    setFileNeedsSavingIndicator(false);
1969:                    SelectTablesDialog.clear();
1970:                    disconnectMenuItemActionPerformed(null);
1971:                    getRecentMenu().addToRecentList(file.getAbsolutePath());
1972:                } catch (Exception e) {
1973:                    e.printStackTrace();
1974:                    logToConsole(
1975:                            "Failed to load application file! (" + e + ")",
1976:                            LogLevel.ERROR);
1977:                    getRecentMenu()
1978:                            .removeFromRecentList(file.getAbsolutePath());
1979:                }
1980:            }
1981:
1982:            private static void logToConsole(Object o, LogLevel error) {
1983:                if (jagGenerator == null) {
1984:                    System.out.println(o);
1985:                } else {
1986:                    jagGenerator.logger.log(o.toString(), error);
1987:                }
1988:            }
1989:
1990:            private void saveMenuItemActionPerformed(
1991:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuItemActionPerformed
1992:                saveButtonActionPerformed(evt);
1993:            }//GEN-LAST:event_saveMenuItemActionPerformed
1994:
1995:            private void saveAsMenuItemActionPerformed(
1996:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsMenuItemActionPerformed
1997:                int fileChooserStatus;
1998:                JFileChooser fileChooser = new JFileChooser(
1999:                        getFileChooserStartDir(FILECHOOSER_APPFILE_SAVE));
2000:                fileChooser.setDialogTitle("Save application file..");
2001:                ExtensionsFileFilter filter = new ExtensionsFileFilter("xml");
2002:                fileChooser.setFileFilter(filter);
2003:                fileChooserStatus = fileChooser.showSaveDialog(this );
2004:                if (fileChooserStatus == JFileChooser.APPROVE_OPTION) {
2005:                    file = fileChooser.getSelectedFile();
2006:                    setFileChooserStartDir(FILECHOOSER_APPFILE_SAVE, file);
2007:                    save();
2008:                }
2009:            }//GEN-LAST:event_saveAsMenuItemActionPerformed
2010:
2011:            private void connectMenuItemActionPerformed(
2012:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectMenuItemActionPerformed
2013:                GenericJdbcManager previous = conManager;
2014:                conManager = null;
2015:                getConManager();
2016:                if (conManager == null) {
2017:                    conManager = previous;
2018:
2019:                } else {
2020:                    //we're connected!
2021:                    DatabaseUtils.clearCache();
2022:
2023:                    Iterator entities = root.getEntityEjbs().iterator();
2024:                    while (entities.hasNext()) {
2025:                        Entity entity = (Entity) entities.next();
2026:                        for (int i = 0; i < entity.getChildCount(); i++) {
2027:                            TreeNode child = entity.getChildAt(i);
2028:                            if (child instanceof  Relation) {
2029:                                ((RelationPanel) ((Relation) child).getPanel())
2030:                                        .initValues(false);
2031:                            }
2032:                        }
2033:                    }
2034:                }
2035:            }//GEN-LAST:event_connectMenuItemActionPerformed
2036:
2037:            private void addSessionMenuItemActionPerformed(
2038:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSessionMenuItemActionPerformed
2039:                addObject(root, new Session(root.getRootPackage()), true, false);
2040:                setFileNeedsSavingIndicator(true);
2041:            }//GEN-LAST:event_addSessionMenuItemActionPerformed
2042:
2043:            private void treeValueChanged(TreeSelectionEvent evt) {//GEN-FIRST:event_treeValueChanged
2044:                TreePath path = evt.getNewLeadSelectionPath();
2045:                JagBean jagBean;
2046:                if (path != null) {
2047:                    jagBean = (JagBean) path.getLastPathComponent();
2048:                } else {
2049:                    jagBean = (JagBean) treeModel.getRoot();
2050:                }
2051:                splitPane.setRightComponent(jagBean.getPanel());
2052:                splitPane.setDividerLocation(SPLIT_PANE_WIDTH);
2053:            }//GEN-LAST:event_treeValueChanged
2054:
2055:            private void exitMenuItemActionPerformed(
2056:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
2057:                exitForm(null);
2058:            }//GEN-LAST:event_exitMenuItemActionPerformed
2059:
2060:            private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
2061:                kickTheBucket(null);
2062:            }//GEN-LAST:event_exitForm
2063:
2064:            // Variables declaration - do not modify//GEN-BEGIN:variables
2065:            private javax.swing.JMenuItem aboutMenuItem;
2066:            private javax.swing.JMenuItem addBusinessMenuItem;
2067:            private javax.swing.JMenuItem addEntityMenuItem;
2068:            private javax.swing.JMenuItem addFieldMenuItem;
2069:            private javax.swing.JMenuItem addRelationMenuItem;
2070:            private javax.swing.JMenuItem addSessionMenuItem;
2071:            private javax.swing.JMenu addSubMenu;
2072:            public javax.swing.JPanel applicationFileInfoPanel;
2073:            private javax.swing.JButton businessMethodButton;
2074:            private javax.swing.JMenuItem connectMenuItem;
2075:            private javax.swing.JMenu connectionMenu;
2076:            private javax.swing.JTextPane console;
2077:            private javax.swing.JScrollPane consoleScrollPane;
2078:            private javax.swing.JMenuItem contentMenuItem;
2079:            public javax.swing.JPanel databaseConnectionInfoPanel;
2080:            public javax.swing.JLabel databaseConnectionLabel;
2081:            private javax.swing.JButton deleteButton;
2082:            private javax.swing.JMenuItem deleteMenuItem;
2083:            private javax.swing.JSplitPane desktopConsoleSplitPane;
2084:            private javax.swing.JDesktopPane desktopPane;
2085:            private javax.swing.JMenuItem disconnectMenuItem;
2086:            private javax.swing.JMenuItem driverManagerMenuItem;
2087:            private javax.swing.JMenu editMenu;
2088:            private javax.swing.JButton entityButton;
2089:            private javax.swing.JButton executeButton;
2090:            private javax.swing.JMenuItem exitMenuItem;
2091:            private javax.swing.JMenuItem exportMenuItem;
2092:            private javax.swing.JButton fieldButton;
2093:            private javax.swing.JMenu fileMenu;
2094:            public javax.swing.JLabel fileNameLabel;
2095:            private javax.swing.JMenuItem generateJavaApplicationAsMenuItem;
2096:            private javax.swing.JButton helpButton;
2097:            private javax.swing.JMenu helpMenu;
2098:            private javax.swing.JMenuItem importMenuItem;
2099:            private javax.swing.JSeparator jSeparator1;
2100:            private javax.swing.JSeparator jSeparator2;
2101:            private javax.swing.JSeparator jSeparator3;
2102:            private javax.swing.JSeparator jSeparator4;
2103:            private javax.swing.JMenuBar menuBar;
2104:            private javax.swing.JButton newButton;
2105:            private javax.swing.JMenuItem newMenuItem;
2106:            private javax.swing.JButton openButton;
2107:            private javax.swing.JMenuItem openMenuItem;
2108:            private javax.swing.JButton relationButton;
2109:            private javax.swing.JMenuItem saveAsMenuItem;
2110:            private javax.swing.JButton saveButton;
2111:            private javax.swing.JMenuItem saveMenuItem;
2112:            private javax.swing.JButton sessionButton;
2113:            private javax.swing.JPanel spacer;
2114:            private javax.swing.JSplitPane splitPane;
2115:            public javax.swing.JTextArea textConsole;
2116:            public javax.swing.JToolBar toolBar;
2117:            private javax.swing.JTree tree;
2118:            private javax.swing.JScrollPane treeScrollPane;
2119:            // End of variables declaration//GEN-END:variables
2120:            private com.finalist.jaggenerator.menu.RecentMenu recentMenu;
2121:
2122:            public com.finalist.jaggenerator.menu.RecentMenu getRecentMenu() {
2123:                return recentMenu;
2124:            }
2125:
2126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.