JComponentPack 1.5.0

com.zfqjava.chart
Class Chart

java.lang.Object
  extended by com.zfqjava.chart.AbstractNode
      extended by com.zfqjava.chart.Chart
All Implemented Interfaces:
Node, Cloneable
Direct Known Subclasses:
BasicChart

public class Chart
extends AbstractNode

Chart provides a chart container.


Field Summary
protected  EventListenerList listenerList
           
 
Constructor Summary
Chart()
           
 
Method Summary
 void addChartListener(ChartListener l)
          Adds the specified chart listener to receive node events from this chart container.
 void addGroupListener(GroupListener l)
          Adds the specified group listener to receive node events from this chart container.
 void addLinkListener(LinkListener l)
          Adds the specified link listener to receive link events from this chart.
 void addSelection(List nodes)
          Adds the nodes to selection.
 void addSelection(Node node)
          Adds the node to selection.
 void addSelectionListener(SelectionListener l)
          Adds the specified selection listener to receive node events from this chart container.
 void cancelEditing()
          Cancels the current editing session.
 void clearSelection()
          Clears the all selection node.
protected  AbstractCellEditor createEditor()
           
protected  Shape createPaintShape()
          Creates the paint shape.
protected  AbstractCellRenderer createRenderer()
           
 void doLayout()
          Layout the children nodes.
protected  void drawShape(Graphics2D g, Shape s)
           
 Node findNodeAt(int x, int y)
          Finds the node contains the point x, y.
protected  void fireNodeAdded(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeGrouped(GroupNode node, List nodeList)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeLinked(Link link, Node startNode, Node endNode)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeMoved(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeRemoved(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeResized(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeRotated(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeSelected(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeUngrouped(GroupNode node, List nodeList)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeUnlinked(Link link, Node startNode, Node endNode)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireNodeUnselected(Node node)
          Notifies all listeners that have registered interest for notification on this event type.
 ChartListener[] getChartListeners()
          Returns an array of all the chart listeners registered on this chart.
 JComponent getContainer()
          Returns the container for this chart.
 Node getEditingNode()
          Returns the current editing node.
 AbstractCellEditor getEditor()
           
 Component getEditorComponent()
          Returns the component that is handling the editing session.
 int getGridHeight()
          Returns the grid height.
 GridMode getGridMode()
          Returns the grid mode for this chart.
 int getGridWidth()
          Returns the grid width.
 List getGroupList()
          Returns all group nodes.
 GroupListener[] getGroupListeners()
          Returns an array of all the group listeners registered on this chart.
 LinkListener[] getLinkListeners()
          Returns an array of all the link listeners registered on this chart.
 EventListener[] getListeners(Class listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this model.
 Dimension getPreferredSize()
          Returns the preferred size of this node.
 AbstractCellRenderer getRenderer()
           
 Map getRenderingHints()
          Returns the RenderingHints for rendering.
 Node getSelectedNode()
          Returns the last selected node.
 int getSelectionCount()
          Returns the number of nodes that are selected.
 List getSelectionList()
          Returns all selected nodes.
 SelectionListener[] getSelectionListeners()
          Returns an array of all the selection listeners registered on this chart.
 Tool getTool()
          Returns the Tool for this chart.
 boolean group(List nodes)
          Group the nodes.
 boolean isEditing()
          Returns true if a node is being edited.
 boolean isGridShown()
          Returns the grid shown property.
 boolean isGridSnaped()
          Returns the grid snaped property.
 boolean isGrouped(Node node)
          Determines the node grouped state.
 boolean isSelected(Node node)
          Determines the node selected state.
 boolean isSelectionEmpty()
          Determines the selection whether is empty.
 void moveToBack(Node node)
          Move the node to back.
 void moveToFront(Node node)
          Move the node to front.
 void paint(Graphics2D g)
          Paints itself.
protected  void paintNodes(Graphics2D g)
           
protected  String paramString()
           
 void removeChartListener(ChartListener l)
          Removes the specified chart listener so that it no longer receives chart events from this chart.
 void removeGroupListener(GroupListener l)
          Removes the specified group listener so that it no longer receives group events from this chart.
 void removeLinkListener(LinkListener l)
          Removes the specified link listener so that it no longer receives link events from this chart.
 void removeSelection(List nodes)
          Removes the nodes from selection
 void removeSelection(Node node)
          Removes the node from selection
 void removeSelectionListener(SelectionListener l)
          Removes the specified selection listener so that it no longer receives selection events from this chart.
 void repaint(int x, int y, int width, int height)
          Repaints the specified area.
 void select(Node node)
          Selects the node.
 void selectAll()
          Selects all nodes.
 void setContainer(JComponent c)
          Sets the container for this chart.
 void setGridHeight(int gridHeight)
          Sets the grid height.
 void setGridMode(GridMode gridMode)
          Sets the grid mode for this chart.
 void setGridShown(boolean shown)
          Sets the grid shown property.
 void setGridSize(int gridWidth, int gridHeight)
          Sets the grid size for this chart.
 void setGridSnaped(boolean snaped)
          Sets the grid snaped property.
 void setGridWidth(int gridWidth)
          Sets the grid width.
 void setRenderingHints(Map hints)
          Sets the RenderingHints for rendering.
 void setTool(Tool t)
          Sets the Tool for this chart.
 void startEditingAtNode(Node node)
          Starts edit the specified node.
 boolean stopEditing()
          Ends the current editing session.
 BufferedImage toBufferedImage()
          Returns a BufferedImage for this chart.
 boolean ungroup(GroupNode node)
          Ungroup the node.
 
Methods inherited from class com.zfqjava.chart.AbstractNode
addHandle, addHandle, addLink, addNode, addNode, addNode, addNode, clone, configureShape, configureShape, contains, contains, contains, createHandles, fillShape, getBounds, getCellBounds, getCenterX, getCenterY, getChart, getCursor, getDrawComposite, getDrawPaint, getFillComposite, getFillPaint, getFont, getHandleCount, getHandleList, getHeight, getLayout, getLinkCount, getLinkList, getLock, getMargin, getName, getNode, getNodeCount, getNodeList, getPaintBounds, getPaintShape, getShadowComposite, getShadowPaint, getShadowTransform, getStroke, getToolTipText, getToolTipText, getTransform, getUserObject, getWidth, getX, getY, indexOfNode, intersects, intersects, isAdjustable, isCellable, isDrawable, isEditable, isEmpty, isFillable, isGroupable, isLinkable, isMovable, isPreferredSizeSet, isResizable, isRotatable, isSelectable, isShadowable, isVisible, removeAllNode, removeHandle, removeHandle, removeLink, removeNode, removeNode, removeNode, repaint, repaint, revalidate, setAdjustable, setBounds, setBounds, setCellable, setCenterLocation, setChart, setCursor, setDrawable, setDrawComposite, setDrawPaint, setEditable, setFillable, setFillComposite, setFillPaint, setFont, setGroupable, setLayout, setLinkable, setLocation, setMargin, setMovable, setName, setPaintShape, setPreferredSize, setResizable, setRotatable, setSelectable, setShadowable, setShadowComposite, setShadowPaint, setShadowTransform, setSize, setStroke, setToolTipText, setTransform, setUserObject, setVisible, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listenerList

protected EventListenerList listenerList
Constructor Detail

Chart

public Chart()
Method Detail

setContainer

public void setContainer(JComponent c)
Sets the container for this chart.

Parameters:
c - the container
See Also:
getContainer()

getContainer

public JComponent getContainer()
Returns the container for this chart.

Returns:
the container
See Also:
setContainer(javax.swing.JComponent)

isEditing

public boolean isEditing()
Returns true if a node is being edited.

Returns:
true if a node is being edited

stopEditing

public boolean stopEditing()
Ends the current editing session.

Returns:
true if editing was in progress and is now stopped, false if editing was not in progress

cancelEditing

public void cancelEditing()
Cancels the current editing session. Has no effect if the chart isn't being edited.


startEditingAtNode

public void startEditingAtNode(Node node)
Starts edit the specified node.

Parameters:
node - the node to be edited

getEditingNode

public Node getEditingNode()
Returns the current editing node.

Returns:
the current editing node

getEditorComponent

public Component getEditorComponent()
Returns the component that is handling the editing session. If nothing is being edited, returns null.

Returns:
Component handling editing session
Since:
JDataGrid 1.6.1

setTool

public void setTool(Tool t)
Sets the Tool for this chart.

Parameters:
t - the Tool
See Also:
getTool()

getTool

public Tool getTool()
Returns the Tool for this chart.

Returns:
the Tool
See Also:
setTool(com.zfqjava.chart.Tool)

setGridMode

public void setGridMode(GridMode gridMode)
Sets the grid mode for this chart.

Parameters:
gridMode - the grid mode
See Also:
getGridMode()

getGridMode

public GridMode getGridMode()
Returns the grid mode for this chart.

Returns:
the grid mode for this chart
See Also:
setGridMode(com.zfqjava.chart.GridMode)

setGridSize

public void setGridSize(int gridWidth,
                        int gridHeight)
Sets the grid size for this chart.

Parameters:
gridWidth - the grid width
gridHeight - the grid height

setGridWidth

public void setGridWidth(int gridWidth)
Sets the grid width.

Parameters:
gridWidth - the grid width
See Also:
getGridWidth()

getGridWidth

public int getGridWidth()
Returns the grid width.

Returns:
the grid width
See Also:
setGridWidth(int)

setGridHeight

public void setGridHeight(int gridHeight)
Sets the grid height.

Parameters:
gridHeight - the grid height
See Also:
getGridHeight()

getGridHeight

public int getGridHeight()
Returns the grid height.

Returns:
the grid height
See Also:
setGridHeight(int)

setGridSnaped

public void setGridSnaped(boolean snaped)
Sets the grid snaped property.

Parameters:
snaped - the grid snaped property
See Also:
isGridSnaped()

isGridSnaped

public boolean isGridSnaped()
Returns the grid snaped property.

Returns:
the grid snaped property
See Also:
setGridSnaped(boolean)

setGridShown

public void setGridShown(boolean shown)
Sets the grid shown property.

Parameters:
shown - the grid shown property
See Also:
isGridShown()

isGridShown

public boolean isGridShown()
Returns the grid shown property.

Returns:
the grid shown property
See Also:
setGridShown(boolean)

doLayout

public void doLayout()
Description copied from interface: Node
Layout the children nodes.

Specified by:
doLayout in interface Node
Overrides:
doLayout in class AbstractNode

drawShape

protected void drawShape(Graphics2D g,
                         Shape s)
Overrides:
drawShape in class AbstractNode

findNodeAt

public Node findNodeAt(int x,
                       int y)
Description copied from interface: Node
Finds the node contains the point x, y.

Specified by:
findNodeAt in interface Node
Overrides:
findNodeAt in class AbstractNode
Parameters:
x - the x location
y - the y location
Returns:
the node contians the point x, y

moveToFront

public void moveToFront(Node node)
Move the node to front.

Parameters:
node - the node
See Also:
moveToBack(com.zfqjava.chart.Node)

moveToBack

public void moveToBack(Node node)
Move the node to back.

Parameters:
node - the node
See Also:
moveToFront(com.zfqjava.chart.Node)

addSelection

public void addSelection(Node node)
Adds the node to selection.

Parameters:
node - the node add to selection
See Also:
removeSelection(com.zfqjava.chart.Node)

addSelection

public void addSelection(List nodes)
Adds the nodes to selection.

Parameters:
nodes - the nodes add to selection
See Also:
removeSelection(com.zfqjava.chart.Node)

removeSelection

public void removeSelection(Node node)
Removes the node from selection

Parameters:
node - the node remove from selection
See Also:
addSelection(com.zfqjava.chart.Node)

removeSelection

public void removeSelection(List nodes)
Removes the nodes from selection

Parameters:
nodes - the nodes remove from selection
See Also:
addSelection(com.zfqjava.chart.Node)

clearSelection

public void clearSelection()
Clears the all selection node.


getSelectionCount

public int getSelectionCount()
Returns the number of nodes that are selected.

Returns:
the number of nodes that are selected

isSelectionEmpty

public boolean isSelectionEmpty()
Determines the selection whether is empty.

Returns:
true if the selection is empty

getSelectionList

public List getSelectionList()
Returns all selected nodes.

Returns:
all selected nodes

getSelectedNode

public Node getSelectedNode()
Returns the last selected node.

Returns:
the last selected node

isSelected

public boolean isSelected(Node node)
Determines the node selected state.

Parameters:
node - the node to determine
Returns:
true if the node is selected, otherwise false

select

public void select(Node node)
Selects the node.

Parameters:
node - the node

selectAll

public void selectAll()
Selects all nodes.


getGroupList

public List getGroupList()
Returns all group nodes.

Returns:
all group node

isGrouped

public boolean isGrouped(Node node)
Determines the node grouped state.

Parameters:
node - the node to determine
Returns:
true if the node is grouped, otherwise false

group

public boolean group(List nodes)
Group the nodes. Returns true if changes as a result of the call. (Otherwise returns false.

Parameters:
nodes - the nodes to group
Returns:
true if changes as a result of the call
See Also:
ungroup(com.zfqjava.chart.GroupNode)

ungroup

public boolean ungroup(GroupNode node)
Ungroup the node. Returns true if changes as a result of the call. (Otherwise returns false.

Parameters:
node - the group node
Returns:
true if changes as a result of the call
See Also:
group

setRenderingHints

public void setRenderingHints(Map hints)
Sets the RenderingHints for rendering.

Parameters:
hints - the RenderingHints for rendering
See Also:
getRenderingHints()

getRenderingHints

public Map getRenderingHints()
Returns the RenderingHints for rendering.

Returns:
the RenderingHints for rendering
See Also:
setRenderingHints(java.util.Map)

toBufferedImage

public BufferedImage toBufferedImage()
Returns a BufferedImage for this chart.

Returns:
a BufferedImage

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height)
Description copied from interface: Node
Repaints the specified area.

Specified by:
repaint in interface Node
Overrides:
repaint in class AbstractNode

getPreferredSize

public Dimension getPreferredSize()
Description copied from interface: Node
Returns the preferred size of this node.

Specified by:
getPreferredSize in interface Node
Overrides:
getPreferredSize in class AbstractNode
Returns:
the node preferred size

createPaintShape

protected Shape createPaintShape()
Description copied from class: AbstractNode
Creates the paint shape.

Overrides:
createPaintShape in class AbstractNode
Returns:
the paint shape

paint

public void paint(Graphics2D g)
Description copied from interface: Node
Paints itself.

Specified by:
paint in interface Node
Overrides:
paint in class AbstractNode
Parameters:
g - the node Graphics object

paintNodes

protected void paintNodes(Graphics2D g)
Overrides:
paintNodes in class AbstractNode

createRenderer

protected AbstractCellRenderer createRenderer()
Since:
JDataGrid 2.0.1

getRenderer

public AbstractCellRenderer getRenderer()
Since:
JDataGrid 2.0.1

createEditor

protected AbstractCellEditor createEditor()
Since:
JDataGrid 2.0.1

getEditor

public AbstractCellEditor getEditor()
Since:
JDataGrid 2.0.1

paramString

protected String paramString()
Overrides:
paramString in class AbstractNode

addChartListener

public void addChartListener(ChartListener l)
Adds the specified chart listener to receive node events from this chart container. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the chart listener
Since:
JDataGrid 2.0
See Also:
ChartEvent, ChartListener, removeChartListener(com.zfqjava.chart.event.ChartListener), getChartListeners()

removeChartListener

public void removeChartListener(ChartListener l)
Removes the specified chart listener so that it no longer receives chart events from this chart. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this chart. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the chart listener
Since:
JDataGrid 2.0
See Also:
ChartEvent, ChartListener, addChartListener(com.zfqjava.chart.event.ChartListener), getChartListeners()

getChartListeners

public ChartListener[] getChartListeners()
Returns an array of all the chart listeners registered on this chart.

Returns:
all of this comonent's ChartListeners or an empty array if no chart listeners are currently registered
Since:
JDataGrid 2.0
See Also:
addChartListener(com.zfqjava.chart.event.ChartListener), removeChartListener(com.zfqjava.chart.event.ChartListener)

fireNodeAdded

protected void fireNodeAdded(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeRemoved

protected void fireNodeRemoved(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeResized

protected void fireNodeResized(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeMoved

protected void fireNodeMoved(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeRotated

protected void fireNodeRotated(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

addSelectionListener

public void addSelectionListener(SelectionListener l)
Adds the specified selection listener to receive node events from this chart container. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the selection listener
Since:
JDataGrid 2.0
See Also:
SelectionEvent, SelectionListener, removeSelectionListener(com.zfqjava.chart.event.SelectionListener), getSelectionListeners()

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
Removes the specified selection listener so that it no longer receives selection events from this chart. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this chart. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the selection listener
Since:
JDataGrid 2.0
See Also:
SelectionEvent, SelectionListener, addSelectionListener(com.zfqjava.chart.event.SelectionListener), getSelectionListeners()

getSelectionListeners

public SelectionListener[] getSelectionListeners()
Returns an array of all the selection listeners registered on this chart.

Returns:
all of this chart's SelectionListeners or an empty array if no chart listeners are currently registered
Since:
JDataGrid 2.0
See Also:
addSelectionListener(com.zfqjava.chart.event.SelectionListener), removeSelectionListener(com.zfqjava.chart.event.SelectionListener)

fireNodeSelected

protected void fireNodeSelected(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeUnselected

protected void fireNodeUnselected(Node node)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

addGroupListener

public void addGroupListener(GroupListener l)
Adds the specified group listener to receive node events from this chart container. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the group listener
Since:
JDataGrid 2.0
See Also:
GroupEvent, GroupListener, removeGroupListener(com.zfqjava.chart.event.GroupListener), getGroupListeners()

removeGroupListener

public void removeGroupListener(GroupListener l)
Removes the specified group listener so that it no longer receives group events from this chart. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this chart. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the group listener
Since:
JDataGrid 2.0
See Also:
GroupEvent, GroupListener, addGroupListener(com.zfqjava.chart.event.GroupListener), getGroupListeners()

getGroupListeners

public GroupListener[] getGroupListeners()
Returns an array of all the group listeners registered on this chart.

Returns:
all of this chart's GroupListeners or an empty array if no chart listeners are currently registered
Since:
JDataGrid 2.0
See Also:
addGroupListener(com.zfqjava.chart.event.GroupListener), removeGroupListener(com.zfqjava.chart.event.GroupListener)

fireNodeGrouped

protected void fireNodeGrouped(GroupNode node,
                               List nodeList)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeUngrouped

protected void fireNodeUngrouped(GroupNode node,
                                 List nodeList)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

addLinkListener

public void addLinkListener(LinkListener l)
Adds the specified link listener to receive link events from this chart. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the link listener
Since:
JDataGrid 2.0
See Also:
LinkEvent, LinkListener, removeLinkListener(com.zfqjava.chart.event.LinkListener), getLinkListeners()

removeLinkListener

public void removeLinkListener(LinkListener l)
Removes the specified link listener so that it no longer receives link events from this chart. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this chart. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the node listener
Since:
JDataGrid 2.0
See Also:
LinkEvent, LinkListener, addLinkListener(com.zfqjava.chart.event.LinkListener), getLinkListeners()

getLinkListeners

public LinkListener[] getLinkListeners()
Returns an array of all the link listeners registered on this chart.

Returns:
all of this comonent's LinkListeners or an empty array if no link listeners are currently registered
Since:
JDataGrid 2.0
See Also:
addLinkListener(com.zfqjava.chart.event.LinkListener), removeLinkListener(com.zfqjava.chart.event.LinkListener)

fireNodeLinked

protected void fireNodeLinked(Link link,
                              Node startNode,
                              Node endNode)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

fireNodeUnlinked

protected void fireNodeUnlinked(Link link,
                                Node startNode,
                                Node endNode)
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList

getListeners

public EventListener[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a list model m for its list data listeners with the following code:

ListDataListener[] ldls = (ListDataListener[])(m.getListeners(ListDataListener.class));
If no such listeners exist, this method returns an empty array.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
Throws:
ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
JDataGrid 2.0

JComponentPack 1.5.0

Send your Feedback
JComponentPack 1.5.0
Copyright © 2001-2007 Extreme Component, Inc. All rights reserved.