BioLegato 0.5.7

org.biolegato.core.main
Class ProgramWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.biolegato.core.main.ProgramWindow
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public final class ProgramWindow
extends javax.swing.JFrame

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.5.7 1-Sept-2009
Author:
Graham Alvare, Brian Fristensky
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  Sequence[] clipboard
          Global clipboard used for copy, cut, and paste
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 java.awt.Font DEFAULT_FONT
          The default font for BioLegato
static int DOUBLE_CLICK_TIME
          The amount of time between clicks to be considered a double click.
protected  SeqDoc mainSeqDoc
          The main data container for BioLegato.
static java.lang.String PROGRAM_DIR
          This constant is set to the path of BioLegato.jar The value of this constant determined at runtime.
protected  BLProperties properties
          Stores the properties for BioLegato.
static long serialVersionUID
          This constant is used for Serialization
static java.lang.String VERSION
          This constant is used to keep track of version changes.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProgramWindow(java.lang.String[] args)
          Creates a new instance of ProgramWindow.
 
Method Summary
 void aboutPopup()
          Displays an about popup for BioLegato.
 void addData(Sequence[] dataAdd)
          Adds the data to the canvas.
 javax.swing.JMenu addMenuHeading(int order, java.lang.String name)
          Adds a menu heading (JMenu) to our menu (BLMenu).
 javax.swing.JMenu addMenuHeading(java.lang.String name)
          Adds a menu heading (JMenu) to our menu (BLMenu).
 void addMenuItem(java.lang.String headingName, javax.swing.JMenuItem menuItem)
          Adds a menu item (JMenuItem) to a menu heading (JMenu) within the window (ProgramWindow)
 void addPropertiesListener(java.lang.String key, PropertiesListener listener)
          Adds a properties listener to the properties object.
 Sequence[] getAllData()
          Returns the complete contents of the data in the canvas.
 Sequence[] getClipboard()
          Obtains the current contents of the clipboard.
 Sequence[] getData()
          Returns the current/selected data in the canvas.
 java.lang.String getProperty(java.lang.String property)
          Retrieves individual settings for BioLegato.
 SeqDoc getSeqDoc()
          Returns the root sequence document for BioLegato.
 java.lang.Process safeExecute(java.lang.String cmd)
          Ensures that the command will be executed properly as a shell command
 void setClipboard(Sequence[] copy)
          Changes the current contents of the clipboard.
 void setProperty(java.lang.String key, java.lang.String value)
          Changes properties for BioLegato.
 void shellCommand(java.lang.String cmd, java.lang.String data)
          Runs simple shell commands.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

properties

protected BLProperties properties
Stores the properties for BioLegato. See BLProperties for a list of properties intrinsic to BioLegato.


mainSeqDoc

protected SeqDoc mainSeqDoc
The main data container for BioLegato. This stores all data and sequences used by the program.


clipboard

protected Sequence[] clipboard
Global clipboard used for copy, cut, and paste


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

DEFAULT_FONT

public static final java.awt.Font DEFAULT_FONT
The default font for BioLegato


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

serialVersionUID

public static final long serialVersionUID
This constant is used for Serialization

See Also:
Constant Field Values
Constructor Detail

ProgramWindow

public ProgramWindow(java.lang.String[] args)
Creates a new instance of ProgramWindow.

Parameters:
args - the command line arguments for BioLegato.
Method Detail

safeExecute

public java.lang.Process safeExecute(java.lang.String cmd)
Ensures that the command will be executed properly as a shell command

This function generates a command list for execution. The command list will contain the appropriate shell for the current operating system, followed by the "execution-argument", (whatever flag is required to tell the shell that the rest of the commandline should be executed by the shell), followed by the command to execute (the variable cmd)

Operating system values obtained from http://lopica.sourceforge.net/os.html

Parameters:
cmd - the command string to execute
Returns:
if successful a Process object for the executed command.

shellCommand

public 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)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Changes properties for BioLegato.

Parameters:
key - the property to change.
value - the new value for the property.

getProperty

public 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

setClipboard

public void setClipboard(Sequence[] copy)
Changes the current contents of the clipboard.

Parameters:
copy - the new content for the clipboard.

getClipboard

public Sequence[] getClipboard()
Obtains the current contents of the clipboard.

Returns:
the current contents of the clipboard.

getSeqDoc

public SeqDoc getSeqDoc()
Returns the root sequence document for BioLegato.

Returns:
the root sequence document.

getData

public Sequence[] getData()
                   throws javax.swing.text.BadLocationException
Returns the current/selected data in the canvas.

Returns:
the current data for usage by commands
Throws:
javax.swing.text.BadLocationException - any exceiptions related to obtaining the data

getAllData

public Sequence[] getAllData()
                      throws javax.swing.text.BadLocationException
Returns the complete contents of the data in the canvas.

Returns:
the complete contents of the data in the canvas
Throws:
javax.swing.text.BadLocationException - any location exceptions thrown by the underlying Document class

addData

public void addData(Sequence[] dataAdd)
             throws javax.swing.text.BadLocationException
Adds the data to the canvas.

Parameters:
dataAdd - the data to add to the canvas.
Throws:
javax.swing.text.BadLocationException - any exceptions thrown by the underlying document class

addMenuHeading

public 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 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 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.

aboutPopup

public void aboutPopup()
Displays an about popup for BioLegato.


addPropertiesListener

public void addPropertiesListener(java.lang.String key,
                                  PropertiesListener listener)
Adds a properties listener to the properties object.

Parameters:
key - the key of the properties to listen to.
listener - the listener to add to the object.

BioLegato 0.5.7

Copyright © 2008-2009 University of Manitoba.