Example usage for org.jfree.ui RectangleInsets getTop

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

Introduction

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

Prototype

public double getTop() 

Source Link

Document

Returns the top 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;// w w  w  .ja  va 2  s .c  o m
    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: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   www .ja v a 2 s.  c  om*/
        if (legend.getPadding() != null) {
            chart.getLegend().setItemLabelPadding(getRectangle(componentRequest, legend.getPadding(), params));
        }
    }
}

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;/*  w  w w  .  j a  va2s. co m*/
    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: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);/* w  w  w . j  a va  2  s.c om*/
    }

    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   www.  ja v a2  s.  c om
    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.sourceforge.processdash.ui.web.reports.RadarPlot.java

/**
 * Draws the plot on a Java 2D graphics device (such as the screen
 * or a printer).//  w  w w  .j  av  a  2 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.AegeanChartTheme.java

/**
 *
 *//*from  w  w  w.j av a  2 s.c  om*/
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  w w.  j a v a  2  s  .com*/
}

From source file:org.logisticPlanning.utils.graphics.chart.impl.jfree._JFCLineChart2D.java

/** {@inheritDoc} */
@Override/*from ww w.j  a v  a  2 s  .  c o  m*/
protected final void draw(final Graphics2D graph, final Rectangle bounds) {
    final LegendTitle t;
    final RectangleInsets ri;

    if (this.getLegendType() == ELegendType.ONLY_LEGEND) {
        this.__paintAsLegend(graph, bounds);
        return;
    }

    t = this.m_chart.getLegend();
    if ((t != null) && (t.isVisible())) {
        if (bounds.height < bounds.width) {
            t.setPosition(RectangleEdge.RIGHT);
        } else {
            t.setPosition(RectangleEdge.BOTTOM);
        }
    }
    ri = this.m_plot.getInsets();

    this.m_plot.setInsets(new RectangleInsets(ri.getTop(), 0d, 0d, //
            ri.getRight()));
    this.m_chart.draw(graph, bounds);
}

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

/**
 *
 *//*from   ww w  . j a  v  a  2 s  .  co 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));
}