lt.monarch.chart.engine
Interface View

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
Chart<GeneralProjector>
All Known Implementing Classes:
AbstractBorderDecorator, AbstractChart, AbstractLegend, AbstractView, BarChart, BoxWhiskerChart, Chart2D, Chart3D, ColorScaleLegend, CompositeView, ControlChart, CpkChart, DecoratedView, DotPlotChart, EmptyChart, HistogramChart, LabeledChart, LabelView, Legend, LineBorderDecorator, LinePlotChart, MultiSeriesChartBase, ParetoChart, ScatterChart, SimpleChart, SpcChart, ViewGrid, ViewGridIndexed

public interface View
extends java.lang.Cloneable

View is responsible for managing output to some output region


Method Summary
Modifier and Type Method and Description
 void addViewListener(ViewListener listener)
          Registers a view listener
 java.lang.Object clone()
          Must be provided in implementing classes
 ViewContainer container()
          Returns the container for the view
 void dispose()
          Releases all allocated resources.
 float getAlignmentX()
          Returns the alignment along the x axis.
 float getAlignmentY()
          Returns the alignment along the y axis.
 Rectangle2D getBounds()
          Queries view bounds
 java.util.List<?> getContainingObjects()
          Returns all containing objects
 GraphicsManager.GraphicsType getGraphicsType()
          Returns graphics type
 double getHeight()
          Return the current height of this view.
 java.awt.Dimension getMaximumSize(AbstractGraphics g)
          Gets the maximum size of this view.
 java.awt.Dimension getMinimumSize(AbstractGraphics g)
          Gets the minimum size of this view.
 java.awt.Dimension getPreferredSize(AbstractGraphics g)
          Returns preferred view size for rendering on the specified graphics context
 java.awt.Dimension getSize()
          Returns the size of this view in the form of a Dimension object.
 java.awt.Dimension getSize(java.awt.Dimension rv)
          Store the width/height of this view into "return value" rv and return rv.
 Style getStyle()
          Returns the associated local stylesheet
 double getWidth()
          Return the current width of this view.
 double getX()
          Return the current x coordinate of the views origin.
 double getY()
          Return the current y coordinate of the views origin.
 void invalidate()
          Requests a view revalidation
 void removeViewListener(ViewListener listener)
          Unregisters a view listener
 void render(AbstractGraphics g)
          Renders the view
 void repaint()
          Requests a view repaint
 void repaint(Rectangle2D r)
          Requests a repaint of a view region
 void setAlignmentX(float alignmentX)
          Sets the the vertical alignment.
 void setAlignmentY(float alignmentY)
          Sets the the horizontal alignment.
 void setBounds(double x, double y, double width, double height)
          Moves and resizes this view.
 void setBounds(Rectangle2D bounds)
          Sets bounds, where the view should render itself
 void setContainer(ViewContainer container)
          Sets the container for the view.
 void setLocation(double x, double y)
          Moves this view to a new location.
 void setMaximumSize(int width, int height)
          Sets the maximum size of this view to a constant value.
 void setMinimumSize(int width, int height)
          Sets the minimum size of this view to a constant value.
 void setPreferredSize(int width, int height)
          Sets the preferred size of the receiving view.
 void setSize(double width, double height)
          Resizes this view so that it has width width and height.
 void validate(AbstractGraphics g)
          Prepares the view for rendering
 

Method Detail

addViewListener

void addViewListener(ViewListener listener)
Registers a view listener

Parameters:
listener - view listener

removeViewListener

void removeViewListener(ViewListener listener)
Unregisters a view listener

Parameters:
listener - view listener

setContainer

void setContainer(ViewContainer container)
Sets the container for the view. When container is provided, chart can react to user input or request an update.

Parameters:
container - chart container

setBounds

void setBounds(Rectangle2D bounds)
Sets bounds, where the view should render itself

Parameters:
bounds - chart bounds

getBounds

Rectangle2D getBounds()
Queries view bounds

Returns:
view bounds

container

ViewContainer container()
Returns the container for the view

Returns:
chart container

validate

void validate(AbstractGraphics g)
Prepares the view for rendering

Parameters:
g - graphics context

render

void render(AbstractGraphics g)
Renders the view

Parameters:
g - graphics context

getPreferredSize

java.awt.Dimension getPreferredSize(AbstractGraphics g)
Returns preferred view size for rendering on the specified graphics context

Parameters:
g - graphics context
Returns:
preferred size

repaint

void repaint()
Requests a view repaint


repaint

void repaint(Rectangle2D r)
Requests a repaint of a view region

Parameters:
r - view region

invalidate

void invalidate()
Requests a view revalidation


getStyle

Style getStyle()
Returns the associated local stylesheet

Returns:
stylesheet local stylesheet

setBounds

void setBounds(double x,
               double y,
               double width,
               double height)
Moves and resizes this view. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

Parameters:
x - The new x-coordinate of this view.
y - The new y-coordinate of this view.
width - The new width of this view.
height - The new height of this view.

setLocation

void setLocation(double x,
                 double y)
Moves this view to a new location. The top-left corner of the new location is specified by the x and y.

Parameters:
x - The x-coordinate of the new location'stop-left corner.
y - The y-coordinate of the new location's top-left corner.

getX

double getX()
Return the current x coordinate of the views origin.

Returns:
the current x coordinate of the views origin.

getY

double getY()
Return the current y coordinate of the views origin.

Returns:
the current y coordinate of the views origin.

getMaximumSize

java.awt.Dimension getMaximumSize(AbstractGraphics g)
Gets the maximum size of this view.

Parameters:
g - the Graphics context in which the view will be painted
Returns:
A dimension object indicating this view's maximum size.

getMinimumSize

java.awt.Dimension getMinimumSize(AbstractGraphics g)
Gets the minimum size of this view.

Parameters:
g - the Graphics context in which the view will be painted
Returns:
A dimension object indicating this view's minimum size.

setSize

void setSize(double width,
             double height)
Resizes this view so that it has width width and height.

Parameters:
width - The new width of this view in pixels.
height - The new height of this view in pixels.

getSize

java.awt.Dimension getSize()
Returns the size of this view in the form of a Dimension object. The height field of the Dimension object contains this view's height, and the width field of the Dimension object contains this view's width.

Returns:
A Dimension object that indicates the size of this view.

getSize

java.awt.Dimension getSize(java.awt.Dimension rv)
Store the width/height of this view into "return value" rv and return rv. If rv is null a new Dimension object is allocated. This version of getSize() is useful if the caller wants to avoid allocating a new Dimension object on the heap.

Parameters:
rv - the return value, modified to the view size
Returns:
rv

getHeight

double getHeight()
Return the current height of this view. This method is preferable to writing view.getBounds().height, or view.getSize().height because it doesn't cause any heap allocations.

Returns:
the current height of this view.

getWidth

double getWidth()
Return the current width of this view. This method is preferable to writing view.getBounds().width, or view.getSize().width because it doesn't cause any heap allocations.

Returns:
the current width of this view.

setMinimumSize

void setMinimumSize(int width,
                    int height)
Sets the minimum size of this view to a constant value. Subsequent calls to getMinimumSize will always return this value.

Parameters:
width - the minimum width of the view
height - the minimum height of the view

setMaximumSize

void setMaximumSize(int width,
                    int height)
Sets the maximum size of this view to a constant value. Subsequent calls to getMaximumSize will always return this value.

Parameters:
width - the maximum width of the view
height - the maximum height of the view

setPreferredSize

void setPreferredSize(int width,
                      int height)
Sets the preferred size of the receiving view.

Parameters:
width - the preferred width of the receiving view
height - the preferred height of the receiving view

getAlignmentX

float getAlignmentX()
Returns the alignment along the x axis. This specifies how the view would like to be aligned relative to other views. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the farthest away from the origin, 0.5 is centered, etc.

Returns:
the alignment along the x axis

getAlignmentY

float getAlignmentY()
Returns the alignment along the y axis. This specifies how the view would like to be aligned relative to other views. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the farthest away from the origin, 0.5 is centered, etc.

Returns:
the alignment along the y axis

setAlignmentX

void setAlignmentX(float alignmentX)
Sets the the vertical alignment.

Parameters:
alignmentX - the alignment along the x axis

setAlignmentY

void setAlignmentY(float alignmentY)
Sets the the horizontal alignment.

Parameters:
alignmentY - the alignment along the y axis

dispose

void dispose()
Releases all allocated resources.


clone

java.lang.Object clone()
Must be provided in implementing classes

Returns:
Cloned object

getGraphicsType

GraphicsManager.GraphicsType getGraphicsType()
Returns graphics type

Returns:
graphicsType graphics type for view

getContainingObjects

java.util.List<?> getContainingObjects()
Returns all containing objects

Returns:
list of objects