Example usage for org.jfree.chart.block BlockFrame getInsets

List of usage examples for org.jfree.chart.block BlockFrame getInsets

Introduction

In this page you can find the example usage for org.jfree.chart.block BlockFrame getInsets.

Prototype

public RectangleInsets getInsets();

Source Link

Document

Returns the space reserved for the border.

Usage

From source file:com.jaspersoft.studio.components.chart.model.theme.util.PadUtil.java

/**
 * Get the insets of the current frame, if the frame or the provider
 * are not available return null//w  w w  . ja  v  a  2  s  .c  o m
 * 
 * @param provider the provider from where the insets are read
 * @return the insets of the frame or null if they are not available
 */
private static RectangleInsets getFrameInstets(BlockFrameProvider provider) {
    if (provider == null)
        return null;
    BlockFrame frame = provider.getBlockFrame();
    if (frame == null)
        return null;
    return frame.getInsets();
}

From source file:com.jaspersoft.studio.components.chart.model.theme.MLegendSettings.java

@Override
public void setPropertyValue(Object id, Object value) {
    LegendSettings ts = getValue();//from ww  w  .  j a va2  s.c  o m
    if (id.equals(LegendSettings.PROPERTY_showLegend))
        ts.setShowLegend((Boolean) value);
    else if (id.equals(LegendSettings.PROPERTY_font))
        ts.setFont(MFontUtil.setMFont(value));
    else if (id.equals(LegendSettings.PROPERTY_position))
        ts.setPosition((EdgeEnum) posD.getEnumValue(value));
    else if (id.equals(LegendSettings.PROPERTY_horizontalAlignment))
        ts.setHorizontalAlignment(
                ((JFreeChartHorizontalAlignmentEnum) hp.getEnumValue(value)).getJFreeChartValue());
    else if (id.equals(LegendSettings.PROPERTY_verticalAlignment))
        ts.setVerticalAlignment(
                ((JFreeChartVerticalAlignmentEnum) vp.getEnumValue(value)).getJFreeChartValue());
    else if (id.equals(LegendSettings.PROPERTY_backgroundPaint))
        ts.setBackgroundPaint((PaintProvider) value);
    else if (id.equals(LegendSettings.PROPERTY_foregroundPaint))
        ts.setForegroundPaint((PaintProvider) value);

    RectangleInsets ri = PadUtil.setPropertyValue(id, value, ts.getPadding());
    if (ri != null)
        ts.setPadding(ri);
    BlockFrame bf = ts.getBlockFrame();
    ri = PadUtil.setPropertyValue(id, value, bf == null ? null : bf.getInsets(),
            LegendSettings.PROPERTY_blockFrame);
    if (ri != null)
        ts.setBlockFrame(new BlockBorder(ri.getTop(), ri.getLeft(), ri.getBottom(), ri.getRight()));
}

From source file:com.jaspersoft.studio.components.chart.model.theme.MLegendSettings.java

@Override
public Object getPropertyValue(Object id) {
    LegendSettings ts = getValue();//ww w.  j  a v  a  2s.  com
    if (id.equals(LegendSettings.PROPERTY_showLegend))
        return Misc.nvl(ts.getShowLegend(), Boolean.TRUE);
    if (id.equals(LegendSettings.PROPERTY_font)) {
        clFont = MFontUtil.getMFont(clFont, ts.getFont(), null, this);
        return clFont;
    }
    if (id.equals(LegendSettings.PROPERTY_position))
        return posD.getEnumValue(ts.getPositionValue());
    if (id.equals(LegendSettings.PROPERTY_horizontalAlignment))
        return hp.getEnumValue(JFreeChartHorizontalAlignmentEnum.getValue(ts.getHorizontalAlignment()));
    if (id.equals(LegendSettings.PROPERTY_verticalAlignment))
        return vp.getEnumValue(JFreeChartVerticalAlignmentEnum.getValue(ts.getVerticalAlignment()));
    if (id.equals(LegendSettings.PROPERTY_backgroundPaint))
        return ts.getBackgroundPaint();
    if (id.equals(LegendSettings.PROPERTY_foregroundPaint))
        return ts.getForegroundPaint();

    Object pad = PadUtil.getPropertyValue(id, ts.getPadding());
    if (pad != null)
        return pad;
    BlockFrame bf = ts.getBlockFrame();
    if (bf != null) {
        pad = PadUtil.getPropertyValue(id, bf.getInsets(), LegendSettings.PROPERTY_blockFrame);
        if (pad != null)
            return pad;
    }
    return null;
}