first commit
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
import net.sf.jasperreports.crosstabs.JRCellContents;
|
||||
import net.sf.jasperreports.engine.JRBox;
|
||||
import net.sf.jasperreports.engine.JRBoxContainer;
|
||||
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
|
||||
import net.sf.jasperreports.engine.JRElementGroup;
|
||||
import net.sf.jasperreports.engine.JRLineBox;
|
||||
import net.sf.jasperreports.engine.JRStyle;
|
||||
import net.sf.jasperreports.engine.base.JRBaseElementGroup;
|
||||
import net.sf.jasperreports.engine.base.JRBaseLineBox;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
import net.sf.jasperreports.engine.util.JRBoxUtil;
|
||||
import net.sf.jasperreports.engine.util.LineBoxWrapper;
|
||||
|
||||
public class JRBaseCellContents extends JRBaseElementGroup implements JRCellContents, Serializable {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected JRDefaultStyleProvider defaultStyleProvider;
|
||||
|
||||
protected JRStyle style;
|
||||
|
||||
protected String styleNameReference;
|
||||
|
||||
protected Byte mode;
|
||||
|
||||
protected Color backcolor;
|
||||
|
||||
protected JRLineBox lineBox;
|
||||
|
||||
protected int width;
|
||||
|
||||
protected int height;
|
||||
|
||||
private JRBox box;
|
||||
|
||||
public JRBaseCellContents(JRCellContents cell, JRBaseObjectFactory factory) {
|
||||
super((JRElementGroup)cell, factory);
|
||||
this.box = null;
|
||||
this.defaultStyleProvider = factory.getDefaultStyleProvider();
|
||||
this.style = factory.getStyle(cell.getStyle());
|
||||
this.styleNameReference = cell.getStyleNameReference();
|
||||
this.mode = cell.getMode();
|
||||
this.backcolor = cell.getBackcolor();
|
||||
this.lineBox = cell.getLineBox().clone((JRBoxContainer)this);
|
||||
this.width = cell.getWidth();
|
||||
this.height = cell.getHeight();
|
||||
}
|
||||
|
||||
public Color getBackcolor() {
|
||||
return this.backcolor;
|
||||
}
|
||||
|
||||
public JRBox getBox() {
|
||||
return (JRBox)new LineBoxWrapper(getLineBox());
|
||||
}
|
||||
|
||||
public JRLineBox getLineBox() {
|
||||
return this.lineBox;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public JRDefaultStyleProvider getDefaultStyleProvider() {
|
||||
return this.defaultStyleProvider;
|
||||
}
|
||||
|
||||
public JRStyle getStyle() {
|
||||
return this.style;
|
||||
}
|
||||
|
||||
public Byte getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public String getStyleNameReference() {
|
||||
return this.styleNameReference;
|
||||
}
|
||||
|
||||
public Color getDefaultLineColor() {
|
||||
return Color.black;
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
in.defaultReadObject();
|
||||
if (this.lineBox == null) {
|
||||
this.lineBox = (JRLineBox)new JRBaseLineBox((JRBoxContainer)this);
|
||||
JRBoxUtil.setBoxToLineBox(this.box, this.lineBox);
|
||||
this.box = null;
|
||||
}
|
||||
}
|
||||
}
|
264
hrmsEjb/net/sf/jasperreports/crosstabs/base/JRBaseCrosstab.java
Normal file
264
hrmsEjb/net/sf/jasperreports/crosstabs/base/JRBaseCrosstab.java
Normal file
@@ -0,0 +1,264 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.sf.jasperreports.crosstabs.JRCellContents;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstab;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabCell;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabGroup;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
|
||||
import net.sf.jasperreports.crosstabs.design.JRDesignCrosstab;
|
||||
import net.sf.jasperreports.engine.JRCommonElement;
|
||||
import net.sf.jasperreports.engine.JRElement;
|
||||
import net.sf.jasperreports.engine.JRExpression;
|
||||
import net.sf.jasperreports.engine.JRExpressionCollector;
|
||||
import net.sf.jasperreports.engine.JRVariable;
|
||||
import net.sf.jasperreports.engine.JRVisitor;
|
||||
import net.sf.jasperreports.engine.base.JRBaseElement;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
import net.sf.jasperreports.engine.util.JRStyleResolver;
|
||||
|
||||
public class JRBaseCrosstab extends JRBaseElement implements JRCrosstab {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
public static final String PROPERTY_RUN_DIRECTION = "runDirection";
|
||||
|
||||
protected int id;
|
||||
|
||||
protected JRCrosstabParameter[] parameters;
|
||||
|
||||
protected JRVariable[] variables;
|
||||
|
||||
protected JRExpression parametersMapExpression;
|
||||
|
||||
protected JRCrosstabDataset dataset;
|
||||
|
||||
protected JRCrosstabRowGroup[] rowGroups;
|
||||
|
||||
protected JRCrosstabColumnGroup[] columnGroups;
|
||||
|
||||
protected JRCrosstabMeasure[] measures;
|
||||
|
||||
protected int columnBreakOffset;
|
||||
|
||||
protected boolean repeatColumnHeaders = true;
|
||||
|
||||
protected boolean repeatRowHeaders = true;
|
||||
|
||||
protected byte runDirection;
|
||||
|
||||
protected JRCrosstabCell[][] cells;
|
||||
|
||||
protected JRCellContents whenNoDataCell;
|
||||
|
||||
protected JRCellContents headerCell;
|
||||
|
||||
public JRBaseCrosstab(JRCrosstab crosstab, JRBaseObjectFactory factory, int id) {
|
||||
super((JRElement)crosstab, factory);
|
||||
this.id = id;
|
||||
this.columnBreakOffset = crosstab.getColumnBreakOffset();
|
||||
this.repeatColumnHeaders = crosstab.isRepeatColumnHeaders();
|
||||
this.repeatRowHeaders = crosstab.isRepeatRowHeaders();
|
||||
this.runDirection = crosstab.getRunDirection();
|
||||
this.dataset = factory.getCrosstabDataset(crosstab.getDataset());
|
||||
copyParameters(crosstab, factory);
|
||||
copyVariables(crosstab, factory);
|
||||
this.headerCell = factory.getCell(crosstab.getHeaderCell());
|
||||
copyRowGroups(crosstab, factory);
|
||||
copyColumnGroups(crosstab, factory);
|
||||
copyMeasures(crosstab, factory);
|
||||
copyCells(crosstab, factory);
|
||||
this.whenNoDataCell = factory.getCell(crosstab.getWhenNoDataCell());
|
||||
}
|
||||
|
||||
public byte getMode() {
|
||||
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
|
||||
}
|
||||
|
||||
private void copyParameters(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRCrosstabParameter[] crossParameters = crosstab.getParameters();
|
||||
if (crossParameters != null) {
|
||||
this.parameters = new JRCrosstabParameter[crossParameters.length];
|
||||
for (int i = 0; i < this.parameters.length; i++)
|
||||
this.parameters[i] = factory.getCrosstabParameter(crossParameters[i]);
|
||||
}
|
||||
this.parametersMapExpression = factory.getExpression(crosstab.getParametersMapExpression());
|
||||
}
|
||||
|
||||
private void copyVariables(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRVariable[] vars = crosstab.getVariables();
|
||||
if (vars != null) {
|
||||
this.variables = new JRVariable[vars.length];
|
||||
for (int i = 0; i < vars.length; i++)
|
||||
this.variables[i] = (JRVariable)factory.getVariable(vars[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyRowGroups(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRCrosstabRowGroup[] crossRowGroups = crosstab.getRowGroups();
|
||||
if (crossRowGroups != null) {
|
||||
this.rowGroups = new JRCrosstabRowGroup[crossRowGroups.length];
|
||||
for (int i = 0; i < crossRowGroups.length; i++)
|
||||
this.rowGroups[i] = factory.getCrosstabRowGroup(crossRowGroups[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyColumnGroups(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRCrosstabColumnGroup[] crossColumnGroups = crosstab.getColumnGroups();
|
||||
if (crossColumnGroups != null) {
|
||||
this.columnGroups = new JRCrosstabColumnGroup[crossColumnGroups.length];
|
||||
for (int i = 0; i < crossColumnGroups.length; i++)
|
||||
this.columnGroups[i] = factory.getCrosstabColumnGroup(crossColumnGroups[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyMeasures(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRCrosstabMeasure[] crossMeasures = crosstab.getMeasures();
|
||||
if (crossMeasures != null) {
|
||||
this.measures = new JRCrosstabMeasure[crossMeasures.length];
|
||||
for (int i = 0; i < crossMeasures.length; i++)
|
||||
this.measures[i] = factory.getCrosstabMeasure(crossMeasures[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyCells(JRCrosstab crosstab, JRBaseObjectFactory factory) {
|
||||
JRCrosstabCell[][] crossCells = crosstab.getCells();
|
||||
if (crossCells != null) {
|
||||
this.cells = new JRCrosstabCell[this.rowGroups.length + 1][this.columnGroups.length + 1];
|
||||
for (int i = 0; i <= this.rowGroups.length; i++) {
|
||||
for (int j = 0; j <= this.columnGroups.length; j++)
|
||||
this.cells[i][j] = factory.getCrosstabCell(crossCells[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public JRCrosstabDataset getDataset() {
|
||||
return this.dataset;
|
||||
}
|
||||
|
||||
public JRCrosstabRowGroup[] getRowGroups() {
|
||||
return this.rowGroups;
|
||||
}
|
||||
|
||||
public JRCrosstabColumnGroup[] getColumnGroups() {
|
||||
return this.columnGroups;
|
||||
}
|
||||
|
||||
public JRCrosstabMeasure[] getMeasures() {
|
||||
return this.measures;
|
||||
}
|
||||
|
||||
public void collectExpressions(JRExpressionCollector collector) {
|
||||
collector.collect(this);
|
||||
}
|
||||
|
||||
public void visit(JRVisitor visitor) {
|
||||
visitor.visitCrosstab(this);
|
||||
}
|
||||
|
||||
public int getColumnBreakOffset() {
|
||||
return this.columnBreakOffset;
|
||||
}
|
||||
|
||||
public boolean isRepeatColumnHeaders() {
|
||||
return this.repeatColumnHeaders;
|
||||
}
|
||||
|
||||
public boolean isRepeatRowHeaders() {
|
||||
return this.repeatRowHeaders;
|
||||
}
|
||||
|
||||
public JRCrosstabCell[][] getCells() {
|
||||
return this.cells;
|
||||
}
|
||||
|
||||
public JRCrosstabParameter[] getParameters() {
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
public JRExpression getParametersMapExpression() {
|
||||
return this.parametersMapExpression;
|
||||
}
|
||||
|
||||
public JRCellContents getWhenNoDataCell() {
|
||||
return this.whenNoDataCell;
|
||||
}
|
||||
|
||||
public static JRElement getElementByKey(JRCrosstab crosstab, String key) {
|
||||
JRElement element = null;
|
||||
if (crosstab.getHeaderCell() != null)
|
||||
element = crosstab.getHeaderCell().getElementByKey(key);
|
||||
if (element == null)
|
||||
element = getHeadersElement((JRCrosstabGroup[])crosstab.getRowGroups(), key);
|
||||
if (element == null)
|
||||
element = getHeadersElement((JRCrosstabGroup[])crosstab.getColumnGroups(), key);
|
||||
if (element == null)
|
||||
if (crosstab instanceof JRDesignCrosstab) {
|
||||
List cellsList = ((JRDesignCrosstab)crosstab).getCellsList();
|
||||
for (Iterator it = cellsList.iterator(); element == null && it.hasNext(); ) {
|
||||
JRCrosstabCell cell = it.next();
|
||||
element = cell.getContents().getElementByKey(key);
|
||||
}
|
||||
} else {
|
||||
JRCrosstabCell[][] cells = crosstab.getCells();
|
||||
for (int i = cells.length - 1; element == null && i >= 0; i--) {
|
||||
for (int j = (cells[i]).length - 1; element == null && j >= 0; j--) {
|
||||
JRCrosstabCell cell = cells[i][j];
|
||||
if (cell != null)
|
||||
element = cell.getContents().getElementByKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element == null && crosstab.getWhenNoDataCell() != null)
|
||||
element = crosstab.getWhenNoDataCell().getElementByKey(key);
|
||||
return element;
|
||||
}
|
||||
|
||||
private static JRElement getHeadersElement(JRCrosstabGroup[] groups, String key) {
|
||||
JRElement element = null;
|
||||
if (groups != null)
|
||||
for (int i = 0; element == null && i < groups.length; i++) {
|
||||
JRCellContents header = groups[i].getHeader();
|
||||
element = header.getElementByKey(key);
|
||||
if (element == null) {
|
||||
JRCellContents totalHeader = groups[i].getTotalHeader();
|
||||
element = totalHeader.getElementByKey(key);
|
||||
}
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public JRElement getElementByKey(String elementKey) {
|
||||
return getElementByKey(this, elementKey);
|
||||
}
|
||||
|
||||
public JRCellContents getHeaderCell() {
|
||||
return this.headerCell;
|
||||
}
|
||||
|
||||
public JRVariable[] getVariables() {
|
||||
return this.variables;
|
||||
}
|
||||
|
||||
public byte getRunDirection() {
|
||||
return this.runDirection;
|
||||
}
|
||||
|
||||
public void setRunDirection(byte runDirection) {
|
||||
byte old = this.runDirection;
|
||||
this.runDirection = runDirection;
|
||||
getEventSupport().firePropertyChange("runDirection", old, this.runDirection);
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabBucket;
|
||||
import net.sf.jasperreports.engine.JRExpression;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public class JRBaseCrosstabBucket implements JRCrosstabBucket, Serializable {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected byte order = 1;
|
||||
|
||||
protected JRExpression expression;
|
||||
|
||||
protected JRExpression comparatorExpression;
|
||||
|
||||
protected JRBaseCrosstabBucket() {}
|
||||
|
||||
public JRBaseCrosstabBucket(JRCrosstabBucket bucket, JRBaseObjectFactory factory) {
|
||||
factory.put(bucket, this);
|
||||
this.order = bucket.getOrder();
|
||||
this.expression = factory.getExpression(bucket.getExpression());
|
||||
this.comparatorExpression = factory.getExpression(bucket.getComparatorExpression());
|
||||
}
|
||||
|
||||
public byte getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
public JRExpression getExpression() {
|
||||
return this.expression;
|
||||
}
|
||||
|
||||
public JRExpression getComparatorExpression() {
|
||||
return this.comparatorExpression;
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import net.sf.jasperreports.crosstabs.JRCellContents;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabCell;
|
||||
import net.sf.jasperreports.engine.JRRuntimeException;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public class JRBaseCrosstabCell implements JRCrosstabCell, Serializable {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected Integer width;
|
||||
|
||||
protected Integer height;
|
||||
|
||||
protected String rowTotalGroup;
|
||||
|
||||
protected String columnTotalGroup;
|
||||
|
||||
protected JRCellContents contents;
|
||||
|
||||
protected JRBaseCrosstabCell() {}
|
||||
|
||||
public JRBaseCrosstabCell(JRCrosstabCell crosstabCell, JRBaseObjectFactory factory) {
|
||||
factory.put(crosstabCell, this);
|
||||
this.width = crosstabCell.getWidth();
|
||||
this.height = crosstabCell.getHeight();
|
||||
this.rowTotalGroup = crosstabCell.getRowTotalGroup();
|
||||
this.columnTotalGroup = crosstabCell.getColumnTotalGroup();
|
||||
this.contents = factory.getCell(crosstabCell.getContents());
|
||||
}
|
||||
|
||||
public String getRowTotalGroup() {
|
||||
return this.rowTotalGroup;
|
||||
}
|
||||
|
||||
public String getColumnTotalGroup() {
|
||||
return this.columnTotalGroup;
|
||||
}
|
||||
|
||||
public JRCellContents getContents() {
|
||||
return this.contents;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public Integer getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
JRBaseCrosstabCell clone = null;
|
||||
try {
|
||||
clone = (JRBaseCrosstabCell)super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new JRRuntimeException(e);
|
||||
}
|
||||
if (this.contents != null)
|
||||
clone.contents = (JRCellContents)this.contents.clone();
|
||||
return clone;
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabGroup;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public class JRBaseCrosstabColumnGroup extends JRBaseCrosstabGroup implements JRCrosstabColumnGroup {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected int height;
|
||||
|
||||
protected byte position = 1;
|
||||
|
||||
public JRBaseCrosstabColumnGroup(JRCrosstabColumnGroup group, JRBaseObjectFactory factory) {
|
||||
super((JRCrosstabGroup)group, factory);
|
||||
this.height = group.getHeight();
|
||||
this.position = group.getPosition();
|
||||
}
|
||||
|
||||
public byte getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
|
||||
import net.sf.jasperreports.engine.JRElementDataset;
|
||||
import net.sf.jasperreports.engine.JRExpressionCollector;
|
||||
import net.sf.jasperreports.engine.base.JRBaseElementDataset;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public class JRBaseCrosstabDataset extends JRBaseElementDataset implements JRCrosstabDataset {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected boolean dataPreSorted = false;
|
||||
|
||||
public JRBaseCrosstabDataset(JRCrosstabDataset dataset, JRBaseObjectFactory factory) {
|
||||
super((JRElementDataset)dataset, factory);
|
||||
this.dataPreSorted = dataset.isDataPreSorted();
|
||||
}
|
||||
|
||||
public void collectExpressions(JRExpressionCollector collector) {}
|
||||
|
||||
public boolean isDataPreSorted() {
|
||||
return this.dataPreSorted;
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import net.sf.jasperreports.crosstabs.JRCellContents;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabBucket;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabGroup;
|
||||
import net.sf.jasperreports.engine.JRVariable;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public abstract class JRBaseCrosstabGroup implements JRCrosstabGroup, Serializable {
|
||||
protected String name;
|
||||
|
||||
protected byte totalPosition = 0;
|
||||
|
||||
protected JRCrosstabBucket bucket;
|
||||
|
||||
protected JRCellContents header;
|
||||
|
||||
protected JRCellContents totalHeader;
|
||||
|
||||
protected JRVariable variable;
|
||||
|
||||
protected JRBaseCrosstabGroup() {}
|
||||
|
||||
public JRBaseCrosstabGroup(JRCrosstabGroup group, JRBaseObjectFactory factory) {
|
||||
factory.put(group, this);
|
||||
this.name = group.getName();
|
||||
this.totalPosition = group.getTotalPosition();
|
||||
this.bucket = factory.getCrosstabBucket(group.getBucket());
|
||||
this.header = factory.getCell(group.getHeader());
|
||||
this.totalHeader = factory.getCell(group.getTotalHeader());
|
||||
this.variable = (JRVariable)factory.getVariable(group.getVariable());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public JRCrosstabBucket getBucket() {
|
||||
return this.bucket;
|
||||
}
|
||||
|
||||
public byte getTotalPosition() {
|
||||
return this.totalPosition;
|
||||
}
|
||||
|
||||
public boolean hasTotal() {
|
||||
return (this.totalPosition != 0);
|
||||
}
|
||||
|
||||
public JRCellContents getHeader() {
|
||||
return this.header;
|
||||
}
|
||||
|
||||
public JRCellContents getTotalHeader() {
|
||||
return this.totalHeader;
|
||||
}
|
||||
|
||||
public JRVariable getVariable() {
|
||||
return this.variable;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,148 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
|
||||
import net.sf.jasperreports.engine.JRExpression;
|
||||
import net.sf.jasperreports.engine.JRRuntimeException;
|
||||
import net.sf.jasperreports.engine.JRVariable;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
import net.sf.jasperreports.engine.util.JRClassLoader;
|
||||
|
||||
public class JRBaseCrosstabMeasure implements JRCrosstabMeasure, Serializable {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected String name;
|
||||
|
||||
protected String valueClassName;
|
||||
|
||||
protected String valueClassRealName = null;
|
||||
|
||||
protected Class valueClass;
|
||||
|
||||
protected JRExpression expression;
|
||||
|
||||
protected byte calculation = 1;
|
||||
|
||||
protected String incrementerFactoryClassName;
|
||||
|
||||
protected String incrementerFactoryClassRealName;
|
||||
|
||||
protected Class incrementerFactoryClass;
|
||||
|
||||
protected byte percentageOfType = 0;
|
||||
|
||||
protected String percentageCalculatorClassName;
|
||||
|
||||
protected String percentageCalculatorClassRealName;
|
||||
|
||||
protected Class percentageCalculatorClass;
|
||||
|
||||
protected JRVariable variable;
|
||||
|
||||
protected JRBaseCrosstabMeasure() {}
|
||||
|
||||
public JRBaseCrosstabMeasure(JRCrosstabMeasure measure, JRBaseObjectFactory factory) {
|
||||
factory.put(measure, this);
|
||||
this.name = measure.getName();
|
||||
this.valueClassName = measure.getValueClassName();
|
||||
this.expression = factory.getExpression(measure.getValueExpression());
|
||||
this.calculation = measure.getCalculation();
|
||||
this.incrementerFactoryClassName = measure.getIncrementerFactoryClassName();
|
||||
this.percentageOfType = measure.getPercentageOfType();
|
||||
this.percentageCalculatorClassName = measure.getPercentageCalculatorClassName();
|
||||
this.variable = (JRVariable)factory.getVariable(measure.getVariable());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValueClassName() {
|
||||
return this.valueClassName;
|
||||
}
|
||||
|
||||
public JRExpression getValueExpression() {
|
||||
return this.expression;
|
||||
}
|
||||
|
||||
public byte getCalculation() {
|
||||
return this.calculation;
|
||||
}
|
||||
|
||||
public String getIncrementerFactoryClassName() {
|
||||
return this.incrementerFactoryClassName;
|
||||
}
|
||||
|
||||
public byte getPercentageOfType() {
|
||||
return this.percentageOfType;
|
||||
}
|
||||
|
||||
public Class getIncrementerFactoryClass() {
|
||||
if (this.incrementerFactoryClass == null) {
|
||||
String className = getIncrementerFactoryClassRealName();
|
||||
if (className != null)
|
||||
try {
|
||||
this.incrementerFactoryClass = JRClassLoader.loadClassForName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new JRRuntimeException("Could not load measure incrementer class", e);
|
||||
}
|
||||
}
|
||||
return this.incrementerFactoryClass;
|
||||
}
|
||||
|
||||
private String getIncrementerFactoryClassRealName() {
|
||||
if (this.incrementerFactoryClassRealName == null)
|
||||
this.incrementerFactoryClassRealName = JRClassLoader.getClassRealName(this.incrementerFactoryClassName);
|
||||
return this.incrementerFactoryClassRealName;
|
||||
}
|
||||
|
||||
public Class getValueClass() {
|
||||
if (this.valueClass == null) {
|
||||
String className = getValueClassRealName();
|
||||
if (className != null)
|
||||
try {
|
||||
this.valueClass = JRClassLoader.loadClassForName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new JRRuntimeException("Could not load bucket value class", e);
|
||||
}
|
||||
}
|
||||
return this.valueClass;
|
||||
}
|
||||
|
||||
private String getValueClassRealName() {
|
||||
if (this.valueClassRealName == null)
|
||||
this.valueClassRealName = JRClassLoader.getClassRealName(this.valueClassName);
|
||||
return this.valueClassRealName;
|
||||
}
|
||||
|
||||
public JRVariable getVariable() {
|
||||
return this.variable;
|
||||
}
|
||||
|
||||
public String getPercentageCalculatorClassName() {
|
||||
return this.percentageCalculatorClassName;
|
||||
}
|
||||
|
||||
public Class getPercentageCalculatorClass() {
|
||||
if (this.percentageCalculatorClass == null) {
|
||||
String className = getPercentageCalculatorClassRealName();
|
||||
if (className != null)
|
||||
try {
|
||||
this.percentageCalculatorClass = JRClassLoader.loadClassForName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new JRRuntimeException("Could not load measure percentage calculator class", e);
|
||||
}
|
||||
}
|
||||
return this.percentageCalculatorClass;
|
||||
}
|
||||
|
||||
private String getPercentageCalculatorClassRealName() {
|
||||
if (this.percentageCalculatorClassRealName == null)
|
||||
this.percentageCalculatorClassRealName = JRClassLoader.getClassRealName(this.percentageCalculatorClassName);
|
||||
return this.percentageCalculatorClassRealName;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
|
||||
import net.sf.jasperreports.engine.JRExpression;
|
||||
import net.sf.jasperreports.engine.JRParameter;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
import net.sf.jasperreports.engine.base.JRBaseParameter;
|
||||
|
||||
public class JRBaseCrosstabParameter extends JRBaseParameter implements JRCrosstabParameter {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected JRExpression valueExpression;
|
||||
|
||||
protected JRBaseCrosstabParameter() {}
|
||||
|
||||
public JRBaseCrosstabParameter(JRCrosstabParameter parameter, JRBaseObjectFactory factory) {
|
||||
super((JRParameter)parameter, factory);
|
||||
this.valueExpression = factory.getExpression(parameter.getExpression());
|
||||
}
|
||||
|
||||
public JRExpression getExpression() {
|
||||
return this.valueExpression;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
JRBaseCrosstabParameter clone = (JRBaseCrosstabParameter)super.clone();
|
||||
if (this.valueExpression != null)
|
||||
clone.valueExpression = (JRExpression)this.valueExpression.clone();
|
||||
return clone;
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package net.sf.jasperreports.crosstabs.base;
|
||||
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabGroup;
|
||||
import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
|
||||
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
|
||||
|
||||
public class JRBaseCrosstabRowGroup extends JRBaseCrosstabGroup implements JRCrosstabRowGroup {
|
||||
private static final long serialVersionUID = 10200L;
|
||||
|
||||
protected int width;
|
||||
|
||||
protected byte position = 1;
|
||||
|
||||
public JRBaseCrosstabRowGroup(JRCrosstabRowGroup group, JRBaseObjectFactory factory) {
|
||||
super((JRCrosstabGroup)group, factory);
|
||||
this.width = group.getWidth();
|
||||
this.position = group.getPosition();
|
||||
}
|
||||
|
||||
public byte getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user