本文整理汇总了Java中net.sf.jasperreports.components.table.Cell类的典型用法代码示例。如果您正苦于以下问题:Java Cell类的具体用法?Java Cell怎么用?Java Cell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于net.sf.jasperreports.components.table包,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inScope
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
protected boolean inScope(PropertyMetadata propertyMetadata, JRElementGroup container)
{
if (container instanceof JRFrame)
{
return inScope(propertyMetadata, (JRElement) container);
}
List<PropertyScope> scopes = propertyMetadata.getScopes();
if (container instanceof JRBand)
{
return scopes.contains(PropertyScope.BAND);
}
if (container instanceof Cell)
{
return scopes.contains(PropertyScope.TABLE_CELL);
}
if (container instanceof JRCellContents)
{
return scopes.contains(PropertyScope.CROSSTAB_CELL);
}
return false;
}
示例2: writeTableCell
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
protected void writeTableCell(JRComponentElement componentElement, Cell cell, String name,
JRXmlWriter reportWriter) throws IOException
{
if (cell != null)
{
JRXmlWriteHelper writer = reportWriter.getXmlWriteHelper();
writer.startElement(name);
reportWriter.writeStyleReferenceAttr(cell);
writer.addAttribute("height", cell.getHeight());
writer.addAttribute("rowSpan", cell.getRowSpan());
if (isNewerVersionOrEqual(componentElement, reportWriter, JRConstants.VERSION_4_8_0))
{
reportWriter.writeProperties(cell);
}
reportWriter.writeBox(cell.getLineBox(), JRXmlWriter.JASPERREPORTS_NAMESPACE);
reportWriter.writeChildElements(cell);
writer.closeElement();//cell
}
}
示例3: initHeader
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
private Rectangle initHeader(Rectangle p, BaseColumn bc, int type, String grName) {
int y = p.y;
int h = 0;
int w = bc.getWidth();
Cell c = getCell(bc, type, grName);
if (c != null) {
y = p.y + c.getHeight();
h = c.getHeight();
boundsMap.put(c, new Rectangle(p.x, p.y, w, h));
}
if (bc instanceof ColumnGroup) {
Rectangle pi = new Rectangle(p.x, y, w, h);
int hi = 0;
for (BaseColumn bcg : ((ColumnGroup) bc).getColumns()) {
pi = initHeader(pi, bcg, type, grName);
pi.setLocation(pi.x, y);
if (hi < pi.height)
hi = pi.height;
}
h += hi;
}
return new Rectangle(p.x + w, y, w, h);
}
示例4: initFooter
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
private Rectangle initFooter(Rectangle p, BaseColumn bc, int type, String grName) {
int y = p.y;
int h = 0;
int w = bc.getWidth();
Cell c = getCell(bc, type, grName);
if (bc instanceof ColumnGroup) {
Rectangle pi = new Rectangle(p.x, y, w, h);
int hi = 0;
for (BaseColumn bcg : ((ColumnGroup) bc).getColumns()) {
pi = initFooter(pi, bcg, type, grName);
pi.setLocation(pi.x, y);
if (hi < pi.height)
hi = pi.height;
}
h += hi;
}
if (c != null) {
y = p.y + h;
int cellHeight = c.getHeight();
boundsMap.put(c, new Rectangle(p.x, y, w, cellHeight));
h += cellHeight;
}
return new Rectangle(p.x + w, y, w, h);
}
示例5: getCellElement
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
/**
*
*/
public static <T extends JRElement> T getCellElement(Class<T> type, Cell cell, boolean oneElementPerCell)
{
List<JRChild> detailElements = cell == null ? null : cell.getChildren();
if (detailElements == null || (detailElements != null && oneElementPerCell && detailElements.size() != 1))
{
return null;
}
for (JRChild detailElement: detailElements)
{
if (type.isInstance(detailElement) )
{
@SuppressWarnings("unchecked")
T de = (T) detailElement;
return de;
}
}
return null;
}
示例6: visitColumn
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
@Override
public Void visitColumn(Column column)
{
Cell cell = columnCell(column);
if (!isEmpty(cell))
{
int rowSpan = cell.getRowSpan() == null ? 1 : cell.getRowSpan();
int rowLevel = level + rowSpan - 1;
JRDesignElementGroup elementGroup = bandInfo.getRowElementGroup(rowLevel);
JRElement cellElement = createColumnCell(column, elementGroup, cell);
elementGroup.addElement(cellElement);
bandInfo.cellAdded(level, new CellInfo(cellElement, rowSpan, fillColumn.getColSpan()));
yOffset += cell.getHeight();
}
xOffset += column.getWidth();
return null;
}
示例7: getColumnHeaderLabelExpression
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
protected JRExpression getColumnHeaderLabelExpression(Cell header)
{
List<JRChild> detailElements = header == null ? null : header.getChildren();
// only consider cells with a single text fields
if (detailElements == null || detailElements.size() != 1)
{
return null;
}
JRChild detailElement = detailElements.get(0);
if (detailElement instanceof JRTextField)
{
return ((JRTextField) detailElement).getExpression();
}
if (detailElement instanceof JRStaticText)
{
return builtinEvaluatorFactory.createConstantExpression(((JRStaticText)detailElement).getText());
}
return null;
}
示例8: getSectionHeight
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
private int getSectionHeight(byte sectionType, String groupName)
{
int height = 0;
List<BaseColumn> columns = getTable().getColumns();
for (BaseColumn c : columns)
{
if (c instanceof StandardColumn)
{
Cell cell = getCellOfType(c, sectionType, groupName);
if (cell != null && cell.getHeight().intValue() > height) height = cell.getHeight().intValue();
}
else if (c instanceof StandardColumnGroup)
{
int gh = getSectionHeight((StandardColumnGroup)c, sectionType, groupName );
height = (gh > height) ? gh : height;
}
}
return height;
}
示例9: getCellOfType
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
private Cell getCellOfType(BaseColumn col, byte sectionType, String groupName)
{
if (col == null) return null;
switch (sectionType)
{
case TableCell.TABLE_HEADER: return col.getTableHeader();
case TableCell.COLUMN_HEADER: return col.getColumnHeader();
case TableCell.GROUP_HEADER: return col.getGroupHeader(groupName);
case TableCell.TABLE_FOOTER: return col.getTableFooter();
case TableCell.COLUMN_FOOTER: return col.getColumnFooter();
case TableCell.GROUP_FOOTER: return col.getGroupFooter(groupName);
case TableCell.DETAIL:
{
if (col instanceof StandardColumn) return ((StandardColumn)col).getDetailCell();
}
}
return null;
}
示例10: paintCell
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
public static void paintCell(Widget widget, Graphics2D g, Cell cell, int x, int y, int width, int height) {
Paint oldPaint = g.getPaint();
g.setColor(CELL_LABEL_COLOR);
if (cell == null)
{
g.setPaint(getNullAreaTexture());
g.fillRect(x, y, width, height);
g.setPaint(CELL_LABEL_COLOR);
g.drawRect(x, y, width, height);
return;
}
g.drawRect(x, y, width, height);
// paint frame...
g.setPaint(AbstractReportObjectScene.DESIGN_LINE_COLOR);
paintFrame(widget, g, cell.getLineBox(),cell.getStyle(),x,y,width,height);
g.setPaint(oldPaint);
}
示例11: initDetail
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
private Rectangle initDetail(Rectangle p, BaseColumn bc) {
int h = 0;
int w = 0;
if (bc != null && bc instanceof Column) {
Cell c = ((Column) bc).getDetailCell();
w = bc.getWidth();
if (c != null)
h = c.getHeight();
boundsMap.put(c, new Rectangle(p.x, p.y, w, h));
}
return new Rectangle(p.x + w, p.y, w, h);
}
示例12: getBounds
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
public Rectangle getBounds(int width, Cell cell, BaseColumn col) {
Rectangle b = boundsMap.get(cell);
if (b != null)
return b;
int w = col != null ? col.getWidth() : 0;
int h = cell != null ? cell.getHeight() : 0;
return new Rectangle(0, 0, w, h);
}
示例13: getCell
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
public static Cell getCell(BaseColumn bc, int type, String grName) {
Cell cell = null;
switch (type) {
case TABLE_HEADER:
cell = bc.getTableHeader();
break;
case TABLE_FOOTER:
cell = bc.getTableFooter();
break;
case COLUMN_HEADER:
cell = bc.getColumnHeader();
break;
case COLUMN_FOOTER:
cell = bc.getColumnFooter();
break;
case COLUMN_DETAIL:
if (bc instanceof Column)
cell = ((Column) bc).getDetailCell();
break;
case COLUMN_GROUP_HEADER:
cell = bc.getGroupHeader(grName);
break;
case COLUMN_GROUP_FOOTER:
cell = bc.getGroupFooter(grName);
break;
}
return cell;
}
示例14: visitCell
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
protected void visitCell(Cell cell)
{
if (cell != null)
{
ElementsVisitorUtils.visitElements(visitor, cell.getChildren());
}
}
示例15: isEmpty
import net.sf.jasperreports.components.table.Cell; //导入依赖的package包/类
@Override
protected boolean isEmpty(Cell cell)
{
if (super.isEmpty(cell))
{
return true;
}
// also threat zero height cells as empty.
// FIXME only doing this for the detail cells to minimize impact, it should apply to all cells
List<JRChild> children = cell.getChildren();
return cell.getHeight() == 0 && (children == null || children.isEmpty());
}