[7738] | 1 | /**
|
---|
| 2 | *#########################################################################
|
---|
| 3 | *
|
---|
| 4 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
| 5 | * library suite from the New Zealand Digital Library Project at the
|
---|
| 6 | * University of Waikato, New Zealand.
|
---|
| 7 | *
|
---|
[10242] | 8 | * Author: John Thompson, NZDL Project, University of Waikato
|
---|
[7738] | 9 | *
|
---|
[10242] | 10 | * Copyright (C) 2005 New Zealand Digital Library Project
|
---|
[7738] | 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify
|
---|
| 13 | * it under the terms of the GNU General Public License as published by
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | * (at your option) any later version.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful,
|
---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | * GNU General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, write to the Free Software
|
---|
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | *########################################################################
|
---|
| 26 | */
|
---|
| 27 | package org.greenstone.gatherer;
|
---|
| 28 |
|
---|
| 29 |
|
---|
[9092] | 30 | import java.io.*;
|
---|
[7738] | 31 | import javax.swing.*;
|
---|
[9092] | 32 | import org.greenstone.gatherer.util.Utility;
|
---|
[7738] | 33 |
|
---|
[10242] | 34 | /**
|
---|
| 35 | * Containing the main() method, this class is the entry point for the
|
---|
| 36 | * stand-alone (non-Applet) GLI. The main point of this class is to set
|
---|
| 37 | * some stand-alone specific properties and then create an instance of the
|
---|
| 38 | * Gatherer class.
|
---|
| 39 | * @author John Thompson, NZDL Project, University of Waikato
|
---|
[7738] | 40 | */
|
---|
| 41 | public class GathererProg
|
---|
| 42 | {
|
---|
[10242] | 43 | /** The entry point into the stand-alone GLI.
|
---|
[7738] | 44 | * @param args A collection of arguments that may include: initial screen size, dictionary, path to the GSDL etc.
|
---|
| 45 | */
|
---|
[32725] | 46 | static public void main(final String[] args)
|
---|
[10242] | 47 | {
|
---|
[7738] | 48 | // A serious hack, but its good enough to stop crappy 'Could not
|
---|
| 49 | // lock user prefs' error messages. Thanks to Walter Schatz from
|
---|
| 50 | // the java forums.
|
---|
| 51 | System.setProperty("java.util.prefs.syncInterval","2000000");
|
---|
[10242] | 52 | // => results in one message every 600 hours!
|
---|
[7738] | 53 |
|
---|
| 54 | // Ensure platform specific LAF
|
---|
| 55 | try {
|
---|
[14974] | 56 | // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
---|
| 57 | UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
---|
[7738] | 58 | }
|
---|
[9092] | 59 | catch (Exception exception) {
|
---|
[7738] | 60 | exception.printStackTrace();
|
---|
| 61 | }
|
---|
[9092] | 62 |
|
---|
[10342] | 63 | // Determine the GLI user directory path
|
---|
| 64 | String gli_user_directory_path = System.getProperty("user.home") + File.separator;
|
---|
| 65 | if (Utility.isWindows()) {
|
---|
| 66 | gli_user_directory_path += "Application Data" + File.separator + "Greenstone" + File.separator + "GLI" + File.separator;
|
---|
| 67 | }
|
---|
| 68 | else {
|
---|
| 69 | gli_user_directory_path += ".gli" + File.separator;
|
---|
| 70 | }
|
---|
| 71 | Gatherer.setGLIUserDirectoryPath(gli_user_directory_path);
|
---|
| 72 |
|
---|
[10362] | 73 | // We have a local GLI
|
---|
| 74 | Gatherer.setGLIDirectoryPath(System.getProperty("user.dir") + File.separator);
|
---|
[32673] | 75 |
|
---|
[32920] | 76 | // Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
|
---|
[32926] | 77 | final Gatherer gatherer = new Gatherer(args);
|
---|
[32923] | 78 |
|
---|
[32673] | 79 | // TESTING circumventing the old GUI event dispatch thread exceptions in GLI. Follows
|
---|
| 80 | // https://docs.oracle.com/javase/6/docs/api/javax/swing/package-summary.html#threading
|
---|
| 81 | // referred from Event Dispatch Thread page at https://joel-costigliola.github.io/assertj/assertj-swing-edt.html
|
---|
| 82 |
|
---|
| 83 | // Schedule a job for the event-dispatching thread:
|
---|
| 84 | // creating and showing this application's GUI.
|
---|
[32920] | 85 |
|
---|
| 86 | SwingUtilities.invokeLater(new Runnable() {
|
---|
[32673] | 87 | public void run() {
|
---|
[32923] | 88 | // This line used to be done immediately after setGLIDirectoryPath()
|
---|
| 89 | // and new Gatherer() above, but is now inside an invokeLater() to do graphical stuff here.
|
---|
| 90 |
|
---|
[32673] | 91 | // Display the GUI immediately
|
---|
| 92 | gatherer.openGUI();
|
---|
| 93 | }
|
---|
| 94 | });
|
---|
[32923] | 95 |
|
---|
[7738] | 96 | }
|
---|
| 97 | }
|
---|