org.jplot2d.layout
Interface LayoutDirector
-
- All Known Implementing Classes:
- GridLayoutDirector, OverlayLayoutDirector, SimpleLayoutDirector
public interface LayoutDirectorThe interface to layout a plot. All methods of LayoutDirector will be called inside the plot engine. User should never call them directly. Every plot should have its own LayoutDirector. Re-using a LayoutDirector among multiple plot is not recommended. Re-using a LayoutDirector by plots in different environment will fail due to thread problem.A plot's subplots are laid out in the content area. All layers in a plot are stacked over and have the same size of the content area.
The axis is a special component. Its length can be set when laid out, but its height is fixed and derived from its internal status, such as tick height and labels.
The layout director has 2 working mode.
- For root plot, the size is known, and the content size will be decided by layout director
- For subplot, the content constraint has been set by its container's layout director. The content size will be the constraint, and size is calculated by layout director
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description java.lang.ObjectgetConstraint(PlotEx plot)Returns the constraint for the given plot.java.awt.geom.Dimension2DgetPreferredContentSize(PlotEx plot)java.awt.geom.Dimension2DgetPreferredSize(PlotEx plot)Returns the preferred size of the given plot.voidinvalidateLayout(PlotEx plot)Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.voidlayout(PlotEx plot)Layout the plot.voidremove(PlotEx plot)Removes the given child from this layout.voidsetConstraint(PlotEx plot, java.lang.Object constraint)Sets the constraint for the given plot.
-
-
-
Method Detail
-
getConstraint
java.lang.Object getConstraint(PlotEx plot)
Returns the constraint for the given plot.- Parameters:
plot- The plot- Returns:
- The constraint
-
setConstraint
void setConstraint(PlotEx plot, java.lang.Object constraint)
Sets the constraint for the given plot.- Parameters:
plot-constraint-
-
remove
void remove(PlotEx plot)
Removes the given child from this layout.- Parameters:
plot-
-
invalidateLayout
void invalidateLayout(PlotEx plot)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.- Parameters:
plot- the plot has been invalidate.
-
layout
void layout(PlotEx plot)
Layout the plot. Normally the plot contents size is calculated by subtracting margin from plot size. If the plot has contents size constraint, the plot size is calculated by adding margin to plot content size.
-
getPreferredSize
java.awt.geom.Dimension2D getPreferredSize(PlotEx plot)
Returns the preferred size of the given plot.- Parameters:
plot- The plot- Returns:
- The preferred size
-
getPreferredContentSize
java.awt.geom.Dimension2D getPreferredContentSize(PlotEx plot)
-
-
DMelt 3.0 © DataMelt by jWork.ORG