public class ModelLineView extends JPanel implements diva.canvas.interactor.SelectionListener
DivaPlot
. the X
dimension of a DivaPlot (and the current spectrum displayed. The
view is a JTable
that shows the current spectra and their
descriptions, the controllers are buttons to add new spectra and
delete existing ones.
To encapsulate often required facilities this class also provides utility methods for reading and writing the spectra from/to disk file and an Action for initiating a file chooser to control this process.
Store all this in a VOTable.
ModelLine
,
DivaPlot
,
ModelLineTableModel
,
DeblendFrame
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected class |
ModelLineView.DeleteAction
Delete action.
|
protected class |
ModelLineView.GaussianAction
Add action.
|
protected class |
ModelLineView.LorentzAction |
protected class |
ModelLineView.ReadAction
Inner Action that read ranges from disk file
|
protected class |
ModelLineView.VoigtAction |
protected class |
ModelLineView.WriteAction
Inner Action that writes ranges to a disk file.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected JPanel |
actionBar |
protected Color |
colour
The colour of any figures that are created.
|
protected uk.ac.starlink.util.gui.BasicFileChooser |
fileChooser
File chooser used for reading and writing text files.
|
protected ModelLineTableModel |
model |
protected DivaPlotGraphicsPane |
pane
GraphicsPane that contains all the figures.
|
protected DivaPlot |
plot
The DivaPlot that we are working with.
|
protected JScrollPane |
scroller |
protected JTable |
table
The JList showing the properties.
|
protected TitledBorder |
title
Create all visual components.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ModelLineView(DivaPlot plot)
Create an instance.
|
ModelLineView(DivaPlot plot,
Color colour)
Create an instance with a given colour and constained property.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createSpectrum(uk.ac.starlink.diva.interp.Interpolator interpolator)
Create a new spectrum and arrange to have it added to the model, when
drawn.
|
protected void |
createSpectrum(uk.ac.starlink.diva.interp.Interpolator interpolator,
double[] props)
Create a new spectrum with the given properties.
|
void |
delete(int index)
Delete a spectrum (index of position in list).
|
void |
deleteAll()
Delete all spectra (typical when containing window withdrawn).
|
protected void |
deleteSelected()
Delete any selected spectra.
|
Color |
getColour()
Get the colour of any figures.
|
void |
getFileForSpectra()
Initiate a file selection dialog and choose a file to contain the
ranges.
|
void |
getFileWithSpectra()
Initiate a file selection dialog and choose a file that contains a list
of fitting ranges.
|
Action |
getReadAction(String name)
Create an action for starting to read a file from disk.
|
int[] |
getSelectedIndices()
Get the currently selected rows as a list.
|
Action |
getWriteAction(String name)
Create an action for starting to write to a disk file.
|
protected void |
initFileChooser()
Initialise the file chooser to have the necessary filters.
|
protected void |
initUI()
Initialise the various user interface components.
|
void |
readSpectraFromFile(File file)
Read a set of spectra from a file.
|
protected void |
selectionChanged(ListSelectionEvent e)
Invoked when the selected spectrum changes.
|
void |
selectionChanged(diva.canvas.interactor.SelectionEvent e)
Called when a figure is selected on the graphics pane.
|
void |
setColour(Color colour)
Set the colour of any figures.
|
protected void |
setPlot(DivaPlot plot)
Set the plot used.
|
void |
writeSpectraToFile(File file)
Write the current spectra to a simple text file.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
protected DivaPlot plot
protected JTable table
protected DivaPlotGraphicsPane pane
protected Color colour
protected TitledBorder title
protected JScrollPane scroller
protected ModelLineTableModel model
protected JPanel actionBar
protected uk.ac.starlink.util.gui.BasicFileChooser fileChooser
public ModelLineView(DivaPlot plot)
protected void setPlot(DivaPlot plot)
plot
- The new plot valueprotected void initUI()
protected void selectionChanged(ListSelectionEvent e)
public int[] getSelectedIndices()
protected void createSpectrum(uk.ac.starlink.diva.interp.Interpolator interpolator)
protected void createSpectrum(uk.ac.starlink.diva.interp.Interpolator interpolator, double[] props)
props
- an array of properties in world coordinates (not
graphics).protected void deleteSelected()
public void deleteAll()
public void delete(int index)
public void setColour(Color colour)
colour
- The new colour valuepublic Color getColour()
protected void initFileChooser()
public void getFileWithSpectra()
public void getFileForSpectra()
public void readSpectraFromFile(File file)
file
- reference to the file.public void writeSpectraToFile(File file)
file
- reference to the file.public Action getReadAction(String name)
public Action getWriteAction(String name)
public void selectionChanged(diva.canvas.interactor.SelectionEvent e)
selectionChanged
in interface diva.canvas.interactor.SelectionListener
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.