jview
Class JDataModelFrame

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 jview.JExitFrame
                          extended by jview.JConfirmExitFrame
                              extended by jview.JBorderFrame
                                  extended by jview.JDataModelFrame
All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, BorderLabels, Displayable, BeanSupport, Initializable, LocalizedAware, LocalizedComposed

public class JDataModelFrame
extends JBorderFrame
implements PropertyChangeListener, BeanSupport

This frame works together with a JFitResidualDisplay and allows displaying of the original data, the model fit and the residuals. Additionally, the user may adjust some of the model parameters, those given in KEY_ADJUSTABLE, while those denoted in KEY_FIXED cannot be altered. Changing the parameters is accomplished by spinners, the step-size is regulated by the errors of the model parameters, if known, #setInitialModel, and by #KEY_ADJUSTABLESTEP. Transfer functions for x, y and the residual allow more flexibility.

See Also:
Serialized Form

Nested Class Summary
static class JDataModelFrame.Show
          Class to create the frame and display it.
 
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
private  List<String> adjustlist
          This is the list of parameters known for the current fitter.
private  Map<String,List<String>> adjustmap
          How I map models to adjustable parameters.
private  Map<String,JLabel> constants
          To trace constants.
private  JLabel correlationfit
          The label with the root of the coefficient of determination.
private static int DEFADJUSTMAX
          How I step from error to spinner.
private static double DEFADJUSTSTEP
          How I step from error to spinner.
private static String DEFEQUAL
          How I separate constant name from value in display labels.
private static Insets DEFINSETS
          The default insets on the labels and spinners.
private static Dimension DEFMINPANEL
          Minimum panel size.
private  ModelFitting fitter
          The current active fitter.
private  List<String> fixedlist
          This is the list of known constants for the current fitter.
private  Map<String,List<String>> fixedmap
          How I map models to adjustable parameters.
static String KEY_ADJUSTABLE
          The names of the parameters that should be adjustable.
static String KEY_ADJUSTMAX
          The maximum number of spinner steps from the current value..
static String KEY_ADJUSTSTEP
          The spinner-step values of the adjustable parameters.
static String KEY_CANVAS
          The properties of the splitted canvas to show.
static String KEY_EQUAL
          How I separate constant name from value in display labels.
static String KEY_FIXED
          The mapping of fixed parameters to their values.
static String KEY_MINPANEL
          I need a minimum size of the right panel, otherwise I cant see it.
static String R2
          The header for the R label.
private  JComponent right
          The panel which contains the spinners and labels.
static String RMS
          The header for the rms label.
private  JLabel rmsfit
          The label with the current model RMS.
private  Map<String,MySpinner> spinners
          To trace the new value.
private  DataCanvasProviding splitter
          The splitted data pane to display residuals plus fit.
static String UNDEFINED
          For undefined RMS or correlation.
 
Fields inherited from class jview.JBorderFrame
DATACLEANSE, KEY_ABOUTURL, KEY_ACTIONCLASS, KEY_AIPLOGO, KEY_BIGGERSTRUT, KEY_DATAANALYSER, KEY_EASTALIGNMENT, KEY_FITTERS, KEY_FITTERTIPS, KEY_HELPSIZE, KEY_LESSERSTRUT, KEY_NOLOGO, KEY_NORTHALIGNMENT, KEY_SOUTHALIGNMENT, KEY_WESTALIGNMENT, MODELFITTER
 
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 util.BeanSupport
CASTING
 
Fields inherited from interface jview.BorderLabels
KEY_ABOUT, KEY_ABOUTACC, KEY_FILEACCS, KEY_FILEITEMS, KEY_FILEMENU, KEY_FILEMNEMONIC, KEY_HELPMENU, KEY_HELPMNEMONIC, KEY_HELPTITLE, KEY_NOHELP, KEY_NOURLACCESS, KEY_TITLE
 
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
JDataModelFrame(LocalizedSupplying prop)
          Constructs an expression frame from a property container.
JDataModelFrame(Map<String,String> prop)
          Constructs an expression frame from a property mapping.
 
Method Summary
private  boolean addAdjustable(Variable v)
          Adds a spinner to the spinners mapping if not present or updates the value.
private  boolean addConstant(Variable v)
          Adds a constant.
private  void cache(String name, Number val)
          Caches a new variable value in our table.
private  void cleanse()
          Cleanse spinners and lables.
private  JComponent createRight()
           
private  MySpinner createSpinner(Variable v)
           
 Component getRepresentation()
          We return our expression canvas.
protected  List getRightItems()
          We return a panel that holds the spinners and constant labels as soon as parameters are specified.
 void init()
          We have to pack ourselves after init.
private  boolean initParameterPanel(List<String> adjustable, List<String> fixed)
          We initialize the spinners and constans maps with displayable items.
 boolean isInterested(String propname)
          Returns the same interest as my minion display.
private static Map<String,List<String>> parseParameterNames(String p)
          We propertize a key value and convert the property values to string lists.
 void propertyChange(PropertyChangeEvent pce)
          Receives the property changes.
 void setComposedProperties(LocalizedSupplying prop)
          Sets the composed properties, defaults the transfer function or constructs them with an empty constructor.
private  void setLabelConstant(JLabel c, Variable v)
          Puts the name of the variable plus the value in the label's text and update the tooltiptext to include the error.
private  void setSpinnerAdjustable(MySpinner s, Variable v)
           
private  boolean spinnersAndLabels(List<Variable> received, List<String> adjustable, List<String> fixed)
           
private  void updateRmsAndR()
           
 
Methods inherited from class jview.JBorderFrame
analyserListenTo, createButton, createCheckBox, createDataAnalysers, createFitters, createHelp, createLabel, createLocalizedButton, createLocalizedCheckBox, createLocalizedHelp, createLocalizedLabel, createLocalizedRadioButton, createRadioButton, createStatus, getAboutAction, getActiveFit, getBiggerStrut, getBottomItems, getComposedProperties, getDataAnalysers, getFitterButtonGroup, getFitterComboBox, getIcon, getLeftItems, getLesserStrut, getModelFittings, getStatusField, getTopItems, hasFired, printAlignment, setAlignment, setFired
 
Methods inherited from class jview.JConfirmExitFrame
disposeAndExit, disposeImmediately
 
Methods inherited from class jview.JExitFrame
setVisible
 
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, 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 util.BeanSupport
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

UNDEFINED

public static final String UNDEFINED
For undefined RMS or correlation.

See Also:
Constant Field Values

RMS

public static final String RMS
The header for the rms label.

See Also:
Constant Field Values

R2

public static final String R2
The header for the R label.

See Also:
Constant Field Values

KEY_CANVAS

public static final String KEY_CANVAS
The properties of the splitted canvas to show.

See Also:
Constant Field Values

KEY_ADJUSTABLE

public static final String KEY_ADJUSTABLE
The names of the parameters that should be adjustable.

See Also:
Constant Field Values

KEY_ADJUSTSTEP

public static final String KEY_ADJUSTSTEP
The spinner-step values of the adjustable parameters.

See Also:
Constant Field Values

KEY_ADJUSTMAX

public static final String KEY_ADJUSTMAX
The maximum number of spinner steps from the current value..

See Also:
Constant Field Values

KEY_FIXED

public static final String KEY_FIXED
The mapping of fixed parameters to their values.

See Also:
Constant Field Values

KEY_EQUAL

public static final String KEY_EQUAL
How I separate constant name from value in display labels.

See Also:
Constant Field Values

KEY_MINPANEL

public static final String KEY_MINPANEL
I need a minimum size of the right panel, otherwise I cant see it.

See Also:
Constant Field Values

DEFINSETS

private static final Insets DEFINSETS
The default insets on the labels and spinners.


DEFADJUSTSTEP

private static final double DEFADJUSTSTEP
How I step from error to spinner.

See Also:
Constant Field Values

DEFADJUSTMAX

private static final int DEFADJUSTMAX
How I step from error to spinner.

See Also:
Constant Field Values

DEFEQUAL

private static final String DEFEQUAL
How I separate constant name from value in display labels.

See Also:
Constant Field Values

DEFMINPANEL

private static final Dimension DEFMINPANEL
Minimum panel size.


splitter

private DataCanvasProviding splitter
The splitted data pane to display residuals plus fit.


fitter

private ModelFitting fitter
The current active fitter.


rmsfit

private JLabel rmsfit
The label with the current model RMS. Quality of fit and chi2 as tip


correlationfit

private JLabel correlationfit
The label with the root of the coefficient of determination.


adjustmap

private Map<String,List<String>> adjustmap
How I map models to adjustable parameters.


fixedmap

private Map<String,List<String>> fixedmap
How I map models to adjustable parameters.


right

private JComponent right
The panel which contains the spinners and labels.


fixedlist

private List<String> fixedlist
This is the list of known constants for the current fitter.


adjustlist

private List<String> adjustlist
This is the list of parameters known for the current fitter.


spinners

private Map<String,MySpinner> spinners
To trace the new value.


constants

private Map<String,JLabel> constants
To trace constants.

Constructor Detail

JDataModelFrame

public JDataModelFrame(Map<String,String> prop)
Constructs an expression frame from a property mapping.


JDataModelFrame

public JDataModelFrame(LocalizedSupplying prop)
Constructs an expression frame from a property container.

Method Detail

setComposedProperties

public void setComposedProperties(LocalizedSupplying prop)
Sets the composed properties, defaults the transfer function or constructs them with an empty constructor.

Specified by:
setComposedProperties in interface LocalizedAware
Overrides:
setComposedProperties in class JBorderFrame

init

public void init()
We have to pack ourselves after init.

Specified by:
init in interface Initializable
Overrides:
init in class JBorderFrame

isInterested

public boolean isInterested(String propname)
Returns the same interest as my minion display.


propertyChange

public void propertyChange(PropertyChangeEvent pce)
Receives the property changes. Pipes all to the canvas, rebuilds the spinners on MODELFITTER, ignores MODELDATA, resets the spinner and constant labels on MODELSOLUTION and MODELPARAMETER.

Specified by:
propertyChange in interface PropertyChangeListener

getRepresentation

public Component getRepresentation()
We return our expression canvas.

Specified by:
getRepresentation in interface Displayable
Overrides:
getRepresentation in class JBorderFrame

getRightItems

protected List getRightItems()
We return a panel that holds the spinners and constant labels as soon as parameters are specified.

Overrides:
getRightItems in class JBorderFrame

cleanse

private void cleanse()
Cleanse spinners and lables.


updateRmsAndR

private void updateRmsAndR()

createRight

private JComponent createRight()

spinnersAndLabels

private boolean spinnersAndLabels(List<Variable> received,
                                  List<String> adjustable,
                                  List<String> fixed)

addAdjustable

private boolean addAdjustable(Variable v)
Adds a spinner to the spinners mapping if not present or updates the value.

Returns:
True, if a new spinner has been created.

createSpinner

private MySpinner createSpinner(Variable v)

addConstant

private boolean addConstant(Variable v)
Adds a constant.


setSpinnerAdjustable

private void setSpinnerAdjustable(MySpinner s,
                                  Variable v)

setLabelConstant

private void setLabelConstant(JLabel c,
                              Variable v)
Puts the name of the variable plus the value in the label's text and update the tooltiptext to include the error.


initParameterPanel

private boolean initParameterPanel(List<String> adjustable,
                                   List<String> fixed)
We initialize the spinners and constans maps with displayable items. The list provided define the order in which parameters are added. Only entries within the spinner and constant maps are considerd, unknown names are left empty.


cache

private void cache(String name,
                   Number val)
Caches a new variable value in our table.


parseParameterNames

private static final Map<String,List<String>> parseParameterNames(String p)
We propertize a key value and convert the property values to string lists.