本文整理汇总了Java中net.sf.jasperreports.crosstabs.JRCrosstabMeasure类的典型用法代码示例。如果您正苦于以下问题:Java JRCrosstabMeasure类的具体用法?Java JRCrosstabMeasure怎么用?Java JRCrosstabMeasure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JRCrosstabMeasure类属于net.sf.jasperreports.crosstabs包,在下文中一共展示了JRCrosstabMeasure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeCrosstabMeasure
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
/**
*
*/
protected void writeCrosstabMeasure( JRCrosstabMeasure measure, String measureName)
{
if(measure != null)
{
write( "JRDesignCrosstabMeasure " + measureName + " = new JRDesignCrosstabMeasure();\n");
write( measureName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(measure.getName()));
write( measureName + ".setValueClassName(\"{0}\");\n", measure.getValueClassName());
write( measureName + ".setCalculation({0});\n", measure.getCalculationValue(), CalculationEnum.NOTHING);
write( measureName + ".setPercentageType({0});\n", measure.getPercentageType(), CrosstabPercentageEnum.NONE);
write( measureName + ".setPercentageCalculatorClassName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(measure.getPercentageCalculatorClassName()));
writeExpression( measure.getValueExpression(), measureName, "ValueExpression");
flush();
}
}
示例2: JRDesignCrosstab
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的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: addRowGroupVars
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
protected void addRowGroupVars(JRDesignCrosstabRowGroup rowGroup)
{
addVariable(rowGroup.getVariable());
for (Iterator<JRCrosstabMeasure> measureIt = measures.iterator(); measureIt.hasNext();)
{
JRCrosstabMeasure measure = measureIt.next();
addTotalVar(measure, rowGroup, null);
for (Iterator<JRCrosstabColumnGroup> colIt = columnGroups.iterator(); colIt.hasNext();)
{
JRCrosstabColumnGroup colGroup = colIt.next();
addTotalVar(measure, rowGroup, colGroup);
}
}
}
示例4: addColGroupVars
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
protected void addColGroupVars(JRDesignCrosstabColumnGroup colGroup)
{
addVariable(colGroup.getVariable());
for (Iterator<JRCrosstabMeasure> measureIt = measures.iterator(); measureIt.hasNext();)
{
JRCrosstabMeasure measure = measureIt.next();
addTotalVar(measure, null, colGroup);
for (Iterator<JRCrosstabRowGroup> rowIt = rowGroups.iterator(); rowIt.hasNext();)
{
JRCrosstabRowGroup rowGroup = rowIt.next();
addTotalVar(measure, rowGroup, colGroup);
}
}
}
示例5: getTotalVariableName
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
public static String getTotalVariableName(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)
{
StringBuilder name = new StringBuilder();
name.append(measure.getName());
if (rowGroup != null)
{
name.append('_');
name.append(rowGroup.getName());
}
if (colGroup != null)
{
name.append('_');
name.append(colGroup.getName());
}
name.append("_ALL");
return name.toString();
}
示例6: removeRowGroupVars
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
protected void removeRowGroupVars(JRCrosstabRowGroup rowGroup)
{
removeVariable(rowGroup.getVariable());
for (Iterator<JRCrosstabMeasure> measureIt = measures.iterator(); measureIt.hasNext();)
{
JRCrosstabMeasure measure = measureIt.next();
removeTotalVar(measure, rowGroup, null);
for (Iterator<JRCrosstabColumnGroup> colIt = columnGroups.iterator(); colIt.hasNext();)
{
JRCrosstabColumnGroup colGroup = colIt.next();
removeTotalVar(measure, rowGroup, colGroup);
}
}
}
示例7: removeColGroupVars
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
protected void removeColGroupVars(JRCrosstabColumnGroup colGroup)
{
removeVariable(colGroup.getVariable());
for (Iterator<JRCrosstabMeasure> measureIt = measures.iterator(); measureIt.hasNext();)
{
JRCrosstabMeasure measure = measureIt.next();
removeTotalVar(measure, null, colGroup);
for (Iterator<JRCrosstabRowGroup> rowIt = rowGroups.iterator(); rowIt.hasNext();)
{
JRCrosstabRowGroup rowGroup = rowIt.next();
removeTotalVar(measure, rowGroup, colGroup);
}
}
}
示例8: removeMeasure
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
/**
* Removes a measure.
*
* @param measureName the measure name
* @return the removed measure
*/
public JRCrosstabMeasure removeMeasure(String measureName)
{
JRDesignCrosstabMeasure removed = null;
Integer idx = measuresMap.remove(measureName);
if (idx != null)
{
removed = (JRDesignCrosstabMeasure) measures.remove(idx.intValue());
for (ListIterator<JRCrosstabMeasure> it = measures.listIterator(idx.intValue()); it.hasNext();)
{
JRCrosstabMeasure group = it.next();
measuresMap.put(group.getName(), Integer.valueOf(it.previousIndex()));
}
removeMeasureVars(removed);
removed.removePropertyChangeListener(JRDesignCrosstabMeasure.PROPERTY_VALUE_CLASS, measureClassChangeListener);
getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_MEASURES, removed, idx.intValue());
}
return removed;
}
示例9: createDetailCells
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的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;
}
}
}
}
示例10: setName
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void setName(String s) {
if (s.equals(""))
{
throw new IllegalArgumentException("Measure name not valid.");
}
List<JRCrosstabMeasure> currentMeasures = Arrays.asList(getCrosstab().getMeasures());
for (JRCrosstabMeasure p : currentMeasures)
{
if (p != getMeasure() && p.getName().equals(s))
{
throw new IllegalArgumentException("Measure name already in use.");
}
}
String oldName = getMeasure().getName();
getMeasure().setName(s);
ObjectPropertyUndoableEdit opue = new ObjectPropertyUndoableEdit(
getMeasure(), "Name", String.class, oldName, s);
IReportManager.getInstance().addUndoableEdit(opue);
}
示例11: getCrosstabMeasure
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
public JRBaseCrosstabMeasure getCrosstabMeasure(JRCrosstabMeasure measure)
{
JRBaseCrosstabMeasure baseCrosstabMeasure = null;
if (measure != null)
{
baseCrosstabMeasure = (JRBaseCrosstabMeasure) get(measure);
if (baseCrosstabMeasure == null)
{
baseCrosstabMeasure = new JRBaseCrosstabMeasure(measure, this);
}
}
return baseCrosstabMeasure;
}
示例12: writeCrosstabMeasure
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
protected void writeCrosstabMeasure(JRCrosstabMeasure measure) throws IOException
{
writer.startElement(JRCrosstabMeasureFactory.ELEMENT_measure);
writer.addEncodedAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_name, measure.getName());
writer.addAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_class, measure.getValueClassName());
writer.addAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_calculation, measure.getCalculationValue(), CalculationEnum.NOTHING);
writer.addAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_incrementerFactoryClass, measure.getIncrementerFactoryClassName());
writer.addAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_percentageOf, measure.getPercentageType(), CrosstabPercentageEnum.NONE);
writer.addAttribute(JRCrosstabMeasureFactory.ATTRIBUTE_percentageCalculatorClass, measure.getPercentageCalculatorClassName());
writeExpression(JRCrosstabMeasureFactory.ELEMENT_measureExpression, measure.getValueExpression(), false);
writer.closeElement();
}
示例13: copyMeasures
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
private void copyMeasures(JRCrosstab crosstab, JRFillCrosstabObjectFactory factory)
{
JRCrosstabMeasure[] crossMeasures = crosstab.getMeasures();
measures = new JRFillCrosstabMeasure[crossMeasures.length];
for (int i = 0; i < crossMeasures.length; i++)
{
measures[i] = factory.getCrosstabMeasure(crossMeasures[i]);
}
}
示例14: copyMeasures
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
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]);
}
}
}
示例15: JRBaseCrosstabMeasure
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure; //导入依赖的package包/类
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.calculationValue = measure.getCalculationValue();
this.incrementerFactoryClassName = measure.getIncrementerFactoryClassName();
this.percentageType = measure.getPercentageType();
this.percentageCalculatorClassName = measure.getPercentageCalculatorClassName();
this.variable = factory.getVariable(measure.getVariable());
}