BioLegato 0.7.5 Core API

org.biolegato.main
Class BLMain

java.lang.Object
  extended by org.biolegato.main.BLMain

public final class BLMain
extends java.lang.Object

The main program and generic function class.

This class is used to generate the main window, do all startup processing, and run the program. This class also contains most of the utility functions.

Version:
0.7.5 25-Mar-2011
Author:
Graham Alvare, Brian Fristensky

Nested Class Summary
static class BLMain.ARCH
           
static class BLMain.OS
           
 
Field Summary
static javax.swing.JMenuItem ABOUT_MENUITEM
          The menu item for BioLegato's "About..."
static BLMain.ARCH CURRENT_ARCH
          Stores the current machine architecture
static java.lang.String CURRENT_DIR
          This constant is set to the path of where biolegato was run The value of this constant determined at runtime.
static BLMain.OS CURRENT_OS
          Stores the current operating system
static boolean debug
          Stores information regarding the usage of the debug command NOTE: This should always be accessed using Main.debug
static java.util.Properties DEFAULT_PROPERTIES
          Stores the properties for BioLegato.
static int DOUBLE_CLICK_TIME
          The amount of time between clicks to be considered a double click.
static java.lang.String EMPTY_STRING
          This constant stores an empty string (to avoid recreation)
static javax.swing.JMenuItem EXIT_MENUITEM
          The menu item for BioLegato's "Exit..."
static java.lang.String HOME_DIR
          Stores the user's home directory
static java.lang.String NAME
          This constant stores the program's name
static java.lang.String PROGRAM_DIR
          This constant is set to the path of BioLegato.jar The value of this constant determined at runtime.
static long serialVersionUID
          This constant is used for Serialization
static java.lang.String VERSION
          This constant is used to keep track of version changes.
 
Constructor Summary
BLMain()
           
 
Method Summary
static javax.swing.JMenu addMenuHeading(int order, java.lang.String name)
          Adds a menu heading (JMenu) to our menu (BLMenu).
static javax.swing.JMenu addMenuHeading(java.lang.String name)
          Adds a menu heading (JMenu) to our menu (BLMenu).
static void addMenuItem(int location, java.lang.String headingName, javax.swing.JMenuItem menuItem)
          Adds a menu item (JMenuItem) to a menu heading (JMenu) within the window (ProgramWindow)
static void addMenuItem(java.lang.String headingName, javax.swing.JMenuItem menuItem)
          Adds a menu item (JMenuItem) to a menu heading (JMenu) within the window (ProgramWindow)
static java.lang.String envreplace(java.lang.String change)
          Replaces $VARIABLE name with environment variables.
static void error(java.lang.String message, java.lang.String location)
          Sends an error message to BioLegato's standard err.
static DataCanvas getCanvas()
          Returns the current/selected data in the canvas.
static java.io.File getCurrentPWD()
          Gets the present working directory "PWD" for BioLegato (this does NOT change CURRENT_DIR!) This value can be used to cache which directory file dialog boxes should use as their "current working directory"
static javax.swing.JFrame getJFrame()
          Provides access for other classes to the main program window JFrame object.
static java.lang.String getProperty(java.lang.String property)
          Retrieves individual settings for BioLegato.
static boolean isDigit(char test)
          Tests if a character is a digit or not.
static void main(java.lang.String[] args)
          Starts up BioLegato.
static void message(java.lang.String message, java.lang.String location)
          Sends a message to BioLegato's standard out.
static int numberDigits(int n)
          Divide and conquer algorithm to calculate the number of digits for a given number
static void setCurrentPWD(java.io.File newPWD)
          Sets the present working directory "PWD" for BioLegato (this does NOT change CURRENT_DIR!) This value can be used to cache which directory file dialog boxes should use as their "current working directory"
static void shellCommand(java.lang.String cmd, java.lang.String data)
          Runs simple shell commands.
static boolean testNumber(java.lang.String test)
          Checks if a character array is all digits.
static void warning(java.lang.String message, java.lang.String location)
          Sends an warning message to BioLegato's standard err.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
This constant stores an empty string (to avoid recreation)

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
This constant stores the program's name

See Also:
Constant Field Values

PROGRAM_DIR

public static final java.lang.String PROGRAM_DIR
This constant is set to the path of BioLegato.jar The value of this constant determined at runtime.


CURRENT_DIR

public static final java.lang.String CURRENT_DIR
This constant is set to the path of where biolegato was run The value of this constant determined at runtime.


VERSION

public static final java.lang.String VERSION
This constant is used to keep track of version changes.

See Also:
Constant Field Values

HOME_DIR

public static final java.lang.String HOME_DIR
Stores the user's home directory


DOUBLE_CLICK_TIME

public static final int DOUBLE_CLICK_TIME
The amount of time between clicks to be considered a double click.

See Also:
Constant Field Values

CURRENT_OS

public static final BLMain.OS CURRENT_OS
Stores the current operating system


CURRENT_ARCH

public static final BLMain.ARCH CURRENT_ARCH
Stores the current machine architecture


serialVersionUID

public static final long serialVersionUID
This constant is used for Serialization

See Also:
Constant Field Values

ABOUT_MENUITEM

public static final javax.swing.JMenuItem ABOUT_MENUITEM
The menu item for BioLegato's "About..."


EXIT_MENUITEM

public static final javax.swing.JMenuItem EXIT_MENUITEM
The menu item for BioLegato's "Exit..."


DEFAULT_PROPERTIES

public static final java.util.Properties DEFAULT_PROPERTIES
Stores the properties for BioLegato. The current properties registered are:
Property Used internally Description
debug Yes determines whether or not to display debug information
plugins Yes sets the plugin directory
temp Yes sets the temporary files directory
font.size Yes determines the default font size for objects in BioLegato
font.type Yes determines the default font type for objects in BioLegato
shell.name Yes determines the shell to execute
shell.parameter Yes determines the parameter for directing the shell to execute a command
user.plugins Yes determines whether or not to read the user's plugin files (located in the user's home directory
canvas Yes determines the canvas to show on startup (if multiple canvases available)
GDE.menu No determines whether or not to read the GDE menu files (backwards compatibility mode)
GDE.help.viewer No determines which file to feed the help file to
GDE.help.path No the location to search for the help files
This properties class will read properties files from the directory containing BioLegato, the user directory and finally the directory BioLegato was launched from. Please note that you can disable reading of properties files from the user directory via. "user.properties"; likewise you can disable reading properties files in the directory BioLegato was launched from via. "pwd.properties" NOTE: for path properties BioLegato will replace all $'s with the appropriate environment variables if set.


debug

public static boolean debug
Stores information regarding the usage of the debug command NOTE: This should always be accessed using Main.debug

Constructor Detail

BLMain

public BLMain()
Method Detail

main

public static void main(java.lang.String[] args)
Starts up BioLegato.

Parameters:
args - the command line arguments for BioLegato.

getProperty

public static java.lang.String getProperty(java.lang.String property)
Retrieves individual settings for BioLegato. This is used to obtain values of properties in BioLeagato

Parameters:
property - the property key to retrieve the value for
Returns:
the property value corresponding to the key parameter

getCanvas

public static DataCanvas getCanvas()
Returns the current/selected data in the canvas.

Returns:
the current data for usage by commands

getJFrame

public static javax.swing.JFrame getJFrame()
Provides access for other classes to the main program window JFrame object.

Returns:
the JFrame object corresponding to the main program window.

addMenuHeading

public static javax.swing.JMenu addMenuHeading(java.lang.String name)
Adds a menu heading (JMenu) to our menu (BLMenu).

Parameters:
name - the name of the menu heading
Returns:
either the JMenu which was added or the JMenu that corresponds to the existing menu heading.

addMenuHeading

public static javax.swing.JMenu addMenuHeading(int order,
                                               java.lang.String name)
Adds a menu heading (JMenu) to our menu (BLMenu).

Parameters:
order - the position to place the menu tag
name - the name of the menu heading
Returns:
either the JMenu which was added or the JMenu that corresponds to the existing menu heading.

addMenuItem

public static void addMenuItem(int location,
                               java.lang.String headingName,
                               javax.swing.JMenuItem menuItem)
Adds a menu item (JMenuItem) to a menu heading (JMenu) within the window (ProgramWindow)

If the heading which was entered does not exist, this function will create it; hence why addMenuHeading returns the heading corresponding to the name entered if a menu heading with that name already exists.

Parameters:
location - is the location in the menu to insert the item at
headingName - is the name of the menu heading to add the menu item to.
menuItem - is the menu item to add to the heading.

addMenuItem

public static void addMenuItem(java.lang.String headingName,
                               javax.swing.JMenuItem menuItem)
Adds a menu item (JMenuItem) to a menu heading (JMenu) within the window (ProgramWindow)

If the heading which was entered does not exist, this function will create it; hence why addMenuHeading returns the heading corresponding to the name entered if a menu heading with that name already exists.

Parameters:
headingName - is the name of the menu heading to add the menu item to.
menuItem - is the menu item to add to the heading.

shellCommand

public static void shellCommand(java.lang.String cmd,
                                java.lang.String data)
Runs simple shell commands. Reroutes all output to the console.

Parameters:
cmd - the command string to run
data - the data to use as standard input (System.in)

error

public static void error(java.lang.String message,
                         java.lang.String location)
Sends an error message to BioLegato's standard err.

Parameters:
message - the error message to send.
location - the location the error occurred.

warning

public static void warning(java.lang.String message,
                           java.lang.String location)
Sends an warning message to BioLegato's standard err.

Parameters:
message - the warning message to send.
location - the location the error occurred.

message

public static void message(java.lang.String message,
                           java.lang.String location)
Sends a message to BioLegato's standard out.

Parameters:
message - the message to send.
location - the location the message was sent from.

testNumber

public static boolean testNumber(java.lang.String test)
Checks if a character array is all digits.

Parameters:
test - the character array to test.
Returns:
true if the array only contains digits.

numberDigits

public static int numberDigits(int n)
Divide and conquer algorithm to calculate the number of digits for a given number

Parameters:
n - the number to calculate the digit content

envreplace

public static java.lang.String envreplace(java.lang.String change)
Replaces $VARIABLE name with environment variables. This function provides functionality similar to BASH. NOTE: if the variable is $BL_HOME, and this is not set, the variable will default to the current working directory.

Parameters:
change - the string to modify.
Returns:
the modified string.

getCurrentPWD

public static java.io.File getCurrentPWD()
Gets the present working directory "PWD" for BioLegato (this does NOT change CURRENT_DIR!) This value can be used to cache which directory file dialog boxes should use as their "current working directory"

Returns:
the current value of "PWD"

setCurrentPWD

public static void setCurrentPWD(java.io.File newPWD)
Sets the present working directory "PWD" for BioLegato (this does NOT change CURRENT_DIR!) This value can be used to cache which directory file dialog boxes should use as their "current working directory"

Parameters:
newPWD - the new directory to use as the "PWD"

isDigit

public static boolean isDigit(char test)
Tests if a character is a digit or not. Digits are from 0-9, a-z, and A-Z

Parameters:
test - the character to test.
Returns:
true if the character is a digit, otherwise false.

BioLegato 0.7.5 Core API

Copyright © 2008-2011 University of Manitoba.