PamView
Class PamGui

java.lang.Object
  extended by PamView.PamView
      extended by PamView.PamGui
All Implemented Interfaces:
java.awt.event.WindowListener, java.util.EventListener, PamSettings, PamViewInterface

public class PamGui
extends PamView
implements java.awt.event.WindowListener, PamSettings

Author:
Doug Gillespie

Simple PamGui implementing a tab control.


Nested Class Summary
(package private)  class PamGui.GUIComponentListener
           
(package private)  class PamGui.menuAbout
           
(package private)  class PamGui.menuArray
           
(package private)  class PamGui.menuCoreHelp
           
(package private)  class PamGui.MenuDataSave
           
(package private)  class PamGui.menuExit
           
(package private)  class PamGui.menuExportSettings
           
(package private)  class PamGui.menuImportSettings
           
(package private)  class PamGui.menuLoadSettings
           
(package private)  class PamGui.menuModuleOrder
           
(package private)  class PamGui.MenuMultiThreading
           
(package private)  class PamGui.menuOpenLogFile
           
(package private)  class PamGui.MenuPamguardURL
           
(package private)  class PamGui.menuPamStart
           
(package private)  class PamGui.menuPamStop
           
(package private)  class PamGui.menuSave
           
(package private)  class PamGui.menuSaveAs
           
(package private)  class PamGui.menuShowObjectDiagram
           
(package private)  class PamGui.menuShowObjectList
           
(package private)  class PamGui.MenuXMLExport
           
(package private)  class PamGui.PerformanceTests
           
(package private)  class PamGui.tabListener
           
(package private)  class PamGui.TestMenuHelpPG
           
(package private)  class PamGui.TipMenu
           
 
Field Summary
private  MenuItemEnabler addModuleEnabler
           
(package private)  BusyLayeredPane busyPane
           
(package private)  javax.swing.JMenu fileMenu
          Makes a standard GUI menu for the display which will include add ins taken from the varous PamControlledUnits.
(package private)  boolean gpsSimActive
           
private  GuiParameters guiParameters
           
private  boolean initializationComplete
           
private  javax.swing.JPanel mainPanel
           
private  PamTabbedPane mainTab
           
(package private)  javax.swing.JMenuBar menuBar
           
private  MenuItemEnabler orderModulesEnabler
           
private  MenuItemEnabler removeModuleEnabler
           
private  javax.swing.JScrollPane scrollingSidePanel
           
private  javax.swing.JPanel sidePanel
           
private static boolean somethingShowing
           
private  MenuItemEnabler startMenuEnabler
           
private  MenuItemEnabler stopMenuEnabler
           
private static java.awt.Rectangle virtualBounds
          Static for getScreenBounds.
 
Fields inherited from class PamView.PamView
frame, pamControllerInterface, pamModelInterface
 
Constructor Summary
PamGui(PamControllerInterface pamControllerInterface, PamModelInterface pamModelInterface, int frameNumber)
           
 
Method Summary
 void addControlledUnit(PamControlledUnit unit)
           
private  void changeSidePanelOrder()
           
private  void changeTabOrder()
           
private  void changeUnitOrder()
           
private  void closeExtraFrame()
          Get's called if an extra frame is closed.
 void enableGUIControl(boolean enable)
           
private  void enableLoggingMenu()
           
private  void enableMenus()
          Rewrote the menu enablers for the Logging menu (and made it more general to extend to other menus shoule they ever need to be anabled.
(package private)  PamControlledUnit findControlledUnit(int tabNo)
           
private  javax.swing.JMenuBar getDummyMenuBar()
          Makes a dummy menu bar with some text in it which is displayed as PAMGUARD is first starting up
protected  void getGuiParameters()
          Get the GUi parameters before saving so that these can be written to the psf file, even if the Window was previouslu closed.
 PamTabbedPane getMainTab()
           
private  java.lang.String getModeName()
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
private  java.lang.String getTabTipText()
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
 java.lang.String getViewName()
           
static boolean isSomethingShowing()
          Static flag to say that at least one GUI has opened.
 javax.swing.JMenuBar makeGuiMenu()
           
 void modelChanged(int changeType)
           
static void openURL(java.lang.String urlString)
           
 void pamEnded()
          opens a url.
 void pamStarted()
           
private  boolean prepareToClose()
          this get's called whenever the main window closes - ideally, I'd like to stop this happening when the system is running, but since that's not possible, just make sure everything has stopped.
 void removeControlledUnit(PamControlledUnit unit)
           
 void renameControlledUnit(PamControlledUnit unit)
           
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 void setTitle(java.lang.String title)
           
 void showControlledUnit(PamControlledUnit pamControlledUnit)
          tells the view to show the main display panel of a pamControlledUnit
 void showDialog(java.lang.String s1, java.lang.String s2, int dialogType)
           
private  void showSidePanel()
           
 void ShowTabSpecificSettings()
          Set up specific settings for the tab - get's called quite a lot, including whenever modules are added or removed in order to make sure that menus contain the correct options for existing modules.
 void windowActivated(java.awt.event.WindowEvent e)
          Implementation of WindowListener
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class PamView.PamView
getFrameNumber, getGuiFrame, setFrameNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gpsSimActive

boolean gpsSimActive

mainPanel

private javax.swing.JPanel mainPanel

mainTab

private PamTabbedPane mainTab

sidePanel

private javax.swing.JPanel sidePanel

scrollingSidePanel

private javax.swing.JScrollPane scrollingSidePanel

initializationComplete

private boolean initializationComplete

guiParameters

private GuiParameters guiParameters

startMenuEnabler

private MenuItemEnabler startMenuEnabler

stopMenuEnabler

private MenuItemEnabler stopMenuEnabler

addModuleEnabler

private MenuItemEnabler addModuleEnabler

removeModuleEnabler

private MenuItemEnabler removeModuleEnabler

orderModulesEnabler

private MenuItemEnabler orderModulesEnabler

somethingShowing

private static volatile boolean somethingShowing

virtualBounds

private static java.awt.Rectangle virtualBounds
Static for getScreenBounds.


fileMenu

javax.swing.JMenu fileMenu
Makes a standard GUI menu for the display which will include add ins taken from the varous PamControlledUnits.


menuBar

javax.swing.JMenuBar menuBar

busyPane

BusyLayeredPane busyPane
Constructor Detail

PamGui

public PamGui(PamControllerInterface pamControllerInterface,
              PamModelInterface pamModelInterface,
              int frameNumber)
Method Detail

isSomethingShowing

public static boolean isSomethingShowing()
Static flag to say that at least one GUI has opened.

Returns:
true when one or more GUI frames are visible.

getModeName

private java.lang.String getModeName()

getDummyMenuBar

private javax.swing.JMenuBar getDummyMenuBar()
Makes a dummy menu bar with some text in it which is displayed as PAMGUARD is first starting up

Returns:
dummy Menu.

addControlledUnit

public void addControlledUnit(PamControlledUnit unit)
Specified by:
addControlledUnit in interface PamViewInterface

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface PamViewInterface

getTabTipText

private java.lang.String getTabTipText()

removeControlledUnit

public void removeControlledUnit(PamControlledUnit unit)
Specified by:
removeControlledUnit in interface PamViewInterface

renameControlledUnit

public void renameControlledUnit(PamControlledUnit unit)
Specified by:
renameControlledUnit in class PamView

findControlledUnit

PamControlledUnit findControlledUnit(int tabNo)

ShowTabSpecificSettings

public void ShowTabSpecificSettings()
Set up specific settings for the tab - get's called quite a lot, including whenever modules are added or removed in order to make sure that menus contain the correct options for existing modules.


makeGuiMenu

public javax.swing.JMenuBar makeGuiMenu()

enableMenus

private void enableMenus()
Rewrote the menu enablers for the Logging menu (and made it more general to extend to other menus shoule they ever need to be anabled. This arises now that we have multiple main menus on the frame depending on which tab is being viewed. Since each menu bar has references to different menus and menu items, we can no lnger use the ones set in the constuctors for the menu. Each item is therefore found by name before it's enabled. For now I'm taking the names out of the reference to the last menu item.


enableLoggingMenu

private void enableLoggingMenu()

openURL

public static void openURL(java.lang.String urlString)

pamEnded

public void pamEnded()
opens a url. Copied from http://www.centerkey.com/java/browser/

Specified by:
pamEnded in interface PamViewInterface
Parameters:
url - url to open

pamStarted

public void pamStarted()
Specified by:
pamStarted in interface PamViewInterface

modelChanged

public void modelChanged(int changeType)
Specified by:
modelChanged in interface PamViewInterface

changeUnitOrder

private void changeUnitOrder()

changeTabOrder

private void changeTabOrder()

changeSidePanelOrder

private void changeSidePanelOrder()

showSidePanel

private void showSidePanel()

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Implementation of WindowListener

Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

getGuiParameters

protected void getGuiParameters()
Get the GUi parameters before saving so that these can be written to the psf file, even if the Window was previouslu closed.


prepareToClose

private boolean prepareToClose()
this get's called whenever the main window closes - ideally, I'd like to stop this happening when the system is running, but since that's not possible, just make sure everything has stopped.

Returns:
true if ok to close, false otherwise.

closeExtraFrame

private void closeExtraFrame()
Get's called if an extra frame is closed. Moves all tabs back to the main frame then closes itself.


showDialog

public void showDialog(java.lang.String s1,
                       java.lang.String s2,
                       int dialogType)

showControlledUnit

public void showControlledUnit(PamControlledUnit pamControlledUnit)
Description copied from class: PamView
tells the view to show the main display panel of a pamControlledUnit

Specified by:
showControlledUnit in interface PamViewInterface
Specified by:
showControlledUnit in class PamView

getViewName

public java.lang.String getViewName()
Specified by:
getViewName in class PamView

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Returns:
An integer version number for the settings

getUnitName

public java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

public java.lang.String getUnitType()
Specified by:
getUnitType in interface PamSettings
Returns:
A Name specific to the type, e.g. Glick detector

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required

getMainTab

public PamTabbedPane getMainTab()

enableGUIControl

public void enableGUIControl(boolean enable)
Specified by:
enableGUIControl in interface PamViewInterface