|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
JLogView_.widgets.LGCanvas
public class LGCanvas
LGCanvas is a widget represeting the main canvas area. Put simply, this is the drawing area where all the axis, labels, plots, annotations and legend will be drawn. There are different responses that need to occur with mouse interactions: zoom, position on the axes, coordinates of the point the mouse pointer is on etc...
This canvas object can also be saved as an image or printed.
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 |
---|
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.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
LGCanvas()
This is the constructor of the LGCanvas. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
This method comes from the ActionListener interface. |
java.lang.String |
getColumnNameOf(float x,
float y)
This methods returns the column name of a given data point if the data point is nowhere to be found in the current graph data the result might be null. |
LGGraph |
getGraph()
This methods returns the current graph. |
javax.swing.JLabel |
getGraphTitle()
This methods returns the current graph title as a label object. |
LGLegend |
getLegend()
This methods returns the legend of the current graph, the main use of this function is for updating the legend font, entries and position. |
float[] |
getRealCoords(int x,
int y)
This methods converts between coordinates systems. |
float[] |
getSpotNear(int x,
int y)
This methods attempts to return the coordinates of the nearest graph data point to the given pixels coordinates on the canvas. |
void |
mouseClicked(java.awt.event.MouseEvent e)
This method comes from the MouseListener interface. |
void |
mouseEntered(java.awt.event.MouseEvent e)
This method comes from the MouseListener interface. |
void |
mouseExited(java.awt.event.MouseEvent e)
This method comes from the MouseListener interface. |
void |
mousePressed(java.awt.event.MouseEvent e)
This method comes from the MouseListener interface. |
void |
mouseReleased(java.awt.event.MouseEvent e)
This method comes from the MouseListener interface. |
void |
paint(java.awt.Graphics h)
This method is overriding the default paint method. |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat format,
int pageIndex)
This methods prints out the current canvas on the given printer graphics context. |
void |
removeGraphAnnotations()
This methods clears out all annotations from the current graph |
void |
saveAsImage(java.lang.String format,
java.io.File writeto)
This methods saves the current canvas display as an image, this does not include the red lines pointing to the axis. |
void |
setAnnotateActive(boolean note)
This methods tells the canvas whether or not to be in annotating mode. |
void |
setGraph(LGGraph graph)
This methods sets the current graph to be displayed, it also adjust the axes accordingly. |
void |
setGraphTitle(javax.swing.JLabel newtitle)
This methods updates the current graph title using a label object. |
void |
setLegend(LGLegend newleg)
This methods sets the legend for the current graph to be displayed, it triggers a column renaming if the legend entries and the graph column names do not match anymore. |
void |
setMousePos(int x,
int y)
This methods tells the LGCanvas the current position of the mouse within the canvas. |
void |
setUseColours(boolean usethem)
This methods tells the canvas whether of not to use colours for drawing the graph |
void |
setUseLineStyles(boolean usethem)
This methods tells the canvas whether of not to use different line styles when drawing the graph |
void |
setUseRedLines(boolean usethem)
This methods tells the canvas whether or not to draw red line coming from the mouse pointer to each axis. |
void |
setUseSymbols(boolean usethem)
This methods tells the canvas whether of not to use different symbols when drawing the graph coordinates entries from the table |
void |
setZoomActive(boolean zoom)
This methods tells the canvas whether or not to be in zooming mode. |
void |
switchAxisLabels(boolean lab)
This methods tells the canvas to switch the axis labels on or off. |
void |
switchLegend(boolean leg)
This methods tells the canvas to switch the legend on or off. |
void |
update(java.awt.Graphics h)
This method is overriding the default update method to ensure slick repainting. |
boolean |
XisResolutionAxis()
This methods tells whether or not the current X axis is treated as a resolution axis |
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, 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 |
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 |
Constructor Detail |
---|
public LGCanvas()
Method Detail |
---|
public void setGraph(LGGraph graph)
graph
- an LGGraph object that represents the graph to be drawn on the canvasLGGraph
public LGGraph getGraph()
LGGraph
public LGLegend getLegend()
LGLegend
public void setLegend(LGLegend newleg)
newleg
- an LGLegend object that represents the legend of the graph to be drawn on the canvasLGLegend
public void removeGraphAnnotations()
public void setMousePos(int x, int y)
x
- the x coordinates of the mouse on the canvasy
- the y coordinates of the mouse on the canvaspublic void setUseRedLines(boolean usethem)
usethem
- a booleanpublic void setUseColours(boolean usethem)
usethem
- a boolean, true -> colours, false->black / whitepublic void setUseLineStyles(boolean usethem)
usethem
- a boolean, true -> use patterns, false->continuous linepublic void setUseSymbols(boolean usethem)
usethem
- a boolean, true -> different symbols, false->only big dotspublic void switchLegend(boolean leg)
leg
- a boolean, true -> display legend, false->hide legendpublic void switchAxisLabels(boolean lab)
lab
- a boolean, true -> display axis labels, false->hide axis labelspublic javax.swing.JLabel getGraphTitle()
JLabel
public void setGraphTitle(javax.swing.JLabel newtitle)
newtitle
- a JLabel object containing the graph title and its display settings.JLabel
public void paint(java.awt.Graphics h)
paint
in class javax.swing.JComponent
h
- the graphic context of this canvasGraphics
public float[] getRealCoords(int x, int y)
x
- the x coordinate on the canvasy
- the y coordinate on the canvas
public float[] getSpotNear(int x, int y)
x
- the x coordinate on the canvasy
- the y coordinate on the canvas
public boolean XisResolutionAxis()
public java.lang.String getColumnNameOf(float x, float y)
x
- the x graph local coordinate of the data pointy
- the y graph local coordinate of the data point
String
public void update(java.awt.Graphics h)
update
in class javax.swing.JComponent
h
- the graphic context of this canvasGraphics
public void setZoomActive(boolean zoom)
zoom
- a boolean, true-> we are zooming, false-> we are only displaying.public void setAnnotateActive(boolean note)
note
- a boolean, true-> we are annotating, false-> we are only displaying.public void saveAsImage(java.lang.String format, java.io.File writeto)
format
- a String describing the format (acceptable values: jpg, bmp, png, gif)writeto
- a String containing the path of the file in which to write the image.public int print(java.awt.Graphics g, java.awt.print.PageFormat format, int pageIndex)
print
in interface java.awt.print.Printable
g
- a Graphics object representing the graphic context of the chosen printerformat
- the page format being used for printingpageIndex
- the index of the page we print on.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
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 mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |