edu.jhu.ece.iacl.jist.pipeline
Class ProcessingDialog

java.lang.Object
  extended by JDialogScriptableBase
      extended by edu.jhu.ece.iacl.jist.pipeline.ProcessingDialog
All Implemented Interfaces:
ParamViewObserver, java.awt.event.ComponentListener, java.util.EventListener
Direct Known Subclasses:
ProcessingGroupDialog

public class ProcessingDialog
extends JDialogScriptableBase
implements ParamViewObserver, java.awt.event.ComponentListener

 
 Processing Dialog is a generic class that replaces all MIPAV plug-in dialogs
 The dialogs are auto-generated based on the input and output parameters.
 
 This class should not be extended. Any changes to this class will appear
 globally across all plug-ins.
 
 

Author:
Blake Lucas

Field Summary
protected  ProcessingAlgorithm algorithm
          processing algorithm
protected  javax.swing.JPanel buttonPanel
          Panel for pushing buttons.
protected  ParamInputView inputView
          View for input parameters.
protected  ParamOutputView outputView
          View for output parameters.
protected static java.util.regex.Pattern paramInfoRegex
          Regular expression to find parameter information in a string *.
protected static java.lang.String paramListDelimiter
          Delimeter used for parameters *.
protected  ViewJFrameBase parentFrame
          parent MIPAV frame.
protected static long serialVersionUID
          The Constant serialVersionUID.
 
Constructor Summary
ProcessingDialog()
          Empty constructor needed for dynamic instantiation.
ProcessingDialog(ProcessingAlgorithm algorithm)
          Constructor creates input and output parameters from algorithm and uses the algorithm name as title.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Handle action events.
 void algorithmPerformed(AlgorithmBase algo)
          Handle the termination of the algorithm.
protected  javax.swing.JPanel buildInputButtons()
          Build buttons that will appear on input pane.
protected  javax.swing.JPanel buildOutputButtons()
          Build buttons that will appear on output pane.
 void callAlgorithm()
          Start the algorithm; but first, save the input parameters as defaults.
 void clickClose()
          Handle event when user clicks "Close".
 boolean clickOk()
          Handle event when user clicks "OK".
 boolean clickOpen(java.io.File file)
          Handle event when user clicks "Open".
 void clickSaveAll(java.io.File saveDir)
          Handle event when user clicks "Save Parameters and Resources".
 void clickSaveDefinition(java.io.File saveFile)
          Handle event when user clicks "Save As Module Definition".
 void clickSaveInput(java.io.File saveFile)
          Handle event when user clicks "Save As Algorithm Input".
 void componentHidden(java.awt.event.ComponentEvent arg0)
           
 void componentMoved(java.awt.event.ComponentEvent arg0)
           
 void componentResized(java.awt.event.ComponentEvent event)
          Shameless hack to circumvent bug in linux implementation that prevents window from being resized.
 void componentShown(java.awt.event.ComponentEvent arg0)
           
protected  void createInputDialog()
          Create input dialog frame from input parameters.
 javax.swing.JMenuBar createInputMenuBar()
          Create menubar for input pane.
 void dispose()
          Dispose of dialog.
protected  void doPostAlgorithmActions()
          Store result images in script runner.
 ParamInputView getInputView()
          Get input view.
 ParamOutputView getOutputView()
          Get output view.
 ViewJFrameBase getParentFrame()
          Get parent frame for Mipav.
 void init(java.io.File pipeFile)
          Initialize parameters and algorithm from file.
 void init(PipeAlgorithm pipe)
          Initialize parameter and algorithm from existing algorithm.
 boolean load(java.io.File file)
          Loads algorithm input profile from specified location into input parameters.
 void loadDefaults()
          Load defaults from MIPAV preferences.
protected  boolean saveAll(java.io.File saveDir)
          Save all input and output parameters and their external resources.
 void saveDefaults()
          Saves input dialog settings to XML file.
protected  boolean saveInput(java.io.File saveFile)
          Save all input parameters to specified file.
protected  boolean saveInputBeforeRun()
          Save all input params after run so that inputs can be checked for current consistency 2009.06.21 DO NOT SAVE INPUTs after run
protected  java.io.File selectSaveDirectory()
          Open dialog to specify output directory for parameters.
protected  void setGUIFromParams()
          Set up the dialog GUI based on the parameters before running the algorithm as part of a script.
 void setOutputDirectory(java.io.File f)
          Set directory to store output results.
 void setParentFrame(ViewJFrameBase parentFrame)
          Set parent MIPAV frame.
 void start()
          Start dialog with input parameters from algorithm.
protected  void storeParamsFromGUI()
          Store the parameters from the dialog to record the execution of this algorithm.
 void update(ParamModel model, ParamInputView view)
          An update to the parameters occurred.
 void windowClosing(java.awt.event.WindowEvent e)
          Make sure all threads shutdown when window is closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The Constant serialVersionUID.

See Also:
Constant Field Values

paramInfoRegex

protected static final java.util.regex.Pattern paramInfoRegex
Regular expression to find parameter information in a string *.


paramListDelimiter

protected static final java.lang.String paramListDelimiter
Delimeter used for parameters *.

See Also:
Constant Field Values

inputView

protected ParamInputView inputView
View for input parameters.


outputView

protected ParamOutputView outputView
View for output parameters.


parentFrame

protected ViewJFrameBase parentFrame
parent MIPAV frame.


algorithm

protected ProcessingAlgorithm algorithm
processing algorithm


buttonPanel

protected javax.swing.JPanel buttonPanel
Panel for pushing buttons.

Constructor Detail

ProcessingDialog

public ProcessingDialog()
Empty constructor needed for dynamic instantiation.


ProcessingDialog

public ProcessingDialog(ProcessingAlgorithm algorithm)
Constructor creates input and output parameters from algorithm and uses the algorithm name as title.

Parameters:
algorithm - the algorithm
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Handle action events.

Parameters:
event - dialog events

algorithmPerformed

public void algorithmPerformed(AlgorithmBase algo)
Handle the termination of the algorithm. Open image viewers for ModelImage resources associated with the output parameters

Parameters:
algo - algorithm

buildInputButtons

protected javax.swing.JPanel buildInputButtons()
Build buttons that will appear on input pane.

Returns:
the j panel

buildOutputButtons

protected javax.swing.JPanel buildOutputButtons()
Build buttons that will appear on output pane.

Returns:
the j panel

callAlgorithm

public void callAlgorithm()
Start the algorithm; but first, save the input parameters as defaults. Run algorithm as minimum priority thread.


clickClose

public void clickClose()
Handle event when user clicks "Close".


clickOk

public boolean clickOk()
Handle event when user clicks "OK".

Returns:
true, if click ok

clickOpen

public boolean clickOpen(java.io.File file)
Handle event when user clicks "Open".

Parameters:
file - the file
Returns:
true, if click open

clickSaveAll

public void clickSaveAll(java.io.File saveDir)
Handle event when user clicks "Save Parameters and Resources".

Parameters:
saveDir - the save dir

clickSaveDefinition

public void clickSaveDefinition(java.io.File saveFile)
Handle event when user clicks "Save As Module Definition".

Parameters:
saveFile - the save file

clickSaveInput

public void clickSaveInput(java.io.File saveFile)
Handle event when user clicks "Save As Algorithm Input".

Parameters:
saveFile - the save file

componentHidden

public void componentHidden(java.awt.event.ComponentEvent arg0)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent arg0)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent event)
Shameless hack to circumvent bug in linux implementation that prevents window from being resized.

Specified by:
componentResized in interface java.awt.event.ComponentListener
Parameters:
event - the event

componentShown

public void componentShown(java.awt.event.ComponentEvent arg0)
Specified by:
componentShown in interface java.awt.event.ComponentListener

createInputDialog

protected void createInputDialog()
Create input dialog frame from input parameters.


createInputMenuBar

public javax.swing.JMenuBar createInputMenuBar()
Create menubar for input pane.

Returns:
menu bar

dispose

public void dispose()
Dispose of dialog.


doPostAlgorithmActions

protected void doPostAlgorithmActions()
Store result images in script runner. Removed - script runner declared a hack. will be repared at a future time


getInputView

public ParamInputView getInputView()
Get input view.

Returns:
input view

getOutputView

public ParamOutputView getOutputView()
Get output view.

Returns:
output view

getParentFrame

public ViewJFrameBase getParentFrame()
Get parent frame for Mipav.

Returns:
parent frame

init

public void init(java.io.File pipeFile)
Initialize parameters and algorithm from file.

Parameters:
pipeFile - pipe file

init

public void init(PipeAlgorithm pipe)
Initialize parameter and algorithm from existing algorithm.

Parameters:
pipe - algorithm

load

public boolean load(java.io.File file)
Loads algorithm input profile from specified location into input parameters.

Parameters:
file - the file
Returns:
true if successful

loadDefaults

public void loadDefaults()
Load defaults from MIPAV preferences.


saveAll

protected boolean saveAll(java.io.File saveDir)
Save all input and output parameters and their external resources. 2009.06.21 DO NOT SAVE INPUTs after run

Parameters:
saveDir - the save dir
Returns:
save completed successfully

saveInputBeforeRun

protected boolean saveInputBeforeRun()
Save all input params after run so that inputs can be checked for current consistency 2009.06.21 DO NOT SAVE INPUTs after run

Parameters:
saveDir - the save dir
Returns:
save completed successfully

saveDefaults

public void saveDefaults()
Saves input dialog settings to XML file. This method does not save the external associated resources for the input parameters.


saveInput

protected boolean saveInput(java.io.File saveFile)
Save all input parameters to specified file.

Parameters:
saveFile - the save file
Returns:
save completed successfully

selectSaveDirectory

protected java.io.File selectSaveDirectory()
Open dialog to specify output directory for parameters.

Returns:
the file

setGUIFromParams

protected void setGUIFromParams()
Set up the dialog GUI based on the parameters before running the algorithm as part of a script.


setOutputDirectory

public void setOutputDirectory(java.io.File f)
Set directory to store output results.

Parameters:
f - output directory

setParentFrame

public void setParentFrame(ViewJFrameBase parentFrame)
Set parent MIPAV frame.

Parameters:
parentFrame - the parent frame

start

public void start()
Start dialog with input parameters from algorithm.


storeParamsFromGUI

protected void storeParamsFromGUI()
                           throws ParserException
Store the parameters from the dialog to record the execution of this algorithm.

Throws:
ParserException - If there is a problem creating one of the new parameters.

update

public void update(ParamModel model,
                   ParamInputView view)
An update to the parameters occurred.

Specified by:
update in interface ParamViewObserver
Parameters:
model - parameter
view - input view

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Make sure all threads shutdown when window is closed.

Parameters:
e - window event