01: /*
02: * Copyright (c) 2004-2006, Jean-François Brazeau. All rights reserved.
03: *
04: * Redistribution and use in source and binary forms, with or without
05: * modification, are permitted provided that the following conditions are met:
06: *
07: * 1. Redistributions of source code must retain the above copyright notice,
08: * this list of conditions and the following disclaimer.
09: *
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * 3. The name of the author may not be used to endorse or promote products
15: * derived from this software without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18: * IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22: * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23: * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25: * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26: * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27: */
28: package jfb.tst.tools.activitymgr.ui;
29:
30: import jfb.tools.activitymgr.core.ModelMgr;
31: import jfb.tools.activitymgr.ui.TasksUI;
32: import jfb.tools.activitymgr.ui.util.CfgMgr;
33:
34: import org.apache.log4j.Logger;
35: import org.apache.log4j.PropertyConfigurator;
36: import org.eclipse.swt.SWT;
37: import org.eclipse.swt.layout.FillLayout;
38: import org.eclipse.swt.widgets.Display;
39: import org.eclipse.swt.widgets.Shell;
40:
41: public class TasksUITest {
42:
43: /** Logger */
44: private static Logger log = Logger.getLogger(TasksUITest.class);
45:
46: public static void main(String[] args) {
47: try {
48: // Initialisation des logs et chargement de la config
49: PropertyConfigurator.configure("cfg/log4j.properties");
50: CfgMgr.load();
51: // Initialisation de la connexion à la base de données
52: String jdbcDriver = CfgMgr.get(CfgMgr.JDBC_DRIVER);
53: String jdbcUrl = CfgMgr.get(CfgMgr.JDBC_URL);
54: String jdbcUser = CfgMgr.get(CfgMgr.JDBC_USER);
55: String jdbcPassword = CfgMgr.get(CfgMgr.JDBC_PASSWORD);
56: ModelMgr.initDatabaseAccess(jdbcDriver, jdbcUrl, jdbcUser,
57: jdbcPassword);
58:
59: // Ouverture de la denêtre
60: Display display = new Display();
61: Shell shell = new Shell(display);
62: shell.setSize(700, 400);
63: shell.setText("Tasks");
64: shell.setLayout(new FillLayout(SWT.VERTICAL));
65:
66: TasksUI ui = new TasksUI(shell);
67:
68: shell.open();
69:
70: ui.databaseOpened();
71: log.debug("UI initialized");
72: log.debug("Length : " + shell.getShells().length);
73:
74: while (!shell.isDisposed()) {
75: if (!display.readAndDispatch())
76: display.sleep();
77: }
78: } catch (Throwable t) {
79: t.printStackTrace();
80: }
81: }
82:
83: }
|