Example usage for org.jfree.ui RectangleInsets getBottom

List of usage examples for org.jfree.ui RectangleInsets getBottom

Introduction

In this page you can find the example usage for org.jfree.ui RectangleInsets getBottom.

Prototype

public double getBottom() 

Source Link

Document

Returns the bottom insets.

Usage

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

public static Object getPropertyValue(Object id, RectangleInsets ri, String preID) {
    if (ri == null)
        ri = PadUtil.RECTANGLE_INSETS;/*from   www.j av a  2  s. c  om*/
    if (id.equals(preID + PadUtil.PADDING_TOP))
        return ri.getTop();
    if (id.equals(preID + PadUtil.PADDING_BOTTOM))
        return ri.getBottom();
    if (id.equals(preID + PadUtil.PADDING_LEFT))
        return ri.getLeft();
    if (id.equals(preID + PadUtil.PADDING_RIGHT))
        return ri.getRight();
    return null;
}

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

public static RectangleInsets setPropertyValue(Object id, Object value, RectangleInsets ri, String preID) {
    if (ri == null)
        ri = PadUtil.RECTANGLE_INSETS;/*from   w ww.  jav  a  2s . com*/
    if (value == null)
        value = 0.0d;
    if (id.equals(preID + PadUtil.PADDING_TOP))
        return new RectangleInsets((Double) value, ri.getLeft(), ri.getBottom(), ri.getRight());
    else if (id.equals(preID + PadUtil.PADDING_BOTTOM))
        return new RectangleInsets(ri.getTop(), ri.getLeft(), (Double) value, ri.getRight());
    else if (id.equals(preID + PadUtil.PADDING_LEFT))
        return new RectangleInsets(ri.getTop(), (Double) value, ri.getBottom(), ri.getRight());
    else if (id.equals(preID + PadUtil.PADDING_RIGHT))
        return new RectangleInsets(ri.getTop(), ri.getLeft(), ri.getBottom(), (Double) value);
    return null;
}

From source file:org.toobsframework.pres.chart.ChartUtil.java

public static void configureLegend(IRequest componentRequest, JFreeChart chart, Legend legend, Map params) {
    if (legend != null) {
        if (legend.getBorder() != null) {
            RectangleInsets rect = getRectangle(componentRequest, legend.getBorder(), params);
            chart.getLegend().setBorder(rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight());
        }/*from w w  w.  java2  s.c o m*/
        if (legend.getPadding() != null) {
            chart.getLegend().setItemLabelPadding(getRectangle(componentRequest, legend.getPadding(), params));
        }
    }
}

From source file:net.sf.jasperreports.customizers.marker.AbstractMarkerCustomizer.java

protected void configureMarker(Marker marker) {
    String label = getProperty(PROPERTY_LABEL);
    if (label != null && label.length() > 0) {
        marker.setLabel(label);/*from  w w w .  j  a  v a  2s  .  c o  m*/
    }

    RectangleAnchorEnum labelAnchor = RectangleAnchorEnum.getByName(getProperty(PROPERTY_LABEL_ANCHOR));
    if (labelAnchor != null) {
        marker.setLabelAnchor(labelAnchor.getRectangleAnchor());
    }

    Double offsetTop = getDoubleProperty(PROPERTY_LABEL_OFFSET_TOP);
    Double offsetLeft = getDoubleProperty(PROPERTY_LABEL_OFFSET_LEFT);
    Double offsetBottom = getDoubleProperty(PROPERTY_LABEL_OFFSET_BOTTOM);
    Double offsetRight = getDoubleProperty(PROPERTY_LABEL_OFFSET_RIGHT);
    if (offsetTop != null || offsetLeft != null || offsetBottom != null || offsetRight != null) {
        RectangleInsets currentOffset = marker.getLabelOffset();
        marker.setLabelOffset(new RectangleInsets(offsetTop == null ? currentOffset.getTop() : offsetTop,
                offsetLeft == null ? currentOffset.getLeft() : offsetLeft,
                offsetBottom == null ? currentOffset.getBottom() : offsetBottom,
                offsetRight == null ? currentOffset.getRight() : offsetRight));
    }

    TextAnchorEnum labelTextAnchor = TextAnchorEnum.getByName(getProperty(PROPERTY_LABEL_TEXT_ANCHOR));
    if (labelTextAnchor != null) {
        marker.setLabelTextAnchor(labelTextAnchor.getTextAnchor());
    }

    Color color = JRColorUtil.getColor(getProperty(PROPERTY_COLOR), null);
    if (color != null) {
        marker.setPaint(color);
    }

    Float alpha = getFloatProperty(PROPERTY_ALPHA);
    if (alpha != null) {
        marker.setAlpha(alpha);
    }
}

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

@Override
public void setPropertyValue(Object id, Object value) {
    LegendSettings ts = getValue();//from w  w  w .j  a  v a  2  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:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java

/**
 *
 *///www .java  2  s .  c o m
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException {

    super.configureChart(jfreeChart, jrPlot);
    TextTitle title = jfreeChart.getTitle();

    if (title != null) {

        RectangleInsets padding = title.getPadding();
        double bottomPadding = Math.max(padding.getBottom(), 15d);
        title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }
}

From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java

@Override
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException {

    super.configureChart(jfreeChart, jrPlot);
    TextTitle title = jfreeChart.getTitle();

    if (title != null) {

        RectangleInsets padding = title.getPadding();
        double bottomPadding = Math.max(padding.getBottom(), 15d);
        title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }//  w ww. jav  a2  s .  c o  m
}

From source file:net.sourceforge.processdash.ui.web.reports.RadarPlot.java

/**
 * Draws the plot on a Java 2D graphics device (such as the screen
 * or a printer).// w ww  . j ava2 s . c  o m
 * @param g2 The graphics device.
 * @param plotArea The area within which the plot should be drawn.
 */
@Override
public void draw(Graphics2D g2, Rectangle2D plotArea, Point2D anchor, PlotState state, PlotRenderingInfo info) {
    // adjust for insets...
    RectangleInsets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(plotArea.getX() + insets.getLeft(), plotArea.getY() + insets.getTop(),
                plotArea.getWidth() - insets.getLeft() - insets.getRight(),
                plotArea.getHeight() - insets.getTop() - insets.getBottom());
    }

    if (info != null) {
        info.setPlotArea(plotArea);
        info.setDataArea(plotArea);
    }

    drawBackground(g2, plotArea);
    drawOutline(g2, plotArea);

    Shape savedClip = g2.getClip();
    g2.clip(plotArea);

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha()));

    if (this.dataset != null) {
        drawRadar(g2, plotArea, info, 0, this.dataset);
    } else {
        drawNoDataMessage(g2, plotArea);
    }

    g2.clip(savedClip);
    g2.setComposite(originalComposite);

    drawOutline(g2, plotArea);

}

From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

/**
 *
 *///from www .  j a v  a  2 s  .c  o  m
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException {
    super.configureChart(jfreeChart, jrPlot);

    TextTitle title = jfreeChart.getTitle();
    if (title != null) {
        RectangleInsets padding = title.getPadding();
        double bottomPadding = Math.max(padding.getBottom(), 15d);
        title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }

    GradientPaint gp = (GradientPaint) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BACKGROUND_PAINT);

    jfreeChart.setBackgroundPaint(new GradientPaint(0f, 0f, gp.getColor1(), 0f, getChart().getHeight() * 0.7f,
            gp.getColor2(), false));
}

From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java

@Override
protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException {
    super.configureChart(jfreeChart, jrPlot);

    TextTitle title = jfreeChart.getTitle();
    if (title != null) {
        RectangleInsets padding = title.getPadding();
        double bottomPadding = Math.max(padding.getBottom(), 15d);
        title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight());
    }//from   w  ww.  j a  va  2s  .  co  m

    GradientPaint gp = (GradientPaint) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BACKGROUND_PAINT);

    jfreeChart.setBackgroundPaint(new GradientPaint(0f, 0f, gp.getColor1(), 0f, getChart().getHeight() * 0.7f,
            gp.getColor2(), false));
}