Search in sources :

Example 6 with RectangleConstraint

use of org.jfree.chart.block.RectangleConstraint in project SIMVA-SoS by SESoS.

the class CompositeTitle method arrange.

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    Size2D contentSize = this.container.arrange(g2, contentConstraint);
    return new Size2D(calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight()));
}
Also used : Size2D(org.jfree.ui.Size2D) RectangleConstraint(org.jfree.chart.block.RectangleConstraint)

Example 7 with RectangleConstraint

use of org.jfree.chart.block.RectangleConstraint in project SIMVA-SoS by SESoS.

the class TextTitle method arrange.

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        } else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), cc.getHeightRange());
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    // suppress compiler warning
    assert contentSize != null;
    return new Size2D(calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight()));
}
Also used : Size2D(org.jfree.ui.Size2D) LengthConstraintType(org.jfree.chart.block.LengthConstraintType) RectangleConstraint(org.jfree.chart.block.RectangleConstraint)

Example 8 with RectangleConstraint

use of org.jfree.chart.block.RectangleConstraint in project SIMVA-SoS by SESoS.

the class LegendGraphic method arrange.

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(contentConstraint.getWidth(), contentConstraint.getHeight());
        }
    }
    assert contentSize != null;
    return new Size2D(calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight()));
}
Also used : Size2D(org.jfree.ui.Size2D) LengthConstraintType(org.jfree.chart.block.LengthConstraintType) RectangleConstraint(org.jfree.chart.block.RectangleConstraint)

Aggregations

RectangleConstraint (org.jfree.chart.block.RectangleConstraint)8 Size2D (org.jfree.ui.Size2D)8 LengthConstraintType (org.jfree.chart.block.LengthConstraintType)4 Rectangle2D (java.awt.geom.Rectangle2D)2 BlockParams (org.jfree.chart.block.BlockParams)2 EntityBlockResult (org.jfree.chart.block.EntityBlockResult)2 Range (org.jfree.data.Range)2 RectangleEdge (org.jfree.ui.RectangleEdge)2 Point2D (java.awt.geom.Point2D)1 AxisLocation (org.jfree.chart.axis.AxisLocation)1 BlockContainer (org.jfree.chart.block.BlockContainer)1 EntityCollection (org.jfree.chart.entity.EntityCollection)1 PlotOrientation (org.jfree.chart.plot.PlotOrientation)1