Source Code Cross Referenced for OctopusGeneratorPanel.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » loader » wizard » 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 » Database JDBC Connection Pool » octopus » org.webdocwf.util.loader.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.webdocwf.util.loader.wizard;
0002:
0003:        import java.awt.Dimension;
0004:        import java.awt.Toolkit;
0005:        import java.awt.event.ActionEvent;
0006:        import java.awt.event.ActionListener;
0007:        import java.io.BufferedWriter;
0008:        import java.io.File;
0009:        import java.io.FileWriter;
0010:        import java.io.Writer;
0011:        import java.util.HashMap;
0012:
0013:        import javax.swing.AbstractAction;
0014:        import javax.swing.BorderFactory;
0015:        import javax.swing.Box;
0016:        import javax.swing.BoxLayout;
0017:        import javax.swing.ImageIcon;
0018:        import javax.swing.JButton;
0019:        import javax.swing.JCheckBox;
0020:        import javax.swing.JComboBox;
0021:        import javax.swing.JComponent;
0022:        import javax.swing.JFileChooser;
0023:        import javax.swing.JLabel;
0024:        import javax.swing.JPanel;
0025:        import javax.swing.JRadioButton;
0026:        import javax.swing.JScrollPane;
0027:        import javax.swing.JSplitPane;
0028:        import javax.swing.JTabbedPane;
0029:        import javax.swing.JTextArea;
0030:        import javax.swing.JTextField;
0031:        import javax.swing.KeyStroke;
0032:        import javax.swing.ScrollPaneConstants;
0033:        import javax.swing.SwingConstants;
0034:        import javax.swing.border.Border;
0035:        import javax.swing.border.EtchedBorder;
0036:
0037:        public class OctopusGeneratorPanel extends JPanel {
0038:
0039:            private static final String SOURCE_TYPE = "Source database type",
0040:                    TARGET_TYPE = "Target database type",
0041:                    SOURCE_DATABASE = "Source database URL",
0042:                    TARGET_DATABASE = "Target database URL",
0043:                    SOURCE_USER = "Source database user",
0044:                    SOURCE_PASSWORD = "Source database password",
0045:                    TARGET_USER = "Target database user",
0046:                    TARGET_PASSWORD = "Target database password",
0047:                    VALUE_MODE = "Value mode",
0048:                    GENERATOR_OUTPUT = "Generator output directory",
0049:                    DOML_PATH = "Doml URL( when use Doml as input )",
0050:                    PACKAGE_NAME = "Package name",
0051:                    SOURCE_DRIVER_NAME = "Source database driver name",
0052:                    TARGET_DRIVER_NAME = "Target database driver name",
0053:                    ADDITIONAL_PATHS = "Additional classpath",
0054:                    DROP_TABLE = "Drop Tables",
0055:                    CREATE_TABLE = "Create Tables",
0056:                    CREATE_PRIMARY_KEYS = "Create Primary Keys",
0057:                    DROP_FOREIGN_KEYS = "Drop Foreign Keys",
0058:                    CREATE_FOREIGN_KEYS = "Create Foreign Keys",
0059:                    CREATE_INDEXES = "Create Indexes",
0060:                    CREATE_SQL_FOR_ALL_VENDORS = "Create SQL Statements for All Vendors",
0061:                    GENERATE_DOML = "Generate Doml file",
0062:                    GENERATE_XML = "Generate Xml files",
0063:                    GENERATE_SQL = "Generate Sql files",
0064:                    OPTIMIZED_MODE = "Optimized mode for all tables",
0065:                    FULL_MODE = "Full mode for all tables",
0066:                    INCLUDE_TABLE_LIST = "Include Table List (e.g. table1;table2)",
0067:                    PATH_TO_CONF_IN_JAR = "Path to conf files in jar",
0068:                    LOG_MODE = "Log mode", LOG_FILE_NAME = "Log file name",
0069:                    LOG_FILE_DIRECTORY = "Log file directory";
0070:
0071:            //dimensions
0072:            public static Dimension bigButton = new Dimension(140, 25);
0073:            public static Dimension toolBarButton = new Dimension(30, 30);
0074:            public static Dimension smallComponent = new Dimension(150, 20);
0075:            public static Dimension bigComponent = new Dimension(400, 20);
0076:            public static Dimension bigPlusButton = new Dimension(380, 20);
0077:            public static Dimension veryBigComponent = new Dimension(650, 20);
0078:            public static Dimension veryBigPlusButton = new Dimension(630, 20);
0079:            public static Dimension panelComponenet = new Dimension(720, 40);
0080:
0081:            JSplitPane main;
0082:
0083:            Border loweredBorder = BorderFactory
0084:                    .createEtchedBorder(EtchedBorder.LOWERED);
0085:            Border raisedBorder = BorderFactory
0086:                    .createEtchedBorder(EtchedBorder.RAISED);
0087:            Border bevelBorder = BorderFactory.createLoweredBevelBorder();
0088:
0089:            private JCheckBox sqlFiles, xmlFiles, domlFile, createTables,
0090:                    createPK, createFK, createIn, dropTables, createSQLForAll,
0091:                    dropFK;
0092:            private JRadioButton optimizedMode, fullMode;
0093:            private JTextField packageField, generatorOutput, addPaths;
0094:            //		private OctopusProjectFrame parent;
0095:            private OctopusGeneratorData initData;
0096:            private HashMap fields;
0097:            private JTextArea traceArea;
0098:
0099:            public OctopusGeneratorPanel() {
0100:                //    super("TDT Generator Application", true, true, true, true);
0101:                //	setFrameIcon( new ImageIcon(getClass().getClassLoader().getResource("org/webdocwf/util/loader/"+
0102:                //		   "wizard/images/Enhydra16.gif")));
0103:
0104:                //			this.parent = parent;
0105:                fields = new HashMap();
0106:                //generatorOptions
0107:                //    JPanel generatorOptionsUp = new JPanel();
0108:                //			JPanel generatorOptionsDown = new JPanel();
0109:
0110:                //generator input data
0111:                JTabbedPane octopusGeneratorData = new JTabbedPane();
0112:                JPanel commonPanel = new JPanel();
0113:                JPanel advancedPanel = new JPanel();
0114:                JPanel outputOptions = new JPanel();
0115:                octopusGeneratorData.addTab("JDBC", commonPanel);
0116:                octopusGeneratorData.addTab("Output options", outputOptions);
0117:                octopusGeneratorData.addTab("Advanced", advancedPanel);
0118:
0119:                //generatotOptionsUp panel
0120:                //    generatorOptionsUp.setLayout(new BoxLayout(generatorOptionsUp, BoxLayout.Y_AXIS));
0121:                //    generatorOptionsUp.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
0122:                //			JButton help = createOctopusButton("Help", bigButton);
0123:                //			help.setAction(new OctopusHelpAction());
0124:                //    generatorOptionsUp.add(help);
0125:
0126:                //generatotOptionsDown panel
0127:                //			generatorOptionsDown.setLayout(new BoxLayout(generatorOptionsDown, BoxLayout.Y_AXIS));
0128:                //			generatorOptionsDown.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
0129:                //			JButton start = createOctopusButton("Start", bigButton);
0130:                //			start.setAction(new StartOctopusGenerator());
0131:                //			JButton stop = createOctopusButton("Stop", bigButton);
0132:                //			stop.setAction(new StopOctopusGenerator());
0133:                //			JButton save = createOctopusButton("Save", bigButton);
0134:                //			save.setAction(new SaveProjectAction());
0135:                //			generatorOptionsDown.add(Box.createRigidArea(new Dimension(0, 5)));
0136:                //			generatorOptionsDown.add(start);
0137:                //			generatorOptionsDown.add(Box.createRigidArea(new Dimension(0, 5)));
0138:                //			generatorOptionsDown.add(stop);
0139:                //			generatorOptionsDown.add(Box.createRigidArea(new Dimension(0, 5)));
0140:                //			generatorOptionsDown.add(save);
0141:                //			generatorOptionsDown.add(Box.createRigidArea(new Dimension(0, 15)));
0142:                //			generatorOptionsDown.add(help);
0143:
0144:                //generatorOptions
0145:                //    JSplitPane generatorOptions = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
0146:                //        generatorOptionsUp, generatorOptionsDown);
0147:                //    generatorOptions.setOneTouchExpandable(true);
0148:                //    generatorOptions.setDividerLocation(560);
0149:
0150:                //    JSplitPane generatorInputData = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
0151:                //        generatorOptions, octopusGeneratorData);
0152:                //			JSplitPane generatorInputData =
0153:                //				new JSplitPane(
0154:                //					JSplitPane.HORIZONTAL_SPLIT,
0155:                //					true,
0156:                //					new JPanel(),
0157:                //					octopusGeneratorData);
0158:
0159:                //advanced panel
0160:                JPanel pathToConfPanel = new JPanel();
0161:                pathToConfPanel.setLayout(new BoxLayout(pathToConfPanel,
0162:                        BoxLayout.X_AXIS));
0163:                pathToConfPanel.setBorder(setTitleOfBorder("Advanced Options",
0164:                        loweredBorder));
0165:                JLabel strPathToConf = OctopusProjectFrame.createOctopusLabel(
0166:                        PATH_TO_CONF_IN_JAR, smallComponent);
0167:                JTextField pathToConf = OctopusProjectFrame
0168:                        .createOctopusTextField(PATH_TO_CONF_IN_JAR,
0169:                                veryBigComponent);
0170:                pathToConfPanel.add(strPathToConf);
0171:                pathToConfPanel.add(pathToConf);
0172:
0173:                JPanel mainPathToConfPanel = new JPanel();
0174:                mainPathToConfPanel.setLayout(new BoxLayout(
0175:                        mainPathToConfPanel, BoxLayout.X_AXIS));
0176:                mainPathToConfPanel.add(pathToConfPanel);
0177:                mainPathToConfPanel.add(Box.createHorizontalGlue());
0178:
0179:                advancedPanel.setLayout(new BoxLayout(advancedPanel,
0180:                        BoxLayout.Y_AXIS));
0181:                advancedPanel.add(Box.createRigidArea(new Dimension(0, 15)));
0182:                advancedPanel.add(mainPathToConfPanel);
0183:
0184:                //sourcePanel
0185:                JPanel sourcePanel = new JPanel();
0186:                sourcePanel.setLayout(new BoxLayout(sourcePanel,
0187:                        BoxLayout.Y_AXIS));
0188:                //sourceType
0189:                JLabel strSourceType = OctopusProjectFrame.createOctopusLabel(
0190:                        SOURCE_TYPE, bigComponent);
0191:                JComboBox sourceType = OctopusProjectFrame
0192:                        .createOctopusCombobox(SOURCE_TYPE, bigComponent);
0193:                //sourceUrl
0194:                JLabel strSourceUrl = OctopusProjectFrame.createOctopusLabel(
0195:                        SOURCE_DATABASE, bigComponent);
0196:                JTextField sourceUrl = OctopusProjectFrame
0197:                        .createOctopusTextField(SOURCE_DATABASE, bigComponent);
0198:                //sourceDriverName
0199:                JLabel strSourceDriverName = OctopusProjectFrame
0200:                        .createOctopusLabel(SOURCE_DRIVER_NAME, bigComponent);
0201:                JComboBox sourceDriverName = OctopusProjectFrame
0202:                        .createOctopusCombobox(SOURCE_DRIVER_NAME, bigComponent);
0203:                //sourceUser
0204:                JLabel strSourceUser = OctopusProjectFrame.createOctopusLabel(
0205:                        SOURCE_USER, bigComponent);
0206:                JTextField sourceUser = OctopusProjectFrame
0207:                        .createOctopusTextField(SOURCE_USER, bigComponent);
0208:                //sourcePassword
0209:                JLabel strSourcePassword = OctopusProjectFrame
0210:                        .createOctopusLabel(SOURCE_PASSWORD, bigComponent);
0211:                JTextField sourcePassword = OctopusProjectFrame
0212:                        .createOctopusTextField(SOURCE_PASSWORD, bigComponent);
0213:                //doml
0214:                JLabel strDomlUrl = OctopusProjectFrame.createOctopusLabel(
0215:                        DOML_PATH, bigComponent);
0216:                JTextField domlUrl = OctopusProjectFrame
0217:                        .createOctopusTextField(DOML_PATH, bigPlusButton);
0218:                JButton domlButton = OctopusProjectFrame.createOctopusButton(
0219:                        "doml url button", new Dimension(20, 20));
0220:                domlButton.setAction(new BrowseAction_DOML());
0221:
0222:                ImageIcon icon = new ImageIcon(getClass().getClassLoader()
0223:                        .getResource(
0224:                                "org/webdocwf/util/loader/"
0225:                                        + "wizard/images/database.gif"));
0226:                JLabel sourceLabel = new JLabel("JDBC Source Database", icon,
0227:                        SwingConstants.RIGHT);
0228:
0229:                sourcePanel.add(createJDBCRow(sourceLabel, null));
0230:                sourcePanel.add(Box.createRigidArea(new Dimension(0, 10)));
0231:                sourcePanel.add(createJDBCRow(strSourceType, null));
0232:                sourcePanel.add(createJDBCRow(sourceType, null));
0233:                sourcePanel.add(createJDBCRow(strSourceUrl, null));
0234:                sourcePanel.add(createJDBCRow(sourceUrl, null));
0235:                sourcePanel.add(createJDBCRow(strDomlUrl, null));
0236:                sourcePanel.add(createJDBCRow(domlUrl, domlButton));
0237:                sourcePanel.add(createJDBCRow(strSourceDriverName, null));
0238:                sourcePanel.add(createJDBCRow(sourceDriverName, null));
0239:                sourcePanel.add(createJDBCRow(strSourceUser, null));
0240:                sourcePanel.add(createJDBCRow(sourceUser, null));
0241:                sourcePanel.add(createJDBCRow(strSourcePassword, null));
0242:                sourcePanel.add(createJDBCRow(sourcePassword, null));
0243:
0244:                sourcePanel.setBorder(setTitleOfBorder("", bevelBorder));
0245:
0246:                //targetPanel
0247:                JPanel targetPanel = new JPanel();
0248:                targetPanel.setLayout(new BoxLayout(targetPanel,
0249:                        BoxLayout.Y_AXIS));
0250:                //targetType
0251:                JLabel strTargetType = OctopusProjectFrame.createOctopusLabel(
0252:                        TARGET_TYPE, bigComponent);
0253:                JComboBox targetType = OctopusProjectFrame
0254:                        .createOctopusCombobox(TARGET_TYPE, bigComponent);
0255:                //targetUrl
0256:                JLabel strTargetUrl = OctopusProjectFrame.createOctopusLabel(
0257:                        TARGET_DATABASE, bigComponent);
0258:                JTextField targetUrl = OctopusProjectFrame
0259:                        .createOctopusTextField(TARGET_DATABASE, bigComponent);
0260:                //targetDriverName
0261:                JLabel strTargetDriverName = OctopusProjectFrame
0262:                        .createOctopusLabel(TARGET_DRIVER_NAME, bigComponent);
0263:                JComboBox targetDriverName = OctopusProjectFrame
0264:                        .createOctopusCombobox(TARGET_DRIVER_NAME, bigComponent);
0265:                //targetUser
0266:                JLabel strTargetUser = OctopusProjectFrame.createOctopusLabel(
0267:                        TARGET_USER, bigComponent);
0268:                JTextField targetUser = OctopusProjectFrame
0269:                        .createOctopusTextField(TARGET_USER, bigComponent);
0270:                //targetPassword
0271:                JLabel strTargetPassword = OctopusProjectFrame
0272:                        .createOctopusLabel(TARGET_PASSWORD, bigComponent);
0273:                JTextField targetPassword = OctopusProjectFrame
0274:                        .createOctopusTextField(TARGET_PASSWORD, bigComponent);
0275:
0276:                JLabel strTargetDoml = OctopusProjectFrame.createOctopusLabel(
0277:                        "Doml URL", bigComponent);
0278:                String msg = "Doml file will be placed in output directory";
0279:                JTextField targetDoml = OctopusProjectFrame
0280:                        .createOctopusTextField("Doml URL target", bigComponent);
0281:                targetDoml.setText(msg);
0282:                targetDoml.setEditable(false);
0283:
0284:                ImageIcon icon2 = new ImageIcon(getClass().getClassLoader()
0285:                        .getResource(
0286:                                "org/webdocwf/util/loader/"
0287:                                        + "wizard/images/database2.gif"));
0288:                JLabel targetLabel = new JLabel("JDBC Target Database", icon2,
0289:                        SwingConstants.RIGHT);
0290:
0291:                targetPanel.add(createJDBCRow(targetLabel, null));
0292:                targetPanel.add(Box.createRigidArea(new Dimension(0, 10)));
0293:                targetPanel.add(createJDBCRow(strTargetType, null));
0294:                targetPanel.add(createJDBCRow(targetType, null));
0295:                targetPanel.add(createJDBCRow(strTargetUrl, null));
0296:                targetPanel.add(createJDBCRow(targetUrl, null));
0297:                targetPanel.add(createJDBCRow(strTargetDoml, null));
0298:                targetPanel.add(createJDBCRow(targetDoml, null));
0299:                targetPanel.add(createJDBCRow(strTargetDriverName, null));
0300:                targetPanel.add(createJDBCRow(targetDriverName, null));
0301:                targetPanel.add(createJDBCRow(strTargetUser, null));
0302:                targetPanel.add(createJDBCRow(targetUser, null));
0303:                targetPanel.add(createJDBCRow(strTargetPassword, null));
0304:                targetPanel.add(createJDBCRow(targetPassword, null));
0305:
0306:                targetPanel.setBorder(setTitleOfBorder("", bevelBorder));
0307:
0308:                JPanel JDBCPanel = new JPanel();
0309:                JDBCPanel.setLayout(new BoxLayout(JDBCPanel, BoxLayout.X_AXIS));
0310:                JDBCPanel.add(sourcePanel);
0311:                JDBCPanel.add(targetPanel);
0312:
0313:                JPanel JDBCMainPanel = new JPanel();
0314:                JDBCMainPanel.setLayout(new BoxLayout(JDBCMainPanel,
0315:                        BoxLayout.X_AXIS));
0316:                JDBCMainPanel.add(JDBCPanel);
0317:                JDBCMainPanel.add(Box.createHorizontalGlue());
0318:
0319:                //value mode panel
0320:                JPanel valuModePanel = new JPanel();
0321:                valuModePanel.setLayout(new BoxLayout(valuModePanel,
0322:                        BoxLayout.X_AXIS));
0323:                valuModePanel.setBorder(setTitleOfBorder("Value mode",
0324:                        loweredBorder));
0325:                JLabel strValueMode = OctopusProjectFrame.createOctopusLabel(
0326:                        VALUE_MODE, smallComponent);
0327:                JComboBox valueMode = OctopusProjectFrame
0328:                        .createOctopusCombobox(VALUE_MODE, veryBigComponent);
0329:                valuModePanel.add(strValueMode);
0330:                valuModePanel.add(valueMode);
0331:
0332:                JPanel mainValueModePanel = new JPanel();
0333:                mainValueModePanel.setLayout(new BoxLayout(mainValueModePanel,
0334:                        BoxLayout.X_AXIS));
0335:                mainValueModePanel.add(valuModePanel);
0336:                mainValueModePanel.add(Box.createHorizontalGlue());
0337:
0338:                //generatorOutput panel
0339:                JPanel generatorOutputPanel = new JPanel();
0340:                generatorOutputPanel.setLayout(new BoxLayout(
0341:                        generatorOutputPanel, BoxLayout.X_AXIS));
0342:                JPanel generatorOutputInnerPanel = new JPanel();
0343:                JButton browseGeneratorOutput = OctopusProjectFrame
0344:                        .createOctopusButton("O", new Dimension(20, 20));
0345:                browseGeneratorOutput.setAction(new BrowseAction_GO());
0346:
0347:                generatorOutputInnerPanel.setLayout(new BoxLayout(
0348:                        generatorOutputInnerPanel, BoxLayout.X_AXIS));
0349:                generatorOutputInnerPanel.setBorder(setTitleOfBorder(
0350:                        "Generator Output", loweredBorder));
0351:                JLabel strGeneratorOutput = OctopusProjectFrame
0352:                        .createOctopusLabel(GENERATOR_OUTPUT, smallComponent);
0353:                generatorOutput = OctopusProjectFrame.createOctopusTextField(
0354:                        GENERATOR_OUTPUT, veryBigPlusButton);
0355:                generatorOutputInnerPanel.add(strGeneratorOutput);
0356:                generatorOutputInnerPanel.add(generatorOutput);
0357:                generatorOutputInnerPanel.add(browseGeneratorOutput);
0358:
0359:                generatorOutputPanel.add(generatorOutputInnerPanel);
0360:                generatorOutputPanel.add(Box.createHorizontalGlue());
0361:
0362:                //includetablelist panel
0363:                JPanel includeTableListPanel = new JPanel();
0364:                includeTableListPanel.setLayout(new BoxLayout(
0365:                        includeTableListPanel, BoxLayout.X_AXIS));
0366:                JPanel includeTableListInnerPanel = new JPanel();
0367:                includeTableListInnerPanel.setLayout(new BoxLayout(
0368:                        includeTableListInnerPanel, BoxLayout.X_AXIS));
0369:                includeTableListInnerPanel.setBorder(setTitleOfBorder(
0370:                        "Tables List", loweredBorder));
0371:                JLabel strIncludeTableList = OctopusProjectFrame
0372:                        .createOctopusLabel(INCLUDE_TABLE_LIST, smallComponent);
0373:                JTextField includeTableList = OctopusProjectFrame
0374:                        .createOctopusTextField(INCLUDE_TABLE_LIST,
0375:                                veryBigComponent);
0376:                includeTableListInnerPanel.add(strIncludeTableList);
0377:                includeTableListInnerPanel.add(includeTableList);
0378:
0379:                includeTableListPanel.add(includeTableListInnerPanel);
0380:                includeTableListPanel.add(Box.createHorizontalGlue());
0381:
0382:                //additinal classpaths panel
0383:                JPanel addPathsPanel = new JPanel();
0384:                addPathsPanel.setLayout(new BoxLayout(addPathsPanel,
0385:                        BoxLayout.X_AXIS));
0386:                JPanel addPathsInnerPanel = new JPanel();
0387:                JButton browseAdditionalClass = OctopusProjectFrame
0388:                        .createOctopusButton("O", new Dimension(20, 20));
0389:                browseAdditionalClass.setAction(new BrowseAction_AC());
0390:                addPathsInnerPanel.setLayout(new BoxLayout(addPathsInnerPanel,
0391:                        BoxLayout.X_AXIS));
0392:                addPathsInnerPanel.setBorder(setTitleOfBorder(
0393:                        "Add new drivers", loweredBorder));
0394:                JLabel strAddPaths = OctopusProjectFrame.createOctopusLabel(
0395:                        ADDITIONAL_PATHS, smallComponent);
0396:                addPaths = OctopusProjectFrame.createOctopusTextField(
0397:                        ADDITIONAL_PATHS, veryBigPlusButton);
0398:                addPathsInnerPanel.add(strAddPaths);
0399:                addPathsInnerPanel.add(addPaths);
0400:                addPathsInnerPanel.add(browseAdditionalClass);
0401:
0402:                addPathsPanel.add(addPathsInnerPanel);
0403:                addPathsPanel.add(Box.createHorizontalGlue());
0404:
0405:                JPanel commonOptionsPanel = new JPanel();
0406:                JPanel commonOptionsMainPanel = new JPanel();
0407:                commonOptionsPanel.setLayout(new BoxLayout(commonOptionsPanel,
0408:                        BoxLayout.Y_AXIS));
0409:                commonOptionsMainPanel.setLayout(new BoxLayout(
0410:                        commonOptionsMainPanel, BoxLayout.X_AXIS));
0411:                commonOptionsPanel.add(mainValueModePanel);
0412:                commonOptionsPanel.add(generatorOutputPanel);
0413:                commonOptionsPanel.add(includeTableListPanel);
0414:                commonOptionsPanel.add(addPathsPanel);
0415:
0416:                commonOptionsMainPanel.add(commonOptionsPanel);
0417:                commonOptionsMainPanel.add(Box.createHorizontalGlue());
0418:
0419:                commonPanel.setLayout(new BoxLayout(commonPanel,
0420:                        BoxLayout.Y_AXIS));
0421:                commonPanel.add(JDBCMainPanel);
0422:                commonPanel.add(commonOptionsMainPanel);
0423:                commonPanel.add(Box.createVerticalGlue());
0424:
0425:                JPanel outputMode = new JPanel();
0426:                outputMode
0427:                        .setLayout(new BoxLayout(outputMode, BoxLayout.X_AXIS));
0428:                outputMode.setBorder(setTitleOfBorder("Output Mode",
0429:                        loweredBorder));
0430:                sqlFiles = new JCheckBox(GENERATE_SQL);
0431:                sqlFiles.setSelected(true);
0432:                xmlFiles = new JCheckBox(GENERATE_XML);
0433:                xmlFiles.setSelected(true);
0434:                domlFile = new JCheckBox(GENERATE_DOML);
0435:                outputMode.add(sqlFiles);
0436:                outputMode.add(xmlFiles);
0437:                outputMode.add(domlFile);
0438:
0439:                sqlFiles.addActionListener(new ActionListener() {
0440:                    public void actionPerformed(ActionEvent e) {
0441:                        if (sqlFiles.isSelected()) {
0442:                            createTables.setEnabled(true);
0443:                            createTables.setSelected(true);
0444:                            dropTables.setEnabled(true);
0445:                            dropTables.setSelected(true);
0446:                            createPK.setEnabled(true);
0447:                            createPK.setSelected(true);
0448:                            createFK.setEnabled(true);
0449:                            createFK.setSelected(true);
0450:                            dropFK.setEnabled(true);
0451:                            dropFK.setSelected(true);
0452:                            createIn.setEnabled(true);
0453:                            createIn.setSelected(true);
0454:                            createSQLForAll.setEnabled(true);
0455:                            createSQLForAll.setSelected(false);
0456:                        } else {
0457:                            createTables.setSelected(false);
0458:                            createTables.setEnabled(false);
0459:                            dropTables.setEnabled(false);
0460:                            dropTables.setSelected(false);
0461:                            createPK.setEnabled(false);
0462:                            createPK.setSelected(false);
0463:                            createFK.setEnabled(false);
0464:                            createFK.setSelected(false);
0465:                            dropFK.setEnabled(false);
0466:                            dropFK.setSelected(false);
0467:                            createIn.setEnabled(false);
0468:                            createIn.setSelected(false);
0469:                            createSQLForAll.setEnabled(false);
0470:                            createSQLForAll.setSelected(false);
0471:                        }
0472:                    }
0473:                });
0474:
0475:                xmlFiles.addActionListener(new ActionListener() {
0476:                    public void actionPerformed(ActionEvent e) {
0477:                        if (xmlFiles.isSelected()) {
0478:                            optimizedMode.setEnabled(true);
0479:                            optimizedMode.setSelected(false);
0480:                            fullMode.setEnabled(true);
0481:                            fullMode.setSelected(true);
0482:                        } else {
0483:                            optimizedMode.setEnabled(false);
0484:                            optimizedMode.setSelected(false);
0485:                            fullMode.setEnabled(false);
0486:                            fullMode.setSelected(false);
0487:                        }
0488:                    }
0489:                });
0490:
0491:                domlFile.addActionListener(new ActionListener() {
0492:                    public void actionPerformed(ActionEvent e) {
0493:                        if (domlFile.isSelected()) {
0494:                            packageField.setEditable(true);
0495:                            packageField.setText("");
0496:                        } else {
0497:                            packageField.setText("");
0498:                            packageField.setEditable(false);
0499:
0500:                        }
0501:                    }
0502:                });
0503:
0504:                JPanel mainOutputMode = new JPanel();
0505:                mainOutputMode.setLayout(new BoxLayout(mainOutputMode,
0506:                        BoxLayout.X_AXIS));
0507:                mainOutputMode.add(outputMode);
0508:                mainOutputMode.add(Box.createHorizontalGlue());
0509:
0510:                createTables = new JCheckBox(CREATE_TABLE);
0511:                createTables.setSelected(true);
0512:                createPK = new JCheckBox(CREATE_PRIMARY_KEYS);
0513:                createPK.setSelected(true);
0514:                createFK = new JCheckBox(CREATE_FOREIGN_KEYS);
0515:                createFK.setSelected(true);
0516:                createIn = new JCheckBox(CREATE_INDEXES);
0517:                createIn.setSelected(true);
0518:                dropTables = new JCheckBox(DROP_TABLE);
0519:                dropTables.setSelected(true);
0520:                dropFK = new JCheckBox(DROP_FOREIGN_KEYS);
0521:                dropFK.setSelected(true);
0522:                createSQLForAll = new JCheckBox(CREATE_SQL_FOR_ALL_VENDORS);
0523:
0524:                JPanel sqlOptionsPanel1 = new JPanel();
0525:                sqlOptionsPanel1.setLayout(new BoxLayout(sqlOptionsPanel1,
0526:                        BoxLayout.Y_AXIS));
0527:                sqlOptionsPanel1.add(dropTables);
0528:                sqlOptionsPanel1.add(createTables);
0529:                sqlOptionsPanel1.add(createPK);
0530:
0531:                JPanel sqlOptionsPanel2 = new JPanel();
0532:                sqlOptionsPanel2.setLayout(new BoxLayout(sqlOptionsPanel2,
0533:                        BoxLayout.Y_AXIS));
0534:                sqlOptionsPanel2.add(dropFK);
0535:                sqlOptionsPanel2.add(createFK);
0536:                sqlOptionsPanel2.add(createIn);
0537:
0538:                JPanel sqlOptionsPanel3 = new JPanel();
0539:                sqlOptionsPanel3.setLayout(new BoxLayout(sqlOptionsPanel3,
0540:                        BoxLayout.Y_AXIS));
0541:                sqlOptionsPanel3.add(createSQLForAll);
0542:
0543:                JPanel sqlOptionsPanel = new JPanel();
0544:                sqlOptionsPanel.setLayout(new BoxLayout(sqlOptionsPanel,
0545:                        BoxLayout.X_AXIS));
0546:                sqlOptionsPanel.setBorder(setTitleOfBorder("SQL Options",
0547:                        loweredBorder));
0548:                sqlOptionsPanel.add(sqlOptionsPanel1);
0549:                sqlOptionsPanel.add(sqlOptionsPanel2);
0550:                sqlOptionsPanel.add(sqlOptionsPanel3);
0551:
0552:                JPanel mainSqlOptionsPanel = new JPanel();
0553:                mainSqlOptionsPanel.setLayout(new BoxLayout(
0554:                        mainSqlOptionsPanel, BoxLayout.X_AXIS));
0555:                mainSqlOptionsPanel.add(sqlOptionsPanel);
0556:                mainSqlOptionsPanel.add(Box.createHorizontalGlue());
0557:
0558:                JPanel xmlOptionsPanel = new JPanel();
0559:                xmlOptionsPanel.setLayout(new BoxLayout(xmlOptionsPanel,
0560:                        BoxLayout.X_AXIS));
0561:                optimizedMode = new JRadioButton(OPTIMIZED_MODE);
0562:                fullMode = new JRadioButton(FULL_MODE);
0563:                //			fullMode.setSelected(true);
0564:
0565:                optimizedMode.addActionListener(new ActionListener() {
0566:                    public void actionPerformed(ActionEvent e) {
0567:                        if (optimizedMode.isSelected()) {
0568:                            fullMode.setSelected(false);
0569:                        } else {
0570:                            fullMode.setSelected(true);
0571:                        }
0572:                    }
0573:                });
0574:
0575:                fullMode.addActionListener(new ActionListener() {
0576:                    public void actionPerformed(ActionEvent e) {
0577:                        if (fullMode.isSelected()) {
0578:                            optimizedMode.setSelected(false);
0579:                        } else {
0580:                            optimizedMode.setSelected(true);
0581:                        }
0582:                    }
0583:                });
0584:
0585:                xmlOptionsPanel.setBorder(setTitleOfBorder("XML Options",
0586:                        loweredBorder));
0587:                xmlOptionsPanel.add(optimizedMode);
0588:                xmlOptionsPanel.add(fullMode);
0589:
0590:                JPanel mainXmlOptionsPanel = new JPanel();
0591:                mainXmlOptionsPanel.setLayout(new BoxLayout(
0592:                        mainXmlOptionsPanel, BoxLayout.X_AXIS));
0593:                mainXmlOptionsPanel.add(xmlOptionsPanel);
0594:                mainXmlOptionsPanel.add(Box.createHorizontalGlue());
0595:
0596:                JPanel packagePanel = new JPanel();
0597:                packagePanel.setLayout(new BoxLayout(packagePanel,
0598:                        BoxLayout.X_AXIS));
0599:                packagePanel.setBorder(setTitleOfBorder(
0600:                        "Package name for doml file", loweredBorder));
0601:                packageField = OctopusProjectFrame.createOctopusTextField(
0602:                        PACKAGE_NAME, veryBigComponent);
0603:                packageField.setEditable(false);
0604:                JLabel strPackageField = OctopusProjectFrame
0605:                        .createOctopusLabel(PACKAGE_NAME, smallComponent);
0606:                packagePanel.add(strPackageField);
0607:                packagePanel.add(packageField);
0608:
0609:                JPanel mainPackagePanel = new JPanel();
0610:                mainPackagePanel.setLayout(new BoxLayout(mainPackagePanel,
0611:                        BoxLayout.X_AXIS));
0612:                mainPackagePanel.add(packagePanel);
0613:                mainPackagePanel.add(Box.createHorizontalGlue());
0614:
0615:                //zk added this for logging
0616:                JPanel loggingModePanel = new JPanel();
0617:                loggingModePanel.setLayout(new BoxLayout(loggingModePanel,
0618:                        BoxLayout.X_AXIS));
0619:
0620:                //log mode
0621:                JLabel strLogMode = OctopusProjectFrame.createOctopusLabel(
0622:                        LOG_MODE, smallComponent);
0623:                JComboBox logMode = OctopusProjectFrame.createOctopusCombobox(
0624:                        LOG_MODE, veryBigComponent);
0625:
0626:                loggingModePanel.add(strLogMode);
0627:                loggingModePanel.add(logMode);
0628:                //loggingModePanel.add(Box.createHorizontalGlue());
0629:
0630:                //log file directory
0631:                JPanel loggingDirPanel = new JPanel();
0632:                loggingDirPanel.setLayout(new BoxLayout(loggingDirPanel,
0633:                        BoxLayout.X_AXIS));
0634:                JLabel strLogFileDir = OctopusProjectFrame.createOctopusLabel(
0635:                        LOG_FILE_DIRECTORY, smallComponent);
0636:                JTextField logFileDir = OctopusProjectFrame
0637:                        .createOctopusTextField(LOG_FILE_DIRECTORY,
0638:                                veryBigPlusButton);
0639:                JButton logDirButton = OctopusProjectFrame.createOctopusButton(
0640:                        "", new Dimension(20, 20));
0641:
0642:                logDirButton.setAction(new BrowseAction_L());
0643:
0644:                loggingDirPanel.add(strLogFileDir);
0645:                loggingDirPanel.add(logFileDir);
0646:                loggingDirPanel.add(logDirButton);
0647:                //loggingDirPanel.add(Box.createHorizontalGlue());
0648:
0649:                //log file name
0650:                JPanel loggingFilePanel = new JPanel();
0651:                loggingFilePanel.setLayout(new BoxLayout(loggingFilePanel,
0652:                        BoxLayout.X_AXIS));
0653:                JLabel strLogFileName = OctopusProjectFrame.createOctopusLabel(
0654:                        LOG_FILE_NAME, smallComponent);
0655:                JTextField logFileName = OctopusProjectFrame
0656:                        .createOctopusTextField(LOG_FILE_NAME, veryBigComponent);
0657:
0658:                loggingFilePanel.add(strLogFileName);
0659:                loggingFilePanel.add(logFileName);
0660:                //loggingFilePanel.add(Box.createHorizontalGlue());
0661:
0662:                JPanel loggingPanel = new JPanel();
0663:                loggingPanel.setLayout(new BoxLayout(loggingPanel,
0664:                        BoxLayout.Y_AXIS));
0665:                loggingPanel.setBorder(setTitleOfBorder("Logging options",
0666:                        loweredBorder));
0667:                loggingPanel.add(loggingModePanel);
0668:                loggingPanel.add(loggingDirPanel);
0669:                loggingPanel.add(loggingFilePanel);
0670:                //loggingPanel.add(Box.createHorizontalGlue());
0671:
0672:                JPanel mainLoggingPanel = new JPanel();
0673:                mainLoggingPanel.setLayout(new BoxLayout(mainLoggingPanel,
0674:                        BoxLayout.X_AXIS));
0675:                mainLoggingPanel.add(loggingPanel);
0676:                //mainLoggingPanel.setAlignmentX(0);
0677:                mainLoggingPanel.add(Box.createHorizontalGlue());
0678:
0679:                //end
0680:
0681:                //output options panel
0682:                outputOptions.setLayout(new BoxLayout(outputOptions,
0683:                        BoxLayout.Y_AXIS));
0684:
0685:                outputOptions.add(Box.createRigidArea(new Dimension(0, 10)));
0686:                outputOptions.add(mainOutputMode);
0687:                outputOptions.add(Box.createRigidArea(new Dimension(0, 10)));
0688:                outputOptions.add(mainSqlOptionsPanel);
0689:                outputOptions.add(Box.createRigidArea(new Dimension(0, 10)));
0690:                outputOptions.add(mainXmlOptionsPanel);
0691:                outputOptions.add(Box.createRigidArea(new Dimension(0, 10)));
0692:                outputOptions.add(mainPackagePanel);
0693:                //zk added for logging
0694:                outputOptions.add(Box.createRigidArea(new Dimension(0, 10)));
0695:                outputOptions.add(mainLoggingPanel);
0696:
0697:                //
0698:
0699:                // output panel
0700:                JPanel textAreaPanel = new JPanel();
0701:                textAreaPanel.setLayout(new BoxLayout(textAreaPanel,
0702:                        BoxLayout.X_AXIS));
0703:                JPanel areaOptionPanel = new JPanel();
0704:                areaOptionPanel.setLayout(new BoxLayout(areaOptionPanel,
0705:                        BoxLayout.Y_AXIS));
0706:                traceArea = new JTextArea(18, 130);
0707:                traceArea.setLineWrap(true);
0708:                traceArea.setEditable(false);
0709:                traceArea.setBorder(BorderFactory
0710:                        .createEtchedBorder(EtchedBorder.RAISED));
0711:                JScrollPane scrollPane = new JScrollPane(traceArea,
0712:                        ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
0713:                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
0714:
0715:                scrollPane.setBorder(setTitleOfBorder(
0716:                        "Log TDT Generator output ... ", loweredBorder));
0717:                JButton fullScreen = OctopusProjectFrame.createOctopusButton(
0718:                        "Full Screen", new Dimension(25, 25));
0719:                fullScreen.setAction(new FullScreenAction());
0720:                JButton normalScreen = OctopusProjectFrame.createOctopusButton(
0721:                        "Normal Screen", new Dimension(25, 25));
0722:                normalScreen.setAction(new NormalScreenAction());
0723:                JButton saveScreen = OctopusProjectFrame.createOctopusButton(
0724:                        "Save Trace", new Dimension(25, 25));
0725:                saveScreen.setAction(new SaveTraceAction());
0726:                JButton clearTrace = OctopusProjectFrame.createOctopusButton(
0727:                        "Clear Trace", new Dimension(25, 25));
0728:                clearTrace.setAction(new ClearTraceAction());
0729:
0730:                areaOptionPanel.add(fullScreen);
0731:                areaOptionPanel.add(normalScreen);
0732:                areaOptionPanel.add(saveScreen);
0733:                areaOptionPanel.add(clearTrace);
0734:                areaOptionPanel.add(Box.createVerticalGlue());
0735:                areaOptionPanel.setBorder(BorderFactory
0736:                        .createEtchedBorder(EtchedBorder.LOWERED));
0737:
0738:                //			JPanel areaOptionMainPanel = new JPanel(new BorderLayout());
0739:                //			areaOptionMainPanel.add(areaOptionPanel, BorderLayout.PAGE_START);
0740:
0741:                textAreaPanel.add(areaOptionPanel);
0742:                textAreaPanel.add(scrollPane);
0743:                //			main =
0744:                //				new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, generatorInputData, textAreaPanel);
0745:                main = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
0746:                        octopusGeneratorData, textAreaPanel);
0747:                main.setOneTouchExpandable(true);
0748:                //    main.setDividerLocation(650);
0749:
0750:                //setting all parameters into hash table
0751:                //source
0752:                fields.put(SOURCE_TYPE, sourceType);
0753:                fields.put(SOURCE_DATABASE, sourceUrl);
0754:                fields.put(DOML_PATH, domlUrl);
0755:                fields.put(SOURCE_DRIVER_NAME, sourceDriverName);
0756:                fields.put(SOURCE_USER, sourceUser);
0757:                fields.put(SOURCE_PASSWORD, sourcePassword);
0758:                //target
0759:                fields.put(TARGET_TYPE, targetType);
0760:                fields.put(TARGET_DATABASE, targetUrl);
0761:                fields.put(TARGET_DRIVER_NAME, targetDriverName);
0762:                fields.put(TARGET_USER, targetUser);
0763:                fields.put(TARGET_PASSWORD, targetPassword);
0764:
0765:                //copy mode
0766:                fields.put(VALUE_MODE, valueMode);
0767:
0768:                fields.put(GENERATOR_OUTPUT, generatorOutput);
0769:                fields.put(ADDITIONAL_PATHS, addPaths);
0770:                fields.put(INCLUDE_TABLE_LIST, includeTableList);
0771:
0772:                //sql statements
0773:                fields.put(GENERATE_SQL, sqlFiles);
0774:                fields.put(CREATE_TABLE, createTables);
0775:                fields.put(CREATE_PRIMARY_KEYS, createPK);
0776:                fields.put(CREATE_FOREIGN_KEYS, createFK);
0777:                fields.put(CREATE_INDEXES, createIn);
0778:                fields.put(DROP_TABLE, dropTables);
0779:                fields.put(DROP_FOREIGN_KEYS, dropFK);
0780:                fields.put(CREATE_SQL_FOR_ALL_VENDORS, createSQLForAll);
0781:
0782:                //xml options
0783:                fields.put(GENERATE_XML, xmlFiles);
0784:                fields.put(FULL_MODE, fullMode);
0785:                fields.put(OPTIMIZED_MODE, optimizedMode);
0786:
0787:                //ZK added for logging
0788:                fields.put(LOG_MODE, logMode);
0789:                fields.put(LOG_FILE_NAME, logFileName);
0790:                fields.put(LOG_FILE_DIRECTORY, logFileDir);
0791:                //end
0792:
0793:                //doml options
0794:                fields.put(GENERATE_DOML, domlFile);
0795:                fields.put(PACKAGE_NAME, packageField);
0796:
0797:                //advanced
0798:                fields.put(PATH_TO_CONF_IN_JAR, pathToConf);
0799:
0800:                //    Container container = getContentPane();
0801:                setLayout(new BoxLayout(this , BoxLayout.X_AXIS));
0802:                add(main);
0803:                setBounds(0, 0, 970, 680);
0804:            }
0805:
0806:            private JPanel createJDBCRow(JComponent jc1, JComponent jc2) {
0807:                JPanel jp = new JPanel();
0808:                jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS));
0809:                jp.add(jc1);
0810:                if (jc2 != null)
0811:                    jp.add(jc2);
0812:
0813:                jp.add(Box.createHorizontalGlue());
0814:                return jp;
0815:            }
0816:
0817:            private Border setTitleOfBorder(String title, Border border) {
0818:                Border inb = BorderFactory.createTitledBorder(border, title);
0819:                return inb;
0820:            }
0821:
0822:            public JTextArea getTraceArea() {
0823:                return this .traceArea;
0824:            }
0825:
0826:            //		private JButton createOctopusButton(String componentName, Dimension dimension) {
0827:            //
0828:            //			JButton button = new JButton();
0829:            //			if (!componentName.equalsIgnoreCase(""))
0830:            //				button.setText(componentName);
0831:            //
0832:            //			button.setAlignmentX(Component.LEFT_ALIGNMENT);
0833:            //			button.setAlignmentY(Component.CENTER_ALIGNMENT);
0834:            //			button.setMinimumSize(new Dimension(dimension));
0835:            //			button.setMaximumSize(new Dimension(dimension));
0836:            //			button.setPreferredSize(new Dimension(dimension));
0837:            //
0838:            //			return button;
0839:            //		}
0840:            //
0841:            //		private JComboBox createOctopusCombobox(String componentName, Dimension dimension) {
0842:            //
0843:            //			JComboBox comboBox = new JComboBox();
0844:            //			comboBox.setName(componentName);
0845:            //			comboBox.setAlignmentX(Component.LEFT_ALIGNMENT);
0846:            //			comboBox.setAlignmentY(Component.CENTER_ALIGNMENT);
0847:            //			comboBox.setMinimumSize(new Dimension(dimension));
0848:            //			comboBox.setMaximumSize(new Dimension(dimension));
0849:            //			comboBox.setPreferredSize(new Dimension(dimension));
0850:            //
0851:            //			return comboBox;
0852:            //		}
0853:            //
0854:            //		private JLabel createOctopusLabel(String componentName, Dimension dimension) {
0855:            //
0856:            //			JLabel label = new JLabel();
0857:            //			label.setText(componentName);
0858:            //			label.setAlignmentX(Component.LEFT_ALIGNMENT);
0859:            //			label.setAlignmentY(Component.CENTER_ALIGNMENT);
0860:            //			label.setMinimumSize(new Dimension(dimension));
0861:            //			label.setMaximumSize(new Dimension(dimension));
0862:            //			label.setPreferredSize(new Dimension(dimension));
0863:            //
0864:            //			return label;
0865:            //		}
0866:            //
0867:            //		private JTextField createOctopusTextField(String componentName, Dimension dimension) {
0868:            //
0869:            //			JTextField textField = new JTextField();
0870:            //			textField.setName(componentName);
0871:            //			textField.setAlignmentX(Component.LEFT_ALIGNMENT);
0872:            //			textField.setAlignmentY(Component.CENTER_ALIGNMENT);
0873:            //			textField.setMinimumSize(new Dimension(dimension));
0874:            //			textField.setMaximumSize(new Dimension(dimension));
0875:            //			textField.setPreferredSize(new Dimension(dimension));
0876:            //
0877:            //			return textField;
0878:            //		}
0879:
0880:            public void setOctopusGeneratorInit(OctopusGeneratorData initData,
0881:                    String confJarStructure) {
0882:                this .initData = initData;
0883:                setField(LOG_MODE, initData.getLogMode(), "box");
0884:                setField(LOG_FILE_DIRECTORY, initData.getLogFileDir(), "label");
0885:                setField(LOG_FILE_NAME, initData.getLogFileName(), "label");
0886:
0887:                setField(SOURCE_TYPE, initData.getSourceType(), "box");
0888:                setField(TARGET_TYPE, initData.getTargetType(), "box");
0889:                setField(SOURCE_DATABASE, initData.getSourceDatabase(), "label");
0890:                setField(TARGET_DATABASE, initData.getTargetDatabase(), "label");
0891:                setField(SOURCE_USER, initData.getSourceUser(), "label");
0892:                setField(SOURCE_PASSWORD, initData.getSourcePassword(), "label");
0893:                setField(TARGET_USER, initData.getTargetUser(), "label");
0894:                setField(TARGET_PASSWORD, initData.getTargetPassword(), "label");
0895:                setField(VALUE_MODE, initData.getValueMode(), "box");
0896:                setField(GENERATOR_OUTPUT, initData.getGeneratorOutput(),
0897:                        "label");
0898:                setField(DOML_PATH, initData.getDomlPath(), "label");
0899:                setField(PACKAGE_NAME, initData.getPackageName(), "label");
0900:                setField(SOURCE_DRIVER_NAME, initData.getSourceDriverName(),
0901:                        "box");
0902:                setField(TARGET_DRIVER_NAME, initData.getTargetDriverName(),
0903:                        "box");
0904:                setField(ADDITIONAL_PATHS, initData.getAdditionalPaths(),
0905:                        "label");
0906:                setField(DROP_TABLE, initData.getSqlStmtDropTable(), "checkBox");
0907:                setField(DROP_FOREIGN_KEYS, initData.getSqlStmtDropIntegrity(),
0908:                        "checkBox");
0909:                setField(DROP_FOREIGN_KEYS, initData.getSqlStmtDropIntegrity(),
0910:                        "checkBox");
0911:                setField(CREATE_TABLE, initData.getSqlStmtCreateTable(),
0912:                        "checkBox");
0913:                setField(CREATE_PRIMARY_KEYS, initData.getSqlStmtCreatePK(),
0914:                        "checkBox");
0915:                setField(CREATE_FOREIGN_KEYS, initData.getSqlStmtCreateFK(),
0916:                        "checkBox");
0917:                setField(CREATE_INDEXES, initData.getSqlStmtCreateIndex(),
0918:                        "checkBox");
0919:                setField(CREATE_SQL_FOR_ALL_VENDORS, initData
0920:                        .getSqlStmtForAllVendors(), "checkBox");
0921:                setField(GENERATE_SQL, initData.getSqlGenerate(), "checkBox");
0922:                setField(GENERATE_XML, initData.getXmlGenerate(), "checkBox");
0923:                setField(GENERATE_DOML, initData.getDomlGenerate(), "checkBox");
0924:                setField(FULL_MODE, initData.getFullMode(), "radioButton");
0925:                setField(OPTIMIZED_MODE, initData.getFullMode()
0926:                        .equalsIgnoreCase("true") ? "false" : "true",
0927:                        "radioButton");
0928:                setField(INCLUDE_TABLE_LIST, initData.getIncludeTableList(),
0929:                        "label");
0930:                setField(PATH_TO_CONF_IN_JAR, initData.getConfJarStructure(),
0931:                        "label");
0932:
0933:            }
0934:
0935:            public OctopusGeneratorData getOctopusGeneratorInit()
0936:                    throws Exception {
0937:                initData.setLogMode(getField(LOG_MODE, "box"));
0938:                initData.setLogFileName(getField(LOG_FILE_NAME, "label"));
0939:                initData.setLogFileDir(getField(LOG_FILE_DIRECTORY, "label"));
0940:
0941:                initData.setSourceType(getField(SOURCE_TYPE, "box"));
0942:                initData.setTargetType(getField(TARGET_TYPE, "box"));
0943:                initData.setSourceDatabase(getField(SOURCE_DATABASE, "label"));
0944:                initData.setTargetDatabase(getField(TARGET_DATABASE, "label"));
0945:                initData.setSourceUser(getField(SOURCE_USER, "label"));
0946:                initData.setSourcePassword(getField(SOURCE_PASSWORD, "label"));
0947:                initData.setTargetUser(getField(TARGET_USER, "label"));
0948:                initData.setTargetPassword(getField(TARGET_PASSWORD, "label"));
0949:                initData.setValueMode(getField(VALUE_MODE, "box"));
0950:                initData
0951:                        .setGeneratorOutput(getField(GENERATOR_OUTPUT, "label"));
0952:                initData.setDomlPath(getField(DOML_PATH, "label"));
0953:                initData.setPackageName(getField(PACKAGE_NAME, "label"));
0954:                initData
0955:                        .setSourceDriverName(getField(SOURCE_DRIVER_NAME, "box"));
0956:                initData
0957:                        .setTargetDriverName(getField(TARGET_DRIVER_NAME, "box"));
0958:                initData
0959:                        .setAdditionalPaths(getField(ADDITIONAL_PATHS, "label"));
0960:                initData.setSqlStmtDropTable(getField(DROP_TABLE, "checkBox"));
0961:                initData.setSqlStmtDropIntegrity(getField(DROP_FOREIGN_KEYS,
0962:                        "checkBox"));
0963:                initData.setSqlStmtCreateTable(getField(CREATE_TABLE,
0964:                        "checkBox"));
0965:                initData.setSqlStmtCreatePK(getField(CREATE_PRIMARY_KEYS,
0966:                        "checkBox"));
0967:                initData.setSqlStmtCreateFK(getField(CREATE_FOREIGN_KEYS,
0968:                        "checkBox"));
0969:                initData.setSqlStmtCreateIndex(getField(CREATE_INDEXES,
0970:                        "checkBox"));
0971:                initData.setSqlStmtForAllVendors(getField(
0972:                        CREATE_SQL_FOR_ALL_VENDORS, "checkBox"));
0973:                initData.setSqlGenerate(getField(GENERATE_SQL, "checkBox"));
0974:                initData.setXmlGenerate(getField(GENERATE_XML, "checkBox"));
0975:                initData.setDomlGenerate(getField(GENERATE_DOML, "checkBox"));
0976:                if (getField(FULL_MODE, "radioButton").equalsIgnoreCase("true"))
0977:                    initData.setFullMode("true");
0978:                else
0979:                    initData.setFullMode("false");
0980:                initData.setIncludeTableList(getField(INCLUDE_TABLE_LIST,
0981:                        "label"));
0982:                initData.setConfJarStructure(getField(PATH_TO_CONF_IN_JAR,
0983:                        "label"));
0984:
0985:                return initData;
0986:            }
0987:
0988:            private String getField(String fieldName, String type) {
0989:                if (type.equalsIgnoreCase("textfield")
0990:                        || type.equalsIgnoreCase("label")) {
0991:                    JTextField field = (JTextField) fields.get(fieldName);
0992:                    return field.getText().trim();
0993:                } else if (type.startsWith("checkBox")) {
0994:                    JCheckBox field = (JCheckBox) fields.get(fieldName);
0995:                    if (field.isSelected() == true)
0996:                        return "true";
0997:                    else
0998:                        return "false";
0999:                } else if (type.startsWith("radioButton")) {
1000:                    JRadioButton field = (JRadioButton) fields.get(fieldName);
1001:                    if (field.isSelected() == true)
1002:                        return "true";
1003:                    else
1004:                        return "false";
1005:                } else {
1006:                    JComboBox field = (JComboBox) fields.get(fieldName);
1007:                    return field.getSelectedItem().toString();
1008:
1009:                }
1010:            }
1011:
1012:            private void setField(String fieldName, String value, String type) {
1013:                if (type.equalsIgnoreCase("textfield")
1014:                        || type.equalsIgnoreCase("label")) {
1015:                    JTextField field = (JTextField) fields.get(fieldName);
1016:                    field.setText(value);
1017:                } else if (type.equalsIgnoreCase("box")) {
1018:                    JComboBox field = (JComboBox) fields.get(fieldName);
1019:                    int itemCount = field.getItemCount();
1020:                    if (fieldName.equalsIgnoreCase(SOURCE_TYPE)) {
1021:                        for (int i = 0; i < OctopusGeneratorData
1022:                                .getSourceDatabaseTypes().length; i++) {
1023:                            if (itemCount != OctopusGeneratorData
1024:                                    .getSourceDatabaseTypes().length)
1025:                                field.addItem(OctopusGeneratorData
1026:                                        .getSourceDatabaseTypes()[i]);
1027:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1028:                                    .getSourceDatabaseTypes()[i]))
1029:                                field.setSelectedIndex(i);
1030:                        }
1031:                    } else if (fieldName.equalsIgnoreCase(TARGET_TYPE)) {
1032:                        for (int i = 0; i < OctopusGeneratorData
1033:                                .getTargetDatabaseTypes().length; i++) {
1034:                            if (itemCount != OctopusGeneratorData
1035:                                    .getTargetDatabaseTypes().length)
1036:                                field.addItem(OctopusGeneratorData
1037:                                        .getTargetDatabaseTypes()[i]);
1038:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1039:                                    .getTargetDatabaseTypes()[i]))
1040:                                field.setSelectedIndex(i);
1041:                        }
1042:                    } else if (fieldName.equalsIgnoreCase(SOURCE_DRIVER_NAME)) {
1043:                        for (int i = 0; i < OctopusGeneratorData
1044:                                .getSourceDriverNames().length; i++) {
1045:                            if (itemCount != OctopusGeneratorData
1046:                                    .getSourceDriverNames().length)
1047:                                field.addItem(OctopusGeneratorData
1048:                                        .getSourceDriverNames()[i]);
1049:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1050:                                    .getSourceDriverNames()[i]))
1051:                                field.setSelectedIndex(i);
1052:                        }
1053:                    } else if (fieldName.equalsIgnoreCase(TARGET_DRIVER_NAME)) {
1054:                        for (int i = 0; i < OctopusGeneratorData
1055:                                .getTargetDriverNames().length; i++) {
1056:                            if (itemCount != OctopusGeneratorData
1057:                                    .getTargetDriverNames().length)
1058:                                field.addItem(OctopusGeneratorData
1059:                                        .getTargetDriverNames()[i]);
1060:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1061:                                    .getTargetDriverNames()[i]))
1062:                                field.setSelectedIndex(i);
1063:                        }
1064:                    } else if (fieldName.equalsIgnoreCase(VALUE_MODE)) {
1065:                        for (int i = 0; i < OctopusGeneratorData
1066:                                .getValueModes().length; i++) {
1067:                            if (itemCount != OctopusGeneratorData
1068:                                    .getValueModes().length)
1069:                                field.addItem(OctopusGeneratorData
1070:                                        .getValueModes()[i]);
1071:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1072:                                    .getValueModes()[i]))
1073:                                field.setSelectedIndex(i);
1074:                        }
1075:                    } else if (fieldName.equalsIgnoreCase(LOG_MODE)) {
1076:                        boolean setted = false;
1077:                        for (int i = 0; i < OctopusLoaderData.getLogModes().length; i++) {
1078:                            if (field.getItemCount() != OctopusGeneratorData
1079:                                    .getLogModes().length)
1080:                                field.addItem(OctopusGeneratorData
1081:                                        .getLogModes()[i]);
1082:                            if (value.equalsIgnoreCase(OctopusGeneratorData
1083:                                    .getLogModes()[i])) {
1084:                                field.setSelectedIndex(i);
1085:                                setted = true;
1086:                            }
1087:                        }
1088:                        if (!setted)
1089:                            field.setSelectedIndex(1);
1090:                    }
1091:                } else if (type.equalsIgnoreCase("checkbox")) {
1092:                    JCheckBox field = (JCheckBox) fields.get(fieldName);
1093:                    if (fieldName.equalsIgnoreCase(DROP_TABLE)) {
1094:                        if (value.equalsIgnoreCase("true"))
1095:                            field.setSelected(true);
1096:                        else
1097:                            field.setSelected(false);
1098:                    } else if (fieldName.equalsIgnoreCase(DROP_FOREIGN_KEYS)) {
1099:                        if (value.equalsIgnoreCase("true"))
1100:                            field.setSelected(true);
1101:                        else
1102:                            field.setSelected(false);
1103:                    } else if (fieldName.equalsIgnoreCase(CREATE_TABLE)) {
1104:                        if (value.equalsIgnoreCase("true"))
1105:                            field.setSelected(true);
1106:                        else
1107:                            field.setSelected(false);
1108:                    } else if (fieldName.equalsIgnoreCase(CREATE_PRIMARY_KEYS)) {
1109:                        if (value.equalsIgnoreCase("true"))
1110:                            field.setSelected(true);
1111:                        else
1112:                            field.setSelected(false);
1113:                    } else if (fieldName.equalsIgnoreCase(CREATE_FOREIGN_KEYS)) {
1114:                        if (value.equalsIgnoreCase("true"))
1115:                            field.setSelected(true);
1116:                        else
1117:                            field.setSelected(false);
1118:                    } else if (fieldName.equalsIgnoreCase(CREATE_INDEXES)) {
1119:                        if (value.equalsIgnoreCase("true"))
1120:                            field.setSelected(true);
1121:                        else
1122:                            field.setSelected(false);
1123:                    } else if (fieldName
1124:                            .equalsIgnoreCase(CREATE_SQL_FOR_ALL_VENDORS)) {
1125:                        if (value.equalsIgnoreCase("true"))
1126:                            field.setSelected(true);
1127:                        else
1128:                            field.setSelected(false);
1129:                    } else if (fieldName.equalsIgnoreCase(GENERATE_SQL)) {
1130:                        if (value.equalsIgnoreCase("true"))
1131:                            field.setSelected(true);
1132:                        else
1133:                            field.setSelected(false);
1134:                    } else if (fieldName.equalsIgnoreCase(GENERATE_XML)) {
1135:                        if (value.equalsIgnoreCase("true"))
1136:                            field.setSelected(true);
1137:                        else
1138:                            field.setSelected(false);
1139:                    } else if (fieldName.equalsIgnoreCase(GENERATE_DOML)) {
1140:                        if (value.equalsIgnoreCase("true"))
1141:                            field.setSelected(true);
1142:                        else
1143:                            field.setSelected(false);
1144:                    }
1145:                } else if (type.equalsIgnoreCase("radioButton")) {
1146:                    JRadioButton field = (JRadioButton) fields.get(fieldName);
1147:                    if (value.equalsIgnoreCase("true"))
1148:                        field.setSelected(true);
1149:                    else
1150:                        field.setSelected(false);
1151:                }
1152:
1153:            }
1154:
1155:            private class FullScreenAction extends AbstractAction {
1156:
1157:                /**
1158:                 * This method starts the LoaderGenerator application
1159:                 */
1160:                public FullScreenAction() {
1161:
1162:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1163:                            .getClassLoader().getResource(
1164:                                    "org/webdocwf/util/loader/"
1165:                                            + "wizard/images/Host16.gif")));
1166:                    putValue(SHORT_DESCRIPTION, "Full Screen");
1167:                    putValue(LONG_DESCRIPTION, "Set Trace to Full Screen");
1168:                    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('F',
1169:                            Toolkit.getDefaultToolkit()
1170:                                    .getMenuShortcutKeyMask()));
1171:                    putValue(MNEMONIC_KEY, new Integer('F'));
1172:                }
1173:
1174:                /**
1175:                 * This method check if the action is performed (event key pressed)
1176:                 * @param e is event
1177:                 */
1178:                public void actionPerformed(ActionEvent e) {
1179:                    main.setDividerLocation(0);
1180:                }
1181:            }
1182:
1183:            private class NormalScreenAction extends AbstractAction {
1184:
1185:                /**
1186:                 * This method starts the LoaderGenerator application
1187:                 */
1188:                public NormalScreenAction() {
1189:
1190:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1191:                            .getClassLoader().getResource(
1192:                                    "org/webdocwf/util/loader/"
1193:                                            + "wizard/images/Unhost16.gif")));
1194:                    putValue(SHORT_DESCRIPTION, "Normal Screen");
1195:                    putValue(LONG_DESCRIPTION, "Back to normal screen");
1196:                    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('N',
1197:                            Toolkit.getDefaultToolkit()
1198:                                    .getMenuShortcutKeyMask()));
1199:                    putValue(MNEMONIC_KEY, new Integer('N'));
1200:                }
1201:
1202:                /**
1203:                 * This method check if the action is performed (event key pressed)
1204:                 * @param e is event
1205:                 */
1206:                public void actionPerformed(ActionEvent e) {
1207:                    main.setDividerLocation(510);
1208:                }
1209:            }
1210:
1211:            private class SaveTraceAction extends AbstractAction {
1212:
1213:                /**
1214:                 * This method starts the LoaderGenerator application
1215:                 */
1216:                public SaveTraceAction() {
1217:
1218:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1219:                            .getClassLoader().getResource(
1220:                                    "org/webdocwf/util/loader/"
1221:                                            + "wizard/images/Save16.gif")));
1222:                    putValue(SHORT_DESCRIPTION, "Save Trace");
1223:                    putValue(LONG_DESCRIPTION, "Save Trace to file");
1224:                    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('S',
1225:                            Toolkit.getDefaultToolkit()
1226:                                    .getMenuShortcutKeyMask()));
1227:                    putValue(MNEMONIC_KEY, new Integer('S'));
1228:                }
1229:
1230:                /**
1231:                 * This method check if the action is performed (event key pressed)
1232:                 * @param e is event
1233:                 */
1234:                public void actionPerformed(ActionEvent e) {
1235:                    JFileChooser fc = new JFileChooser();
1236:                    fc.setDialogTitle("Save Together Data Transformer log ...");
1237:                    int returnVal = fc.showSaveDialog(null);
1238:                    if (returnVal == JFileChooser.APPROVE_OPTION) {
1239:                        File file = fc.getSelectedFile();
1240:                        String text = traceArea.getText();
1241:                        try {
1242:                            Writer out = new BufferedWriter(
1243:                                    new FileWriter(file));
1244:                            out.write(text);
1245:                            out.close();
1246:                        } catch (Exception ex) {
1247:                            ex.printStackTrace();
1248:                        }
1249:
1250:                    } else {
1251:                        //do nothing
1252:                    }
1253:                }
1254:            }
1255:
1256:            private class ClearTraceAction extends AbstractAction {
1257:
1258:                /**
1259:                 * This method starts the LoaderGenerator application
1260:                 */
1261:                public ClearTraceAction() {
1262:
1263:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1264:                            .getClassLoader().getResource(
1265:                                    "org/webdocwf/util/loader/"
1266:                                            + "wizard/images/Delete16.gif")));
1267:                    putValue(SHORT_DESCRIPTION, "Clear Trace");
1268:                    putValue(LONG_DESCRIPTION, "Clear Trace");
1269:                    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('L',
1270:                            Toolkit.getDefaultToolkit()
1271:                                    .getMenuShortcutKeyMask()));
1272:                    putValue(MNEMONIC_KEY, new Integer('L'));
1273:                }
1274:
1275:                /**
1276:                 * This method check if the action is performed (event key pressed)
1277:                 * @param e is event
1278:                 */
1279:                public void actionPerformed(ActionEvent e) {
1280:                    traceArea.setText("");
1281:                }
1282:            }
1283:
1284:            private class BrowseAction_GO extends AbstractAction {
1285:
1286:                /**
1287:                 * This method stop the LoaderGenerator application
1288:                 */
1289:                public BrowseAction_GO() {
1290:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1291:                            .getClassLoader().getResource(
1292:                                    "org/webdocwf/util/loader/"
1293:                                            + "wizard/images/Open16.gif")));
1294:                    putValue(SHORT_DESCRIPTION,
1295:                            "Browse for Generator output directory");
1296:                    putValue(LONG_DESCRIPTION,
1297:                            "Browse for Generator output directory");
1298:                    putValue(MNEMONIC_KEY, new Integer('B'));
1299:                }
1300:
1301:                /**
1302:                 * This method check if the action is performed (event key pressed)
1303:                 * @param e is event
1304:                 */
1305:                public void actionPerformed(ActionEvent e) {
1306:                    JFileChooser chooser = null;
1307:                    File choice = null;
1308:                    File current = new File(System.getProperty("user.dir"));
1309:                    chooser = new JFileChooser(current);
1310:                    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1311:                    chooser
1312:                            .setFileFilter((javax.swing.filechooser.FileFilter) new DirectoryFilter());
1313:                    chooser.setDialogTitle("Select Generator Output Directory");
1314:                    chooser.setApproveButtonText("Open");
1315:                    String strFieldText = "";
1316:
1317:                    chooser.setCurrentDirectory(new File(strFieldText));
1318:                    int v = chooser.showOpenDialog(null);
1319:                    //      desktop.requestFocus();
1320:
1321:                    switch (v) {
1322:                    case JFileChooser.APPROVE_OPTION:
1323:                        if (chooser.getSelectedFile() != null) {
1324:                            if (chooser.getSelectedFile().exists()) {
1325:                                choice = chooser.getSelectedFile();
1326:                            } else {
1327:                                File parentFile = new File(chooser
1328:                                        .getSelectedFile().getParent());
1329:                                choice = parentFile;
1330:                            }
1331:                            generatorOutput.setText(choice.getPath());
1332:                        }
1333:                        break;
1334:
1335:                    case JFileChooser.CANCEL_OPTION:
1336:                    case JFileChooser.ERROR_OPTION:
1337:
1338:                    }
1339:                }
1340:            }
1341:
1342:            //log dir
1343:            private class BrowseAction_L extends AbstractAction {
1344:
1345:                public BrowseAction_L() {
1346:                    //			  putValue(NAME, "browse");
1347:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1348:                            .getClassLoader().getResource(
1349:                                    "org/webdocwf/util/loader/"
1350:                                            + "wizard/images/Open16.gif")));
1351:                    putValue(SHORT_DESCRIPTION, "Browse for Log file directory");
1352:                    putValue(LONG_DESCRIPTION, "Browse for Log file directory");
1353:                    putValue(MNEMONIC_KEY, new Integer('B'));
1354:                }
1355:
1356:                /**
1357:                 * This method check if the action is performed (event key pressed)
1358:                 * @param e is event
1359:                 */
1360:                public void actionPerformed(ActionEvent e) {
1361:                    JFileChooser chooser = null;
1362:                    File choice = null;
1363:                    File current = new File(System.getProperty("user.dir"));
1364:                    chooser = new JFileChooser(current);
1365:                    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1366:                    chooser
1367:                            .setFileFilter((javax.swing.filechooser.FileFilter) new DirectoryFilter());
1368:                    chooser.setDialogTitle("Select Log File Directory");
1369:                    chooser.setApproveButtonText("Open");
1370:                    String strFieldText = "";
1371:
1372:                    chooser.setCurrentDirectory(new File(strFieldText));
1373:                    int v = chooser.showOpenDialog(null);
1374:                    //			  parent.requestFocus();
1375:
1376:                    switch (v) {
1377:                    case JFileChooser.APPROVE_OPTION:
1378:                        if (chooser.getSelectedFile() != null) {
1379:                            if (chooser.getSelectedFile().exists()) {
1380:                                choice = chooser.getSelectedFile();
1381:                            } else {
1382:                                File parentFile = new File(chooser
1383:                                        .getSelectedFile().getParent());
1384:                                choice = parentFile;
1385:                            }
1386:                            setField(LOG_FILE_DIRECTORY, choice.getPath(),
1387:                                    "label");
1388:                        }
1389:                        break;
1390:
1391:                    case JFileChooser.CANCEL_OPTION:
1392:                    case JFileChooser.ERROR_OPTION:
1393:
1394:                    }
1395:                }
1396:            }
1397:
1398:            //additional paths
1399:            private class BrowseAction_AC extends AbstractAction {
1400:
1401:                /**
1402:                 * This method stop the LoaderGenerator application
1403:                 */
1404:                public BrowseAction_AC() {
1405:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1406:                            .getClassLoader().getResource(
1407:                                    "org/webdocwf/util/loader/"
1408:                                            + "wizard/images/Open16.gif")));
1409:                    putValue(SHORT_DESCRIPTION, "Add .jar files");
1410:                    putValue(LONG_DESCRIPTION,
1411:                            "Add .jar (jdbc) files to system classpath");
1412:                    putValue(MNEMONIC_KEY, new Integer('B'));
1413:                }
1414:
1415:                /**
1416:                 * This method check if the action is performed (event key pressed)
1417:                 * @param e is event
1418:                 */
1419:                public void actionPerformed(ActionEvent e) {
1420:                    JFileChooser chooser = null;
1421:                    File choice = null;
1422:                    File current = new File(System.getProperty("user.dir"));
1423:                    chooser = new JFileChooser(current);
1424:                    chooser
1425:                            .setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
1426:                    chooser
1427:                            .setFileFilter((javax.swing.filechooser.FileFilter) new JarFilter());
1428:                    chooser.setDialogTitle("Select .jar file");
1429:                    chooser.setAcceptAllFileFilterUsed(false);
1430:                    String strFieldText = addPaths.getText();
1431:
1432:                    if (!strFieldText.equalsIgnoreCase(""))
1433:                        strFieldText = strFieldText + ";";
1434:
1435:                    chooser.setCurrentDirectory(new File(strFieldText));
1436:                    chooser.setApproveButtonText("Open");
1437:                    int v = chooser.showOpenDialog(null);
1438:
1439:                    //      desktop.requestFocus();
1440:                    switch (v) {
1441:                    case JFileChooser.APPROVE_OPTION:
1442:                        if (chooser.getSelectedFile() != null) {
1443:                            if (chooser.getSelectedFile().exists()) {
1444:                                choice = chooser.getSelectedFile();
1445:                            } else {
1446:                                File parentFile = new File(chooser
1447:                                        .getSelectedFile().getParent());
1448:                                choice = parentFile;
1449:                            }
1450:                            addPaths.setText(strFieldText + choice.getPath());
1451:                        }
1452:                        break;
1453:
1454:                    case JFileChooser.CANCEL_OPTION:
1455:                    case JFileChooser.ERROR_OPTION:
1456:
1457:                        chooser.removeAll();
1458:                        chooser = null;
1459:                        current = null;
1460:
1461:                    }
1462:                }
1463:            }
1464:
1465:            //doml file
1466:            private class BrowseAction_DOML extends AbstractAction {
1467:
1468:                /**
1469:                 * This method stop the LoaderGenerator application
1470:                 */
1471:                public BrowseAction_DOML() {
1472:                    //      putValue(NAME, "browse");
1473:                    putValue(SMALL_ICON, new ImageIcon(getClass()
1474:                            .getClassLoader().getResource(
1475:                                    "org/webdocwf/util/loader/"
1476:                                            + "wizard/images/Open16.gif")));
1477:                    putValue(SHORT_DESCRIPTION, "Browse for .doml file");
1478:                    putValue(LONG_DESCRIPTION, "Browse for .doml file");
1479:                    putValue(MNEMONIC_KEY, new Integer('B'));
1480:                }
1481:
1482:                /**
1483:                 * This method check if the action is performed (event key pressed)
1484:                 * @param e is event
1485:                 */
1486:                public void actionPerformed(ActionEvent e) {
1487:                    JFileChooser chooser = null;
1488:                    File choice = null;
1489:                    File current = new File(System.getProperty("user.dir"));
1490:                    chooser = new JFileChooser(current);
1491:                    chooser
1492:                            .setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
1493:                    chooser
1494:                            .setFileFilter((javax.swing.filechooser.FileFilter) new DomlFilter());
1495:                    chooser.setDialogTitle("Select .doml file");
1496:                    chooser.setAcceptAllFileFilterUsed(false);
1497:                    String strFieldText = "";
1498:
1499:                    chooser.setCurrentDirectory(new File(strFieldText));
1500:                    chooser.setApproveButtonText("Open");
1501:                    int v = chooser.showOpenDialog(null);
1502:
1503:                    //				parent.requestFocus();
1504:                    switch (v) {
1505:                    case JFileChooser.APPROVE_OPTION:
1506:                        if (chooser.getSelectedFile() != null) {
1507:                            if (chooser.getSelectedFile().exists()) {
1508:                                choice = chooser.getSelectedFile();
1509:                            } else {
1510:                                File parentFile = new File(chooser
1511:                                        .getSelectedFile().getParent());
1512:                                choice = parentFile;
1513:                            }
1514:                            setField(DOML_PATH, choice.getPath(), "label");
1515:                        }
1516:                        break;
1517:
1518:                    case JFileChooser.CANCEL_OPTION:
1519:                    case JFileChooser.ERROR_OPTION:
1520:
1521:                        chooser.removeAll();
1522:                        chooser = null;
1523:
1524:                    }
1525:                }
1526:            }
1527:
1528:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.