ChartCat 1.2

li.netcat.chart.util
Class PanelPart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.PanelPart
All Implemented Interfaces:
Part

public class PanelPart
extends AbstractPart

Since the layout of charts follows another layout paradigm than the standard AWT components, the layout manager concept of AWT cannot be applied to charts. Furthermore, the architecture of this library is completely independent of AWT components. For that reason, an own layout concept has been developed.

This layout concept manages with only two classes: The PanelPart and the PanelPartConstraints.

The PanelPart is an implementation of the Part interface and contains an arbitrary number of parts that get layouted against each other by its container.

Some parts (title or legend) are associated with PanelPartConstraints that define their position absolute or relative to other parts in the container. But most parts know themselves where to place (a grid or a graph), they don't need constraints at all.

As you will see, the layout mechanism of a single PanelPart is very powerful, and with the help of boxed panel parts, the most complex layouts are possible.

Author:
Arthur Marxer
See Also:
PanelPartConstraints

Field Summary
 
Fields inherited from class li.netcat.chart.util.AbstractPart
BACKGROUND, FOREGROUND, PERSPECTIVE
 
Constructor Summary
PanelPart()
          Constructs a new and empty PanelPart.
 
Method Summary
 void addPart(Part part)
          Adds a part to this PanelPart using no constraints.
 void addPart(Part part, PanelPartConstraints constraints)
          Adds a part to this PanelPart using the given constraints.
 PanelPartConstraints getConstraintsAt(int index)
          Returns the constraints at a given index.
 int getIndexOfPart(Part part)
          Returns the index of a given part.
 Layout getLayout(java.awt.Graphics g)
          Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.
 Part getPartAt(int index)
          Returns the part at a given index.
 int getPartCount()
          Returns the number of parts that are contained in this PanelPart.
 void removePart(Part part)
          Removes a part from this panel.
 void setChart(Chart chart)
          Sets the container of this part.
 
Methods inherited from class li.netcat.chart.util.AbstractPart
getChart, getPerspective, invalidate, setPerspective
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PanelPart

public PanelPart()
Constructs a new and empty PanelPart.

Method Detail

addPart

public void addPart(Part part)
Adds a part to this PanelPart using no constraints.

Parameters:
part - The part to be added, not null.

addPart

public void addPart(Part part,
                    PanelPartConstraints constraints)
Adds a part to this PanelPart using the given constraints.

Parameters:
part - The part to be added, not null.
constraints - The constraints that define the positioning of the part. This parameter can also be null.

getPartCount

public int getPartCount()
Returns the number of parts that are contained in this PanelPart.

Returns:
The number of parts that are contained in this PanelPart.

getPartAt

public Part getPartAt(int index)
Returns the part at a given index.

Parameters:
index - The index of the part. It must be >= 0 and < getPartCount().
Returns:
The part at the given index. Never null.

getConstraintsAt

public PanelPartConstraints getConstraintsAt(int index)
Returns the constraints at a given index.

Parameters:
index - The index of the part. It must be >= 0 and < getPartCount().
Returns:
The constraints at the given index, can also be null.

getIndexOfPart

public int getIndexOfPart(Part part)
Returns the index of a given part.

Parameters:
part - The part whose index is required.
Returns:
The index or the part or -1 if it's not found in this PanelPart.

removePart

public void removePart(Part part)
Removes a part from this panel.

Parameters:
part - The part that has to be removed.
Throws:
java.lang.RuntimeException - if the part is not found in this PanelPart.

setChart

public void setChart(Chart chart)
Description copied from interface: Part
Sets the container of this part. This method should not be called by custom code. It gets called when this Part is added to a chart by calling chart.setContent(part);. Implementers of parts must keep this reference and invoke for example chart.invalidate() when a property in this part changes.

Specified by:
setChart in interface Part
Overrides:
setChart in class AbstractPart

getLayout

public Layout getLayout(java.awt.Graphics g)
Description copied from interface: Part
Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.

Parameters:
g - The relevant graphics object.
Returns:
A layout that is able to report the bounds of this part and is able to paint this part. This method may also return null.

ChartCat 1.2

Copyright 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print