org.math.plot.canvas
Class PlotCanvas

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 org.math.plot.canvas.PlotCanvas
All Implemented Interfaces:
ComponentListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, BaseDependant
Direct Known Subclasses:
Plot2DCanvas, Plot3DCanvas

public abstract class PlotCanvas
extends JPanel
implements MouseListener, MouseMotionListener, ComponentListener, BaseDependant, MouseWheelListener

BSD License

Author:
Yann RICHET
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static RenderingHints AALIAS
           
 int ActionMode
           
 boolean allowEdit
           
 boolean allowNote
           
 boolean allowNoteCoord
           
 Base base
           
protected  double[] coordNoted
           
protected  boolean dragging
           
protected  AbstractDrawer draw
           
static Color EDIT_COLOR
           
protected  BasePlot grid
           
 LegendPanel linkedLegendPanel
           
protected  int[] mouseClick
           
protected  int[] mouseCurent
           
static Color NOTE_COLOR
           
 Vector<Plotable> objects
           
 int[] panelSize
           
 Vector<Plot> plots
           
static int TRANSLATION
           
static int ZOOM
           
 
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
PlotCanvas()
           
PlotCanvas(Base b, BasePlot bp)
           
PlotCanvas(double[] min, double[] max)
           
PlotCanvas(double[] min, double[] max, String[] axesScales, String[] axesLabels)
           
 
Method Summary
 void addBaseLabel(String text, Color c, double... where)
           
 void addLabel(String text, Color c, double... where)
           
 int addPlot(Plot newPlot)
           
 void addPlotable(Plotable p)
           
 void addQuantiletoPlot(int numPlot, double[]... q)
           
 void addQuantiletoPlot(int numPlot, int numAxe, double... q)
           
 void addQuantiletoPlot(int numPlot, int numAxe, double q)
           
 void attachLegend(LegendPanel lp)
           
 void changePlotColor(int I, Color c)
           
 void changePlotData(int I, double[]... XY)
           
 void changePlotName(int I, String name)
           
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
 void displayDatasFrame()
           
 void displayDatasFrame(int i)
           
 void displaySetScalesFrame()
           
 String[] getAxesScales()
           
 boolean getEditable()
           
 BasePlot getGrid()
           
 boolean getNotable()
           
 Plot getPlot(int i)
           
 Plotable getPlotable(int i)
           
 Plotable[] getPlotables()
           
 int getPlotIndex(Plot p)
           
 Plot[] getPlots()
           
 void includeInBounds(double... into)
           
 void includeInBounds(Plot plot)
           
abstract  void initBasenGrid()
           
 void initBasenGrid(Base b, BasePlot bp)
           
abstract  void initBasenGrid(double[] min, double[] max)
           
 void initBasenGrid(double[] min, double[] max, String[] axesScales, String[] axesLabels)
           
abstract  void initDrawer()
           
private  void initPanel()
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
 void paint(Graphics gcomp)
           
 void removeAllPlots()
           
 void removePlot(int I)
           
 void removePlot(Plot p)
           
 void removePlotable(int i)
           
 void removePlotable(Plotable p)
           
 void resetBase()
           
 void setActionMode(int am)
           
 void setAutoBounds()
           
 void setAutoBounds(int axe)
           
 void setAxeLabel(int axe, String label)
           
 void setAxeScale(int axe, String scale)
           
 void setAxesLabels(String... labels)
           
 void setAxesScales(String... scales)
           
 void setEditable(boolean b)
           
 void setFixedBounds(double[] min, double[] max)
           
 void setFixedBounds(int axe, double min, double max)
           
 void setNotable(boolean b)
           
 void setNoteCoords(boolean b)
           
 void setPlot(int I, Plot p)
           
 void toGraphicFile(File file)
           
 
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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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

panelSize

public int[] panelSize

base

public Base base

draw

protected AbstractDrawer draw

grid

protected BasePlot grid

linkedLegendPanel

public LegendPanel linkedLegendPanel

plots

public Vector<Plot> plots

objects

public Vector<Plotable> objects

AALIAS

protected static final RenderingHints AALIAS

NOTE_COLOR

public static Color NOTE_COLOR

EDIT_COLOR

public static Color EDIT_COLOR

allowEdit

public boolean allowEdit

allowNote

public boolean allowNote

allowNoteCoord

public boolean allowNoteCoord

coordNoted

protected double[] coordNoted

ZOOM

public static final int ZOOM
See Also:
Constant Field Values

TRANSLATION

public static final int TRANSLATION
See Also:
Constant Field Values

ActionMode

public int ActionMode

dragging

protected boolean dragging

mouseCurent

protected int[] mouseCurent

mouseClick

protected int[] mouseClick
Constructor Detail

PlotCanvas

public PlotCanvas()

PlotCanvas

public PlotCanvas(Base b,
                  BasePlot bp)

PlotCanvas

public PlotCanvas(double[] min,
                  double[] max)

PlotCanvas

public PlotCanvas(double[] min,
                  double[] max,
                  String[] axesScales,
                  String[] axesLabels)
Method Detail

attachLegend

public void attachLegend(LegendPanel lp)

initPanel

private void initPanel()

initDrawer

public abstract void initDrawer()

initBasenGrid

public void initBasenGrid(double[] min,
                          double[] max,
                          String[] axesScales,
                          String[] axesLabels)

initBasenGrid

public abstract void initBasenGrid(double[] min,
                                   double[] max)

initBasenGrid

public abstract void initBasenGrid()

initBasenGrid

public void initBasenGrid(Base b,
                          BasePlot bp)

setActionMode

public void setActionMode(int am)

setNoteCoords

public void setNoteCoords(boolean b)

setEditable

public void setEditable(boolean b)

getEditable

public boolean getEditable()

setNotable

public void setNotable(boolean b)

getNotable

public boolean getNotable()

getPlots

public Plot[] getPlots()

getPlot

public Plot getPlot(int i)

getPlotIndex

public int getPlotIndex(Plot p)

getPlotables

public Plotable[] getPlotables()

getPlotable

public Plotable getPlotable(int i)

getGrid

public BasePlot getGrid()

getAxesScales

public String[] getAxesScales()

setAxesLabels

public void setAxesLabels(String... labels)

setAxeLabel

public void setAxeLabel(int axe,
                        String label)

setAxesScales

public void setAxesScales(String... scales)

setAxeScale

public void setAxeScale(int axe,
                        String scale)

setFixedBounds

public void setFixedBounds(double[] min,
                           double[] max)

setFixedBounds

public void setFixedBounds(int axe,
                           double min,
                           double max)

includeInBounds

public void includeInBounds(double... into)

includeInBounds

public void includeInBounds(Plot plot)

setAutoBounds

public void setAutoBounds()

setAutoBounds

public void setAutoBounds(int axe)

resetBase

public void resetBase()
Specified by:
resetBase in interface BaseDependant

addLabel

public void addLabel(String text,
                     Color c,
                     double... where)

addBaseLabel

public void addBaseLabel(String text,
                         Color c,
                         double... where)

addPlotable

public void addPlotable(Plotable p)

removePlotable

public void removePlotable(Plotable p)

removePlotable

public void removePlotable(int i)

addPlot

public int addPlot(Plot newPlot)

setPlot

public void setPlot(int I,
                    Plot p)

changePlotData

public void changePlotData(int I,
                           double[]... XY)

changePlotName

public void changePlotName(int I,
                           String name)

changePlotColor

public void changePlotColor(int I,
                            Color c)

removePlot

public void removePlot(int I)

removePlot

public void removePlot(Plot p)

removeAllPlots

public void removeAllPlots()

addQuantiletoPlot

public void addQuantiletoPlot(int numPlot,
                              double[]... q)

addQuantiletoPlot

public void addQuantiletoPlot(int numPlot,
                              int numAxe,
                              double... q)

addQuantiletoPlot

public void addQuantiletoPlot(int numPlot,
                              int numAxe,
                              double q)

toGraphicFile

public void toGraphicFile(File file)
                   throws IOException
Throws:
IOException

displaySetScalesFrame

public void displaySetScalesFrame()

displayDatasFrame

public void displayDatasFrame(int i)

displayDatasFrame

public void displayDatasFrame()

paint

public void paint(Graphics gcomp)
Overrides:
paint in class JComponent

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener

componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener