uk.ac.starlink.splat.iface
Class FlipFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by uk.ac.starlink.splat.iface.FlipFrame
All Implemented Interfaces:
ActionListener, ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants, LineProvider, PlotListener

public class FlipFrame
extends JFrame
implements ActionListener, ChangeListener, PlotListener, ItemListener, LineProvider

Provides a toolbox for optionally flipping and translating a modifiable spectrum. Flipping allows the detailed line shape to be compared.

See Also:
Serialized Form

Nested Class Summary
protected  class FlipFrame.LocalAction
          Inner class defining all local Actions.
protected  class FlipFrame.StateStore
           
protected  class FlipFrame.StoredProperties
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JComboBox availableSpectra
          JComboBox that displays the list of available spectra.
protected  JPanel contentPane
          Content pane of frame.
protected  uk.ac.starlink.util.gui.BasicFileChooser fileChooser
          File chooser used for line visitor files
protected  JCheckBox flipBox
          Flip state.
protected  uk.ac.starlink.ast.gui.DecimalField flipCentre
          Flip coordinate.
protected  GlobalSpecPlotList globalList
          The global list of spectra and plots.
protected  uk.ac.starlink.ast.gui.DecimalField incrementSpinner
          Spinner increment.
protected  SpinnerNumberModel offsetModel
          And the model.
protected  uk.ac.starlink.ast.gui.ScientificSpinner offsetSpinner
          User offset control.
protected  PlotControl plot
          The PlotControl that is displaying the current spectrum.
protected static Preferences prefs
          UI preferences.
protected  JCheckBox redshiftBox
          Is offset to be interpreted as a redshift?
protected  JCheckBoxMenuItem singleComparisonBox
          Menu item retaining state of visitor state changes
protected  JTextArea spefoArea
          Simple text area for SPEFO values.
protected  JCheckBoxMenuItem spefoBox
          Menu item retaining state of SPEFO changes
protected  JTextArea spefoNotes
           
protected  double spefoOffset
           
protected  double spefoRV
           
protected  Map storedPropertiesMap
          List of spectra and properties that we have modified.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FlipFrame(PlotControl plot)
          Create an instance.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
protected  void addSpectrum(EditableSpecData spectrum, boolean replace)
          Add a spectrum to the changed list.
protected  void applyOffset()
          Apply the current offset to the selected spectrum.
protected  void closeWindowEvent(boolean reset)
          Close the window.
protected  void copyFlipCurrentSpectrum()
          Make a copy of the current spectrum and apply a flip, if requested.
protected  EditableSpecData getComparisonSpectrum()
          Access the comparison spectrum, this is the one selected in the JComboBox of spectra.
 Object getLineState()
          Return any state information about the current line.
 PlotControl getPlot()
          Get the PlotControl that we are using.
protected  FlipFrame.StoredProperties getStoredProperties(EditableSpecData spectrum)
          Get the StoredProperties instance for a spectrum.
protected  void initFileChooser()
          Initialise the file chooser to have the necessary filters.
protected  void initFrame()
          Initialise frame properties (disposal, title, menus etc.).
protected  void initUI()
          Initialise the main part of the user interface.
 void itemStateChanged(ItemEvent e)
           
protected  void makeSpefoChanges()
          Make SPEFO-like changes to interface ala Petr Skoda.
 void plotChanged(PlotChangedEvent e)
          Sent when a plot property is changed (i.e.
 void plotCreated(PlotChangedEvent e)
          Sent when a plot is created.
 void plotRemoved(PlotChangedEvent e)
          Sent when a plot is removed.
protected  void readVisitorLineList()
          Read a line list of positions and initialise the LineVisitor with them.
protected  boolean redshiftSpecFrameSet(uk.ac.starlink.ast.FrameSet frameSet, boolean islineid, double redshift)
          Transform the spectral coordinates of a FrameSet by a redshift factor.
protected  void resetSelectedSpectrum()
          Reset selected spectrum to it default offset.
 void setPlot(PlotControl plot)
          Set the PlotControlFrame that has the spectrum that we are to process.
protected  void setVisitorLineList()
          Set the comparison spectrum as the visitor line list.
protected  void spefoSave()
          Append the contents of the SPEFO areas to the file SPEFO.log.
 void stateChanged(ChangeEvent e)
           
protected  void updateNames()
          Update the spectra available for translation.
 void viewLine(double coord, uk.ac.starlink.ast.Frame coordFrame, Object state)
          Move to a view of a line, possibilty restoring some related state information.
 void viewSpectrum(SpecData specData)
          Display a spectrum.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

prefs

protected static Preferences prefs
UI preferences.


storedPropertiesMap

protected Map storedPropertiesMap
List of spectra and properties that we have modified.


availableSpectra

protected JComboBox availableSpectra
JComboBox that displays the list of available spectra.


flipBox

protected JCheckBox flipBox
Flip state.


redshiftBox

protected JCheckBox redshiftBox
Is offset to be interpreted as a redshift?


offsetSpinner

protected uk.ac.starlink.ast.gui.ScientificSpinner offsetSpinner
User offset control.


offsetModel

protected SpinnerNumberModel offsetModel
And the model.


incrementSpinner

protected uk.ac.starlink.ast.gui.DecimalField incrementSpinner
Spinner increment.


flipCentre

protected uk.ac.starlink.ast.gui.DecimalField flipCentre
Flip coordinate.


globalList

protected GlobalSpecPlotList globalList
The global list of spectra and plots.


contentPane

protected JPanel contentPane
Content pane of frame.


plot

protected PlotControl plot
The PlotControl that is displaying the current spectrum.


spefoBox

protected JCheckBoxMenuItem spefoBox
Menu item retaining state of SPEFO changes


spefoArea

protected JTextArea spefoArea
Simple text area for SPEFO values. Also keep values for log.


spefoNotes

protected JTextArea spefoNotes

spefoOffset

protected double spefoOffset

spefoRV

protected double spefoRV

singleComparisonBox

protected JCheckBoxMenuItem singleComparisonBox
Menu item retaining state of visitor state changes


fileChooser

protected uk.ac.starlink.util.gui.BasicFileChooser fileChooser
File chooser used for line visitor files

Constructor Detail

FlipFrame

public FlipFrame(PlotControl plot)
Create an instance.

Method Detail

getPlot

public PlotControl getPlot()
Get the PlotControl that we are using.

Returns:
the PlotControl

setPlot

public void setPlot(PlotControl plot)
Set the PlotControlFrame that has the spectrum that we are to process.

Parameters:
plot - the PlotControl reference.

initUI

protected void initUI()
Initialise the main part of the user interface.


initFrame

protected void initFrame()
Initialise frame properties (disposal, title, menus etc.).


copyFlipCurrentSpectrum

protected void copyFlipCurrentSpectrum()
Make a copy of the current spectrum and apply a flip, if requested. The initial translation is set so that the feature in the middle of the Plot is shown in the middle.


redshiftSpecFrameSet

protected boolean redshiftSpecFrameSet(uk.ac.starlink.ast.FrameSet frameSet,
                                       boolean islineid,
                                       double redshift)
Transform the spectral coordinates of a FrameSet by a redshift factor. To deal with all occasions (nearly) we must let AST work this out. The way to do this is by setting the observer reference frame to be the Source and add a source velocity equivalent to the redshift. We then move the reference frame back to some solar system frame... The problems with this approach are when the reference frame is already at the Source... In that case I think we would need to construct a mapping for all possible spectral coordinate systems and units, a non-trivial task. Assume a fix for line identifiers, which we know are at "source.


updateNames

protected void updateNames()
Update the spectra available for translation. Only EditableSpecData instances are allowed and only those in the plot.


getComparisonSpectrum

protected EditableSpecData getComparisonSpectrum()
Access the comparison spectrum, this is the one selected in the JComboBox of spectra.


getStoredProperties

protected FlipFrame.StoredProperties getStoredProperties(EditableSpecData spectrum)
Get the StoredProperties instance for a spectrum.


applyOffset

protected void applyOffset()
Apply the current offset to the selected spectrum.


addSpectrum

protected void addSpectrum(EditableSpecData spectrum,
                           boolean replace)
Add a spectrum to the changed list. Replaces an existing spectrum, if replace is true.


resetSelectedSpectrum

protected void resetSelectedSpectrum()
Reset selected spectrum to it default offset.


readVisitorLineList

protected void readVisitorLineList()
Read a line list of positions and initialise the LineVisitor with them.


initFileChooser

protected void initFileChooser()
Initialise the file chooser to have the necessary filters.


setVisitorLineList

protected void setVisitorLineList()
Set the comparison spectrum as the visitor line list.


makeSpefoChanges

protected void makeSpefoChanges()
Make SPEFO-like changes to interface ala Petr Skoda.


spefoSave

protected void spefoSave()
Append the contents of the SPEFO areas to the file SPEFO.log. In a compressed format requested by Petr.


closeWindowEvent

protected void closeWindowEvent(boolean reset)
Close the window. Reset shift of current spectrum if requested.


stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener

plotCreated

public void plotCreated(PlotChangedEvent e)
Description copied from interface: PlotListener
Sent when a plot is created.

Specified by:
plotCreated in interface PlotListener

plotRemoved

public void plotRemoved(PlotChangedEvent e)
Description copied from interface: PlotListener
Sent when a plot is removed.

Specified by:
plotRemoved in interface PlotListener

plotChanged

public void plotChanged(PlotChangedEvent e)
Description copied from interface: PlotListener
Sent when a plot property is changed (i.e. spectrum added/removed?).

Specified by:
plotChanged in interface PlotListener

itemStateChanged

public void itemStateChanged(ItemEvent e)
Specified by:
itemStateChanged in interface ItemListener

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

viewSpectrum

public void viewSpectrum(SpecData specData)
Description copied from interface: LineProvider
Display a spectrum. Can replace or add to those already displayed depending on the context. This spectrum will already be in the global list of spectra.

Specified by:
viewSpectrum in interface LineProvider
Parameters:
specData - the spectrum to display

viewLine

public void viewLine(double coord,
                     uk.ac.starlink.ast.Frame coordFrame,
                     Object state)
Description copied from interface: LineProvider
Move to a view of a line, possibilty restoring some related state information.

Specified by:
viewLine in interface LineProvider
Parameters:
coord - the coordinate of the line in wcs units.
coordFrame - Frame defining the coordinate system and units. This should be used to transform into the coordinate system as understood by the LineProvider.
state - previously returned state information, null for none.

getLineState

public Object getLineState()
Description copied from interface: LineProvider
Return any state information about the current line. What this state contains is only understood by the LineProvider.

Specified by:
getLineState in interface LineProvider
Returns:
an Object defining the current state


Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.