public class JLChart
extends javax.swing.JComponent
implements java.awt.event.MouseWheelListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ActionListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JPopupMenu |
chartMenu |
protected java.awt.Window |
dialogParent |
static java.lang.String |
FR_DATE_FORMAT |
static int |
LABEL_DOWN
Place label at the bottom of the chart
|
static int |
LABEL_LEFT
Place label at the left of the chart
|
static int |
LABEL_RIGHT
Place label at the right of the chart
|
static int |
LABEL_ROW
Place label at the bottom of the chart and try to arrange them in rows
|
static int |
LABEL_UP
Place label at the top of the chart
|
protected java.util.Vector<fr.esrf.tangoatk.widget.util.chart.LabelRect> |
labelRect |
protected java.lang.String |
lastDataFileLocation |
protected javax.swing.filechooser.FileFilter |
lastFileFilter |
protected java.lang.String |
lastSnapshotLocation |
protected double |
maxDisplayDuration |
static int |
MENU_CHARTPROP |
static int |
MENU_DATALOAD |
static int |
MENU_DATASAVE |
static int |
MENU_DVPROP |
static int |
MENU_PRINT |
static int |
MENU_STAT |
static int |
MENU_TABLE |
protected boolean |
modalDialog |
protected java.lang.String |
noValueString |
protected javax.swing.JFrame |
parentFrame |
protected boolean |
preferDialog |
protected javax.swing.JDialog |
tableDialog |
static java.lang.String |
US_DATE_FORMAT |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
JLChart()
Graph constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
void |
addData(JLDataView v,
double x,
double y)
Add data to dataview , perform fast update when possible and garbage old data
(if a display duration is specified).
|
void |
addJLChartActionListener(IJLChartActionListener l)
Add the specified JLChartAction listener to the list
|
void |
addMenuItem(javax.swing.JMenuItem menu)
Method to add item to the contextual menu.
|
void |
addSeparator()
Method to add a separator to the contextual menu.
|
void |
addUserAction(java.lang.String name)
Adds a user action.
|
void |
applyConfiguration(CfFileReader f)
Apply graph configuration.
|
java.lang.String[] |
buildPanelString(SearchInfo si) |
void |
enterZoom()
Enter zoom mode.
|
void |
exitZoom()
Exit zoom mode.
|
int |
garbageData(JLDataView v)
Remove points that exceed displayDuration.
|
java.awt.Color |
getChartBackground()
Gets the chart background (curve area)
|
java.lang.String |
getConfiguration()
Build a configuration string that can be write into a file and is compatible
with CfFileReader.
|
double |
getDisplayDuration()
Gets the display duration.
|
java.lang.String |
getHeader()
Gets the current header
|
java.awt.Font |
getHeaderFont()
Gets the header font
|
java.lang.String |
getHelpString()
Returns a string containing the configuration file help.
|
java.awt.Font |
getLabelFont()
Returns the label font
|
int |
getLabelPlacement()
Returns the current label placement.
|
java.awt.Dimension |
getMargin()
Gets the current margin
|
double |
getMaxDisplayDuration()
Gets the maximum allowed for a display duration
|
java.lang.String |
getNoValueString()
Used with saveDataFile().
|
int |
getTimePrecision()
Returns the allowed margin to make a projection on a line on data show (default: 0).
|
protected javax.swing.JMenuItem |
getUserActionMenuItem(java.lang.String actionName) |
JLAxis |
getXAxis()
Return a handle to the x axis
|
JLAxis |
getY1Axis()
Return a handle to the left y axis
|
JLAxis |
getY2Axis()
Return a handle to the right y axis
|
static boolean |
isInRange(double x,
int NB) |
boolean |
isLabelVisible()
Determines wether labels are visivle or not.
|
boolean |
isPaintAxisFirst()
Return painting order between axis and curve
|
boolean |
isXAxisOnBottom()
tells weather x Axis is on bottom of screen or not
|
boolean |
isZoomed()
Determines wether the graph is zoomed.
|
void |
loadDataFile(java.lang.String fileName)
Loads a data file and add the corresponding data to Y1 axis
|
static void |
main(java.lang.String[] args) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent evt) |
void |
paint(java.awt.Graphics g)
Paint the components.
|
void |
printGraph()
Prints out this graph.
|
void |
refreshTableSingle(JLDataView v) |
void |
removeDataView(JLDataView view) |
void |
removeJLChartActionListener(IJLChartActionListener l)
Remove the specified JLChartAction Listener
|
void |
removeMenuItem(int menu)
Method to remove item of the contextual menu.
|
void |
removeUserAction(java.lang.String name)
Removes a user action from chart menu.
|
void |
reset() |
void |
reset(boolean showConfirmDialog) |
void |
setBackground(java.awt.Color c) |
void |
setChartBackground(java.awt.Color c)
Sets the chart background (curve area)
|
void |
setDisplayDuration(double v)
Sets the display duration.This will garbage old data in all displayed data views.
|
void |
setFrameParent(javax.swing.JFrame parent)
Sets the JFrame that will receive the header as title.
|
void |
setHeader(java.lang.String s)
Sets the header and displays it.
|
void |
setHeaderColor(java.awt.Color c)
Sets the header color
|
void |
setHeaderFont(java.awt.Font f)
Sets header font
|
void |
setHeaderVisible(boolean b)
Displays or hides header.
|
void |
setJLChartListener(IJLChartListener l)
Set the specified JLChart Listener
|
void |
setLabelFont(java.awt.Font f)
Sets the label font
|
void |
setLabelPlacement(int p)
Set the label placement.
|
void |
setLabelVisible(boolean b)
Displays or hide labels.
|
void |
setMargin(java.awt.Dimension d)
Sets component margin
|
void |
setMaxDisplayDuration(double maxDisplayDuration)
Sets the maximum allowed for a display duration
|
void |
setNoValueString(java.lang.String noValueString)
Used with saveDataFile().
|
void |
setPaintAxisFirst(boolean b)
Paints axis under curve when true
|
void |
setParentForTableDialog(java.awt.Dialog parent)
Sets the parent that the "show table" dialog should have (in case you chose to have a dialog)
|
void |
setParentForTableDialog(java.awt.Frame parent)
Sets the parent that the "show table" dialog should have (in case you chose to have a dialog)
|
void |
setPreferDialogForTable(boolean preferDialog,
boolean modal)
Sets if you prefer to use a JDialog with showTableXXX() methods instead of the classic JFrame
|
void |
setTimePrecision(int milliseconds)
Sets the allowed margin to make a projection on a line on data show.
|
void |
setXAxisOnBottom(boolean b)
Sets weather x Axis is on bottom of screen or not
|
void |
showDataOptionDialog(JLDataView v)
Display the data view option dialog.
|
void |
showOptionDialog()
Display the global graph option dialog.
|
void |
showPanel(java.awt.Graphics g,
SearchInfo si)
Display the value tooltip.
|
void |
showPanel(java.awt.Graphics g,
SearchInfo si,
java.awt.event.MouseEvent scrEvent) |
protected void |
showStatAll() |
protected void |
showStatAll(java.util.Vector<JLDataView> views) |
protected void |
showTableAll() |
protected void |
showTableAll(java.util.Vector<JLDataView> views) |
void |
unselectAll()
Remove all dataview from the graph.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, 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, updateUI
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final int LABEL_DOWN
public static final int LABEL_UP
public static final int LABEL_RIGHT
public static final int LABEL_LEFT
public static final int LABEL_ROW
public static final int MENU_CHARTPROP
public static final int MENU_DVPROP
public static final int MENU_TABLE
public static final int MENU_DATASAVE
public static final int MENU_PRINT
public static final int MENU_STAT
public static final int MENU_DATALOAD
public static final java.lang.String US_DATE_FORMAT
public static final java.lang.String FR_DATE_FORMAT
protected java.util.Vector<fr.esrf.tangoatk.widget.util.chart.LabelRect> labelRect
protected double maxDisplayDuration
protected javax.swing.JPopupMenu chartMenu
protected boolean preferDialog
protected boolean modalDialog
protected javax.swing.JDialog tableDialog
protected java.awt.Window dialogParent
protected javax.swing.JFrame parentFrame
protected java.lang.String lastSnapshotLocation
protected java.lang.String lastDataFileLocation
protected javax.swing.filechooser.FileFilter lastFileFilter
protected java.lang.String noValueString
public JLAxis getXAxis()
public JLAxis getY1Axis()
public JLAxis getY2Axis()
public void setXAxisOnBottom(boolean b)
b
- boolean to know weather x Axis is on bottom of screen or notpublic boolean isXAxisOnBottom()
public void setHeaderFont(java.awt.Font f)
f
- Header fontgetHeaderFont()
public java.awt.Font getHeaderFont()
setHeaderFont(java.awt.Font)
public void setMargin(java.awt.Dimension d)
d
- MargingetMargin()
public java.awt.Dimension getMargin()
setMargin(java.awt.Dimension)
public void setBackground(java.awt.Color c)
setBackground
in class javax.swing.JComponent
public void setChartBackground(java.awt.Color c)
c
- Background colorpublic java.awt.Color getChartBackground()
public void setPaintAxisFirst(boolean b)
b
- Painting orderpublic boolean isPaintAxisFirst()
public void setHeaderVisible(boolean b)
b
- true if the header is visible, false otherwisesetHeader(java.lang.String)
public void setHeader(java.lang.String s)
s
- Graph headergetHeader()
public java.lang.String getHeader()
setHeader(java.lang.String)
public void setFrameParent(javax.swing.JFrame parent)
parent
- JFrame parentpublic void setDisplayDuration(double v)
v
- Displauy duration (millisec). Pass Double.POSITIVE_INFINITY to disable.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double)
public double getDisplayDuration()
setDisplayDuration(double)
public double getMaxDisplayDuration()
setMaxDisplayDuration(double)
,
setDisplayDuration(double)
public void setMaxDisplayDuration(double maxDisplayDuration)
maxDisplayDuration
- The maximum allowed for a display durationgetMaxDisplayDuration()
,
getDisplayDuration()
,
setDisplayDuration(double)
public void setHeaderColor(java.awt.Color c)
c
- Header colorpublic void setLabelVisible(boolean b)
b
- true if labels are visible, false otherwiseisLabelVisible()
public boolean isLabelVisible()
public void setLabelPlacement(int p)
p
- PlacementLABEL_UP
,
LABEL_DOWN
,
LABEL_ROW
,
LABEL_LEFT
,
LABEL_RIGHT
public int getLabelPlacement()
setLabelPlacement(int)
public void setLabelFont(java.awt.Font f)
f
- public java.awt.Font getLabelFont()
setLabelFont(java.awt.Font)
public void showOptionDialog()
public void showDataOptionDialog(JLDataView v)
public boolean isZoomed()
public void enterZoom()
public void setJLChartListener(IJLChartListener l)
l
- JLChart listener. If set to null the listener will be removed.public void addUserAction(java.lang.String name)
name
- Action namepublic void removeUserAction(java.lang.String name)
name
- Action namepublic void addJLChartActionListener(IJLChartActionListener l)
l
- Listener to addpublic void exitZoom()
public void removeMenuItem(int menu)
menu
- Item to removeMENU_CHARTPROP
,
MENU_DVPROP
,
MENU_TABLE
,
MENU_DATASAVE
,
MENU_PRINT
,
MENU_STAT
,
MENU_DATALOAD
public void addMenuItem(javax.swing.JMenuItem menu)
menu
- MenuItem to addpublic void addSeparator()
public void removeJLChartActionListener(IJLChartActionListener l)
l
- Listener to removepublic void applyConfiguration(CfFileReader f)
f
- Handle to CfFileReader object that contains global graph paramCfFileReader.parseText(java.lang.String)
,
CfFileReader.readFile(java.lang.String)
,
JLAxis.applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
,
JLDataView.applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
public java.lang.String getConfiguration()
applyConfiguration(fr.esrf.tangoatk.widget.util.chart.CfFileReader)
,
JLDataView.getConfiguration(java.lang.String)
,
JLAxis.getConfiguration(java.lang.String)
public java.lang.String getHelpString()
public void unselectAll()
public void printGraph()
public void loadDataFile(java.lang.String fileName)
fileName
- the full path of the data filepublic void refreshTableSingle(JLDataView v)
protected void showTableAll(java.util.Vector<JLDataView> views)
protected void showTableAll()
protected void showStatAll(java.util.Vector<JLDataView> views)
protected void showStatAll()
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- Graphics object.public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public java.lang.String[] buildPanelString(SearchInfo si)
public void showPanel(java.awt.Graphics g, SearchInfo si)
g
- Graphics objectsi
- SearchInfo structure.JLAxis.searchNearest(int, int, fr.esrf.tangoatk.widget.util.chart.JLAxis)
public void showPanel(java.awt.Graphics g, SearchInfo si, java.awt.event.MouseEvent scrEvent)
public int garbageData(JLDataView v)
v
- DataView containing pointspublic void addData(JLDataView v, double x, double y)
v
- The dataviewx
- x coordinates (real space)y
- y coordinates (real space)setDisplayDuration(double)
public void setTimePrecision(int milliseconds)
milliseconds
- the margin, in millisecondspublic int getTimePrecision()
public java.lang.String getNoValueString()
public void setNoValueString(java.lang.String noValueString)
noValueString
- The String used to represent "no data"public void setPreferDialogForTable(boolean preferDialog, boolean modal)
preferDialog
- Prefer to have a dialog or notmodal
- The dialog should be modal or notpublic void setParentForTableDialog(java.awt.Frame parent)
parent
- The parentsetPreferDialogForTable(boolean, boolean)
public void setParentForTableDialog(java.awt.Dialog parent)
parent
- The parentsetPreferDialogForTable(boolean, boolean)
public void removeDataView(JLDataView view)
public void reset()
public void reset(boolean showConfirmDialog)
protected javax.swing.JMenuItem getUserActionMenuItem(java.lang.String actionName)
public static boolean isInRange(double x, int NB)
public static void main(java.lang.String[] args)