lt.monarch.chart.swing
Class JChartPanel

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 lt.monarch.chart.swing.JChartPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, ViewContainer

public class JChartPanel
extends javax.swing.JPanel
implements ViewContainer

Swing ViewContainer implementation.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
 
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
Modifier and Type Field and Description
protected  View chart
          the chart
protected  ChartObjectsMap chartObjectsMap
          chart objects map
protected  HotSpotMap hotSpotMap
          the hot spot map
protected  PaintMode paintMode
          Panel paint mode.
protected  PaintStyle<ChartPaintTags> paintStyle
          Color style object for getting and setting entityStyle to stylesheet
 Style style
          Local stylesheet.
 
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
Constructor and Description
JChartPanel(View chart)
          Constructs a new JChartPanel with the specified chart.
 
Method Summary
Modifier and Type Method and Description
 void addGestureListener(GestureListener l)
          Adds the specified gesture listener to receive gesture events from this view container.
 void addMultitouchListener(MultitouchListener l)
          Adds the specified multitouch listener to receive multitouch events from this view container.
 void addNotify()
          Notifies this component that it now has a parent component.
 void disableChartObjectPropertiesEditor()
          Disables chart object properties editor.
 void disableToolTips()
          Disables tool tips for this chart container.
 void doLayout()
          Causes this container to lay out its components.
 void enableChartObjectPropertiesEditor()
          Enables default chart object properties editor.
 void enableChartObjectPropertiesEditor(ChartObjectPropertiesEditor charPropertiesEditor)
          Enables a specific chart object properties editor.
 void enableToolTips()
          Enables tool tips for this chart container.
 ChartObjectsMap.TaggedChartObject findObjectUnder(Point2D point)
          Find mapped object under point
 ChartObjectsMap getChartObjectsMap()
          Returns a chart objects map for the view container.
 java.awt.Component getComponent()
          Returns the associated Component.
 HotSpotMap getHotSpotMap()
          Gets hot spot map of the chart panel.
 java.awt.Dimension getMaximumSize()
          Gets the maximum size of this chart panel.
 java.awt.Dimension getMinimumSize()
          Gets the minimum size of this chart panel.
 PaintMode getPaintMode()
          Returns panel painting mode.
 PaintStyle<ChartPaintTags> getPaintStyle()
          Gets panel paint style object
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of this chart panel.
 java.lang.String getToolTipText(java.awt.event.MouseEvent e)
          Returns the string to be used as the tool tip for event.
 AbstractGraphics getUpdateGraphics()
          Returns the default graphics context, where any view can render itself.
 AbstractGraphics getUpdateGraphics(java.awt.Graphics2D graphics)
           
 View getView()
          Returns chart view.
 boolean isFreezed()
          Determines whether this chart container is frozen.
 void paintComponent(java.awt.Graphics graphics)
          Triggers JPanel's paintComponent method, updates chart size, validate's chart and renders it.
protected  void paintComponent2(java.awt.Graphics graphics)
           
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Processes mouse events occurring on this component
protected  void processMouseMotionEvent(java.awt.event.MouseEvent e)
          Processes mouse motion events, such as MouseEvent.MOUSE_DRAGGED.
 void removeGestureListener(GestureListener l)
          Removes the specified gesture listener so that it no longer receives gesture events from this view container.
 void removeMultitouchListener(MultitouchListener l)
          Removes the specified multitouch listener so that it no longer receives multitouch events from this view container.
 void removeNotify()
          Notifies this component that it no longer has a parent component.
 void repaint(Rectangle2D r)
          Requests a container update.
 void revalidate()
          Requests a container to be revalidated.
 void setFreezed(boolean flag)
          Freezes or defreezes chart container.
 void setHotSpotMap(HotSpotMap map)
          Sets the specified hot spot map for the chart panel.
 void setMaximumSize(java.awt.Dimension maximumSize)
          Sets the maximum size of this chart panel.
 void setMinimumSize(java.awt.Dimension minimumSize)
          Sets the minimum size of this chart panel.
 void setPaintMode(PaintMode mode)
          Sets panel painting mode.
 void setPreferredSize(java.awt.Dimension preferredSize)
          Sets the preferred size of this chart panel.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, 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, 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
 
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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.ViewContainer
addMouseListener, addMouseMotionListener, addMouseWheelListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener
 

Field Detail

chart

protected View chart
the chart


hotSpotMap

protected HotSpotMap hotSpotMap
the hot spot map


chartObjectsMap

protected ChartObjectsMap chartObjectsMap
chart objects map


paintMode

protected PaintMode paintMode
Panel paint mode. This flag identifies the toFill method used for painting the panel. Possible values are StylesheetConstants.FILL_PAINT, StylesheetConstants.GRADIENT_PAINT, StylesheetConstants.IMAGE_PAINT and StylesheetConstants.HATCH_PAINT.


style

public final Style style
Local stylesheet. All color and font information is stored here


paintStyle

protected PaintStyle<ChartPaintTags> paintStyle
Color style object for getting and setting entityStyle to stylesheet

Constructor Detail

JChartPanel

public JChartPanel(View chart)
Constructs a new JChartPanel with the specified chart.

Parameters:
chart - the chart
Method Detail

getPaintStyle

public PaintStyle<ChartPaintTags> getPaintStyle()
Gets panel paint style object

Returns:
the paintStyle object

getHotSpotMap

public HotSpotMap getHotSpotMap()
Gets hot spot map of the chart panel.

Specified by:
getHotSpotMap in interface ViewContainer
Returns:
hot spot map of the chart panel

setHotSpotMap

public void setHotSpotMap(HotSpotMap map)
Sets the specified hot spot map for the chart panel.

Parameters:
map - the new hot spot map

setMinimumSize

public void setMinimumSize(java.awt.Dimension minimumSize)
Sets the minimum size of this chart panel.

Overrides:
setMinimumSize in class javax.swing.JComponent
Parameters:
minimumSize - the new minimum size of this chart panel

setPreferredSize

public void setPreferredSize(java.awt.Dimension preferredSize)
Sets the preferred size of this chart panel.

Overrides:
setPreferredSize in class javax.swing.JComponent
Parameters:
preferredSize - the new preferred size of this chart panel

setMaximumSize

public void setMaximumSize(java.awt.Dimension maximumSize)
Sets the maximum size of this chart panel.

Overrides:
setMaximumSize in class javax.swing.JComponent
Parameters:
maximumSize - the new maximum size of this chart panel

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the minimum size of this chart panel.

Overrides:
getMinimumSize in class javax.swing.JComponent
Returns:
minimum size of this container

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of this chart panel.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
preferred size of this container

getMaximumSize

public java.awt.Dimension getMaximumSize()
Gets the maximum size of this chart panel.

Overrides:
getMaximumSize in class javax.swing.JComponent
Returns:
maximum size of this container

enableToolTips

public void enableToolTips()
Enables tool tips for this chart container.


disableToolTips

public void disableToolTips()
Disables tool tips for this chart container.


repaint

public void repaint(Rectangle2D r)
Requests a container update.

Specified by:
repaint in interface ViewContainer
Parameters:
r - the specified rectangle of this view container to repaint

revalidate

public void revalidate()
Requests a container to be revalidated.

Specified by:
revalidate in interface ViewContainer
Overrides:
revalidate in class javax.swing.JComponent

getComponent

public java.awt.Component getComponent()
Returns the associated Component.

Specified by:
getComponent in interface ViewContainer
Returns:
reference to this chart container

getUpdateGraphics

public AbstractGraphics getUpdateGraphics()
Returns the default graphics context, where any view can render itself.

Specified by:
getUpdateGraphics in interface ViewContainer
Returns:
graphics context returned by JPanel's getGraphics method

getUpdateGraphics

public AbstractGraphics getUpdateGraphics(java.awt.Graphics2D graphics)

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
Returns the string to be used as the tool tip for event.

Overrides:
getToolTipText in class javax.swing.JComponent
Parameters:
e - the mouse event
Returns:
tool tip text

doLayout

public void doLayout()
Causes this container to lay out its components.

Overrides:
doLayout in class java.awt.Container

paintComponent

public void paintComponent(java.awt.Graphics graphics)
Triggers JPanel's paintComponent method, updates chart size, validate's chart and renders it.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
graphics - the graphics context

paintComponent2

protected void paintComponent2(java.awt.Graphics graphics)

addNotify

public void addNotify()
Notifies this component that it now has a parent component. Sets chart container to this JChartPanel instance.

Overrides:
addNotify in class javax.swing.JComponent

removeNotify

public void removeNotify()
Notifies this component that it no longer has a parent component. Sets chart container to null.

Overrides:
removeNotify in class javax.swing.JComponent

setFreezed

public void setFreezed(boolean flag)
Freezes or defreezes chart container. When frozen, the JChartPanel caches its current view into off-screen image and until defrozen paints the cached view instead of requesting the chart to render the view. null value is assigned to chart's container parameter, when container is frozen. When unfrozen reference of this container instance is set back to the chart.

Parameters:
flag - true to freeze the container

isFreezed

public boolean isFreezed()
Determines whether this chart container is frozen.

Returns:
true if container is frozen; false otherwise

setPaintMode

public void setPaintMode(PaintMode mode)
Sets panel painting mode. Possible values are: FILL_PAINT, HATCH_PAINT and GRADIENT_PAINT. FILL_PAINT for single color toFill-painting. GRADIENT_PAINT for cyclic (from start color to center color and from center color to start color) or acyclic (from start color to end color) gradient panel painting. By default the paint mode is set to FILL_PAINT.

Parameters:
mode - series painting mode.

getPaintMode

public PaintMode getPaintMode()
Returns panel painting mode. Possible values are : FILL_PAINT or GRADIENT_PAINT. FILL_PAINT for single color toFill-painting. GRADIENT_PAINT for cyclic (from start color to center color and from center color to start color) or acyclic (from start color to end color) gradient series painting. By default the paint mode is set to FILL_PAINT.

Returns:
series painting mode.

getView

public View getView()
Returns chart view.

Specified by:
getView in interface ViewContainer
Returns:
Returns the chart view.

getChartObjectsMap

public ChartObjectsMap getChartObjectsMap()
Returns a chart objects map for the view container.

Specified by:
getChartObjectsMap in interface ViewContainer
Returns:
a chart objects map for the view container

enableChartObjectPropertiesEditor

public void enableChartObjectPropertiesEditor()
Enables default chart object properties editor. If another editor is enabled this call is ignored.


enableChartObjectPropertiesEditor

public void enableChartObjectPropertiesEditor(ChartObjectPropertiesEditor charPropertiesEditor)
Enables a specific chart object properties editor. If another editor is enabled this call is ignored.

Parameters:
charPropertiesEditor - chart properties editor

disableChartObjectPropertiesEditor

public void disableChartObjectPropertiesEditor()
Disables chart object properties editor.


addGestureListener

public void addGestureListener(GestureListener l)
Description copied from interface: ViewContainer
Adds the specified gesture listener to receive gesture events from this view container.

Specified by:
addGestureListener in interface ViewContainer
Parameters:
l - the gesture listener

addMultitouchListener

public void addMultitouchListener(MultitouchListener l)
Description copied from interface: ViewContainer
Adds the specified multitouch listener to receive multitouch events from this view container.

Specified by:
addMultitouchListener in interface ViewContainer
Parameters:
l - the gesture listener

removeGestureListener

public void removeGestureListener(GestureListener l)
Description copied from interface: ViewContainer
Removes the specified gesture listener so that it no longer receives gesture events from this view container.

Specified by:
removeGestureListener in interface ViewContainer
Parameters:
l - the gesture listener

removeMultitouchListener

public void removeMultitouchListener(MultitouchListener l)
Description copied from interface: ViewContainer
Removes the specified multitouch listener so that it no longer receives multitouch events from this view container.

Specified by:
removeMultitouchListener in interface ViewContainer
Parameters:
l - the gesture listener

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Processes mouse events occurring on this component

Overrides:
processMouseEvent in class javax.swing.JComponent
Parameters:
e - the mouse event

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
Processes mouse motion events, such as MouseEvent.MOUSE_DRAGGED.

Overrides:
processMouseMotionEvent in class javax.swing.JComponent
Parameters:
e - the MouseEvent

findObjectUnder

public ChartObjectsMap.TaggedChartObject findObjectUnder(Point2D point)
Find mapped object under point

Returns:
mapped object