edu.ucla.stat.SOCR.core
Class GraphPanels

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.ucla.stat.SOCR.core.GraphPanels
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
DistributionGraphPanel, MGFGraphPanel, PGFGraphPanel

public class GraphPanels
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
static int ABOVE
           
static int BELOW
           
protected  int bottomMargin
           
static int BOUNDS
           
static int CONTINUOUS
           
 java.text.DecimalFormat decimalFormat
           
static int DISCRETE
           
protected  Distribution dist
           
protected  Domain domain
           
static int HORIZONTAL
           
protected  double left
           
static int LEFT
           
protected  int leftMargin
           
protected  double leftx
           
static int MIDPOINTS
           
static int MIXED
           
protected  double right
           
static int RIGHT
           
protected  int rightMargin
           
protected  double rightx
           
protected  int topMargin
           
protected  int type
           
static int VERTICAL
           
protected  double xMax
           
protected  double xMin
           
protected  int xPosition
           
protected  double yMax
           
protected  double yMin
           
protected  int yPosition
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphPanels(SOCRDistributionFunctors container)
           
 
Method Summary
 void drawAxis(java.awt.Graphics g, Domain d, double c, int orientation, int type)
          This method draws an axis corresponding to a partition of an interval at position c relative to the other variable.
 void drawAxis(java.awt.Graphics g, double a, double b, double w, double c, int orientation)
          This method draws an axis corresponding to the partition of [a, b] into subintervals of width w, with tick marks at the partition bounds
 void drawAxis(java.awt.Graphics g, double a, double b, double w, double c, int orientation, int type)
          This method draws an axis corresponding to the partition of [a, b] into subintervals of width w, as in the previous method
 void drawBox(java.awt.Graphics g, double x0, double y0, double x1, double y1)
          This method draws a box between the specified corner points in scale units
 void drawBox(java.awt.Graphics g, int style, double x, double y, double l, int i, int j)
          Draw a box at the specified x and y coordinates (in scale units) Length l (in scale units) width: i pixels in the negative direction, j in the positive direction
 void drawBoxPlot(java.awt.Graphics g, double x1, double x2, double x3, double x4, double x5, int y)
          The following method draws a five-number, horizontal boxplot.
 void drawBoxPlot(java.awt.Graphics g, double x, double r, int y)
          The following method draws a symmetric, horizontal boxplot, centered at x of radius r (in scale units).
 void drawLabel(java.awt.Graphics g, java.lang.String s, double x, double y, int location)
          This method draws label s to the left, right, above, or below (x, y) (in scale units)
 void drawLine(java.awt.Graphics g, double x1, double y1, double x2, double y2)
          This method draws a line between (x1, y1) and (x2, y2), where the coordinates are in scale units
 void drawTick(java.awt.Graphics g, double x, double y, int orientation)
          This method draws a tick mark at the specified x and y coordinates (in scale units), 3 pixels in the positive direction and 3 in the negative direction
 void drawTick(java.awt.Graphics g, double x, double y, int i, int j, int orientation)
          This method draws a tick mark at the specified x and y coordinates (in scale units), i pixels in the negative direction, j in the positive direction.
 void fillBox(java.awt.Graphics g, double x0, double y0, double x1, double y1)
          This method fills a box between the specified corner points in scale units
 void fillBox(java.awt.Graphics g, int style, double x, double y, double l, int i, int j)
           
 void fillBoxPlot(java.awt.Graphics g, double x1, double x2, double x3, double x4, double x5, int y)
          The following method fills a five-number, horizontal boxplot.
 void fillBoxPlot(java.awt.Graphics g, double x, double r, int y)
          The following method fills a symmetric, horizontal boxplot, centered at x of radius r (in scale units).
protected  java.lang.String format(double x)
           
 double getBetweenCDF()
           
 double getLeftCDF()
           
 double getLeftCutOff()
           
 java.lang.String getPanelFile()
           
 double getRightCDF()
           
 double getRightCutOff()
           
 void mouseClicked(java.awt.event.MouseEvent evt)
           
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 void mouseEntered(java.awt.event.MouseEvent evt)
           
 void mouseExited(java.awt.event.MouseEvent evt)
           
 void mouseMoved(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
           
 void mouseReleased(java.awt.event.MouseEvent evt)
           
 void rigidIntegralMotionOfDiscriteDistributions(boolean _leftOrRightLimit)
          This method ensures that LEFT and RIGHT limits for areas in DISCRETE distributions are limited to only integer values.
 void setDistribution(Distribution d)
           
 void setLeftCutOff(double _left)
          These methods get/set the Limits, leftCutOff and rightCutOff, for the probability calculation.
 void setMargins(int l, int r, int b, int t)
          This method sets the margin (in pixels)
 void setRightCutOff(double _right)
           
 void setScale(double x0, double x1, double y0, double y1)
          This method sets the minimum and maximum values on the x and y axes
 int xGraph(double x)
          This method computes the x coordinate in graph units for a given x in scale units
 int xPixels(double x)
          This method convert x scale units to x pixels
 double xScale(int x)
          This method computes the x coordinate in scale units for a given x in graph units
 int yGraph(double y)
          This method computes the y coordinate in graph units for a given y in scale units
 int yPixels(double y)
          This method converts y scale units to y pixels
 double yScale(int y)
          This method computes the y coordinate in scale units for a given y in graph units
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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
 
Methods inherited from class java.awt.Container
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, 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, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leftMargin

protected int leftMargin

rightMargin

protected int rightMargin

topMargin

protected int topMargin

bottomMargin

protected int bottomMargin

xMin

protected double xMin

xMax

protected double xMax

yMin

protected double yMin

yMax

protected double yMax

dist

protected Distribution dist

domain

protected Domain domain

type

protected int type

xPosition

protected int xPosition

yPosition

protected int yPosition

left

protected double left

right

protected double right

leftx

protected double leftx

rightx

protected double rightx

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

ABOVE

public static final int ABOVE
See Also:
Constant Field Values

BELOW

public static final int BELOW
See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
See Also:
Constant Field Values

MIDPOINTS

public static final int MIDPOINTS
See Also:
Constant Field Values

BOUNDS

public static final int BOUNDS
See Also:
Constant Field Values

DISCRETE

public static final int DISCRETE
See Also:
Constant Field Values

CONTINUOUS

public static final int CONTINUOUS
See Also:
Constant Field Values

MIXED

public static final int MIXED
See Also:
Constant Field Values

decimalFormat

public java.text.DecimalFormat decimalFormat
Constructor Detail

GraphPanels

public GraphPanels(SOCRDistributionFunctors container)
Method Detail

getPanelFile

public java.lang.String getPanelFile()

setDistribution

public void setDistribution(Distribution d)

setLeftCutOff

public void setLeftCutOff(double _left)
These methods get/set the Limits, leftCutOff and rightCutOff, for the probability calculation. These methods are typically called from SOCRDistribution


setRightCutOff

public void setRightCutOff(double _right)

getLeftCutOff

public double getLeftCutOff()

getRightCutOff

public double getRightCutOff()

setScale

public void setScale(double x0,
                     double x1,
                     double y0,
                     double y1)
This method sets the minimum and maximum values on the x and y axes


setMargins

public void setMargins(int l,
                       int r,
                       int b,
                       int t)
This method sets the margin (in pixels)


xGraph

public int xGraph(double x)
This method computes the x coordinate in graph units for a given x in scale units


yGraph

public int yGraph(double y)
This method computes the y coordinate in graph units for a given y in scale units


xScale

public double xScale(int x)
This method computes the x coordinate in scale units for a given x in graph units


yScale

public double yScale(int y)
This method computes the y coordinate in scale units for a given y in graph units


xPixels

public int xPixels(double x)
This method convert x scale units to x pixels


yPixels

public int yPixels(double y)
This method converts y scale units to y pixels


drawLine

public void drawLine(java.awt.Graphics g,
                     double x1,
                     double y1,
                     double x2,
                     double y2)
This method draws a line between (x1, y1) and (x2, y2), where the coordinates are in scale units


drawTick

public void drawTick(java.awt.Graphics g,
                     double x,
                     double y,
                     int i,
                     int j,
                     int orientation)
This method draws a tick mark at the specified x and y coordinates (in scale units), i pixels in the negative direction, j in the positive direction. The variable s is style, either horizontal or vertical.


drawTick

public void drawTick(java.awt.Graphics g,
                     double x,
                     double y,
                     int orientation)
This method draws a tick mark at the specified x and y coordinates (in scale units), 3 pixels in the positive direction and 3 in the negative direction


drawLabel

public void drawLabel(java.awt.Graphics g,
                      java.lang.String s,
                      double x,
                      double y,
                      int location)
This method draws label s to the left, right, above, or below (x, y) (in scale units)


drawAxis

public void drawAxis(java.awt.Graphics g,
                     Domain d,
                     double c,
                     int orientation,
                     int type)
This method draws an axis corresponding to a partition of an interval at position c relative to the other variable. The orientation indicates style, either horizongal or vertical. The type means that either the midpoints or the bounds are indicated with tick marks. The pattern is the format pattern for the labels


drawAxis

public void drawAxis(java.awt.Graphics g,
                     double a,
                     double b,
                     double w,
                     double c,
                     int orientation,
                     int type)
This method draws an axis corresponding to the partition of [a, b] into subintervals of width w, as in the previous method


drawAxis

public void drawAxis(java.awt.Graphics g,
                     double a,
                     double b,
                     double w,
                     double c,
                     int orientation)
This method draws an axis corresponding to the partition of [a, b] into subintervals of width w, with tick marks at the partition bounds


drawBox

public void drawBox(java.awt.Graphics g,
                    double x0,
                    double y0,
                    double x1,
                    double y1)
This method draws a box between the specified corner points in scale units


fillBox

public void fillBox(java.awt.Graphics g,
                    double x0,
                    double y0,
                    double x1,
                    double y1)
This method fills a box between the specified corner points in scale units


drawBoxPlot

public void drawBoxPlot(java.awt.Graphics g,
                        double x,
                        double r,
                        int y)
The following method draws a symmetric, horizontal boxplot, centered at x of radius r (in scale units). The variable y is the vertical position, in pixels


fillBoxPlot

public void fillBoxPlot(java.awt.Graphics g,
                        double x,
                        double r,
                        int y)
The following method fills a symmetric, horizontal boxplot, centered at x of radius r (in scale units). The variable y is the vertical position in pixels


drawBoxPlot

public void drawBoxPlot(java.awt.Graphics g,
                        double x1,
                        double x2,
                        double x3,
                        double x4,
                        double x5,
                        int y)
The following method draws a five-number, horizontal boxplot. The variable y is the vertical position, in pixels


fillBoxPlot

public void fillBoxPlot(java.awt.Graphics g,
                        double x1,
                        double x2,
                        double x3,
                        double x4,
                        double x5,
                        int y)
The following method fills a five-number, horizontal boxplot. The variable y is the vertical position, in pixels


drawBox

public void drawBox(java.awt.Graphics g,
                    int style,
                    double x,
                    double y,
                    double l,
                    int i,
                    int j)
Draw a box at the specified x and y coordinates (in scale units) Length l (in scale units) width: i pixels in the negative direction, j in the positive direction


fillBox

public void fillBox(java.awt.Graphics g,
                    int style,
                    double x,
                    double y,
                    double l,
                    int i,
                    int j)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Specified by:
mouseExited in interface java.awt.event.MouseListener

rigidIntegralMotionOfDiscriteDistributions

public void rigidIntegralMotionOfDiscriteDistributions(boolean _leftOrRightLimit)
This method ensures that LEFT and RIGHT limits for areas in DISCRETE distributions are limited to only integer values. Without this restriction on the discrete distributions, the reported areas under the density continuously change which does not make sense in the discrete case. Bug reported by Juana Sanchez (10/19/05)


getLeftCDF

public double getLeftCDF()

getRightCDF

public double getRightCDF()

getBetweenCDF

public double getBetweenCDF()

format

protected java.lang.String format(double x)