Package gov.nih.mipav.view
Class ViewToolBarBuilder
java.lang.Object
gov.nih.mipav.view.ViewToolBarBuilder
- All Implemented Interfaces:
ActionListener,ItemListener,Serializable,EventListener
public class ViewToolBarBuilder
extends Object
implements ItemListener, ActionListener, Serializable
Builds the GUI toolbars for the user interface.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassClass used to indicate on the toolbar whether a script is being recorded.(package private) classDOCUMENT ME!private classDOCUMENT ME!class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Vector<ButtonGroup> Vector to hold all toggle groups for VOI toggle (and custom toggle configurations)The button used to toggle borders around painted areas.The button used to toggle borders around painted areas.protected JButtonThe button used to enable checker board display of two images.protected JButtonThe button used to select the color of the paint used.protected JButtonThe button for presets used only for CT images.protected JComboBoxThe combo box containing the possible choices for the current script in the script toolbar.protected StringThe script currently selected in the scripting toolbar (null if no script is selected).protected static final BorderA border used for each toolbar.protected JSpinnerThe spinner for indicating the intensity to fill the image with when commiting paint in an image.private doubleThe amount to change the value in the intensity spinner by when the user clicks it.private doubleThe current value chosen in the intensity spinner.private doubleThe maximum value which can be chosen in the intensity spinner.private doubleThe minimum value which can be chosen in the intensity spinner.static final intDOCUMENT ME!protected floatThe opacity of the paint, between 0 (transparent) and 1 (opaque).protected JComboBoxCombo box to hold all of the paint brushes.protected JToggleButtonDOCUMENT ME!private String[]DOCUMENT ME!protected ColorThe paint color to be used when the user paints in the image.protected JToggleButtonThe button for the "default" mode of the mouse, where clicking in the image shows the intensity of that voxel.private JPopupMenuDOCUMENT ME!private ViewToolBarBuilder.PopupListenerDOCUMENT ME!protected static final BorderA border to use for pressed buttons.protected JToggleButtonThe button used to enable the showing of a small portion of image b near the mouse cursor.DOCUMENT ME!protected ObjectThe class which wants to listen to changes made to this components of the toolbars.static final StringDOCUMENT ME!protected ViewToolBarBuilder.VOIColorButtonprotected ButtonGroupA button group for all toggle buttons which change the effect of mouse usage in the image.protected JButtonprotected JButton -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDOCUMENT ME!private JToolBarbuild3DVOIToolBar(JToolBar VOIToolBar, int numberOfDimensions, int voiIndex) Builds a toolbar with just the basic lut buttons on it.final JButtonbuildButton(CustomUIBuilder.UIParams params) Creates a JButton using a UIParams parametersfinal JButtonbuildButton(String cmd, String tooltip, String iconBase) Create a new toolbar button.buildCustomToolBar(Vector<CustomUIBuilder.UIParams> paramVector) buildGeneralToolBar(int numberOfDimensions, int type) Builds the general image toolbar, with buttons for saving the image, the histogram, etc., and a slider for a 3D image.Creates the LUT thresholding toolbar.Builds the LUT toolbar, with buttons for quick-changing the LUT of the image.Build the top part of the LUT toolbar.buildPaintToolBar(int type, int nDim) Builds the paint toolbar, with buttons for widths of paint brushes, color chooser, etc.Creates the RGB histogram toolbar.buildScriptToolBar(boolean isRecording) Builds the script toolbar, for quickly recording and playing back scripts.final JButtonbuildTextButton(String text, String toolTip, String action) Helper method to build a text button for the toolbar.final JToggleButtonbuildToggleButton(CustomUIBuilder.UIParams params, ButtonGroup group) Create a new toolbar togglable button.final JToggleButtonbuildToggleButton(String cmd, int mnemonic, String tooltip, String iconBase, ButtonGroup group) Create a new toolbar togglable button.final JToggleButtonbuildToggleButton(String cmd, String tooltip, String iconBase) Create a new toolbar togglable button.final JToggleButtonbuildToggleButton(String cmd, String tooltip, String iconBase, ButtonGroup group) Create a new toolbar togglable button.buildVolumeTriPlanarVOIToolBar(int numberOfDimensions, int voiIndex, boolean bTraverseImage, boolean bOpacity, ButtonGroup kGroup) Builds the VOI toolbar, with buttons for creating various types of VOIs (elliptical, square, etc.), and for cut and paste operations.Accessor that returns the current intensity paint name (that is, the text of the intensity button, 0, 1, etc.).floatAccessor that returns the current opacity of the paint.intReturns the selected paint brush's index.getPaintBrushName(int index) Returns the name of the paintbrush at the given index.Accessor that returns the current color of the paint.private Integer[]DOCUMENT ME!Returns the full path and file name of the currently selected script file in the scripting toolbar.Returns the VOI Color/properties buttonstatic final JToolBarCreate a blank toolbar and set it up.voiditemStateChanged(ItemEvent event) Sets border painted or not painted depending on if the button was selected or deselected.static final JButtonMakes a separator for the use in the toolbars - a button with the proper icon.private voidrefreshPaintBox(boolean doDelete, int indexOfRemoval) DOCUMENT ME!voidMethod to run the script currently selected in the scripting toolbar.voidsetCheckboardButtonEnabled(boolean flag) Accessor that enables or disables the checkerboard button.voidsetCTButtonEnabled(boolean flag) Accessor that enables or disables the CT button.voidsetIntensityPaintName(String stringValue) Accessor that sets the intensity paint name (that is, the text of the intensity spinner).voidsetOpacity(float op) Accessor that sets the opacity of the paint.voidsetPaintBrush(int index) Sets the index of the paintBox (to select a different paint brush).voidAccessor that sets the paint brush button to selected.voidsetPaintColor(Color color) Accessor that sets the color of the paint.voidsetPointerButton(JToggleButton pointerButton) voidAccessor that sets the pointer button to selected.voidsetRegButtonEnabled(boolean flag) Accessor that enables or disables the window region button.voidsetSpinnerValues(int type) Sets the spinner values based on image type.voidsetToggleButtonSelected(String actionCommand) Sets the correct Toggle button to be selected (based on action command).voidsetVOIGroup(ButtonGroup newVOIGroup) voidupdateScripts(String dirName) Method to update the list of scripts in the scripting toolbar based on the directory name provided.
-
Field Details
-
pressedBorder
A border to use for pressed buttons. -
etchedBorder
A border used for each toolbar. -
NUM_BRUSHES_INTERNAL
public static final int NUM_BRUSHES_INTERNALDOCUMENT ME!- See Also:
-
USER_BRUSHES
DOCUMENT ME! -
borderPaintButton
The button used to toggle borders around painted areas. -
bogusBorderPaintButton
The button used to toggle borders around painted areas. -
checkerBoardButton
The button used to enable checker board display of two images. -
colorPaintButton
The button used to select the color of the paint used. -
ctButton
The button for presets used only for CT images. -
scrollButton
-
syncImagesIcon
-
currentScriptComboBox
The combo box containing the possible choices for the current script in the script toolbar. Filled with entries from the currently selected "Scripting directory". -
currentSelectedScript
The script currently selected in the scripting toolbar (null if no script is selected). -
intensitySpinner
The spinner for indicating the intensity to fill the image with when commiting paint in an image. -
opacity
protected float opacityThe opacity of the paint, between 0 (transparent) and 1 (opaque). Set from the opacity dialog. -
paintBox
Combo box to hold all of the paint brushes. -
paintBrushButton
DOCUMENT ME! -
paintColor
The paint color to be used when the user paints in the image. -
pointerVOIButton
The button for the "default" mode of the mouse, where clicking in the image shows the intensity of that voxel. -
regButton
The button used to enable the showing of a small portion of image b near the mouse cursor. -
scriptTable
DOCUMENT ME! -
UI
The class which wants to listen to changes made to this components of the toolbars. May have to be a ActionListener, MouseListener, ChangeListener, or ViewJFrameBase depending on which toolbars are being used in a particular dialog or frame. -
VOIGroup
A button group for all toggle buttons which change the effect of mouse usage in the image. -
voiColorButton
-
voiUndoButton
-
voiRedoButton
-
bgVector
Vector to hold all toggle groups for VOI toggle (and custom toggle configurations) -
intensityStep
private double intensityStepThe amount to change the value in the intensity spinner by when the user clicks it. -
intensityValue
private double intensityValueThe current value chosen in the intensity spinner. -
maxIntensity
private double maxIntensityThe maximum value which can be chosen in the intensity spinner. -
minIntensity
private double minIntensityThe minimum value which can be chosen in the intensity spinner. -
paintBrushNames
DOCUMENT ME! -
popup
DOCUMENT ME! -
popupListener
DOCUMENT ME!
-
-
Constructor Details
-
ViewToolBarBuilder
Sets the UI.- Parameters:
_UI- The user interface pointer.
-
-
Method Details
-
initToolBar
Create a blank toolbar and set it up.- Returns:
- a new toolbar
-
makeSeparator
Makes a separator for the use in the toolbars - a button with the proper icon.- Returns:
- The separator.
-
actionPerformed
DOCUMENT ME!- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- DOCUMENT ME!
-
buildBasicLUTToolBar
Builds a toolbar with just the basic lut buttons on it.- Returns:
- the basic lut toolbar
-
buildButton
Create a new toolbar button.- Parameters:
cmd- the command generated by the buttontooltip- tooltip for the buttoniconBase- the base of the icon file names (eg - "icon.gif" and "iconroll.gif" would have an "icon"iconBase- Returns:
- a new button
-
buildButton
Creates a JButton using a UIParams parameters- Parameters:
params- UIParams (static final variable from CustomUIBuilder)- Returns:
-
buildGeneralToolBar
Builds the general image toolbar, with buttons for saving the image, the histogram, etc., and a slider for a 3D image.- Parameters:
numberOfDimensions- Number of dimensions of the image.type- Data type of image (really only care about color vs. the rest).- Returns:
- The general image toolbar.
-
buildLUTThresholdToolBar
Creates the LUT thresholding toolbar.- Returns:
- the new toolbar
-
buildLUTToolBarBottom
Builds the LUT toolbar, with buttons for quick-changing the LUT of the image.- Returns:
- The LUT toolbar.
-
buildLUTToolBarTop
Build the top part of the LUT toolbar.- Returns:
- the top part of the LUT toolbar
-
buildPaintToolBar
Builds the paint toolbar, with buttons for widths of paint brushes, color chooser, etc.- Parameters:
type- Data type of image (really color vs. the rest).nDim- The number of dimensions in the image.- Returns:
- The paint toolbar.
-
buildRGBToolBar
Creates the RGB histogram toolbar.- Returns:
- the new toolbar
-
buildScriptToolBar
Builds the script toolbar, for quickly recording and playing back scripts.- Parameters:
isRecording- whether we are recording a script- Returns:
- The script toolbar.
-
buildTextButton
Helper method to build a text button for the toolbar.- Parameters:
text- Text for button.toolTip- Tool tip to be associated with button.action- Action command for button.- Returns:
- a new text button
-
buildToggleButton
Create a new toolbar togglable button.- Parameters:
cmd- the command generated by the buttontooltip- tooltip for the buttoniconBase- the base of the icon file names (eg - "icon.gif" and "iconroll.gif" would have an "icon"iconBase- Returns:
- a new togglable button
-
buildToggleButton
public final JToggleButton buildToggleButton(String cmd, String tooltip, String iconBase, ButtonGroup group) Create a new toolbar togglable button.- Parameters:
cmd- the command generated by the buttontooltip- tooltip for the buttoniconBase- the base of the icon file names (eg - "icon.gif" and "iconroll.gif" would have an "icon"iconBasegroup- the button group to add the togglable button to (use null for the VOIGroup)- Returns:
- a new togglable button
-
buildToggleButton
Create a new toolbar togglable button.- Parameters:
params- button parameters that include actioncommand, tooltiptext, and iconbasegroup- the button group to add the togglable button to (use null for the VOIGroup)- Returns:
- a new togglable button
-
buildToggleButton
public final JToggleButton buildToggleButton(String cmd, int mnemonic, String tooltip, String iconBase, ButtonGroup group) Create a new toolbar togglable button.- Parameters:
cmd- the command generated by the buttonmnemonic- short-cut mnemonic for this buttontooltip- tooltip for the buttoniconBase- the base of the icon file names (eg - "icon.gif" and "iconroll.gif" would have an "icon"iconBasegroup- the button group to add the togglable button to- Returns:
- a new togglable button
-
buildCustomToolBar
-
build3DVOIToolBar
-
buildVolumeTriPlanarVOIToolBar
public JToolBar buildVolumeTriPlanarVOIToolBar(int numberOfDimensions, int voiIndex, boolean bTraverseImage, boolean bOpacity, ButtonGroup kGroup) Builds the VOI toolbar, with buttons for creating various types of VOIs (elliptical, square, etc.), and for cut and paste operations.- Returns:
- the VOI toolbar
-
getIntensityPaintName
Accessor that returns the current intensity paint name (that is, the text of the intensity button, 0, 1, etc.).- Returns:
- Current intensity paint name.
-
getOpacity
public float getOpacity()Accessor that returns the current opacity of the paint.- Returns:
- Current opacity of the paint.
-
getPaintBrush
public int getPaintBrush()Returns the selected paint brush's index.- Returns:
- DOCUMENT ME!
-
getPaintBrushName
Returns the name of the paintbrush at the given index.- Parameters:
index- the index of the paint brush- Returns:
- the name
-
getPaintColor
Accessor that returns the current color of the paint.- Returns:
- Current color of the paint.
-
getPointerButton
-
getSelectedScriptFileName
Returns the full path and file name of the currently selected script file in the scripting toolbar.- Returns:
- The full path and file name of the currently selected script.
-
getVOIColorButton
Returns the VOI Color/properties button- Returns:
- voi color button
-
getVOIUndoButton
-
getVOIRedoButton
-
itemStateChanged
Sets border painted or not painted depending on if the button was selected or deselected. Changes the currently selected script.- Specified by:
itemStateChangedin interfaceItemListener- Parameters:
event- Event that triggered this function.
-
runCurrentScript
public void runCurrentScript()Method to run the script currently selected in the scripting toolbar. -
setCheckboardButtonEnabled
public void setCheckboardButtonEnabled(boolean flag) Accessor that enables or disables the checkerboard button.- Parameters:
flag-trueto enable,falseto disable.
-
setCTButtonEnabled
public void setCTButtonEnabled(boolean flag) Accessor that enables or disables the CT button.- Parameters:
flag-trueto enable,falseto disable.
-
setIntensityPaintName
Accessor that sets the intensity paint name (that is, the text of the intensity spinner).- Parameters:
stringValue- Value to set it to.
-
setOpacity
public void setOpacity(float op) Accessor that sets the opacity of the paint.- Parameters:
op- Opacity to set to.
-
setPaintBrush
public void setPaintBrush(int index) Sets the index of the paintBox (to select a different paint brush).- Parameters:
index- index of the paint box (brush) to select
-
setPaintBrushButtonSelected
public void setPaintBrushButtonSelected()Accessor that sets the paint brush button to selected. -
setPaintColor
Accessor that sets the color of the paint.- Parameters:
color- Color to set paint to.
-
setPointerButton
-
setPointerSelected
public void setPointerSelected()Accessor that sets the pointer button to selected. -
setRegButtonEnabled
public void setRegButtonEnabled(boolean flag) Accessor that enables or disables the window region button.- Parameters:
flag-trueto enable,falseto disable.
-
setSpinnerValues
public void setSpinnerValues(int type) Sets the spinner values based on image type.- Parameters:
type- Image type (BYTE, FLOAT, ...)
-
setToggleButtonSelected
Sets the correct Toggle button to be selected (based on action command).- Parameters:
command- String the action command of the VOI Button (easiest)
-
setVOIGroup
-
updateScripts
Method to update the list of scripts in the scripting toolbar based on the directory name provided. It is assumed that all scripts end with an .sct extension.- Parameters:
dirName- The name of the directory containing the scripts
-
getPaintList
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
refreshPaintBox
private void refreshPaintBox(boolean doDelete, int indexOfRemoval) DOCUMENT ME!- Parameters:
doDelete- DOCUMENT ME!indexOfRemoval- DOCUMENT ME!
-