|
ChartCat 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectli.netcat.chart.util.AbstractPart
li.netcat.chart.util.PanelPart
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.
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 |
public PanelPart()
PanelPart
.
Method Detail |
public void addPart(Part part)
PanelPart
using no constraints.
part
- The part to be added, not null
.public void addPart(Part part, PanelPartConstraints constraints)
PanelPart
using the given constraints.
part
- The part to be added, not null
.constraints
- The constraints that define the positioning of the part.
This parameter can also be null
.public int getPartCount()
PanelPart
.
PanelPart
.public Part getPartAt(int index)
index
- The index of the part. It must be >= 0 and < getPartCount()
.
public PanelPartConstraints getConstraintsAt(int index)
index
- The index of the part. It must be >= 0 and < getPartCount()
.
public int getIndexOfPart(Part part)
part
- The part whose index is required.
PanelPart
.public void removePart(Part part)
part
- The part that has to be removed.
java.lang.RuntimeException
- if the part is not found in this PanelPart
.public void setChart(Chart chart)
Part
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.
setChart
in interface Part
setChart
in class AbstractPart
public Layout getLayout(java.awt.Graphics g)
Part
g
- The relevant graphics object.
null
.
|
ChartCat 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |