net.grelf.grip
Class ImFrame

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 net.grelf.grip.ImFrame
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ImFrame
extends javax.swing.JFrame

This class is the window displayed for each image. It has a menu, the code for which is in class ImMenu. The image is displayed on the content pane of the window, in an object of class ImPane. For drawing lines for measuring, the glass pane of this window is used. The code for that is in class GlassPane.

All of the ImFrame objects which currently exist for the application are referenced from a list in the GRIP class.

The frame is only added to the list if an image is successfully opened in it.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
ImFrame(java.lang.String title, DrawingMode drawingMode, java.lang.String imFilePath, int newImageNo, int width, int height, MeasurementHandler mh)
           
ImFrame(java.lang.String title, DrawingMode drawingMode, java.lang.String imFilePath, int newImageNo, int width, int height, MeasurementHandler mh, boolean withMenu)
           
ImFrame(java.lang.String title, DrawingMode drawingMode, java.lang.String imFilePath, int newImageNo, int width, int height, MeasurementHandler mh, boolean withMenu, ImPane imPane)
           
ImFrame(java.lang.String title, DrawingMode drawingMode, java.lang.String imFilePath, int newImageNo, int width, int height, MeasurementHandler mh, boolean withMenu, ImPane imPane, BlobMeas aBlobMeas, ImFrame theParentFrame)
          The most general constructor, that all the others invoke.
ImFrame(java.lang.String title, DrawingMode drawingMode, java.lang.String imFilePath, MeasurementHandler mh)
           
ImFrame(java.lang.String title, ImPane imPane)
          Make a new frame from an already existing ImPane.
ImFrame(java.lang.String title, int width, int height)
          No file loading, no menu.
ImFrame(java.lang.String title, int width, int height, boolean withMenu)
          No file loading but can have menu.
ImFrame(java.lang.String title, int width, int height, boolean withMenu, BlobMeas meas, ImFrame parentFrame)
          No file loading but can have a menu and has an associated set of blob measurements.
ImFrame(java.lang.String title, int newImageNo, int width, int height, MeasurementHandler mh)
           
ImFrame(java.lang.String imFilePath, MeasurementHandler mh)
           
ImFrame(java.lang.String title, java.lang.String imFilePath, MeasurementHandler mh)
           
 
Method Summary
 void addHistory(java.lang.String s)
          Add a string to the history list for this frame.
 void analyseAsSpectrum()
           
 BlobMeasList detectBlobs()
           
 BlobMeasList detectBlobs(boolean includeSinglePixelBlobs)
           
 BlobMeasList detectBlobs(boolean includeSinglePixelBlobs, boolean replot)
           
 void dispose()
          Tidy up when the frame is closed.
 ImFrame duplicate()
          Duplicate this ImFrame, making a new displayed frame.
9.12.30: Returns a reference to the new ImFrame.
 BlobMeas getBlobMeas()
          If this is a frame opened by clicking on a detected blob return a reference to the blob, otherwise return null.
 BlobMeasList getBlobMeases()
          If this frame has a list of detected blob measurements return the list, otherwise return null.
 BlobMenu getBlobMenu()
          To make it possible to disable/enable options via BlobMenu.reviseSettings ().
 java.lang.String getCaption()
          Get the caption of this frame.
 java.lang.String getFilePath()
          Get the path from which the current image was loaded or into which it has been saved.
 GlassPane getGP()
          Get a reference to this frame's overlaid GlassPane.
 TimeInterval getImageTimeSpan()
           
 ImPane getImPane()
          Get a reference to this frame's ImPane display component, which is on its scroll pane.
 java.lang.StringBuffer getInfo()
          Get information about the current image in a format suitable for display (lines end with HTML &jt;br> elements).
 LevelsMenu getLevelsMenu()
          To make it possible to disable/enable options via LevelsMenu.reviseSettings ().
 MeasurementMenu getMeasurementMenu()
          To make it possible to disable/enable options via MeasurementMenu.reviseSettings ().
 ImFrame getParentFrame()
           
 javax.swing.JScrollPane getScrollPane()
          Get a reference to this frame's scroll pane, which is on its content pane.
 StarChart getStarChart()
          Get reference to any associated StarChart object.
 java.util.List<Star> getStars()
          Deprecated. 
 void magnifier(int centreX, int centreY)
          Display a new frame which presents a magnified view from the current frame, around a given pixel position.
protected  void popCaption()
          Retrieve a caption from the stack and use it on the frame.
protected  void pushCaption()
          Push the frame caption onto a stack so a temporary caption be displayed and the current one retrieved later.
 void redisplay()
          Convenience utility which rescales the image for display and repaints the ImPane and GlassPane.
 BlobMeasList replotBlobs()
           
 void saveAs()
          Ask the user for a file path and save the current image there.
 void saveBlobMeasList()
          User selects a file into which to serialise BlobMeasList data which are then written.
 void setBlobMeases(BlobMeasList meases)
          To enable hovering over detected blobs, give the frame a reference to the list of blob measurements.
 void setCaption(java.lang.String s)
          Set the caption of this frame.
protected  void setFilePath(java.lang.String path)
          Set the path from which the current image was loaded or into which it has been saved.
 void setStarChart(StarChart chart)
          Set reference to an associated StarChart object.
 void setStars(java.util.List<Star> stars)
          Deprecated. 
 void showHistory()
          Show the history list of this frame in a message dialofue.
 void showInfo()
          Display information about the current image in a message dialogue.
 
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, 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, 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, paint, 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
 

Constructor Detail

ImFrame

public ImFrame(java.lang.String title,
               int width,
               int height)
No file loading, no menu.


ImFrame

public ImFrame(java.lang.String title,
               int width,
               int height,
               boolean withMenu)
No file loading but can have menu.


ImFrame

public ImFrame(java.lang.String title,
               int width,
               int height,
               boolean withMenu,
               BlobMeas meas,
               ImFrame parentFrame)
No file loading but can have a menu and has an associated set of blob measurements.


ImFrame

public ImFrame(java.lang.String imFilePath,
               MeasurementHandler mh)

ImFrame

public ImFrame(java.lang.String title,
               java.lang.String imFilePath,
               MeasurementHandler mh)

ImFrame

public ImFrame(java.lang.String title,
               DrawingMode drawingMode,
               java.lang.String imFilePath,
               MeasurementHandler mh)

ImFrame

public ImFrame(java.lang.String title,
               int newImageNo,
               int width,
               int height,
               MeasurementHandler mh)

ImFrame

public ImFrame(java.lang.String title,
               DrawingMode drawingMode,
               java.lang.String imFilePath,
               int newImageNo,
               int width,
               int height,
               MeasurementHandler mh)

ImFrame

public ImFrame(java.lang.String title,
               DrawingMode drawingMode,
               java.lang.String imFilePath,
               int newImageNo,
               int width,
               int height,
               MeasurementHandler mh,
               boolean withMenu)

ImFrame

public ImFrame(java.lang.String title,
               ImPane imPane)
Make a new frame from an already existing ImPane. This is mainly for creating frames containing something which implements AssociatedPane.


ImFrame

public ImFrame(java.lang.String title,
               DrawingMode drawingMode,
               java.lang.String imFilePath,
               int newImageNo,
               int width,
               int height,
               MeasurementHandler mh,
               boolean withMenu,
               ImPane imPane)

ImFrame

public ImFrame(java.lang.String title,
               DrawingMode drawingMode,
               java.lang.String imFilePath,
               int newImageNo,
               int width,
               int height,
               MeasurementHandler mh,
               boolean withMenu,
               ImPane imPane,
               BlobMeas aBlobMeas,
               ImFrame theParentFrame)
The most general constructor, that all the others invoke. The BlobMeas parameter is non-null only if this is a frame opened as a result of clicking on or near one detected blob; also in that `* case the parent frame is the one on which the user clicked, containing all the detected blobs.

Method Detail

getLevelsMenu

public LevelsMenu getLevelsMenu()
To make it possible to disable/enable options via LevelsMenu.reviseSettings ().


getMeasurementMenu

public MeasurementMenu getMeasurementMenu()
To make it possible to disable/enable options via MeasurementMenu.reviseSettings ().


getBlobMenu

public BlobMenu getBlobMenu()
To make it possible to disable/enable options via BlobMenu.reviseSettings ().


getFilePath

public java.lang.String getFilePath()
Get the path from which the current image was loaded or into which it has been saved.


setFilePath

protected void setFilePath(java.lang.String path)
Set the path from which the current image was loaded or into which it has been saved.


addHistory

public void addHistory(java.lang.String s)
Add a string to the history list for this frame.


showHistory

public void showHistory()
Show the history list of this frame in a message dialofue.


setBlobMeases

public void setBlobMeases(BlobMeasList meases)
To enable hovering over detected blobs, give the frame a reference to the list of blob measurements.


getBlobMeases

public BlobMeasList getBlobMeases()
If this frame has a list of detected blob measurements return the list, otherwise return null.


saveBlobMeasList

public void saveBlobMeasList()
User selects a file into which to serialise BlobMeasList data which are then written.


getBlobMeas

public BlobMeas getBlobMeas()
If this is a frame opened by clicking on a detected blob return a reference to the blob, otherwise return null.


setStars

@Deprecated
public void setStars(java.util.List<Star> stars)
Deprecated. 

To enable hovering over stars in a star chart, give the frame a reference to the list of stars. Deprecated - use getStarChart () etc.


getStars

@Deprecated
public java.util.List<Star> getStars()
Deprecated. 

If this frame has a list of stars return the list, otherwise return null. Deprecated - use getStarChart () etc.


getStarChart

public StarChart getStarChart()
Get reference to any associated StarChart object.


setStarChart

public void setStarChart(StarChart chart)
Set reference to an associated StarChart object. This is mainly so that ImPane can find it if the drawing mode is STAR_CHART.


getParentFrame

public ImFrame getParentFrame()

getCaption

public java.lang.String getCaption()
Get the caption of this frame.


setCaption

public void setCaption(java.lang.String s)
Set the caption of this frame.


pushCaption

protected void pushCaption()
Push the frame caption onto a stack so a temporary caption be displayed and the current one retrieved later.


popCaption

protected void popCaption()
Retrieve a caption from the stack and use it on the frame.


getGP

public GlassPane getGP()
Get a reference to this frame's overlaid GlassPane.


getImPane

public ImPane getImPane()
Get a reference to this frame's ImPane display component, which is on its scroll pane.


getScrollPane

public javax.swing.JScrollPane getScrollPane()
Get a reference to this frame's scroll pane, which is on its content pane.


dispose

public void dispose()
Tidy up when the frame is closed. Remove it from the table of images, for example. 10.2.24: Also dispose of any frames opened as children of this one (eg, magnified blobs).

Overrides:
dispose in class java.awt.Window

redisplay

public void redisplay()
Convenience utility which rescales the image for display and repaints the ImPane and GlassPane.


duplicate

public ImFrame duplicate()
Duplicate this ImFrame, making a new displayed frame.
9.12.30: Returns a reference to the new ImFrame.


saveAs

public void saveAs()
Ask the user for a file path and save the current image there. Update frame caption and current path.


getInfo

public java.lang.StringBuffer getInfo()
Get information about the current image in a format suitable for display (lines end with HTML &jt;br> elements).


showInfo

public void showInfo()
Display information about the current image in a message dialogue.


getImageTimeSpan

public TimeInterval getImageTimeSpan()

magnifier

public void magnifier(int centreX,
                      int centreY)
Display a new frame which presents a magnified view from the current frame, around a given pixel position. This is called from ImPane when the drawing mode is HOVER and the user clicks the mouse. The magnified view is around the point where the mouse is released.


analyseAsSpectrum

public void analyseAsSpectrum()

detectBlobs

public BlobMeasList detectBlobs()
Returns:
BlobMeasList, sorted in descending order of brightness. Will be null if user cancels threshold dialogue. This version does not include 1-pixel blobs and never replots.

detectBlobs

public BlobMeasList detectBlobs(boolean includeSinglePixelBlobs)
Returns:
BlobMeasList, sorted in descending order of brightness. Will be null if user cancels threshold dialogue. Including 1-pixel blobs is optional but this version never replots.

detectBlobs

public BlobMeasList detectBlobs(boolean includeSinglePixelBlobs,
                                boolean replot)
Returns:
BlobMeasList, sorted in descending order of brightness. Will be null if user cancels threshold dialogue.

replotBlobs

public BlobMeasList replotBlobs()
Returns:
BlobMeasList, sorted in descending order of brightness, having replotted them.