public abstract class AbstractChart extends javax.swing.JPanel implements TView, javax.swing.event.MouseInputListener, java.awt.event.MouseWheelListener
AbstractChart
class provides basic implementations
for chart component.
chart is composed by three parts:
Title: this is a JLabel object at the north of chart to display title text.
you can get it by #getTitleLabel().
ChartPane: this is a JComponent object at the center of the chart to display
primary chart information. you can get it by #getChartPane().
LegnedPane: this is a JPanel object whose position is determined by
#setLegendLayout(int), you can get it by #getLegnedPane().
The abstract method of paintChart(Graphics2D, int, int) is left for the
Implication class of AbstractChart
to override for painting
specified chart graphics.
The AbstractChart
implements the TView
interface,
so TDataBox
acts as the model of chart, you can change the model
by #setDataBox(TDataBox), then the chart will monitor the corresponding databox's
data change and represent the data information on the chart.
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected boolean |
antialias |
protected java.awt.Rectangle |
backgroundBounds |
protected java.awt.Color |
backgroundFillColor |
protected boolean |
backgroundGradient |
protected java.awt.Color |
backgroundGradientColor |
protected int |
backgroundGradientFactory |
protected java.awt.Color |
backgroundOutlineColor |
protected java.lang.String |
backgroundStroke |
protected boolean |
backgroundVisible |
protected TDataBox |
box |
protected twaver.chart.ChartPanel |
chartPane |
protected int |
fixedValueCount |
protected java.text.NumberFormat |
format |
protected boolean |
gradient |
protected java.awt.Color |
gradientColor |
protected java.awt.Color |
highlightBackground |
protected java.awt.Color |
highlightForeground |
protected int |
iconHeight |
protected int |
iconWidth |
protected java.awt.Font |
legendFont |
protected int |
legendLayout |
protected int |
legendOrientation |
protected twaver.chart.LegendPanel |
legendPane |
protected double |
lowerLimit |
protected double |
max |
protected double |
min |
protected java.util.Map |
proportions |
protected java.util.List |
proportionsOfRange |
protected java.util.List |
proportionsOfSum |
protected java.util.List |
publishedElements |
protected double |
range |
protected java.awt.Color |
selectedColor |
protected int |
selectedOffset |
protected java.lang.String |
selectedStroke |
protected int |
shadowOffset |
protected java.util.List |
shapeStructs |
protected java.util.Comparator |
sortComparator |
protected java.lang.String |
stroke |
protected double |
sum |
protected int |
textGap |
protected javax.swing.JLabel |
titleLabel |
protected java.lang.String |
unit |
protected double |
upperLimit |
protected boolean |
valueTextCenter |
protected java.awt.Color |
valueTextColor |
protected java.awt.Font |
valueTextFont |
protected int |
valueTextPosition |
protected boolean |
valueTextVisible |
protected java.util.List |
visibleFilters |
protected int |
xGap |
protected int |
yGap |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
AbstractChart()
Creates a new
AbstractChart object with a new TDataBox |
AbstractChart(java.util.List elements)
Creates a new
AbstractChart object initialized with an explicit
list that contains elements. |
AbstractChart(java.util.List elements,
java.lang.String title)
Creates a new
AbstractChart object initialized with an explicit
list an explicit list that contains elements. |
AbstractChart(java.util.List elements,
java.lang.String title,
java.awt.Color backgroundColor)
Creates a new
AbstractChart object initialized with an explicit
list that contains elements, a title and a background color. |
AbstractChart(java.util.List elements,
java.lang.String title,
java.awt.Color backgroundColor,
java.awt.Color foregroundColor)
Creates a new
AbstractChart object initialized with an explicit
list that contains elements, a title, a background color and a foreground color. |
AbstractChart(TDataBox box)
Creates a new
AbstractChart object initialized with an explicit
data box. |
AbstractChart(TDataBox box,
java.lang.String title,
java.awt.Color backgroundColor)
Creates a new
AbstractChart object with an explicit
data box, a title and a background color |
AbstractChart(TDataBox box,
java.lang.String title,
java.awt.Color backgroundColor,
java.awt.Color foregroundColor)
Creates a new
AbstractChart object initialized with an explicit
data box,a title , a background color and a foreground color. |
Modifier and Type | Method and Description |
---|---|
void |
addElementClickedActionListener(java.awt.event.ActionListener l)
Adds an
ActionListener object which listens in element clicked action in this chart. |
void |
addElementDoubleClickedActionListener(java.awt.event.ActionListener l)
Adds an
ActionListener object which listens in element double clicked action in this chart. |
void |
addItem(Item item)
Adds an item to the box if box does't contain the item.
|
void |
addSelectableFilter(SelectableFilter filter)
Adds a new selectable filter into this chart.
|
void |
addVisibleFilter(VisibleFilter visibleFilter)
Adds a
VisibleFilter object to the visible filter list |
protected abstract void |
calculate()
An abstract method that will be called when this chart is publishing data,
The subclass overrides this method to calculate some values.
|
void |
cleanDirtyState()
Calls this method to force this chart to publish data.
|
void |
clearItems()
Clears the data box of this chart.
|
void |
clearSelectableFilters() |
boolean |
exportImage(javax.swing.JFileChooser chooser,
boolean wholeChart)
Calls to export the image of the chart.
|
boolean |
exportImage(java.lang.String fileName,
java.lang.String formatName,
boolean wholeChart)
Calls to export the image of the chart.
|
void |
exportSVG(java.lang.String fileName) |
void |
exportSVG(java.lang.String fileName,
int width,
int height) |
boolean |
exportToImageIcon(java.lang.String iconUrl,
java.lang.String formatName,
boolean wholeChart) |
void |
fireElementClicked(MouseActionEvent event)
Notifies the action of a listener that have registered interest for
notification on this element mouse click event type.
|
void |
fireElementDoubleClicked(MouseActionEvent event)
Notifies the action event of a listener that have registered interest for
notification on this element mouse double click event type.
|
java.awt.Rectangle |
getBackgroundBounds()
Gets the background bounds of the chart panel
|
java.awt.Color |
getBackgroundFillColor()
Gets the fill color of the background
|
java.awt.Color |
getBackgroundGradientColor()
Gets the the background gradient color.
|
int |
getBackgroundGradientFactory()
Gets the background gradient factory.
|
java.awt.Color |
getBackgroundOutlineColor()
Gets the outline color of the background
|
java.lang.String |
getBackgroundStroke()
Gets the stroke text of the background.
|
javax.swing.JComponent |
getChartPane()
Gets the graphics panel of the chart panel,
the chartPane is the panel that shows the chart graphics.
|
java.awt.Color |
getColor(Element element)
Gets the color of a specified
Element object. |
TDataBox |
getDataBox()
Gets connected databox of this chart.
|
Element |
getElementAt(java.awt.Point point)
Gets the first element which contains the specified point.
|
java.util.List |
getElementClickedActionListeners()
Gets all element clicked action listeners.
|
java.util.List |
getElementDoubleClickedActionListeners()
Gets all element double clicked action listeners.
|
java.text.NumberFormat |
getFormat()
Gets the number format of the chart panel,
the number format is used to format the value text.
|
java.text.NumberFormat |
getFormat(Element element)
Gets the number format of a specified
Element object. |
protected java.lang.String |
getFormatedText(Element element,
double value)
Gets the format text of the value by the number format of a specified
Element object. |
protected java.lang.String |
getFormatedText(Element element,
double value,
int index)
Gets the format text of the value by the number format of a specified
Element object. |
java.awt.Color |
getGradientColor()
Gets the gradient color.
|
protected java.awt.Color |
getGradientColor(Element element)
Gets the gradient color.
|
java.awt.Color |
getHighlightBackground()
Gets the color of the highlight background when the label of the legendPane is selected
|
java.awt.Color |
getHighlightForeground()
Gets the color of the highlight foreground when the label of the legendPane is selected
|
int |
getIconHeight()
Gets the height of the icon that displays on the legend pane.
|
int |
getIconWidth()
Gets the width of the icon that displays on the legend pane.
|
Item |
getItemByIndex(int index)
Returns the item at the specified position in the published elements list.
|
int |
getItemCount()
Gets the count of published elements.
|
java.util.List |
getItems()
Gets all published elements.
|
protected java.util.List |
getLegendElements() |
java.awt.Font |
getLegendFont()
Gets the font of the legnd pane.
|
java.lang.String |
getLegendLabel(Element element)
Gets the label of a specified
Element object,
which is shown in the legendPane. |
int |
getLegendLayout()
Gets the legendLayout of the legendPane.
|
int |
getLegendOrientation()
Gets the orientation of the item label in the legendPane.
|
javax.swing.JPanel |
getLegendPane()
Gets the legend pane of this chart,
the legendPane is the panel which show the text and icon of elements .
|
double |
getLowerLimit()
Gets the lower limit of the chart panel,
the lowerLimit is the minimal scale of the y-axis
|
double |
getMax(Element element)
Gets the maximal of a specified
Element object. |
double |
getMaxZoom()
Gets the maximal zoom scale of the chartPane
|
double |
getMin(Element element)
Gets the minimal value of a specified
Element object. |
double |
getMinZoom()
Gets the minimal zoom scale of the chartPane
|
PopupMenuGenerator |
getPopupMenuGenerator()
Get popup menu generator of the chart panel.
|
java.util.List |
getPublishedElements()
Gets the published element list
|
java.util.List |
getSelectableFilters()
Gets all selectable filters that added to this chart.
|
java.awt.Color |
getSelectedColor()
Gets the color of selected element that is used to paint a selected border.
|
java.awt.Color |
getSelectedColor(Element element)
Gets the color of the specified
Element object when it is selected. |
int |
getSelectedOffset()
Gets the offset which is used to show selected chart item.
|
java.lang.String |
getSelectedStroke()
Gets the stroke text which is used to show selected chart item.
|
java.awt.Stroke |
getSelectedStroke(Element element)
Gets the stroke of the specified
Element object when the element is selected. |
int |
getShadowOffset()
Gets the offset of the shadow,
the shadow is painted along x-axis and y-axis.
|
ShapeStruct |
getShapeStructAt(java.awt.Point point) |
java.util.Comparator |
getSortComparator()
Gets the sort comparator of this chart,
the sort comparator determines the display order of elements on this chart.
|
java.lang.String |
getStroke()
Get the stroke of the chartPane.
|
java.awt.Stroke |
getStroke(Element element)
Gets the stroke of a specified
Element object. |
int |
getTextGap()
Gets the gap of the text which is shown in the chartPane,
such as scale along y-axis,the text of the point value in graphics panel.
|
java.lang.String |
getTitle()
Gets the title of the chart.
|
javax.swing.JLabel |
getTitleLabel()
Gets the title label of this chart,
the titleLabel is the label which show the title.
|
java.lang.String |
getToolTipText(Element element)
Gets the tooltip text of a specified
Element object. |
java.lang.String |
getUnit()
Gets the unit of the value text.
|
double |
getUpperLimit()
Gets the upper limit of this chart,
the UpperLimit is the maximal scale value for the y-axis.
|
double |
getValue(Element element)
Gets the value of a specified
Element object. |
java.util.List |
getValues(Element element)
Gets the value list of a specified
Element object. |
java.awt.Color |
getValueTextColor()
Gets the color of the value text.
|
java.awt.Font |
getValueTextFont()
Gets the font of the value text .
|
int |
getValueTextPosition()
Gets the position of the value text.
|
java.util.List |
getVisibleFilters()
Gets a list contains all visible filters of the chart.
|
int |
getXGap()
Gets the margin space of the chart panel on x coordinate.
|
double |
getXTranslate()
Gets xTranslate of the chart panel,
the xTranslate is the distance which will be translated along the x-axis.
|
double |
getXZoom()
Gets the zoom value of the chartPane along the x-axis
|
int |
getYGap()
Gets the margin space of the chart panel on y coordinate.
|
double |
getYTranslate()
Gets yTranslate of the chart panel,
the yTranslate is the distance which will be translated along the y-axis.
|
double |
getYZoom()
Gets the zoom value of the chartPane along the y-axis
|
double |
getZoomIncrement()
Gets the zoom increment of the chartPane
|
boolean |
isAntialias()
Determines whether the chartPane use antialias model,
the antialias flag is used to set the graphics renderinghint of the charPane
|
boolean |
isBackgroundGradient()
Determines whether to draw gradient background.
|
boolean |
isBackgroundVisible()
Determines whether the background is visible.
|
boolean |
isClearSelectionOnMarginClicked()
Returns true if clearing selection when chart margin (blank area) is clicked.
|
boolean |
isEnableDoubleClickToReset()
Determines whether the chart panel will be reset or not when the char panel is double clicked.
|
boolean |
isEnableToolTipText()
Determines whether the tooltip text is visible.
|
boolean |
isEnableXTranslate()
Determines whether the chartPane can be translated along the x-axis.
|
boolean |
isEnableXZoom()
Determines whether the chartPane can be zoomed along the x-axis.
|
boolean |
isEnableYTranslate()
Determines whether the chartPane can be translated along the y-axis.
|
boolean |
isEnableYZoom()
Determines whether the chart panel can be zoomed along the y-axis.
|
boolean |
isGradient()
Determines whether the graphics uses a GradientPaint to fill
|
boolean |
isIteratorByHiberarchy()
Determines whether iteration of elements of data box by hiberarchy.
|
boolean |
isLazyPublishMode()
Determines whether this chart uses lazy publish mode.
|
boolean |
isLocked()
Checks whether the chart panel is locked.
|
boolean |
isSelectable(Element element) |
boolean |
isSelectableOnRightClick()
If this return true, right click mouse will select the clicked element;
if this return false, right click mouse will not select the clicked element.
|
boolean |
isValueTextCenter()
Determines whether the value text is shown in the center of the chart.
|
boolean |
isValueTextVisible()
Determines whether the value text is visible.
|
boolean |
isVisible(Element element)
Determines whether a specified
Element object is visible on this chart. |
void |
lock()
Locks this chart panel from publishing data.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when a mouse button is clicked on the chart panel
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on the chart panel and then
dragged.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters the chart panel.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits the chart panel.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when a mouse button has been moved on the chart panel.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on the chart panel
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on the chart panel.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Invoked when the mouse wheel is rotated.
|
void |
paint(java.awt.Graphics g) |
protected void |
paintBackground(java.awt.Graphics2D g)
Paints the background of the chart if the background is visible.
|
abstract void |
paintChart(java.awt.Graphics2D g,
int width,
int height)
The abstract method of paintChart(Graphics2D, int, int) is left for the
Implication class of
AbstractChart to override for painting
specified chart graphics. |
protected void |
paintComponent(java.awt.Graphics2D g,
java.awt.Component c,
int x,
int y,
int w,
int h) |
void |
publishData()
Publishes data and update legend pane's layout.
|
void |
publishData(boolean updateLegendLayout)
Publishes data with a boolean flag which decides whether the legendPane should be updated.
|
void |
removeElementClickedActionListener(java.awt.event.ActionListener l)
Removes an action listener from the chart panel
|
void |
removeElementDoubleClickedActionListener(java.awt.event.ActionListener l)
Remove an action listener from the chart panel
|
void |
removeItem(Item item)
Removes an item from the box
|
void |
removeSelectableFilter(SelectableFilter filter)
Removes a selectable filter from this chart.
|
void |
removeVisibleFilter(VisibleFilter visibleFilter)
Removes a specified
VisibleFilter object from the visible filter list. |
void |
reset()
Reset the position and size of the chartPane.
|
void |
setAntialias(boolean antialias)
Sets whether the chartPane will use antialias model.
|
void |
setBackgroundFillColor(java.awt.Color backgroundFillColor)
Sets a new fill color for the background of the chart panel
|
void |
setBackgroundGradient(boolean backgroundGradient)
Sets whether to draw gradient background.
|
void |
setBackgroundGradientColor(java.awt.Color backgroundGradientColor)
Sets the the background gradient color.
|
void |
setBackgroundGradientFactory(int backgroundGradientFactory)
Sets the background gradient factory.
|
void |
setBackgroundOutlineColor(java.awt.Color backgroundOutlineColor)
Sets a new outline color for the background of the chart panel
|
void |
setBackgroundStroke(java.lang.String backgroundStroke)
Sets a new stroke for the background of the chart panel
|
void |
setBackgroundVisible(boolean backgroundVisible)
Sets whether the background should be shown on the chart pane.
|
protected void |
setChartSVGAttribute(AbstractSVGChart chart) |
void |
setClearSelectionOnMarginClicked(boolean isClearSelectionOnMarginClicked)
Use this method to determines whether clear selection
when chart blank area is clicked.
|
void |
setDataBox(TDataBox box)
Sets a new databox for this chart panel.
|
void |
setEnableDoubleClickToReset(boolean enableDoubleClickToReset)
Sets whether the chart panel should be reset or not when the char panel is double clicked.
|
void |
setEnableToolTipText(boolean enableToolTipText)
Sets whether the tooltip text should be shown or not.
|
void |
setEnableXTranslate(boolean enableXTranslate)
Sets whether the chartPane can be translated along the x-axis.
|
void |
setEnableXZoom(boolean enableXZoom)
Sets whether the chartPane can be zoomed along the x-axis.
|
void |
setEnableYTranslate(boolean enableYTranslate)
Sets whether the chartPane can be translated along the y-axis or not.
|
void |
setEnableYZoom(boolean enableYZoom)
Sets whether the chart panel can be zoomed along the y-axis.
|
void |
setForeground(java.awt.Color foregroundColor)
Sets a new color for the foreground of the chart.
|
void |
setFormat(java.text.NumberFormat format)
Sets a new number format for the chart panel.
|
void |
setGradient(boolean gradient)
Sets whether the graphics uses a gradient paint to fill.
|
void |
setGradientColor(java.awt.Color gradientColor)
Sets the gradient color.
|
void |
setHighlightBackground(java.awt.Color highlightBackground)
Sets a new color for the highlight background when the label of the legendPane is selected
|
void |
setHighlightForeground(java.awt.Color highlightForeground)
Sets a new color for the highlight foreground when the label of the legendPane is selected
|
void |
setIconHeight(int iconHeight)
Sets a new height for the icon that displays on the legend pane.
|
void |
setIconWidth(int iconWidth)
Sets a new width for the icon that displays on the legend pane.
|
void |
setItems(java.util.List items)
Sets a new elements list for the box of the chart panel.
|
void |
setIteratorByHiberarchy(boolean iteratorByHiberarchy)
Sets whether iteration of elements of data box by hiberarchy.
|
void |
setLazyPublishMode(boolean lazyPublishMode)
Sets whether the chart should use the lazy publish mode.
|
void |
setLegendFont(java.awt.Font legendFont)
Sets a new font for the legnd pane.
|
void |
setLegendLayout(int legendLayout)
Sets a new layout for the legend pane.
|
void |
setLegendOrientation(int legendOrientation)
Sets a new orientation for the item label in the legendPane.Legal values are:
TWaverConst.LABEL_ORIENTATION_HORIZONTAL
TWaverConst.LABEL_ORIENTATION_VERTICAL
TWaverConst.LABEL_ORIENTATION_LEFT
TWaverConst.LABEL_ORIENTATION_RIGHT
|
void |
setLowerLimit(double lowerLimit)
Sets a new lower limit of the chart panel,
the lowerLimit is the minimal scale of the y-axis.
|
void |
setMaxZoom(double maxZoom)
Sets the maximal zoom scale for the chartPane
|
void |
setMinZoom(double minZoom)
Sets the minimal zoom scale for the chartPane.
|
void |
setPopupMenuGenerator(PopupMenuGenerator popupMenuGenerator)
Set a new popup menu generator for the chart panel.
|
void |
setSelectableOnRightClick(boolean isSelectableOnRightClick)
Set this to true, then right click mouse will select the clicked element;
set this to false, then right click mouse will not select the clicked element.
|
void |
setSelectedColor(java.awt.Color selectedColor)
Sets the color of selected element that is used to paint a selected border.
|
void |
setSelectedOffset(int selectedOffset)
Sets a new offset which will be used to show selected chart item.
|
void |
setSelectedStroke(java.lang.String selectedStroke)
Sets a new stroke which is used to show selected chart item.
|
void |
setShadowOffset(int shadowOffset)
Sets a new offset for the shadow,
the shadow is painted along x-axis and y-axis.
|
void |
setSortComparator(java.util.Comparator sortComparator)
Sets a new sort comparator for the chart,
the sort comparator determines the display order of elements on this chart.
|
void |
setStroke(java.lang.String stroke)
Set a new stroke for the chartPane.
|
void |
setTextGap(int textGap)
Sets a new gap for the text which is shown in the chartPane,
such as scale along y-axis,the text of the item value in the graphics panel.
|
void |
setTitle(java.lang.String title)
Sets a new title for the chart.
|
void |
setTranslate(double x,
double y)
Translates the origin of the graphics context to the point
(x, y) in the current coordinate system.
|
void |
setUnit(java.lang.String unit)
Sets a new unit for the value text.
|
void |
setUpperLimit(double upperLimit)
Sets a new upper limit for this chart,
the UpperLimit is the maximal scale value for the y-axis.
|
void |
setValueTextCenter(boolean valueTextCenter)
Sets whether the value text should be shown in the center of the chart.
|
void |
setValueTextColor(java.awt.Color valueTextColor)
Sets a new color for the value text.
|
void |
setValueTextFont(java.awt.Font valueTextFont)
Sets a new font for the value text.
|
void |
setValueTextPosition(int valueTextPosition)
Sets the position of the value text.
|
void |
setValueTextVisible(boolean valueTextVisible)
Sets whether the value text is visible.
|
void |
setXGap(int gap)
Sets the margin space of the chart panel on x coordinate.
|
void |
setXTranslate(double translate)
Sets a new distance which will be translated along the x-axis for the graphic panel of the chart panel.
|
void |
setXZoom(double zoom)
Sets a new zoom value for the chartPane along the x-axis
|
void |
setYGap(int gap)
Sets the margin space of the chart panel on y coordinate.
|
void |
setYTranslate(double translate)
Sets a new distance which will be translated along the y-axis for the chartPane of the chart panel.
|
void |
setYZoom(double zoom)
Sets a new zoom value for the chartPane along the y-axis
|
void |
setZoomIncrement(double zoomIncrement)
Sets a new zoom increment for the chartPane
|
void |
unlock()
Unlocks the chart panel for republish data.
|
void |
updateTViewUI()
Calls this method to publish data and update the view of the chart.
|
void |
zoomIn()
Zooms in the chartPane.
|
void |
zoomOut()
Zooms out the chartPane.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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
protected TDataBox box
protected java.util.Comparator sortComparator
protected java.util.List visibleFilters
protected java.util.List publishedElements
protected double sum
protected double max
protected double min
protected double range
protected java.util.List proportionsOfSum
protected java.util.List proportionsOfRange
protected java.util.Map proportions
protected java.util.List shapeStructs
protected javax.swing.JLabel titleLabel
protected twaver.chart.ChartPanel chartPane
protected twaver.chart.LegendPanel legendPane
protected java.awt.Rectangle backgroundBounds
protected boolean backgroundVisible
protected java.awt.Color backgroundFillColor
protected java.awt.Color backgroundOutlineColor
protected java.lang.String backgroundStroke
protected boolean backgroundGradient
protected java.awt.Color backgroundGradientColor
protected int backgroundGradientFactory
protected java.awt.Font legendFont
protected int legendLayout
protected int legendOrientation
protected int iconWidth
protected int iconHeight
protected int xGap
protected int yGap
protected int textGap
protected double upperLimit
protected double lowerLimit
protected int selectedOffset
protected java.awt.Color selectedColor
protected java.lang.String selectedStroke
protected java.awt.Color highlightBackground
protected java.awt.Color highlightForeground
protected java.lang.String unit
protected java.lang.String stroke
protected java.text.NumberFormat format
protected boolean valueTextVisible
protected boolean valueTextCenter
protected java.awt.Color valueTextColor
protected java.awt.Font valueTextFont
protected int valueTextPosition
protected boolean antialias
protected boolean gradient
protected int shadowOffset
protected java.awt.Color gradientColor
protected int fixedValueCount
public AbstractChart()
AbstractChart
object with a new TDataBox
public AbstractChart(TDataBox box)
AbstractChart
object initialized with an explicit
data box.box
- an explicit data box object.public AbstractChart(TDataBox box, java.lang.String title, java.awt.Color backgroundColor)
AbstractChart
object with an explicit
data box, a title and a background colorbox
- an explicit data box object.title
- a String
titlebackgroundColor
- a background Color
objectpublic AbstractChart(TDataBox box, java.lang.String title, java.awt.Color backgroundColor, java.awt.Color foregroundColor)
AbstractChart
object initialized with an explicit
data box,a title , a background color and a foreground color.box
- an explicit data box object.title
- a String
titlebackgroundColor
- a background Color
objectforegroundColor
- a foreground Color
objectpublic AbstractChart(java.util.List elements)
AbstractChart
object initialized with an explicit
list that contains elements.elements
- an explicit list that contains elements.public AbstractChart(java.util.List elements, java.lang.String title)
AbstractChart
object initialized with an explicit
list an explicit list that contains elements. and a title text.elements
- an explicit list that contains elements.title
- a title textpublic AbstractChart(java.util.List elements, java.lang.String title, java.awt.Color backgroundColor)
AbstractChart
object initialized with an explicit
list that contains elements, a title and a background color.elements
- an explicit list that contains elementstitle
- a String
textbackgroundColor
- a background Color
public AbstractChart(java.util.List elements, java.lang.String title, java.awt.Color backgroundColor, java.awt.Color foregroundColor)
AbstractChart
object initialized with an explicit
list that contains elements, a title, a background color and a foreground color.elements
- an explicit list that contains elementstitle
- a String
textbackgroundColor
- a background Color
foreroundColor
- a foreground Color
public abstract void paintChart(java.awt.Graphics2D g, int width, int height)
AbstractChart
to override for painting
specified chart graphics.g
- the Graphics
context in which to paintwidth
- the width of the chart panelheight
- the height of the chart panelprotected void paintComponent(java.awt.Graphics2D g, java.awt.Component c, int x, int y, int w, int h)
protected void paintBackground(java.awt.Graphics2D g)
g
- the Graphics
context in which to paintpublic 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 mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
MouseWheelEvent
public void lock()
unlock()
public boolean isLocked()
public void unlock()
lock()
public TDataBox getDataBox()
getDataBox
in interface TView
setDataBox(twaver.TDataBox)
public void setDataBox(TDataBox box)
setDataBox
in interface TView
box
- a new TDataBox
instance which is connected to this chart.getDataBox()
public void updateTViewUI()
updateTViewUI
in interface TView
public Element getElementAt(java.awt.Point point)
point
- a point locationpublic ShapeStruct getShapeStructAt(java.awt.Point point)
public void setTitle(java.lang.String title)
title
- a new String
title textpublic java.lang.String getTitle()
public void addItem(Item item)
item
- an Item
objectpublic void removeItem(Item item)
item
- an Item
objectpublic void clearItems()
TDataBox.clear()
public int getItemCount()
getPublishedElements()
public java.util.List getItems()
getPublishedElements()
public Item getItemByIndex(int index)
index
- the specified position indexpublic void setItems(java.util.List items)
items
- a new elements list to be connected to the data box of this chart.public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public void cleanDirtyState()
setLazyPublishMode(boolean)
protected abstract void calculate()
public void publishData()
publishData(boolean)
public void publishData(boolean updateLegendLayout)
updateLegendLayout
- a boolean flag which decides whether the legendPane should be updatedpublic boolean isIteratorByHiberarchy()
setIteratorByHiberarchy(boolean)
public void setIteratorByHiberarchy(boolean iteratorByHiberarchy)
iteratorByHiberarchy
- True to iteration of elements of data box
by hiberarchy, false otherwise.TDataBox.breadthFirstEnumeration()
,
TDataBox.moveTo(int, Element)
public java.util.List getElementDoubleClickedActionListeners()
public java.util.List getElementClickedActionListeners()
public void addElementDoubleClickedActionListener(java.awt.event.ActionListener l)
ActionListener
object which listens in element double clicked action in this chart.l
- an ActionListener
object to be addedpublic void removeElementDoubleClickedActionListener(java.awt.event.ActionListener l)
l
- the listener to be removedpublic void fireElementDoubleClicked(MouseActionEvent event)
event
- a action eventpublic void addElementClickedActionListener(java.awt.event.ActionListener l)
ActionListener
object which listens in element clicked action in this chart.l
- an ActionListener
object to be addedpublic void removeElementClickedActionListener(java.awt.event.ActionListener l)
l
- the listener to be removedpublic void fireElementClicked(MouseActionEvent event)
event
- a action eventpublic double getUpperLimit()
public void setUpperLimit(double upperLimit)
upperLimit
- a new upper limit valuepublic void setForeground(java.awt.Color foregroundColor)
setForeground
in class javax.swing.JComponent
foregroundColor
- a new Color
object for the foreground of this chart.public javax.swing.JComponent getChartPane()
public javax.swing.JPanel getLegendPane()
public javax.swing.JLabel getTitleLabel()
public int getLegendLayout()
public void setLegendLayout(int legendLayout)
legendLayout
- a new layout for the legend panepublic int getIconHeight()
public void setIconHeight(int iconHeight)
iconHeight
- a new height for the icon that displays on the legend pane.public int getIconWidth()
public void setIconWidth(int iconWidth)
iconHeight
- a new width for the icon that displays on the legend pane.public int getXGap()
public void setXGap(int gap)
gap
- the margin space of the chart panel on x coordinate.public int getYGap()
public void setYGap(int gap)
gap
- the margin space of the chart panel on y coordinate.public boolean isValueTextVisible()
public void setValueTextVisible(boolean valueTextVisible)
valueTextVisible
- if true the value text is visible, false otherwisepublic java.awt.Color getValueTextColor()
public void setValueTextColor(java.awt.Color valueTextColor)
valueTextColor
- a new Color
for the value textpublic java.awt.Font getValueTextFont()
public void setValueTextFont(java.awt.Font valueTextFont)
valueTextFont
- a new Font
object for the value textpublic java.text.NumberFormat getFormat()
public void setFormat(java.text.NumberFormat format)
format
- a new NumberFormat
object for the chart panelpublic java.awt.Font getLegendFont()
public void setLegendFont(java.awt.Font legendFont)
legendFont
- a new Font
objectpublic boolean isAntialias()
public void setAntialias(boolean antialias)
antialias
- if true the chartPane will use antialias model, false otherwisepublic java.util.Comparator getSortComparator()
public void setSortComparator(java.util.Comparator sortComparator)
sortComparator
- the sort comparator of the chart.public void addVisibleFilter(VisibleFilter visibleFilter)
VisibleFilter
object to the visible filter listvisibleFilter
- a VisibleFilter
objectVisibleFilter
public void removeVisibleFilter(VisibleFilter visibleFilter)
VisibleFilter
object from the visible filter list.visibleFilter
- the VisibleFilter
object
which needs to be removed from the visible filter list.public java.util.List getVisibleFilters()
public boolean isVisible(Element element)
Element
object is visible on this chart.element
- a specified Element
object to be checked.public void addSelectableFilter(SelectableFilter filter)
filter
- a new selectable filter to be added.removeSelectableFilter(SelectableFilter)
public void removeSelectableFilter(SelectableFilter filter)
filter
- a selectable filter to be removed.addSelectableFilter(SelectableFilter)
public java.util.List getSelectableFilters()
public void clearSelectableFilters()
public boolean isSelectable(Element element)
public boolean isLazyPublishMode()
setLazyPublishMode(boolean)
public void setLazyPublishMode(boolean lazyPublishMode)
lazyPublishMode
- If true the chart should use the lazy publish mode, false otherwise.isLazyPublishMode()
public double getLowerLimit()
public void setLowerLimit(double lowerLimit)
lowerLimit
- a new minimal scale of the y-axispublic java.awt.Color getSelectedColor()
public void setSelectedColor(java.awt.Color selectedColor)
selectedColor
- the color of selected element that is used to paint a selected border.public java.awt.Color getHighlightBackground()
public void setHighlightBackground(java.awt.Color highlightBackground)
highlightBackground
- a new Color
object of the highlight background
when the label of the legendPane is selectedpublic java.awt.Color getHighlightForeground()
public void setHighlightForeground(java.awt.Color highlightForeground)
highlightForeground
- a new Color
object for the highlight foregroundpublic java.awt.Color getSelectedColor(Element element)
Element
object when it is selected.element
- a specified Element
objectpublic java.awt.Stroke getSelectedStroke(Element element)
Element
object when the element is selected.element
- a specified Element
objectprotected java.awt.Color getGradientColor(Element element)
protected java.lang.String getFormatedText(Element element, double value)
Element
object.element
- a specified Element
objectvalue
- the value which is need to be formatedprotected java.lang.String getFormatedText(Element element, double value, int index)
Element
object.element
- a specified Element
objectvalue
- the value which is need to be formatedpublic java.awt.Color getColor(Element element)
Element
object.element
- a specified Element
objectpublic double getValue(Element element)
Element
object.element
- a specified Element
objectpublic double getMax(Element element)
Element
object.element
- a specified Element
objectpublic double getMin(Element element)
Element
object.element
- a specified Element
objectpublic java.lang.String getLegendLabel(Element element)
Element
object,
which is shown in the legendPane.element
- a specified Element
objectpublic java.lang.String getToolTipText(Element element)
Element
object.element
- a specified Element
objectpublic java.text.NumberFormat getFormat(Element element)
Element
object.element
- a specified Element
objectpublic java.awt.Stroke getStroke(Element element)
Element
object.element
- a specified Element
object.public java.util.List getValues(Element element)
Element
object.element
- a specified Element
objectpublic java.util.List getPublishedElements()
protected java.util.List getLegendElements()
public java.lang.String getStroke()
public void setStroke(java.lang.String stroke)
stroke
- a new stroke for the chartPanepublic java.lang.String getUnit()
public void setUnit(java.lang.String unit)
unit
- a new unit for the value textpublic java.lang.String getSelectedStroke()
public void setSelectedStroke(java.lang.String selectedStroke)
selectedStroke
- a new stroke which is used to show selected chart itempublic int getSelectedOffset()
public void setSelectedOffset(int selectedOffset)
selectedOffset
- a new offset which will be used to show selected chart item.public int getShadowOffset()
public void setShadowOffset(int shadowOffset)
shadowOffset
- a new offset for the shadowpublic int getLegendOrientation()
public void setLegendOrientation(int legendOrientation)
legendOrientation
- a new orientation for the item label in the legendPane.public boolean isGradient()
public void setGradient(boolean gradient)
gradient
- if true graphics will set a gradient paint to fill,false otherwise.public boolean isValueTextCenter()
public void setValueTextCenter(boolean valueTextCenter)
valueTextCenter
- if true the value text should be shown in the center of the chart,false otherwise.public int getTextGap()
public void setTextGap(int textGap)
textGap
- a new gap for the text which is shown in the chartPanepublic void setTranslate(double x, double y)
x
- the x coordinate.y
- the y coordinate.public double getXZoom()
public void setXZoom(double zoom)
zoom
- a new zoom value along the x-axispublic double getYZoom()
public void setYZoom(double zoom)
zoom
- a new zoom value along the y-axispublic double getZoomIncrement()
public void setZoomIncrement(double zoomIncrement)
zoomIncrement
- a new zoom increment for the chartPanepublic double getMaxZoom()
public void setMaxZoom(double maxZoom)
maxZoom
- the maximal zoom scale for the chartPanepublic double getMinZoom()
public void setMinZoom(double minZoom)
minZoom
- the minimal zoom scale for the chartPanepublic void reset()
public boolean isEnableXTranslate()
public void setEnableXTranslate(boolean enableXTranslate)
enableXTranslate
- if true the chartPane can be translated along the x-axis,false otherwisepublic boolean isEnableXZoom()
public void setEnableXZoom(boolean enableXZoom)
enableXZoom
- if true the chartPanel can be zoomed along the x-axis,false otherwisepublic boolean isEnableYTranslate()
public void setEnableYTranslate(boolean enableYTranslate)
enableYTranslate
- if true the chartPane can be translated along the y-axis,false otherwisepublic boolean isEnableYZoom()
public void setEnableYZoom(boolean enableYZoom)
enableYZoom
- if true the chart panel can be zoomed along the y-axis,false otherwisepublic double getXTranslate()
public void setXTranslate(double translate)
translate
- a new distance which will be translated along the x-axispublic double getYTranslate()
public void setYTranslate(double translate)
translate
- a new distance which will be translated along the y-axispublic void zoomIn()
public void zoomOut()
public PopupMenuGenerator getPopupMenuGenerator()
#twaver.PopupMenuGenerator
public void setPopupMenuGenerator(PopupMenuGenerator popupMenuGenerator)
popupMenuGenerator
- a new popup menu generator to be used for this chart panel#twaver.PopupMenuGenerator
public boolean isSelectableOnRightClick()
public void setSelectableOnRightClick(boolean isSelectableOnRightClick)
isSelectableOnRightClick
- if true enables select when right click, false otherwisepublic boolean isClearSelectionOnMarginClicked()
setClearSelectionOnMarginClicked(boolean)
public void setClearSelectionOnMarginClicked(boolean isClearSelectionOnMarginClicked)
isClearSelectionOnMarginClicked
- boolean true
if clearing selection when chart margin (blank area) is clicked,
false otherwise.isClearSelectionOnMarginClicked
public boolean isEnableDoubleClickToReset()
public void setEnableDoubleClickToReset(boolean enableDoubleClickToReset)
enableDoubleClickToReset
- if true the chart panel should be reset when the char panel is double clicked.public boolean isEnableToolTipText()
public void setEnableToolTipText(boolean enableToolTipText)
enableToolTipText
- if true the tooltip text is visible,false otherwisepublic java.awt.Color getBackgroundFillColor()
public void setBackgroundFillColor(java.awt.Color backgroundFillColor)
backgroundFillColor
- a new fill color for the background of the chart panelpublic java.awt.Color getBackgroundOutlineColor()
public void setBackgroundOutlineColor(java.awt.Color backgroundOutlineColor)
backgroundOutlineColor
- a new outline color for the background of the chart panelpublic java.lang.String getBackgroundStroke()
public void setBackgroundStroke(java.lang.String backgroundStroke)
backgroundStroke
- a new String
stroke text for the backgroundpublic boolean isBackgroundVisible()
public void setBackgroundVisible(boolean backgroundVisible)
backgroundVisible
- if true the background should be shown, false otherwise.public java.awt.Rectangle getBackgroundBounds()
public boolean exportImage(java.lang.String fileName, java.lang.String formatName, boolean wholeChart)
fileName
- the file name of the exported imageformatName
- the format name of the exported imagewholeChart
- true to export the whole chart, false to export center chart pane.public boolean exportToImageIcon(java.lang.String iconUrl, java.lang.String formatName, boolean wholeChart)
public boolean exportImage(javax.swing.JFileChooser chooser, boolean wholeChart)
chooser
- the specified file chooserwholeChart
- true to export the whole chart, false to export center chart pane.public boolean isBackgroundGradient()
public void setBackgroundGradient(boolean backgroundGradient)
backgroundGradient
- True to draw gradient background, false otherwise.public java.awt.Color getBackgroundGradientColor()
public void setBackgroundGradientColor(java.awt.Color backgroundGradientColor)
backgroundGradientColor
- the the background gradient color.public int getBackgroundGradientFactory()
public void setBackgroundGradientFactory(int backgroundGradientFactory)
backgroundGradientFactory
- the background gradient factory.public int getValueTextPosition()
setValueTextPosition(int)
public void setValueTextPosition(int valueTextPosition)
valueTextPosition
- the position of the value text.getValueTextPosition()
public java.awt.Color getGradientColor()
setGradientColor(Color)
public void setGradientColor(java.awt.Color gradientColor)
gradientColor
- the gradient color.getGradientColor()
public void exportSVG(java.lang.String fileName, int width, int height)
public void exportSVG(java.lang.String fileName)
protected void setChartSVGAttribute(AbstractSVGChart chart)
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.