本文整理汇总了Java中net.sf.jasperreports.crosstabs.JRCellContents.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java JRCellContents.getWidth方法的具体用法?Java JRCellContents.getWidth怎么用?Java JRCellContents.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.crosstabs.JRCellContents
的用法示例。
在下文中一共展示了JRCellContents.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JRBaseCellContents
import net.sf.jasperreports.crosstabs.JRCellContents; //导入方法依赖的package包/类
public JRBaseCellContents(JRCellContents cell, JRBaseObjectFactory factory)
{
super(cell, factory);
this.defaultStyleProvider = factory.getDefaultStyleProvider();
style = factory.getStyle(cell.getStyle());
styleNameReference = cell.getStyleNameReference();
modeValue = cell.getModeValue();
backcolor = cell.getBackcolor();
lineBox = cell.getLineBox().clone(this);
width = cell.getWidth();
height = cell.getHeight();
this.propertiesMap = JRPropertiesMap.getPropertiesClone(cell);
}
示例2: getCrosstabChildren
import net.sf.jasperreports.crosstabs.JRCellContents; //导入方法依赖的package包/类
/**
*
*/
private List<JRPrintElement> getCrosstabChildren(ReportConverter reportConverter, JRCrosstab crosstab)
{
List<JRPrintElement> crosstabElements = new ArrayList<JRPrintElement>();
int yOffset = 0;
if (crosstab.getTitleCell() != null
&& crosstab.getTitleCell().getHeight() > 0
&& crosstab.getTitleCell().getCellContents() != null)
{
crosstabElements.add(getCrosstabCellFrame(reportConverter, crosstab.getTitleCell().getCellContents(),
0, yOffset, false, false, false));
yOffset += crosstab.getTitleCell().getHeight();
}
JRCrosstabRowGroup[] rowGroups = crosstab.getRowGroups();
int rowHeadersXOffset = 0;
for (int i = 0; i < rowGroups.length; i++)
{
rowHeadersXOffset += rowGroups[i].getWidth();
}
JRCrosstabColumnGroup[] columnGroups = crosstab.getColumnGroups();
int colHeadersYOffset = yOffset;
for (int i = 0; i < columnGroups.length; i++)
{
colHeadersYOffset += columnGroups[i].getHeight();
}
JRCellContents headerCell = crosstab.getHeaderCell();
if (headerCell != null)
{
if (headerCell.getWidth() != 0 && headerCell.getHeight() != 0)
{
crosstabElements.add(
getCrosstabCellFrame(
reportConverter,
headerCell,
0,
yOffset,
false,
false,
false
));
}
}
addCrosstabColumnHeaders(
reportConverter,
crosstab,
rowHeadersXOffset,
yOffset,
crosstabElements
);
addCrosstabRows(
reportConverter,
crosstab,
rowHeadersXOffset,
colHeadersYOffset,
crosstabElements
);
if (crosstab.getRunDirectionValue() == RunDirectionEnum.RTL)
{
mirrorElements(crosstabElements, crosstab.getX(), crosstab.getWidth());
}
return crosstabElements;
}
示例3: verifyCrosstabCells
import net.sf.jasperreports.crosstabs.JRCellContents; //导入方法依赖的package包/类
private void verifyCrosstabCells(JRDesignCrosstab crosstab)
{
JRCrosstabCell[][] cells = crosstab.getCells();
JRCrosstabRowGroup[] rowGroups = crosstab.getRowGroups();
JRCrosstabColumnGroup[] columnGroups = crosstab.getColumnGroups();
JRCrosstabCell baseCell = cells[rowGroups.length][columnGroups.length];
if(baseCell == null || baseCell.getWidth() == null)
{
addBrokenRule("Crosstab base cell width not specified.", crosstab);
}
if(baseCell == null || baseCell.getHeight() == null)
{
addBrokenRule("Crosstab base cell height not specified.", crosstab);
}
for (int i = rowGroups.length; i >= 0 ; --i)
{
for (int j = columnGroups.length; j >= 0 ; --j)
{
JRCrosstabCell cell = cells[i][j];
String cellText = getCrosstabCellText(rowGroups, columnGroups, i, j);
if (cell != null)
{
JRCellContents contents = cell.getContents();
if (i < rowGroups.length)
{
JRCrosstabCell colCell = cells[rowGroups.length][j];
if (colCell != null && colCell.getContents().getWidth() != contents.getWidth())
{
addBrokenRule("Crosstab " + cellText + " width should be " + colCell.getContents().getWidth() + ".", cell);
}
}
if (j < columnGroups.length)
{
JRCrosstabCell rowCell = cells[i][columnGroups.length];
if (rowCell != null && rowCell.getContents().getHeight() != contents.getHeight())
{
addBrokenRule("Crosstab " + cellText + " height should be " + rowCell.getContents().getHeight() + ".", cell);
}
}
verifyCellContents(contents, cellText);
}
}
}
}
示例4: paintCell
import net.sf.jasperreports.crosstabs.JRCellContents; //导入方法依赖的package包/类
/**
* Draw a cell painting just the border and the cell name.
**/
private void paintCell(Graphics2D g, String title, int x, int y, JRCellContents contents)
{
if (contents == null) return;
int width = contents.getWidth();
int height = contents.getHeight();
int txt_height = g.getFontMetrics().getHeight()/2;
Paint oldPaint = g.getPaint();
Shape oldClip = g.getClip();
//Java2DUtils.resetClip(g);
g.setPaint(CELL_LABEL_COLOR);
g.drawRect(x, y, width, height);
g.setPaint(oldPaint);
g.setPaint(AbstractReportObjectScene.DESIGN_LINE_COLOR);
AffineTransform af = g.getTransform();
AffineTransform new_af = (AffineTransform) af.clone();
AffineTransform translate = AffineTransform.getTranslateInstance(
x,
y);
new_af.concatenate(translate);
g.setTransform(new_af);
JRFrame frame = getCrosstabCellFrame(new ReportConverter(getJasperDesign(),true),
contents,
x,y,
x==0 && crosstab.getRunDirectionValue() == RunDirectionEnum.LTR,
x==0 && crosstab.getRunDirectionValue() == RunDirectionEnum.RTL,
false);
if (frame != null && ((CrosstabObjectScene)this.getScene()).getDrawVisitor() != null)
{
((CrosstabObjectScene)this.getScene()).getDrawVisitor().setGraphics2D(g);
((CrosstabObjectScene)this.getScene()).getDrawVisitor().visitFrame(frame);
}
g.setTransform(af);
g.clipRect(x,
y,
width-2,
height-2);
// TODO: add to the visitore the code to draw a void cell....
Color cc = contents.getBackcolor() != null ? contents.getBackcolor() : Color.WHITE;
cc = cc.darker(); //new Color( cc.getRed(), cc.getGreen(), cc.getBlue(), 200);
g.setPaint(cc);
if (IReportManager.getPreferences().getBoolean( IReportManager.PROPERTY_SHOW_CELL_NAMES, false))
{
g.drawString( title, x+3, y + txt_height + 3);
}
g.setClip(oldClip);
g.setPaint(oldPaint);
}
示例5: JRFillCellContents
import net.sf.jasperreports.crosstabs.JRCellContents; //导入方法依赖的package包/类
public JRFillCellContents(JRBaseFiller filler, JRCellContents cell, String cellType,
JRFillCrosstabObjectFactory factory)
{
super(filler, cell, factory);
defaultStyleProvider = factory.getDefaultStyleProvider();
parentCell = cell;
this.cellType = cellType;
int elementId = filler.getFillContext().generateFillElementId();
printElementOriginator = new DefaultPrintElementOriginator(elementId);
lineBox = cell.getLineBox().clone(this);
width = cell.getWidth();
height = cell.getHeight();
factory.registerDelayedStyleSetter(this, parentCell);
initElements();
initConditionalStyles();
initTemplatesMap();
this.originProvider = factory.getParentOriginProvider();
setElementOriginProvider(this.originProvider);
transformedContentsCache = new ReferenceMap();
boxContentsCache = new HashMap<BoxContents,JRFillCellContents>();
clonePool = new JRClonePool(this, true, true);
}