001: package org.webdocwf.util.loader.wizard;
002:
003: import java.awt.Color;
004: import java.awt.Dimension;
005: import java.awt.Toolkit;
006: import java.awt.event.ActionEvent;
007: import java.awt.event.MouseAdapter;
008: import java.awt.event.MouseEvent;
009: import java.awt.event.MouseListener;
010: import java.io.File;
011: import java.io.FileInputStream;
012: import java.io.InputStream;
013:
014: import javax.swing.AbstractAction;
015: import javax.swing.ImageIcon;
016: import javax.swing.JButton;
017: import javax.swing.JDesktopPane;
018: import javax.swing.JFileChooser;
019: import javax.swing.JFrame;
020: import javax.swing.JMenu;
021: import javax.swing.JMenuBar;
022: import javax.swing.JMenuItem;
023: import javax.swing.JOptionPane;
024: import javax.swing.JPopupMenu;
025: import javax.swing.JToolBar;
026: import javax.swing.KeyStroke;
027: import javax.swing.UIManager;
028:
029: public class WizardFrame extends JFrame {
030: private WizardFrame wizardFrame;
031: private JDesktopPane desktop;
032: private JPopupMenu popUp;
033: private static boolean startOctopusLoader = false;
034: private static String pathToXmlFile = "";
035: private static boolean startOctopusProject = false;
036: private static String pathToProjectFile = "";
037: private static String confJarStructure = "";
038: private static int defaultProjectNameCounter = 1;
039: private static final String DEFAULT_PROJECT_NAME = "Untitled project";
040:
041: public WizardFrame(String title) {
042: super (title);
043: wizardFrame = this ;
044: setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
045: desktop = new JDesktopPane();
046: setContentPane(desktop);
047:
048: // Install our custom desktop manager.
049: //ZK commented this
050: //desktop.setDesktopManager(new SampleDesktopMgr());
051: desktop.setBackground(new Color(210, 210, 210));
052:
053: createMenuBar();
054: createPopupMenu();
055:
056: if (startOctopusLoader) {
057: try {
058: OctopusProjectFrame octopusProject = createOctopusProjectFrame(DEFAULT_PROJECT_NAME
059: + defaultProjectNameCounter++);
060: //redefine settings
061: octopusProject.getLoaderPanel().setOctopusLoaderInit(
062: new OctopusLoaderData(), pathToXmlFile,
063: confJarStructure);
064: octopusProject.setActiveTab(1);
065: desktop.add(octopusProject);
066: octopusProject.setVisible(true);
067: octopusProject.requestFocus();
068: } catch (Exception ex) {
069: String message = "Error while starting TDT Wizard . Message : ";
070: message += ex.getMessage();
071: JOptionPane.showMessageDialog(desktop, message + "\n",
072: "Error", 0);
073: System.exit(0);
074: }
075: } else if (startOctopusProject) {
076: try {
077: OctopusProperties properties = new OctopusProperties();
078: InputStream is = new FileInputStream(pathToProjectFile);
079: properties.load(is);
080: String name = properties
081: .getOctopusProperty("ProjectName");
082: if (name == null || name.trim().equals(""))
083: name = DEFAULT_PROJECT_NAME
084: + defaultProjectNameCounter++;
085: OctopusProjectFrame octopusProject = createOctopusProjectFrame(name);
086: confJarStructure = properties
087: .getOctopusProperty("Generator.ConfJarStructure");
088: OctopusGeneratorData generatorData = new OctopusGeneratorData(
089: confJarStructure);
090:
091: //set data
092: setGeneratorData(properties, generatorData);
093:
094: octopusProject.getGeneratorPanel()
095: .setOctopusGeneratorInit(generatorData,
096: confJarStructure);
097: //set data
098: OctopusLoaderData loaderData = new OctopusLoaderData();
099: setLoaderData(properties, loaderData);
100: //
101:
102: octopusProject.getLoaderPanel().setOctopusLoaderInit(
103: loaderData, null, confJarStructure);
104:
105: desktop.add(octopusProject);
106: octopusProject.setVisible(true);
107: octopusProject.requestFocus();
108: } catch (Exception ex) {
109: String message = "Error while starting TDT Wizard . Message : ";
110: message += ex.getMessage();
111: JOptionPane.showMessageDialog(desktop, message + "\n",
112: "Error", 0);
113: System.exit(0);
114: }
115: }
116: }
117:
118: protected void createMenuBar() {
119: JMenuBar mb = new JMenuBar();
120: JMenu menu = new JMenu("Project");
121: menu.setMnemonic('P');
122: JMenu menu2 = new JMenu("IDEOptions");
123: menu2.setMnemonic('I');
124: JMenu menu3 = new JMenu("Help");
125: menu3.setMnemonic('H');
126:
127: menu.add(new NewOctopusProjectItem()); // add Octopus Project frame as new project
128: menu.add(new OpenOctopusProjectItem()); // add Octopus Project frame as open project
129: menu.add(new ExitOctopusApplicationItem()); // add exit
130: menu2.add(new LnFActionMetal()); // add look and feel option
131: menu2.add(new LnFActionMotif());
132: menu2.add(new LnFActionWindows());
133: menu2.add(new LnFActionJava());
134: menu3.add(new OctopusHelpAction("Help"));
135: menu3.addSeparator();
136: menu3.add(new OctopusAboutAction());
137:
138: setJMenuBar(mb);
139: mb.add(menu);
140: mb.add(menu2);
141: mb.add(menu3);
142: }
143:
144: public void createPopupMenu() {
145: JMenuItem menuItem;
146:
147: //Create the popup menu.
148: JPopupMenu popup = new JPopupMenu();
149: JMenuItem popupItem = new JMenuItem("Start new TDT project");
150: popupItem.setAction(new NewOctopusProjectItem());
151: JMenuItem popupItem2 = new JMenuItem(
152: "Open existing TDT project");
153: popupItem2.setAction(new OpenOctopusProjectItem());
154: JMenuItem popupItem3 = new JMenuItem("Exit TDT Application");
155: popupItem3.setAction(new ExitOctopusApplicationItem());
156:
157: popup.add(popupItem);
158: popup.add(popupItem2);
159: popup.add(popupItem3);
160:
161: //Add listener to the destop area so the popup menu can come up.
162: MouseListener popupListener = new PopupListener(popup);
163: desktop.addMouseListener(popupListener);
164: }
165:
166: public static void main(String[] args) {
167:
168: OctopusSplash octopusSplash = new OctopusSplash(
169: "splash_octopus.gif", null);
170:
171: if (args.length > 0 && args.length < 5) {
172: for (int i = 0; i < args.length - 1; i = i + 1) {
173: if (args[i].equalsIgnoreCase("-sol")) {
174: pathToXmlFile = args[++i];
175: if (!pathToXmlFile.equalsIgnoreCase(""))
176: startOctopusLoader = true;
177: }
178: if (args[i].equalsIgnoreCase("-sop")) {
179: pathToProjectFile = args[++i];
180: if (!pathToProjectFile.equalsIgnoreCase(""))
181: startOctopusProject = true;
182: }
183: if (args[i].equalsIgnoreCase("-cjs")) {
184: confJarStructure = args[++i];
185: }
186: }
187: }
188: try {
189: UIManager.setLookAndFeel(UIManager
190: .getSystemLookAndFeelClassName());
191: } catch (Exception e) {
192: e.printStackTrace();
193: }
194: WizardFrame wizardFrame = new WizardFrame(
195: "Together Data Transformer Application");
196:
197: // wizardFrame.addWindowListener(new WindowAdapter() {
198: // public void windowClosing(WindowEvent we) {
199: // System.exit(0);
200: // }
201: // });
202:
203: wizardFrame.setIconImage(new ImageIcon(WizardFrame.class
204: .getResource("images/Enhydra16.gif")).getImage());
205:
206: Dimension dimension = Toolkit.getDefaultToolkit()
207: .getScreenSize();
208: wizardFrame.setBounds(0, 0, dimension.width - 20,
209: dimension.height - 40);
210:
211: try {
212: Thread.sleep(2500);
213: } catch (Exception e) {
214: e.printStackTrace();
215: }
216: OctopusSplash.getSplash().hideSplash();
217: octopusSplash = null;
218: wizardFrame.setVisible(true);
219: }
220:
221: private OctopusProjectFrame createOctopusProjectFrame(String name)
222: throws Exception {
223:
224: //create menu
225: JMenuBar mb = new JMenuBar();
226: JMenu menu = new JMenu("Application");
227: menu.setMnemonic('A');
228: JMenuItem startGenerator = new JMenuItem("Start Generator");
229: JMenuItem startLoader = new JMenuItem("Start Loader");
230: JMenuItem save = new JMenuItem("Save project");
231: JMenuItem stop = new JMenuItem("Close project");
232: JMenuItem help = new JMenuItem("Help");
233: menu.add(startGenerator);
234: menu.add(startLoader);
235: menu.addSeparator();
236: menu.add(save);
237: menu.add(stop);
238: menu.addSeparator();
239: menu.add(help);
240: mb.add(menu);
241:
242: //create toolbar
243: JButton startGeneratorButton = OctopusProjectFrame
244: .createOctopusButton("Start Generator",
245: OctopusGeneratorPanel.toolBarButton);
246: JButton startLoaderButton = OctopusProjectFrame
247: .createOctopusButton("Start Loader",
248: OctopusGeneratorPanel.toolBarButton);
249: JButton stopButton = OctopusProjectFrame.createOctopusButton(
250: "Stop", OctopusGeneratorPanel.toolBarButton);
251: JButton saveButton = OctopusProjectFrame.createOctopusButton(
252: "Save", OctopusGeneratorPanel.toolBarButton);
253: JButton helpButton = OctopusProjectFrame.createOctopusButton(
254: "Help", OctopusGeneratorPanel.toolBarButton);
255: JToolBar toolBar = new JToolBar("TDT toolbar");
256: toolBar.add(startGeneratorButton);
257: // toolBar.addSeparator();
258: toolBar.add(startLoaderButton);
259: toolBar.addSeparator();
260: toolBar.add(saveButton);
261: // toolBar.addSeparator();
262: toolBar.add(stopButton);
263: toolBar.addSeparator();
264: toolBar.add(helpButton);
265: //create generator panel
266: OctopusGeneratorPanel generatorPanel = new OctopusGeneratorPanel();
267: generatorPanel.setOctopusGeneratorInit(
268: new OctopusGeneratorData(confJarStructure),
269: confJarStructure);
270: //create loader panel
271: OctopusLoaderPanel loaderPanel = new OctopusLoaderPanel();
272: loaderPanel.setOctopusLoaderInit(new OctopusLoaderData(), null,
273: confJarStructure);
274: //create octopus project frame
275: OctopusProjectFrame octopusProject = new OctopusProjectFrame(
276: name, loaderPanel, generatorPanel, toolBar);
277: octopusProject.getRootPane().setJMenuBar(mb);
278: //set actions for menu
279: startGenerator.setAction(new StartOctopusGeneratorAction(
280: octopusProject, "Start Generator"));
281: startLoader.setAction(new StartOctopusLoaderAction(
282: octopusProject, "Start Loader"));
283: stop.setAction(new CloseOctopusProjectAction(octopusProject,
284: "Close"));
285: save.setAction(new SaveProjectAction(octopusProject, "Save"));
286: help.setAction(new OctopusHelpAction("Help"));
287: //set actions for toolbar
288: startGeneratorButton.setAction(new StartOctopusGeneratorAction(
289: octopusProject, ""));
290: startLoaderButton.setAction(new StartOctopusLoaderAction(
291: octopusProject, ""));
292: stopButton.setAction(new CloseOctopusProjectAction(
293: octopusProject, ""));
294: saveButton.setAction(new SaveProjectAction(octopusProject, ""));
295: helpButton.setAction(new OctopusHelpAction(""));
296: //return frame
297: return octopusProject;
298: }
299:
300: private class ExitOctopusApplicationItem extends AbstractAction {
301: /**
302: * Action which creates new frame
303: */
304: public ExitOctopusApplicationItem() {
305: putValue(NAME, "Exit");
306: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('X',
307: Toolkit.getDefaultToolkit()
308: .getMenuShortcutKeyMask()));
309: putValue(SMALL_ICON, new ImageIcon(getClass()
310: .getClassLoader().getResource(
311: "org/webdocwf/util/loader/"
312: + "wizard/images/Stop.gif")));
313: putValue(SHORT_DESCRIPTION,
314: "Exit Together Data Transformer Application");
315: putValue(LONG_DESCRIPTION,
316: "Exit Together Data Transformer Application");
317: putValue(MNEMONIC_KEY, new Integer('X'));
318: }
319:
320: public void actionPerformed(ActionEvent e) {
321: try {
322: if (JOptionPane.showConfirmDialog(null,
323: "Are you are sure want to exit?", "Exit",
324: JOptionPane.INFORMATION_MESSAGE) == 0) {
325: System.exit(0);
326: }
327: } catch (Exception ex) {
328: String message = "Error while creating action for ExitOctopusApplicationItem menu item. Message :"
329: + ex.getMessage();
330: JOptionPane.showMessageDialog(desktop, message + "\n",
331: "Error", 0);
332: }
333:
334: }
335: }
336:
337: private class NewOctopusProjectItem extends AbstractAction {
338: /**
339: * Action which creates new frame
340: */
341: public NewOctopusProjectItem() {
342: putValue(NAME, "New TDT Project");
343: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('N',
344: Toolkit.getDefaultToolkit()
345: .getMenuShortcutKeyMask()));
346: putValue(SMALL_ICON, new ImageIcon(getClass()
347: .getClassLoader().getResource(
348: "org/webdocwf/util/loader/"
349: + "wizard/images/New.gif")));
350: putValue(SHORT_DESCRIPTION, "TDT project");
351: putValue(LONG_DESCRIPTION,
352: "Start Together Data Transformer project");
353: putValue(MNEMONIC_KEY, new Integer('N'));
354: }
355:
356: public void actionPerformed(ActionEvent e) {
357: try {
358: String name = (String) JOptionPane.showInputDialog(
359: null, "Project name : ", "New project...",
360: JOptionPane.INFORMATION_MESSAGE, null, null,
361: DEFAULT_PROJECT_NAME
362: + defaultProjectNameCounter++);
363: if (name != null) {
364: if (name == null || name.trim().equals(""))
365: name = DEFAULT_PROJECT_NAME
366: + defaultProjectNameCounter++;
367: OctopusProjectFrame octopusProject = createOctopusProjectFrame(name);
368: desktop.add(octopusProject);
369: octopusProject.setVisible(true);
370: octopusProject.requestFocus();
371: } else {
372: //cancel pressed
373: }
374:
375: } catch (Exception ex) {
376: String message = "Error while creating action for NewOctopusProject menu item. Message :"
377: + ex.getMessage();
378: JOptionPane.showMessageDialog(desktop, message + "\n",
379: "Error", 0);
380: }
381:
382: }
383: }
384:
385: private class OpenOctopusProjectItem extends AbstractAction {
386: /**
387: * Action which creates new frame
388: */
389: public OpenOctopusProjectItem() {
390: putValue(NAME, "Open existing TDT Project");
391: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('O',
392: Toolkit.getDefaultToolkit()
393: .getMenuShortcutKeyMask()));
394: putValue(SMALL_ICON, new ImageIcon(getClass()
395: .getClassLoader().getResource(
396: "org/webdocwf/util/loader/"
397: + "wizard/images/Open.gif")));
398: putValue(SHORT_DESCRIPTION, "TDT project");
399: putValue(LONG_DESCRIPTION,
400: "Open Together Data Transformer project");
401: putValue(MNEMONIC_KEY, new Integer('0'));
402: }
403:
404: public void actionPerformed(ActionEvent e) {
405: try {
406: File current = new File(System.getProperty("user.dir"));
407: JFileChooser chooser = new JFileChooser(current);
408: chooser
409: .setDialogTitle("Open Together Data Transformer project ...");
410: chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
411: chooser
412: .setFileFilter((javax.swing.filechooser.FileFilter) new OctopusFileFilter(
413: OctopusFileFilter.OPF));
414: chooser.setAcceptAllFileFilterUsed(false);
415:
416: chooser.setApproveButtonText("Open");
417: int v = chooser.showOpenDialog(desktop);
418:
419: switch (v) {
420: case JFileChooser.APPROVE_OPTION:
421: if (chooser.getSelectedFile() != null) {
422: openProject(chooser.getSelectedFile());
423: }
424: break;
425: case JFileChooser.CANCEL_OPTION:
426: case JFileChooser.ERROR_OPTION:
427: chooser.removeAll();
428: chooser = null;
429: current = null;
430:
431: }
432:
433: } catch (Exception ex) {
434: String message = "Error while creating action for OpenOctopusProject menu item. Message :"
435: + ex.getMessage();
436: JOptionPane.showMessageDialog(desktop, message + "\n",
437: "Error", 0);
438: }
439: }
440:
441: private void openProject(File projectFile) throws Exception {
442: OctopusProperties properties = new OctopusProperties();
443: InputStream is = new FileInputStream(projectFile);
444: properties.load(is);
445: String name = properties.getOctopusProperty("ProjectName");
446: if (name == null || name.trim().equals(""))
447: name = DEFAULT_PROJECT_NAME
448: + defaultProjectNameCounter++;
449: OctopusProjectFrame octopusProject = createOctopusProjectFrame(name);
450: confJarStructure = properties
451: .getOctopusProperty("Generator.ConfJarStructure");
452: OctopusGeneratorData generatorData = new OctopusGeneratorData(
453: confJarStructure);
454: setGeneratorData(properties, generatorData);
455:
456: octopusProject.getGeneratorPanel().setOctopusGeneratorInit(
457: generatorData, confJarStructure);
458: //set data
459: OctopusLoaderData loaderData = new OctopusLoaderData();
460: setLoaderData(properties, loaderData);
461:
462: octopusProject.getLoaderPanel().setOctopusLoaderInit(
463: loaderData, null, confJarStructure);
464:
465: desktop.add(octopusProject);
466: octopusProject.setVisible(true);
467: octopusProject.requestFocus();
468: }
469: }
470:
471: private class LnFActionMetal extends AbstractAction {
472:
473: public LnFActionMetal() {
474:
475: putValue(NAME, "Metal Look&Feel");
476: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('M',
477: Toolkit.getDefaultToolkit()
478: .getMenuShortcutKeyMask()));
479: putValue(SHORT_DESCRIPTION, "Metal Look & Feel");
480: putValue(LONG_DESCRIPTION, "Set Metal Look & Feel Model");
481: putValue(MNEMONIC_KEY, new Integer('M'));
482: }
483:
484: public void actionPerformed(ActionEvent e) {
485: LnFListener lnf = new LnFListener(wizardFrame);
486: lnf.actionPerformed(e);
487: }
488: }
489:
490: private class LnFActionMotif extends AbstractAction {
491:
492: public LnFActionMotif() {
493:
494: putValue(NAME, "Motif Look&Feel");
495: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('F',
496: Toolkit.getDefaultToolkit()
497: .getMenuShortcutKeyMask()));
498: putValue(SHORT_DESCRIPTION, "Motif Look & Feel");
499: putValue(LONG_DESCRIPTION, "Set Motif Look & Feel Model");
500: putValue(MNEMONIC_KEY, new Integer('F'));
501: }
502:
503: public void actionPerformed(ActionEvent e) {
504: LnFListener lnf = new LnFListener(wizardFrame);
505: lnf.actionPerformed(e);
506: }
507: }
508:
509: private class LnFActionWindows extends AbstractAction {
510:
511: public LnFActionWindows() {
512:
513: putValue(NAME, "Windows Look&Feel");
514: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('W',
515: Toolkit.getDefaultToolkit()
516: .getMenuShortcutKeyMask()));
517: putValue(SHORT_DESCRIPTION, "Windows Look & Feel");
518: putValue(LONG_DESCRIPTION, "Set Windows Look & Feel Model");
519: putValue(MNEMONIC_KEY, new Integer('W'));
520: }
521:
522: public void actionPerformed(ActionEvent e) {
523: LnFListener lnf = new LnFListener(wizardFrame);
524: lnf.actionPerformed(e);
525: }
526: }
527:
528: private class LnFActionJava extends AbstractAction {
529:
530: public LnFActionJava() {
531:
532: putValue(NAME, "Java Look&Feel");
533: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('J',
534: Toolkit.getDefaultToolkit()
535: .getMenuShortcutKeyMask()));
536: putValue(SHORT_DESCRIPTION, "Java Look & Feel");
537: putValue(LONG_DESCRIPTION, "Set Java Look & Feel Model");
538: putValue(MNEMONIC_KEY, new Integer('J'));
539: }
540:
541: public void actionPerformed(ActionEvent e) {
542: LnFListener lnf = new LnFListener(wizardFrame);
543: lnf.actionPerformed(e);
544: }
545: }
546:
547: class PopupListener extends MouseAdapter {
548: JPopupMenu popup;
549:
550: PopupListener(JPopupMenu popupMenu) {
551: popup = popupMenu;
552: }
553:
554: public void mousePressed(MouseEvent e) {
555: showPopup(e);
556: }
557:
558: public void mouseReleased(MouseEvent e) {
559: showPopup(e);
560: }
561:
562: private void showPopup(MouseEvent e) {
563: if (e.isPopupTrigger()) {
564: popup.show(e.getComponent(), e.getX(), e.getY());
565: }
566: }
567: }
568:
569: private class OctopusHelpAction extends AbstractAction {
570:
571: /**
572: * Action which creates new help frame
573: */
574: public OctopusHelpAction(String label) {
575: putValue(NAME, label);
576: putValue(SMALL_ICON, new ImageIcon(getClass()
577: .getClassLoader().getResource(
578: "org/webdocwf/util/loader/"
579: + "wizard/images/Help16.gif")));
580: putValue(SHORT_DESCRIPTION, "Help for running the program");
581: putValue(LONG_DESCRIPTION, "Help for running the program");
582: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('H',
583: Toolkit.getDefaultToolkit()
584: .getMenuShortcutKeyMask()));
585: putValue(MNEMONIC_KEY, new Integer('H'));
586: }
587:
588: /**
589: * Creating event for new windows help frame
590: * @param e is creating events
591: */
592: public void actionPerformed(ActionEvent e) {
593: try {
594: OctopusGeneratorHelpFrame helpFrame = new OctopusGeneratorHelpFrame();
595: helpFrame
596: .setIconImage(new ImageIcon(
597: getClass()
598: .getClassLoader()
599: .getResource(
600: "org/webdocwf/util/loader/"
601: + "wizard/images/Enhydra16.gif"))
602: .getImage());
603: helpFrame.setVisible(true);
604: } catch (Exception ex) {
605: String message = "Error while creating action for TDT Help menu item. Message :"
606: + ex.getMessage();
607: JOptionPane.showMessageDialog(desktop, message + "\n",
608: "Error", 0);
609: System.exit(0);
610: }
611: }
612: }
613:
614: private OctopusAboutFrame createOctopusAboutFrame() {
615: OctopusAboutFrame frame = new OctopusAboutFrame(this .desktop);
616: setDefaultCloseOperation(DISPOSE_ON_CLOSE);
617: return frame;
618: }
619:
620: private class OctopusAboutAction extends AbstractAction {
621: /**
622: * Action which creates new about frame
623: */
624: public OctopusAboutAction() {
625: putValue(NAME, "About");
626: putValue(SMALL_ICON, new ImageIcon(getClass()
627: .getClassLoader().getResource(
628: "org/webdocwf/util/loader/"
629: + "wizard/images/About16.gif")));
630: putValue(SHORT_DESCRIPTION, "About the program");
631: putValue(LONG_DESCRIPTION, "About the program");
632: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('A',
633: Toolkit.getDefaultToolkit()
634: .getMenuShortcutKeyMask()));
635: putValue(MNEMONIC_KEY, new Integer('A'));
636: }
637:
638: /**
639: * Creating event for new windows about frame
640: * @param e is creating events
641: */
642: public void actionPerformed(ActionEvent e) {
643: try {
644: OctopusAboutFrame aboutFrame = createOctopusAboutFrame();
645: // aboutFrame.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("org/webdocwf/util/loader/"+
646: // "wizard/images/Enhydra16.gif")).getImage());
647: desktop.add(aboutFrame);
648: aboutFrame.setVisible(true);
649:
650: } catch (Exception ex) {
651: String message = "Error while creating action for OctopusAbout menu item. Message :"
652: + ex.getMessage();
653: JOptionPane.showMessageDialog(desktop, message + "\n",
654: "Error", 0);
655: System.exit(0);
656: }
657: }
658: }
659:
660: private void setLoaderData(OctopusProperties properties,
661: OctopusLoaderData loaderData) throws Exception {
662: try {
663: loaderData.setAdditionalPaths(properties
664: .getOctopusProperty("Loader.AdditionalPaths"));
665: loaderData.setCommitCount(properties
666: .getOctopusProperty("Loader.CommitCount"));
667: loaderData.setConfJarStructure(properties
668: .getOctopusProperty("Loader.ConfJarStructure"));
669: loaderData.setIncludeTables(properties
670: .getOctopusProperty("Loader.IncludeTables"));
671: loaderData.setLogFileDir(properties
672: .getOctopusProperty("Loader.LogFileDir"));
673: loaderData.setLogFileName(properties
674: .getOctopusProperty("Loader.LogFileName"));
675: loaderData.setLogMode(properties
676: .getOctopusProperty("Loader.LogMode"));
677: loaderData.setOnErrorCon(properties
678: .getOctopusProperty("Loader.ErrorConntinue"));
679: loaderData.setPathToXml(properties
680: .getOctopusProperty("Loader.PathToXml"));
681: loaderData.setRestartIndicator(properties
682: .getOctopusProperty("Loader.RestartIndicator"));
683: loaderData.setReturnCode(properties
684: .getOctopusProperty("Loader.ReturnCode"));
685: loaderData.setUserId(properties
686: .getOctopusProperty("Loader.UserId"));
687: loaderData.setVariables(properties
688: .getOctopusProperty("Loader.Variables"));
689: loaderData.setVendorConf(properties
690: .getOctopusProperty("Loader.VendorConf"));
691: } catch (Exception e) {
692: throw e;
693: }
694: }
695:
696: private void setGeneratorData(OctopusProperties properties,
697: OctopusGeneratorData generatorData) throws Exception {
698: try {
699: generatorData.setAdditionalPaths(properties
700: .getOctopusProperty("Generator.AdditionalPaths"));
701: generatorData.setConfJarStructure(properties
702: .getOctopusProperty("Generator.ConfJarStructure"));
703: generatorData.setDomlGenerate(properties
704: .getOctopusProperty("Generator.DomlGenerate"));
705: generatorData.setDomlPath(properties
706: .getOctopusProperty("Generator.DomlPath"));
707: generatorData.setFullMode(properties
708: .getOctopusProperty("Generator.FullMode"));
709: generatorData.setGeneratorOutput(properties
710: .getOctopusProperty("Generator.GeneratorOutput"));
711: generatorData.setIncludeTableList(properties
712: .getOctopusProperty("Generator.IncludeTableList"));
713: generatorData.setPackageName(properties
714: .getOctopusProperty("Generator.PackageName"));
715: generatorData.setSourceDatabase(properties
716: .getOctopusProperty("Generator.SourceDatabase"));
717: generatorData.setSourceDriverName(properties
718: .getOctopusProperty("Generator.SourceDriverName"));
719: generatorData.setSourcePassword(properties
720: .getOctopusProperty("Generator.SourcePassword"));
721: generatorData.setSourceType(properties
722: .getOctopusProperty("Generator.SourceType"));
723: generatorData.setSourceUser(properties
724: .getOctopusProperty("Generator.SourceUser"));
725: generatorData.setSqlGenerate(properties
726: .getOctopusProperty("Generator.SqlGenerate"));
727: generatorData.setSqlStmtCreateFK(properties
728: .getOctopusProperty("Generator.SqlStmtCreateFK"));
729: generatorData
730: .setSqlStmtCreateIndex(properties
731: .getOctopusProperty("Generator.SqlStmtCreateIndex"));
732: generatorData.setSqlStmtCreatePK(properties
733: .getOctopusProperty("Generator.SqlStmtCreatePK"));
734: generatorData
735: .setSqlStmtCreateTable(properties
736: .getOctopusProperty("Generator.SqlStmtCreateTable"));
737: generatorData
738: .setSqlStmtDropIntegrity(properties
739: .getOctopusProperty("Generator.SqlStmtDropIntegrity"));
740: generatorData.setSqlStmtDropTable(properties
741: .getOctopusProperty("Generator.SqlStmtDropTable"));
742: generatorData
743: .setSqlStmtForAllVendors(properties
744: .getOctopusProperty("Generator.SqlStmtForAllVendors"));
745: generatorData.setTargetDatabase(properties
746: .getOctopusProperty("Generator.TargetDatabase"));
747: generatorData.setTargetDriverName(properties
748: .getOctopusProperty("Generator.TargetDriverName"));
749: generatorData.setTargetPassword(properties
750: .getOctopusProperty("Generator.TargetPassword"));
751: generatorData.setTargetType(properties
752: .getOctopusProperty("Generator.TargetType"));
753: generatorData.setTargetUser(properties
754: .getOctopusProperty("Generator.TargetUser"));
755: generatorData.setValueMode(properties
756: .getOctopusProperty("Generator.ValueMode"));
757: generatorData.setXmlGenerate(properties
758: .getOctopusProperty("Generator.XmlGenerate"));
759:
760: generatorData.setLogMode(properties
761: .getOctopusProperty("Generator.LogMode"));
762: generatorData.setLogFileDir(properties
763: .getOctopusProperty("Generator.LogFileDir"));
764: generatorData.setLogFileName(properties
765: .getOctopusProperty("Generator.LogFileName"));
766: } catch (Exception e) {
767: throw e;
768: }
769: }
770:
771: }
|