本文整理汇总了Java中org.jfree.chart.block.BlockFrame类的典型用法代码示例。如果您正苦于以下问题:Java BlockFrame类的具体用法?Java BlockFrame怎么用?Java BlockFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockFrame类属于org.jfree.chart.block包,在下文中一共展示了BlockFrame类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
/**
* 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);
}
示例2: draw
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
/**
* 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);
}
示例3: setPropertyValue
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
@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()));
}
示例4: getBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
@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);
}
示例5: getPropertyValue
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
@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;
}
示例6: setChartLegend
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
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));
}
}
示例7: BlockFrameWrapper
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
public BlockFrameWrapper(BlockFrame blockFrame)
{
this.blockFrame = blockFrame;
}
示例8: getBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
@Override
public BlockFrame getBlockFrame()
{
return blockFrame;
}
示例9: setBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
public void setBlockFrame(BlockFrame blockFrame)
{
this.blockFrame = blockFrame;
}
示例10: getBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
/**
* @return the blockFrame
*/
public BlockFrame getBlockFrame() {
return frame == null ? null : frame.getBlockFrame();
}
示例11: setBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
/**
* @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);
}
示例12: export
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
/**
* 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);
}
示例13: getBlockFrame
import org.jfree.chart.block.BlockFrame; //导入依赖的package包/类
BlockFrame getBlockFrame();