ikayaki.gui
Class MainViewPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ikayaki.gui.ProjectComponent
                      extended by ikayaki.gui.MainViewPanel
All Implemented Interfaces:
MeasurementListener, ProjectListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class MainViewPanel
extends ProjectComponent

Creates the main view panels (split panels) and Squid and Project components. It also tells everybody if the current project is changed.

Author:
Esko Luontola
See Also:
Serialized Form

Nested Class Summary
private  class MainViewPanel.NewProjectFileChooser
          Customized JFileChooser for the use of getNewProjectAction().
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  Action aboutAction
           
private  CalibrationPanel calibrationPanel
           
private  Action deviceSettingsAction
           
private static int DIVIDER_DEFAULT_LOCATION
           
private static int DIVIDER_SIZE
           
private  Action exitAction
           
private  Action exportProjectToDATAction
           
private  Action exportProjectToDTDAction
           
private  Action exportProjectToSRMAction
           
private  Action helpAction
           
private  Project latestMeasuringProject
          Project which has had the latest measurement, or null if no measurements have been made..
private  MeasurementControlsPanel measurementControlsPanel
           
private  MeasurementDetailsPanel measurementDetailsPanel
           
private  MeasurementGraphsPanel measurementGraphsPanel
           
private  MeasurementSequencePanel measurementSequencePanel
           
private  MainMenuBar menuBar
           
private  Action newProjectAction
           
private  Action openProjectAction
           
private  Action printAction
           
private  Action printPreviewAction
           
private  Action programSettingsAction
           
private  Project project
          Currently opened project, or null of no project is open.
private  ProjectExplorerPanel projectExplorerPanel
           
private  ProjectInformationPanel projectInformationPanel
           
private  JSplitPane splitPane
           
private  Squid squid
          Front-end for controlling the SQUID.
private  MainStatusBar statusBar
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainViewPanel(Project project)
          Loads default view and creates all components and panels.
 
Method Summary
 void createProject(File file, Project.Type type)
          Creates a project file and tries to set it as the active project.
 void exitProgram()
          Tries to exit the program.
 void exportProject(Project project, String type, File output)
          Opens a file chooser and exports the project to a different file format.
 Action getAboutAction()
           
 CalibrationPanel getCalibrationPanel()
           
 Action getDeviceSettingsAction()
           
 Action getExitAction()
           
 Action getExportProjectToDATAction()
           
 Action getExportProjectToSRMAction()
           
 Action getExportProjectToTDTAction()
           
 Action getHelpAction()
           
 MeasurementControlsPanel getMeasurementControlsPanel()
           
 MeasurementDetailsPanel getMeasurementDetailsPanel()
           
 MeasurementGraphsPanel getMeasurementGraphsPanel()
           
 MeasurementSequencePanel getMeasurementSequencePanel()
           
 MainMenuBar getMenuBar()
           
 Action getNewProjectAction()
           
 Action getOpenProjectAction()
           
 Action getPrintAction()
           
 Action getPrintPreviewAction()
           
 Action getProgramSettingsAction()
           
 Project getProject()
          Returns the active project, or null if no project is active.
 ProjectExplorerPanel getProjectExplorerPanel()
           
 ProjectInformationPanel getProjectInformationPanel()
           
 Squid getSquid()
          Returns the Squid instance used for communicating with the hardware, or null if the connection has not yet been fully initialized.
 MainStatusBar getStatusBar()
           
 void loadProject(File file)
          Loads a project file and tries to set it as the active project.
 void projectUpdated(ProjectEvent event)
          Keeps track of which project has a measurement running.
 void setProject(Project project)
          Loads a new project to all GUI components.
 void setSquid(Squid squid)
          Sets the fully initialized Squid interface for the use of the program.
 
Methods inherited from class ikayaki.gui.ProjectComponent
getParentFrame, measurementUpdated
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIVIDER_DEFAULT_LOCATION

private static final int DIVIDER_DEFAULT_LOCATION
See Also:
Constant Field Values

DIVIDER_SIZE

private static final int DIVIDER_SIZE
See Also:
Constant Field Values

squid

private Squid squid
Front-end for controlling the SQUID. Only one project at a time may have access to the SQUID.


project

private Project project
Currently opened project, or null of no project is open.


latestMeasuringProject

private Project latestMeasuringProject
Project which has had the latest measurement, or null if no measurements have been made..


menuBar

private MainMenuBar menuBar

statusBar

private MainStatusBar statusBar

splitPane

private JSplitPane splitPane

projectExplorerPanel

private ProjectExplorerPanel projectExplorerPanel

calibrationPanel

private CalibrationPanel calibrationPanel

projectInformationPanel

private ProjectInformationPanel projectInformationPanel

measurementSequencePanel

private MeasurementSequencePanel measurementSequencePanel

measurementControlsPanel

private MeasurementControlsPanel measurementControlsPanel

measurementDetailsPanel

private MeasurementDetailsPanel measurementDetailsPanel

measurementGraphsPanel

private MeasurementGraphsPanel measurementGraphsPanel

newProjectAction

private Action newProjectAction

openProjectAction

private Action openProjectAction

exportProjectToDATAction

private Action exportProjectToDATAction

exportProjectToDTDAction

private Action exportProjectToDTDAction

exportProjectToSRMAction

private Action exportProjectToSRMAction

printAction

private Action printAction

printPreviewAction

private Action printPreviewAction

exitAction

private Action exitAction

programSettingsAction

private Action programSettingsAction

deviceSettingsAction

private Action deviceSettingsAction

helpAction

private Action helpAction

aboutAction

private Action aboutAction
Constructor Detail

MainViewPanel

public MainViewPanel(Project project)
Loads default view and creates all components and panels. Splitpanel between Calibration, Explorer, Information and rest.

Parameters:
project - the project to be opened, or null to open the last known project.
Method Detail

getSquid

public Squid getSquid()
Returns the Squid instance used for communicating with the hardware, or null if the connection has not yet been fully initialized.


setSquid

public void setSquid(Squid squid)
Sets the fully initialized Squid interface for the use of the program. Sets the active project the owner of the squid by re-setting the active project.

Parameters:
squid - an instance of the Squid.
Throws:
NullPointerException - if squid is null.
IllegalStateException - if the squid has already been set.

getProject

public Project getProject()
Returns the active project, or null if no project is active.

Overrides:
getProject in class ProjectComponent

setProject

public void setProject(Project project)
Loads a new project to all GUI components. This method will be called by the Project Explorer and Calibration panels. It is possible to reopen the same project, in which case all GUI components will as well be updated.

Overrides:
setProject in class ProjectComponent
Parameters:
project - the project to be opened, or null to close the previous one.

projectUpdated

public void projectUpdated(ProjectEvent event)
Keeps track of which project has a measurement running.

Specified by:
projectUpdated in interface ProjectListener
Overrides:
projectUpdated in class ProjectComponent
Parameters:
event - ProjectEvent received.

exitProgram

public void exitProgram()
Tries to exit the program. Will do nothing if a measurement is running. Saves all settings and project files before exiting.


loadProject

public void loadProject(File file)
Loads a project file and tries to set it as the active project. Will show an error dialog if operation failed.

Parameters:
file - the project file to be loaded.
Throws:
NullPointerException - if file is null.

createProject

public void createProject(File file,
                          Project.Type type)
Creates a project file and tries to set it as the active project. Will show an error dialog if operation failed.

Parameters:
file - the project file to be created.
type - the type of the project.
Throws:
NullPointerException - if file or type is null.

exportProject

public void exportProject(Project project,
                          String type,
                          File output)
Opens a file chooser and exports the project to a different file format.

Parameters:
project - the project to be exported.
type - the type of file to export from the current project.
output - the file to write to, or null to open a file chooser.
Throws:
NullPointerException - if type or the current project is null.
IllegalArgumentException - if type is not "dat", "tdt" or "srm".

getMenuBar

public MainMenuBar getMenuBar()

getStatusBar

public MainStatusBar getStatusBar()

getMeasurementGraphsPanel

public MeasurementGraphsPanel getMeasurementGraphsPanel()

getMeasurementDetailsPanel

public MeasurementDetailsPanel getMeasurementDetailsPanel()

getMeasurementControlsPanel

public MeasurementControlsPanel getMeasurementControlsPanel()

getMeasurementSequencePanel

public MeasurementSequencePanel getMeasurementSequencePanel()

getProjectInformationPanel

public ProjectInformationPanel getProjectInformationPanel()

getCalibrationPanel

public CalibrationPanel getCalibrationPanel()

getProjectExplorerPanel

public ProjectExplorerPanel getProjectExplorerPanel()

getNewProjectAction

public Action getNewProjectAction()

getOpenProjectAction

public Action getOpenProjectAction()

getExportProjectToDATAction

public Action getExportProjectToDATAction()

getExportProjectToTDTAction

public Action getExportProjectToTDTAction()

getExportProjectToSRMAction

public Action getExportProjectToSRMAction()

getPrintAction

public Action getPrintAction()

getPrintPreviewAction

public Action getPrintPreviewAction()

getExitAction

public Action getExitAction()

getProgramSettingsAction

public Action getProgramSettingsAction()

getDeviceSettingsAction

public Action getDeviceSettingsAction()

getHelpAction

public Action getHelpAction()

getAboutAction

public Action getAboutAction()