Java 类org.jfree.chart.block.BlockFrame 实例源码

项目:parabuild-ci    文件:LegendTitle.java   
/**
 * Draws the block within the specified area.
 * 
 * @param g2  the graphics device.
 * @param area  the area.
 * @param params  ignored (<code>null</code> permitted).
 * 
 * @return An {@link org.jfree.chart.block.EntityBlockResult} or 
 *         <code>null</code>.
 */
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
    Rectangle2D target = (Rectangle2D) area.clone();
    target = trimMargin(target);
    if (this.backgroundPaint != null) {
        g2.setPaint(this.backgroundPaint);
        g2.fill(target);
    }
    BlockFrame border = getFrame();
    border.draw(g2, target);
    border.getInsets().trim(target);
    BlockContainer container = this.wrapper;
    if (container == null) {
        container = this.items; 
    }
    target = trimPadding(target);
    return container.draw(g2, target, params);   
}
项目:HTML5_WebSite    文件:LegendTitle.java   
/**
 * Draws the block within the specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 * @param params  ignored (<code>null</code> permitted).
 *
 * @return An {@link org.jfree.chart.block.EntityBlockResult} or
 *         <code>null</code>.
 */
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
    Rectangle2D target = (Rectangle2D) area.clone();
    target = trimMargin(target);
    if (this.backgroundPaint != null) {
        g2.setPaint(this.backgroundPaint);
        g2.fill(target);
    }
    BlockFrame border = getFrame();
    border.draw(g2, target);
    border.getInsets().trim(target);
    BlockContainer container = this.wrapper;
    if (container == null) {
        container = this.items;
    }
    target = trimPadding(target);
    return container.draw(g2, target, params);
}
项目:PDFReporter-Studio    文件:MLegendSettings.java   
@Override
public void setPropertyValue(Object id, Object value) {
    LegendSettings ts = getValue();
    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()));
}
项目:nabs    文件:LegendTitle.java   
/**
 * Draws the block within the specified area.
 * 
 * @param g2  the graphics device.
 * @param area  the area.
 * @param params  ignored (<code>null</code> permitted).
 * 
 * @return An {@link org.jfree.chart.block.EntityBlockResult} or 
 *         <code>null</code>.
 */
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
    Rectangle2D target = (Rectangle2D) area.clone();
    target = trimMargin(target);
    if (this.backgroundPaint != null) {
        g2.setPaint(this.backgroundPaint);
        g2.fill(target);
    }
    BlockFrame border = getFrame();
    border.draw(g2, target);
    border.getInsets().trim(target);
    BlockContainer container = this.wrapper;
    if (container == null) {
        container = this.items; 
    }
    target = trimPadding(target);
    return container.draw(g2, target, params);   
}
项目:jasperreports    文件:LineBorderProvider.java   
@Override
public BlockFrame getBlockFrame()
{
    RectangleInsets borderInsets = insets == null ? new RectangleInsets(1.0, 1.0, 1.0, 1.0) : insets;
    Stroke borderStroke = lineStroke == null ? new BasicStroke(1.0f) : lineStroke;
    Paint borderPaint = paint == null ? null : paint.getPaint();
    if (borderPaint == null) 
    {
        borderPaint = Color.BLACK;
    }

    return new LineBorder(borderPaint, borderStroke, borderInsets);
}
项目:PDFReporter-Studio    文件:MLegendSettings.java   
@Override
public Object getPropertyValue(Object id) {
    LegendSettings ts = getValue();
    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;
}
项目:jasperreports    文件:GenericChartTheme.java   
protected void setChartLegend(JFreeChart jfreeChart, Integer baseFontSize)
{

    //The legend visibility is already taken into account in the jfreeChart object's constructor

    LegendTitle legend = jfreeChart.getLegend();
    if (legend != null)
    {
        Font themeLegendFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FONT), getChart().getLegendFont(), baseFontSize);
        legend.setItemFont(themeLegendFont);

        Color legendForecolor = getChart().getOwnLegendColor() != null ? 
                getChart().getOwnLegendColor() :
                (getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) != null ? 
                        (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) :
                        getChart().getLegendColor());
        if (legendForecolor != null)
            legend.setItemPaint(legendForecolor);

        Color legendBackcolor = getChart().getOwnLegendBackgroundColor() != null ? 
                getChart().getOwnLegendBackgroundColor() :
                (getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) != null ? 
                        (Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) :
                        getChart().getLegendBackgroundColor());
        if (legendBackcolor != null)
            legend.setBackgroundPaint(legendBackcolor);

        BlockFrame frame = (BlockFrame)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FRAME);
        if (frame != null)
            legend.setFrame(frame);

        HorizontalAlignment defaultLegendHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_HORIZONTAL_ALIGNMENT);
        if (defaultLegendHAlignment != null)
            legend.setHorizontalAlignment(defaultLegendHAlignment);

        VerticalAlignment defaultLegendVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_VERTICAL_ALIGNMENT);
        if (defaultLegendVAlignment != null)
            legend.setVerticalAlignment(defaultLegendVAlignment);

        RectangleInsets defaultLegendPadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_PADDING);
        RectangleInsets legendPadding = legend.getPadding() != null ? legend.getPadding() : defaultLegendPadding;
        if (legendPadding != null)
            legend.setPadding(legendPadding);

        RectangleEdge defaultLegendPosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_POSITION);
        if (getEdge(getChart().getLegendPositionValue(), defaultLegendPosition) != null)
            legend.setPosition(getEdge(getChart().getLegendPositionValue(), defaultLegendPosition));

    }
}
项目:jasperreports    文件:BlockFrameWrapper.java   
public BlockFrameWrapper(BlockFrame blockFrame)
{
    this.blockFrame = blockFrame;
}
项目:jasperreports    文件:BlockFrameWrapper.java   
@Override
public BlockFrame getBlockFrame()
{
    return blockFrame;
}
项目:jasperreports    文件:BlockFrameWrapper.java   
public void setBlockFrame(BlockFrame blockFrame)
{
    this.blockFrame = blockFrame;
}
项目:jasperreports    文件:LegendSettings.java   
/**
 * @return the blockFrame
 */
public BlockFrame getBlockFrame() {
    return frame == null ? null : frame.getBlockFrame();
}
项目:jasperreports    文件:LegendSettings.java   
/**
 * @param blockFrame the blockFrame to set
 * @deprecated replaced by {@link #setFrame(BlockFrameProvider)}
 */
@Deprecated
public void setBlockFrame(BlockFrame blockFrame) {
    BlockFrameWrapper frameProvider = new BlockFrameWrapper(blockFrame);
    setFrame(frameProvider);
}
项目:jamel    文件:JamelChartPanel.java   
/**
 * Writes the current chart to the specified file in PDF format. This
 * will only work when the OrsonPDF library is found on the classpath.
 * Reflection is used to ensure there is no compile-time dependency on
 * OrsonPDF (which is non-free software).
 * 
 * @param file
 *            the output file ({@code null} not permitted).
 * @param params
 *            formating parameters.
 */
public void export(final File file, final Parameters params) {
    ArgChecks.nullNotPermitted(file, "file");
    final int w;
    final int h;
    if (params != null) {
        w = Integer.parseInt(params.getAttribute("width"));
        h = Integer.parseInt(params.getAttribute("height"));
    } else {
        w = this.getWidth();
        h = this.getHeight();
    }

    // Chart formating

    final TextTitle chartTitle = this.getChart().getTitle();
    this.getChart().setTitle((String) null);
    final BlockFrame legendFrame = this.getChart().getLegend().getFrame();
    this.getChart().getLegend().setFrame(BlockBorder.NONE);

    try {

        // Export to pdf

        final Class<?> pdfDocClass = Class.forName("com.orsonpdf.PDFDocument4Jamel");
        final Object pdfDoc = pdfDocClass.newInstance();
        final Method m = pdfDocClass.getMethod("createPage", Rectangle2D.class);
        final Rectangle2D rect = new Rectangle(w, h);
        final Object page = m.invoke(pdfDoc, rect);
        final Method m2 = page.getClass().getMethod("getGraphics2D");
        final Graphics2D g2 = (Graphics2D) m2.invoke(page);
        g2.setRenderingHint(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, true);
        final Rectangle2D drawArea = new Rectangle2D.Double(0, 0, w, h);
        this.getChart().draw(g2, drawArea);
        final Method m3 = pdfDocClass.getMethod("setAuthor", String.class);
        m3.invoke(pdfDoc, "Pascal Seppecher");
        final Method m4 = pdfDocClass.getMethod("setCreator", String.class);
        m4.invoke(pdfDoc, "Jamel v" + Jamel.getVersion());
        final Method m5 = pdfDocClass.getMethod("setTitle", String.class);
        m5.invoke(pdfDoc, chartTitle.getText());
        final Method m6 = pdfDocClass.getMethod("writeToFile", File.class);
        m6.invoke(pdfDoc, file);

    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
            | InvocationTargetException | NoSuchMethodException | SecurityException ex) {
        throw new RuntimeException(ex);
    }

    // Chart unformating

    this.getChart().setTitle(chartTitle);
    this.getChart().getLegend().setFrame(legendFrame);

}
项目:jasperreports    文件:BlockFrameProvider.java   
BlockFrame getBlockFrame();