本文整理汇总了Java中net.sf.jasperreports.crosstabs.JRCrosstabCell类的典型用法代码示例。如果您正苦于以下问题:Java JRCrosstabCell类的具体用法?Java JRCrosstabCell怎么用?Java JRCrosstabCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JRCrosstabCell类属于net.sf.jasperreports.crosstabs包,在下文中一共展示了JRCrosstabCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeCrosstabCell
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
/**
*
*/
protected void writeCrosstabCell( JRCrosstabCell cell, String cellName)
{
if(cell != null)
{
write( "JRDesignCrosstabCell " + cellName + " = new JRDesignCrosstabCell();\n");
write( cellName + ".setWidth({0, number, #});\n", cell.getWidth());
write( cellName + ".setHeight({0, number, #});\n", cell.getHeight());
write( cellName + ".setRowTotalGroup(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(cell.getRowTotalGroup()));
write( cellName + ".setColumnTotalGroup(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(cell.getColumnTotalGroup()));
writeCellContents( cell.getContents(), cellName + "Contents");
write( cellName + ".setContents(" + cellName + "Contents);\n");
flush();
}
}
示例2: JRDesignCrosstab
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
/**
* Creates a new crosstab.
*
* @param defaultStyleProvider default style provider
*/
public JRDesignCrosstab(JRDefaultStyleProvider defaultStyleProvider)
{
super(defaultStyleProvider);
parametersList = new ArrayList<JRCrosstabParameter>();
parametersMap = new HashMap<String, JRCrosstabParameter>();
rowGroupsMap = new HashMap<String, Integer>();
rowGroups = new ArrayList<JRCrosstabRowGroup>();
columnGroupsMap = new HashMap<String, Integer>();
columnGroups = new ArrayList<JRCrosstabColumnGroup>();
measuresMap = new HashMap<String, Integer>();
measures = new ArrayList<JRCrosstabMeasure>();
cellsMap = new HashMap<Pair<String,String>,JRCrosstabCell>();
cellsList = new ArrayList<JRCrosstabCell>();
addBuiltinParameters();
variablesList = new LinkedMap();
addBuiltinVariables();
dataset = new JRDesignCrosstabDataset();
lineBox = new JRBaseLineBox(this);
}
示例3: createDetailCells
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
private void createDetailCells(JRDesignCrosstab jdc) {
List<JRCrosstabCell> cells = jdc.getCellsList();
JRCrosstabMeasure[] measures = jdc.getMeasures();
if (measures != null && cells != null)
for (JRCrosstabCell c : cells) {
int y = 0;
if (c.getHeight() != null && measures.length > 0) {
int h = c.getHeight() / measures.length;
for (int i = 0; i < measures.length; i++) {
JRDesignExpression exp = new JRDesignExpression();
exp.setText("$V{" + measures[i].getName() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
JRDesignTextField tf = (JRDesignTextField) new MTextField()
.createJRElement(getConfig().getJasperDesign());
tf.setX(0);
tf.setY(y);
tf.setWidth(c.getWidth());
tf.setHeight(h);
tf.setExpression(exp);
((JRDesignCellContents) c.getContents()).addElement(tf);
y += h;
}
}
}
}
示例4: removeElements
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
private void removeElements(JRDesignElement element) {
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(jDesign, jrElement);
for (JRCrosstabCell c : crosstab.getCellsList()) {
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(element, c.getContents().getElements());
}
for (JRCrosstabRowGroup rg : crosstab.getRowGroupsList()) {
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(element, rg.getHeader().getElements());
if (rg.getTotalHeader() != null)
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(element, rg.getTotalHeader().getElements());
}
for (JRCrosstabColumnGroup rc : crosstab.getColumnGroupsList()) {
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(element, rc.getHeader().getElements());
if (rc.getTotalHeader() != null)
com.jaspersoft.studio.model.command.CreateElementCommand.removeElement(element, rc.getTotalHeader().getElements());
}
}
示例5: fillDetailsH
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public void fillDetailsH(Guide gnorth, JRDesignCrosstab crosstab) {
JRCrosstabCell[][] cells = crosstab.getCells();
if (cells != null)
for (int i = cells[0].length - 1; i >= 0; i--) {
Guide north = gnorth;
Guide south = hGuides.get(hGuides.size() - 1);
List<JRCrosstabRowGroup> rows = crosstab.getRowGroupsList();
for (int k = 0; k < rows.size(); k++) {
JRCrosstabRowGroup cg = rows.get(k);
boolean last = k == rows.size() - 1;
if (cg.getTotalPositionValue() == CrosstabTotalPositionEnum.END) {
Guide tnorth = hGuides.get(hGuides.indexOf(south) - 1);
addDetailCellH(cells, i, tnorth, south, cg.getName());
south = tnorth;
} else if (cg.getTotalPositionValue() == CrosstabTotalPositionEnum.START) {
Guide tsouth = hGuides.get(hGuides.indexOf(north) + 1);
addDetailCellH(cells, i, north, tsouth, cg.getName());
north = tsouth;
} else if (!last)
continue;
if (last)
addDetailCellH(cells, i, north, south, null);
}
}
}
示例6: setCellRow
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public void setCellRow(int y, String rowTotal) {
JRCrosstabCell[][] cells = crosstab.getCells();
for (int i = cells.length - 1; i >= 0; i--) {
for (int j = cells[i].length - 1; j >= 0; j--) {
JRCrosstabCell jrCrosstabCell = cells[i][j];
if (jrCrosstabCell != null
&& ((jrCrosstabCell.getRowTotalGroup() != null && jrCrosstabCell.getRowTotalGroup().equals(rowTotal)) || (rowTotal == null && jrCrosstabCell.getRowTotalGroup() == null))) {
Rectangle r = matrix.getBounds(new CrosstabCell((JRDesignCellContents) jrCrosstabCell.getContents()));
if (r != null)
r.setLocation(r.x, y);
}
}
}
}
示例7: getCrosstabDesignWidth
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public int getCrosstabDesignWidth()
{
JRCrosstabCell[][] cells = getCrosstab().getCells();
// Calculate the crosstab width...
int width = 0;
// 1. Add all the rows groups widths...
JRCrosstabRowGroup[] row_groups = getCrosstab().getRowGroups();
for (int i=0; i<row_groups.length; ++i)
{
width += row_groups[i].getWidth();
}
// 2. Sum the width of all the not null data cells ...
for (int i=0; i<cells[0].length; ++i)
{
width += ModelUtils.findColumnWidth(cells, i);
}
return width;
}
示例8: getCrosstabDesignHeight
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public int getCrosstabDesignHeight()
{
JRCrosstabCell[][] cells = getCrosstab().getCells();
// Calculate the crosstab width...
int height = 0;
JRCrosstabColumnGroup[] column_groups = getCrosstab().getColumnGroups();
for (int i=0; i<column_groups.length; ++i)
{
height += column_groups[i].getHeight();
}
// 2. Sum the width of all the data cells on the first row...
for (int i=0; i<cells.length; ++i)
{
height += ModelUtils.findRowHeight(cells, i);
}
return height;
}
示例9: getCrosstabCell
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public JRCrosstabCell getCrosstabCell(JRCrosstabCell cell)
{
JRBaseCrosstabCell baseCell = null;
if (cell != null)
{
baseCell = (JRBaseCrosstabCell)get(cell);
if (baseCell == null)
{
baseCell = new JRBaseCrosstabCell(cell, this);
}
}
return baseCell;
}
示例10: writeCrosstabCell
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
protected void writeCrosstabCell(JRCrosstabCell cell) throws IOException
{
writer.startElement(JRCrosstabCellFactory.ELEMENT_crosstabCell);
writer.addAttribute(JRCrosstabCellFactory.ATTRIBUTE_width, cell.getWidth());
writer.addAttribute(JRCrosstabCellFactory.ATTRIBUTE_height, cell.getHeight());
writer.addEncodedAttribute(JRCrosstabCellFactory.ATTRIBUTE_rowTotalGroup, cell.getRowTotalGroup());
writer.addEncodedAttribute(JRCrosstabCellFactory.ATTRIBUTE_columnTotalGroup, cell.getColumnTotalGroup());
writeCellContents(cell.getContents());
writer.closeElement();
}
示例11: collectCrosstabCells
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
private void collectCrosstabCells(JRCrosstab crosstab, JRExpressionCollector crosstabCollector)
{
if (crosstab instanceof JRDesignCrosstab)
{
List<JRCrosstabCell> cellsList = ((JRDesignCrosstab) crosstab).getCellsList();
if (cellsList != null)
{
for (Iterator<JRCrosstabCell> iter = cellsList.iterator(); iter.hasNext();)
{
JRCrosstabCell cell = iter.next();
crosstabCollector.collect(cell.getContents());
}
}
}
else
{
JRCrosstabCell[][] cells = crosstab.getCells();
if (cells != null)
{
for (int i = 0; i < cells.length; ++i)
{
for (int j = 0; j < cells[i].length; j++)
{
if (cells[i][j] != null)
{
crosstabCollector.collect(cells[i][j].getContents());
}
}
}
}
}
}
示例12: copyCells
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
private void copyCells(JRCrosstab crosstab, JRFillCrosstabObjectFactory factory)
{
JRCrosstabCell[][] crosstabCells = crosstab.getCells();
crossCells = new JRFillCrosstabCell[rowGroups.length + 1][columnGroups.length + 1];
for (int i = 0; i <= rowGroups.length; ++i)
{
for (int j = 0; j <= columnGroups.length; ++j)
{
if (crosstabCells[i][j] != null)
{
crossCells[i][j] = factory.getCrosstabCell(crosstabCells[i][j]);
}
}
}
}
示例13: copyCells
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
private void copyCells(JRCrosstab crosstab, JRBaseObjectFactory factory)
{
JRCrosstabCell[][] crossCells = crosstab.getCells();
if (crossCells != null)
{
this.cells = new JRCrosstabCell[rowGroups.length + 1][columnGroups.length + 1];
for (int i = 0; i <= rowGroups.length; i++)
{
for (int j = 0; j <= columnGroups.length; ++j)
{
this.cells[i][j] = factory.getCrosstabCell(crossCells[i][j]);
}
}
}
}
示例14: JRBaseCrosstabCell
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
public JRBaseCrosstabCell(JRCrosstabCell crosstabCell, JRBaseObjectFactory factory)
{
factory.put(crosstabCell, this);
width = crosstabCell.getWidth();
height = crosstabCell.getHeight();
rowTotalGroup = crosstabCell.getRowTotalGroup();
columnTotalGroup = crosstabCell.getColumnTotalGroup();
contents = factory.getCell(crosstabCell.getContents());
}
示例15: removeRowGroup
import net.sf.jasperreports.crosstabs.JRCrosstabCell; //导入依赖的package包/类
/**
* Removes a row group.
*
* @param groupName the group name
* @return the removed group
*/
public JRCrosstabRowGroup removeRowGroup(String groupName)
{
JRCrosstabRowGroup removed = null;
Integer idx = rowGroupsMap.remove(groupName);
if (idx != null)
{
removed = rowGroups.remove(idx.intValue());
for (ListIterator<JRCrosstabRowGroup> it = rowGroups.listIterator(idx.intValue()); it.hasNext();)
{
JRCrosstabRowGroup group = it.next();
rowGroupsMap.put(group.getName(), Integer.valueOf(it.previousIndex()));
}
for (Iterator<JRCrosstabCell> it = cellsList.iterator(); it.hasNext();)
{
JRCrosstabCell cell = it.next();
String rowTotalGroup = cell.getRowTotalGroup();
if (rowTotalGroup != null && rowTotalGroup.equals(groupName))
{
it.remove();
cellsMap.remove(new Pair<String,String>(rowTotalGroup, cell.getColumnTotalGroup()));
getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_CELLS, cell, -1);
}
}
removeRowGroupVars(removed);
getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_ROW_GROUPS, removed, idx.intValue());
}
return removed;
}