Package gov.nih.mipav.view.dialogs
Class JDialogRunScriptView
- java.lang.Object
-
- gov.nih.mipav.view.dialogs.JDialogRunScriptView
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
,javax.swing.event.ListSelectionListener
public class JDialogRunScriptView extends java.lang.Object implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener
- Version:
- 0.1 May 24, 2006
- Author:
- Nathan Pollack -- Contractor (SSAI)
- See Also:
JDialogRunScriptController
,JDialogRunScriptModel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
JDialogRunScriptView.ArrayListTransferHandler
Transfer handler used for dragging the images and vois into the tree.private class
JDialogRunScriptView.CustomCellRenderer
DOCUMENT ME!private class
JDialogRunScriptView.DropJListTarget
DOCUMENT ME!private class
JDialogRunScriptView.DropJTreeTarget
Class used to handle the dragging/dropping of images/vois into the script tree.private class
JDialogRunScriptView.PopupListener
private class
JDialogRunScriptView.TreeMouseAdapter
DOCUMENT ME!private class
JDialogRunScriptView.TreeMouseDragAdapter
DOCUMENT ME!private class
JDialogRunScriptView.TreeRenderer
***************************************************************************************************** Inner classes to follow************************************************************************************************ ***** protected class ModelImageForScripting{ ModelImage modelImage; ModelImageForScripting(ModelImage modelImage){ this.modelImage = modelImage; } public ModelImage getModelImage(){ return this.modelImage; } public String toString(){ return modelImage.getImageName(); } }.
-
Field Summary
Fields Modifier and Type Field Description private int
centralBuffer
DOCUMENT ME!private java.awt.Container
contentPane
DOCUMENT ME!private JDialogRunScriptController
controller
DOCUMENT ME!private int
dropSource
DOCUMENT ME!private java.util.Vector<java.lang.Object>
emptyVector
DOCUMENT ME!private javax.swing.JFrame
frame
DOCUMENT ME!private java.awt.Dimension
frame_size
DOCUMENT ME!private static int
IMAGE_DROP
DOCUMENT ME!private static java.lang.String
IMAGE_STR
Used for XML tag for an image.private javax.swing.JList
imageList
DOCUMENT ME!private static int
IMAGENODE
Image node type, falls under an imageplaceholder node, created and deleted by user.private static int
IMAGEPLACEHOLDERNODE
Image placeholder node type never created nor deleted by user.private javax.swing.SpringLayout
layout
DOCUMENT ME!private JDialogRunScriptModel
model
DOCUMENT ME!private static java.lang.String
PLACEHOLDER_STR
Used for XML tag for an image placeholder.private javax.swing.JPopupMenu
popup
Menu for setting raw infoprivate JDialogRunScriptView.PopupListener
popupListener
Listener to be added/removed depending on selection statusprivate ScriptTreeNode
root
DOCUMENT ME!private static int
ROOTNODE
Root node type.private static int
SCRIPTNODE
Script node type (Script)... only one and is only child of rootprivate int
scriptNodeChildCount
child count for script nodeprivate java.awt.Dimension
scroll_size
DOCUMENT ME!private int[]
selectedListIndicies
DOCUMENT ME!private javax.swing.JTree
tree
DOCUMENT ME!private java.awt.Dimension
tree_size
private Dimension initial_frame_size = new Dimension(725,800);.private javax.swing.JScrollPane
treeScroll
DOCUMENT ME!private static int
VOI_DROP
DOCUMENT ME!private static java.lang.String
VOI_EMPTY
DOCUMENT ME!private javax.swing.JList
voiList
Keep a reference to the VOI List to turn on and off if multiple images are selected.private static int
VOINODE
VOI node type, begins with VOI_EMPTY string and must be set if present before running of the script.
-
Constructor Summary
Constructors Constructor Description JDialogRunScriptView(JDialogRunScriptController controller, JDialogRunScriptModel model)
Creates a new JDialogRunScriptView object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
DOCUMENT ME!private void
addButton(java.lang.String buttonName)
***************************************************************************************************** Creating buttonsprivate void
addLabel(java.lang.String labelName)
***************************************************************************************************** Creating labelsprivate void
addScrollList(java.lang.String name)
DOCUMENT ME!private void
changeSize()
DOCUMENT ME!private void
createFrame()
Creates the JFrame.void
createScriptTree(java.lang.String[] imagePlaceHolders, java.lang.String[] imageLabels, java.lang.String[] imageActions, int[] numberofVOIs)
DOCUMENT ME!void
createScriptTree(org.w3c.dom.Document savedScript)
DOCUMENT ME!private void
displayView()
DOCUMENT ME!private void
expandAll(javax.swing.JTree tree, boolean expand)
DOCUMENT ME!private void
expandAll(javax.swing.JTree tree, javax.swing.tree.TreePath parent, boolean expand)
DOCUMENT ME!void
fillImagesVOIs(java.util.Vector<java.util.Vector<java.lang.String>> imageHolder, java.util.Vector<java.util.Vector<java.lang.String>> voiHolder)
Gets the list of images selected by the user in this dialog.javax.swing.JComponent
getComponentByName(java.lang.String name)
DOCUMENT ME!javax.swing.JFrame
getFrame()
***************************************************************************************************** Various util type functions.********************************************************************************************* ********javax.swing.JList
getImageList()
DOCUMENT ME!int
getScriptNodeChildCount()
Returns the number of child nodes the script node hasScriptTreeNode
getTreeRoot()
Method to return tree root.javax.swing.JList
getVOIList()
DOCUMENT ME!protected boolean
isTreeReadyForScriptExecution()
Checks tree to see that all place holders have been replaced with actual images and VOIs if not, it prompts the user with a warning message, and highlights the first node that still contains a placeholer.private static javax.swing.DefaultListModel
populateModel(java.lang.Object[] contents)
Scroll List Code.private ScriptTreeNode
populateScriptTree(java.lang.String[] imagePlaceHolders, java.lang.String[] imageLabels, java.lang.String[] imageActions, int[] numberofVOIs)
DOCUMENT ME!private ScriptTreeNode
restoreSavedExecuter(org.w3c.dom.Node executer)
Called when a script is loaded from disk.private void
setLayoutConstraints(java.awt.Component component)
DOCUMENT ME!private void
setSprings(java.awt.Component component, java.awt.Component northAnchor, java.awt.Component westAnchor, int northSpring, int westSprint)
***************************************************************************************************** Setting layout constraints.********************************************************************************************** *******void
update()
DOCUMENT ME!private void
updateNode(ScriptTreeNode node, java.lang.String text)
***************************************************************************************************** Methods to handle tree behavior********************************************************************************************* ******** updateNode, called when a node text needs to be changed.void
valueChanged(javax.swing.event.ListSelectionEvent e)
-
-
-
Field Detail
-
PLACEHOLDER_STR
private static final java.lang.String PLACEHOLDER_STR
Used for XML tag for an image placeholder.- See Also:
- Constant Field Values
-
IMAGE_STR
private static final java.lang.String IMAGE_STR
Used for XML tag for an image.- See Also:
- Constant Field Values
-
SCRIPTNODE
private static final int SCRIPTNODE
Script node type (Script)... only one and is only child of root- See Also:
- Constant Field Values
-
IMAGEPLACEHOLDERNODE
private static final int IMAGEPLACEHOLDERNODE
Image placeholder node type never created nor deleted by user.- See Also:
- Constant Field Values
-
IMAGENODE
private static final int IMAGENODE
Image node type, falls under an imageplaceholder node, created and deleted by user.- See Also:
- Constant Field Values
-
VOINODE
private static final int VOINODE
VOI node type, begins with VOI_EMPTY string and must be set if present before running of the script.- See Also:
- Constant Field Values
-
ROOTNODE
private static final int ROOTNODE
Root node type.- See Also:
- Constant Field Values
-
IMAGE_DROP
private static final int IMAGE_DROP
DOCUMENT ME!- See Also:
- Constant Field Values
-
VOI_DROP
private static final int VOI_DROP
DOCUMENT ME!- See Also:
- Constant Field Values
-
VOI_EMPTY
private static final java.lang.String VOI_EMPTY
DOCUMENT ME!- See Also:
- Constant Field Values
-
centralBuffer
private int centralBuffer
DOCUMENT ME!
-
contentPane
private java.awt.Container contentPane
DOCUMENT ME!
-
controller
private JDialogRunScriptController controller
DOCUMENT ME!
-
dropSource
private int dropSource
DOCUMENT ME!
-
emptyVector
private java.util.Vector<java.lang.Object> emptyVector
DOCUMENT ME!
-
frame
private javax.swing.JFrame frame
DOCUMENT ME!
-
frame_size
private java.awt.Dimension frame_size
DOCUMENT ME!
-
imageList
private javax.swing.JList imageList
DOCUMENT ME!
-
layout
private javax.swing.SpringLayout layout
DOCUMENT ME!
-
popup
private javax.swing.JPopupMenu popup
Menu for setting raw info
-
popupListener
private JDialogRunScriptView.PopupListener popupListener
Listener to be added/removed depending on selection status
-
model
private JDialogRunScriptModel model
DOCUMENT ME!
-
root
private ScriptTreeNode root
DOCUMENT ME!
-
scroll_size
private java.awt.Dimension scroll_size
DOCUMENT ME!
-
selectedListIndicies
private int[] selectedListIndicies
DOCUMENT ME!
-
tree
private javax.swing.JTree tree
DOCUMENT ME!
-
tree_size
private java.awt.Dimension tree_size
private Dimension initial_frame_size = new Dimension(725,800);.
-
treeScroll
private javax.swing.JScrollPane treeScroll
DOCUMENT ME!
-
voiList
private javax.swing.JList voiList
Keep a reference to the VOI List to turn on and off if multiple images are selected.
-
scriptNodeChildCount
private int scriptNodeChildCount
child count for script node
-
-
Constructor Detail
-
JDialogRunScriptView
public JDialogRunScriptView(JDialogRunScriptController controller, JDialogRunScriptModel model)
Creates a new JDialogRunScriptView object.- Parameters:
controller
- DOCUMENT ME!model
- DOCUMENT ME!
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
DOCUMENT ME!- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
e
- DOCUMENT ME!
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent e)
- Specified by:
valueChanged
in interfacejavax.swing.event.ListSelectionListener
-
createScriptTree
public void createScriptTree(org.w3c.dom.Document savedScript)
DOCUMENT ME!- Parameters:
savedScript
- DOCUMENT ME!
-
createScriptTree
public void createScriptTree(java.lang.String[] imagePlaceHolders, java.lang.String[] imageLabels, java.lang.String[] imageActions, int[] numberofVOIs)
DOCUMENT ME!- Parameters:
imagePlaceHolders
- DOCUMENT ME!imageLabels
- DOCUMENT ME!imageActions
- DOCUMENT ME!numberofVOIs
- DOCUMENT ME!
-
fillImagesVOIs
public void fillImagesVOIs(java.util.Vector<java.util.Vector<java.lang.String>> imageHolder, java.util.Vector<java.util.Vector<java.lang.String>> voiHolder)
Gets the list of images selected by the user in this dialog. Should be in the order that the images are used in the script.- Parameters:
imageHolder
- DOCUMENT ME!voiHolder
- DOCUMENT ME!
-
getComponentByName
public javax.swing.JComponent getComponentByName(java.lang.String name)
DOCUMENT ME!- Parameters:
name
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getFrame
public javax.swing.JFrame getFrame()
***************************************************************************************************** Various util type functions.********************************************************************************************* ********- Returns:
- DOCUMENT ME!
-
getImageList
public javax.swing.JList getImageList()
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getTreeRoot
public ScriptTreeNode getTreeRoot()
Method to return tree root.- Returns:
- DOCUMENT ME!
-
getVOIList
public javax.swing.JList getVOIList()
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getScriptNodeChildCount
public int getScriptNodeChildCount()
Returns the number of child nodes the script node has- Returns:
-
update
public void update()
DOCUMENT ME!
-
isTreeReadyForScriptExecution
protected boolean isTreeReadyForScriptExecution()
Checks tree to see that all place holders have been replaced with actual images and VOIs if not, it prompts the user with a warning message, and highlights the first node that still contains a placeholer.- Returns:
True
if all of the image and voi placeholders in all script executors have had images/vois assigned to them,false
otherwise.
-
populateModel
private static javax.swing.DefaultListModel populateModel(java.lang.Object[] contents)
Scroll List Code.- Parameters:
contents
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
addButton
private void addButton(java.lang.String buttonName)
***************************************************************************************************** Creating buttons.*****************************************************************************************************- Parameters:
buttonName
- DOCUMENT ME!
-
addLabel
private void addLabel(java.lang.String labelName)
***************************************************************************************************** Creating labels.*****************************************************************************************************- Parameters:
labelName
- DOCUMENT ME!
-
addScrollList
private void addScrollList(java.lang.String name)
DOCUMENT ME!- Parameters:
name
- DOCUMENT ME!
-
changeSize
private void changeSize()
DOCUMENT ME!
-
createFrame
private void createFrame()
Creates the JFrame.
-
displayView
private void displayView()
DOCUMENT ME!
-
expandAll
private void expandAll(javax.swing.JTree tree, boolean expand)
DOCUMENT ME!- Parameters:
tree
- DOCUMENT ME!expand
- DOCUMENT ME!
-
expandAll
private void expandAll(javax.swing.JTree tree, javax.swing.tree.TreePath parent, boolean expand)
DOCUMENT ME!- Parameters:
tree
- DOCUMENT ME!parent
- DOCUMENT ME!expand
- DOCUMENT ME!
-
populateScriptTree
private ScriptTreeNode populateScriptTree(java.lang.String[] imagePlaceHolders, java.lang.String[] imageLabels, java.lang.String[] imageActions, int[] numberofVOIs)
DOCUMENT ME!- Parameters:
imagePlaceHolders
- DOCUMENT ME!imageLabels
- DOCUMENT ME!imageActions
- DOCUMENT ME!numberofVOIs
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
restoreSavedExecuter
private ScriptTreeNode restoreSavedExecuter(org.w3c.dom.Node executer)
Called when a script is loaded from disk.- Parameters:
executer
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setLayoutConstraints
private void setLayoutConstraints(java.awt.Component component)
DOCUMENT ME!- Parameters:
component
- DOCUMENT ME!
-
setSprings
private void setSprings(java.awt.Component component, java.awt.Component northAnchor, java.awt.Component westAnchor, int northSpring, int westSprint)
***************************************************************************************************** Setting layout constraints.********************************************************************************************** *******- Parameters:
component
- DOCUMENT ME!northAnchor
- DOCUMENT ME!westAnchor
- DOCUMENT ME!northSpring
- DOCUMENT ME!westSprint
- DOCUMENT ME!
-
updateNode
private void updateNode(ScriptTreeNode node, java.lang.String text)
***************************************************************************************************** Methods to handle tree behavior********************************************************************************************* ******** updateNode, called when a node text needs to be changed.- Parameters:
node
- DOCUMENT ME!text
- DOCUMENT ME!
-
-