LiveGraph
data visualisation and analysis framework

org.LiveGraph
Class LiveGraph

java.lang.Object
  extended by org.LiveGraph.LiveGraph

public class LiveGraph
extends java.lang.Object

This is the main executable class of the LiveGraph plotter application. An instance of this class represents the application itself. The tasks of this class is to interpret the command line parameters, to set-up and to start-up the GUI and the back-end of the application, and to provide some functions which are used by different modules of the application to communicate with each other and to access global data, such as settings.

This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.

File: LiveGraph.java

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)

4. All advertising materials distributed in form of HTML pages or any other technology permitting active hyper-links that mention features or use of this software or any derived software must display the acknowledgment specified in condition 3 of this agreement, and in addition, include a visible and working hyper-link to the LiveGraph homepage (http://www.live-graph.org).

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"1.1.1"
Author:
Greg Paperin (http://www.paperin.org)

Nested Class Summary
private  class LiveGraph.UncaughtExceptionHandler
           
 
Field Summary
private static LiveGraph app
          Singleton application instance.
private  DataFileSettings dataFileSettings
          Holds the data file settings for the application.
private  DataFileSettingsWindow dataFileSettingsWindow
          GUI window for data file settings.
private  GraphExporter graphExporter
          Holds the graph exporter.
private  GraphSettings graphSettings
          Holds the graph settings for the application.
private  GraphSettingsWindow graphSettingsWindow
          GUI window for graph settings.
private  MainWindow mainWindow
          Main GUI window of the application.
private  PlotWindow plotWindow
          GUI window for the actual graph plot.
private  DataSeriesSettings seriesSettings
          Holds the data series settings for the application.
private  SeriesSettingsWindow seriesSettingsWindow
          GUI window for data series settings.
private  UpdateInvoker updateInvoker
          Application's data update invoker.
static java.lang.String version
          LiveGraph software version.
 
Constructor Summary
LiveGraph()
           
 
Method Summary
static LiveGraph application()
          Singleton application access method.
 void disposeGUIAndExit()
          This method is called by the main window when it is closed.
 void exec(java.lang.String[] args)
          Main program method.
 DataFileSettings getDataFileSettings()
          Gets the application's global data file settings.
 DataSeriesSettings getDataSeriesSettings()
          Gets the application's global data series settings.
 GraphExporter getGraphExporter()
           
 GraphSettings getGraphSettings()
          Gets the application's global graph settings.
private  java.lang.String getInitialSettingsFiles(java.lang.String[] args, java.util.Map<java.lang.String,java.lang.String> startupFiles)
          Parses the command line arguments for file names for initial settings and combines the results with default settings file names.
private  java.lang.String getInitialSettingsFromCommandLine(java.lang.String[] args, java.util.Map<java.lang.String,java.lang.String> startupFiles)
          Parses the command line arguments for file names for initial settings.
 java.lang.String getJavaSpecificationVersion()
          Determines the current Java specification version.
 void initiateDataUpdate()
          Causes the next data update.
private  void installUncaughtExceptionHandler()
           
 void logErrorLn(java.lang.Object o)
          Prints an error message to the main window message area.
 void logInfoLn(java.lang.Object o)
          Prints an info message to the main window message area.
 void logSuccessLn(java.lang.Object o)
          Prints an success message to the main window message area.
static void main(java.lang.String[] args)
          Program entry point.
 boolean runsCorrectJavaVersion()
          Determines whether the currect Java version is appropriate.
private  void setDefaultInitialSettingsFiles(java.util.Map<java.lang.String,java.lang.String> startupFiles)
          If some settings were not specified to be loaded from a file via the command line, this method is used to specify default files for loading the settings, provided the defualt files exist.
 void setDisplayDataFileSettingsWindow(boolean state)
          Displays or hides the data file settings window.
 void setDisplayGraphSettingsWindow(boolean state)
          Displays or hides the graph settings window.
 void setDisplayPlotWindow(boolean state)
          Displays or hides plot window.
 void setDisplaySeriesSettingsWindow(boolean state)
          Displays or hides the data series settings window.
private  java.lang.String tryParseCommandLineArgument(java.lang.String flag, java.lang.String filename, java.util.Map<java.lang.String,java.lang.String> startupFiles)
          Processes two consecutive command line parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
LiveGraph software version.

See Also:
Constant Field Values

app

private static LiveGraph app
Singleton application instance.


updateInvoker

private UpdateInvoker updateInvoker
Application's data update invoker.


mainWindow

private MainWindow mainWindow
Main GUI window of the application.


dataFileSettingsWindow

private DataFileSettingsWindow dataFileSettingsWindow
GUI window for data file settings.


graphSettingsWindow

private GraphSettingsWindow graphSettingsWindow
GUI window for graph settings.


seriesSettingsWindow

private SeriesSettingsWindow seriesSettingsWindow
GUI window for data series settings.


plotWindow

private PlotWindow plotWindow
GUI window for the actual graph plot.


dataFileSettings

private DataFileSettings dataFileSettings
Holds the data file settings for the application.


graphSettings

private GraphSettings graphSettings
Holds the graph settings for the application.


seriesSettings

private DataSeriesSettings seriesSettings
Holds the data series settings for the application.


graphExporter

private GraphExporter graphExporter
Holds the graph exporter.

Constructor Detail

LiveGraph

public LiveGraph()
Method Detail

application

public static LiveGraph application()
Singleton application access method.

Returns:
The singleton application object.

main

public static void main(java.lang.String[] args)
Program entry point. Creates an application instance and calls the exec(String[]) method.

Parameters:
args - Command line parameters.

exec

public void exec(java.lang.String[] args)
Main program method. It parses the command line parameters, sets up the GUI and the back-end components of the application and configures the their communication. It then loads the default settings and passes the execution control to the main Swing GUI loop.

Parameters:
args - Command line arguments.

getJavaSpecificationVersion

public java.lang.String getJavaSpecificationVersion()
Determines the current Java specification version.

Returns:
The current Java specification version or "unknown" if it could not be obtained.

runsCorrectJavaVersion

public boolean runsCorrectJavaVersion()
Determines whether the currect Java version is appropriate. This is done based on the system property java.specification.version. Java version 1.6 or higher is considered ok.

Returns:
Whether the currect Java version is appropriate.

getInitialSettingsFiles

private java.lang.String getInitialSettingsFiles(java.lang.String[] args,
                                                 java.util.Map<java.lang.String,java.lang.String> startupFiles)
Parses the command line arguments for file names for initial settings and combines the results with default settings file names.

Parameters:
args - Command line arguments.
startupFiles - A table to hold the results.
Returns:
null if no error occured or the error message if there was an error (e.g. incorrect command line arguments).

getInitialSettingsFromCommandLine

private java.lang.String getInitialSettingsFromCommandLine(java.lang.String[] args,
                                                           java.util.Map<java.lang.String,java.lang.String> startupFiles)
Parses the command line arguments for file names for initial settings.

Parameters:
args - Command line arguments.
startupFiles - A table to hold the results.
Returns:
null if no error occured or the error message if there was an error (e.g. incorrect command line arguments).

tryParseCommandLineArgument

private java.lang.String tryParseCommandLineArgument(java.lang.String flag,
                                                     java.lang.String filename,
                                                     java.util.Map<java.lang.String,java.lang.String> startupFiles)
Processes two consecutive command line parameters.

Parameters:
flag - Flag specifier command line parameter.
filename - Filename specifier command line parameter.
startupFiles - A table to hold the results.
Returns:
null if no error occured or the error message if there was an error (e.g. incorrect command line arguments).

setDefaultInitialSettingsFiles

private void setDefaultInitialSettingsFiles(java.util.Map<java.lang.String,java.lang.String> startupFiles)
If some settings were not specified to be loaded from a file via the command line, this method is used to specify default files for loading the settings, provided the defualt files exist.

Parameters:
startupFiles - A table to hold the results.

logInfoLn

public void logInfoLn(java.lang.Object o)
Prints an info message to the main window message area.

Parameters:
o - The message.

logErrorLn

public void logErrorLn(java.lang.Object o)
Prints an error message to the main window message area.

Parameters:
o - The message.

logSuccessLn

public void logSuccessLn(java.lang.Object o)
Prints an success message to the main window message area.

Parameters:
o - The message.

setDisplayDataFileSettingsWindow

public void setDisplayDataFileSettingsWindow(boolean state)
Displays or hides the data file settings window.

Parameters:
state - Whether to display (true) or to hide (false).

setDisplayGraphSettingsWindow

public void setDisplayGraphSettingsWindow(boolean state)
Displays or hides the graph settings window.

Parameters:
state - Whether to display (true) or to hide (false).

setDisplaySeriesSettingsWindow

public void setDisplaySeriesSettingsWindow(boolean state)
Displays or hides the data series settings window.

Parameters:
state - Whether to display (true) or to hide (false).

setDisplayPlotWindow

public void setDisplayPlotWindow(boolean state)
Displays or hides plot window.

Parameters:
state - Whether to display (true) or to hide (false).

disposeGUIAndExit

public void disposeGUIAndExit()
This method is called by the main window when it is closed. This method initiates the disposing of all windows and the data update invocation thread in order to correctly close the application and save all settings to default files.


getDataFileSettings

public DataFileSettings getDataFileSettings()
Gets the application's global data file settings.

Returns:
Global data file settings.

getGraphSettings

public GraphSettings getGraphSettings()
Gets the application's global graph settings.

Returns:
Global graph settings.

getDataSeriesSettings

public DataSeriesSettings getDataSeriesSettings()
Gets the application's global data series settings.

Returns:
Global data series settings.

getGraphExporter

public GraphExporter getGraphExporter()

initiateDataUpdate

public void initiateDataUpdate()
Causes the next data update.


installUncaughtExceptionHandler

private void installUncaughtExceptionHandler()

LiveGraph
data visualisation and analysis framework