本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignExpression类的典型用法代码示例。如果您正苦于以下问题:Java JRDesignExpression类的具体用法?Java JRDesignExpression怎么用?Java JRDesignExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRDesignExpression类属于net.sf.jasperreports.engine.design包,在下文中一共展示了JRDesignExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createObject
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JRDesignExpression expression = new JRDesignExpression();
String className = atts.getValue(JRXmlConstants.ATTRIBUTE_class);
if (className == null)
{
expression.setValueClass(java.lang.String.class);
}
else
{
expression.setValueClassName(className);
}
return expression;
}
示例2: createObject
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JRDesignExpression expression = new JRDesignExpression();
String value = atts.getValue(JRXmlConstants.ATTRIBUTE_class);
if (value != null)
{
// being backward compatible
if(value.equals("dori.jasper.engine.JasperReport"))
{
value = JasperReport.class.getName();
}
expression.setValueClassName(value);
}
else
{
expression.setValueClass(java.lang.String.class);
}
return expression;
}
示例3: createObject
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
JRDesignVariable variable = (JRDesignVariable)digester.peek();
JRDesignExpression expression = new JRDesignExpression();
if (
variable.getCalculationValue() == CalculationEnum.COUNT
|| variable.getCalculationValue() == CalculationEnum.DISTINCT_COUNT
)
{
expression.setValueClassName(java.lang.Object.class.getName());
}
else
{
expression.setValueClassName(variable.getValueClassName());
}
return expression;
}
示例4: createObject
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public Object createObject(Attributes attributes)
{
JRDesignCrosstabMeasure measure = (JRDesignCrosstabMeasure) digester.peek();
JRDesignExpression expression = new JRDesignExpression();
if (
measure.getCalculationValue() == CalculationEnum.COUNT
|| measure.getCalculationValue() == CalculationEnum.DISTINCT_COUNT
)
{
expression.setValueClassName(Object.class.getName());
}
else
{
expression.setValueClassName(measure.getValueClassName());
}
return expression;
}
示例5: findFile
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
protected AFileResource findFile(MReportUnit mrunit,
IProgressMonitor monitor, JasperDesign jd, Set<String> fileset,
JRDesignExpression exp, IFile file) {
String str = ExpressionUtil.cachedExpressionEvaluation(exp, jrConfig);
if (str == null || fileset.contains(str))
return null;
File f = findFile(file, str);
if (f != null && f.exists()) {
PublishOptions popt = new PublishOptions();
popt.setjExpression(exp);
if (!f.getName().contains(":"))
popt.setExpression("\"repo:" + f.getName() + "\"");
fileset.add(str);
return addResource(monitor, mrunit, fileset, f, popt);
}
return null;
}
示例6: performRequest
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public void performRequest(Request req) {
if (RequestConstants.REQ_OPEN.equals(req.getType())) {
if(!ExpressionEditorSupportUtil.isExpressionEditorDialogOpen()) {
JRExpressionEditor wizard = new JRExpressionEditor();
MHtml m = (MHtml) getModel();
wizard.setValue((JRDesignExpression) m
.getPropertyValue(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION));
ExpressionContext ec=ModelUtils.getElementExpressionContext((JRDesignElement)m.getValue(), m);
wizard.setExpressionContext(ec);
WizardDialog dialog = ExpressionEditorSupportUtil.getExpressionEditorWizardDialog(Display.getDefault()
.getActiveShell(), wizard);
if (dialog.open() == Dialog.OK) {
SetValueCommand cmd = new SetValueCommand();
cmd.setTarget((IPropertySource) getModel());
cmd.setPropertyId(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION);
cmd.setPropertyValue(wizard.getValue());
getViewer().getEditDomain().getCommandStack().execute(cmd);
}
}
} else
super.performRequest(req);
}
示例7: setExpression
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
/**
* Sets the expression for the widget.
*
* @param exp
* the expression to set
*/
public void setExpression(JRDesignExpression exp) {
isRefreshing = true;
this.expression = exp;
// PAY ATTENTION: Checks are needed in order to avoid notification
// loop due to the modifyEvent raised after a setText call.
if (exp != null && !exp.getText().equals(textExpression.getText())) {
textExpression.setText(exp.getText());
textExpression.setToolTipText(exp.getText());
if (exp.getText().length() >= oldpos)
textExpression.setSelection(oldpos, oldpos);
} else if (exp == null && !textExpression.getText().isEmpty()) {
textExpression.setText(""); //$NON-NLS-1$
textExpression.setToolTipText(""); //$NON-NLS-1$
}
// Notifies the listeners of the new expression
fireModifyEvent();
isRefreshing = false;
}
示例8: getNewInputObject
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
protected String getNewInputObject() {
if(!ExpressionEditorSupportUtil.isExpressionEditorDialogOpen()) {
JRExpressionEditor wizard = new JRExpressionEditor();
WizardDialog dialog =
ExpressionEditorSupportUtil.getExpressionEditorWizardDialog(getShell(),wizard);
if (dialog.open() == Dialog.OK) {
JRDesignExpression newExp = wizard.getValue();
if(newExp!=null &&
!Misc.nvl(newExp.getText()).equals("")){
return newExp.getText();
}
}
}
return null;
}
示例9: createSerie
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public JRDesignGanttSeries createSerie(JRDesignExpression expr, JRGanttSeries prev) {
JRDesignGanttSeries f = new JRDesignGanttSeries();
f.setSeriesExpression(expr);
if (prev == null) {
f.setPercentExpression(new JRDesignExpression("0"));
f.setStartDateExpression(new JRDesignExpression("new java.util.Date()"));
f.setEndDateExpression(new JRDesignExpression("new java.util.Date()"));
f.setTaskExpression(new JRDesignExpression("\"Task\""));
} else {
f.setPercentExpression(ExprUtil.clone(prev.getPercentExpression()));
f.setStartDateExpression(ExprUtil.clone(prev.getStartDateExpression()));
f.setEndDateExpression(ExprUtil.clone(prev.getEndDateExpression()));
f.setTaskExpression(ExprUtil.clone(prev.getTaskExpression()));
f.setLabelExpression(ExprUtil.clone(prev.getLabelExpression()));
}
return f;
}
示例10: createSerie
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public JRDesignTimePeriodSeries createSerie(JRDesignExpression expr, JRTimePeriodSeries prev) {
JRDesignTimePeriodSeries f = new JRDesignTimePeriodSeries();
f.setSeriesExpression(expr);
if (prev == null) {
f.setValueExpression(new JRDesignExpression("0"));
f.setStartDateExpression(new JRDesignExpression("new java.util.Date()"));
f.setEndDateExpression(new JRDesignExpression("new java.util.Date()"));
} else {
f.setValueExpression(ExprUtil.clone(prev.getValueExpression()));
f.setStartDateExpression(ExprUtil.clone(prev.getStartDateExpression()));
f.setEndDateExpression(ExprUtil.clone(prev.getEndDateExpression()));
f.setLabelExpression(ExprUtil.clone(prev.getLabelExpression()));
}
return f;
}
示例11: createDetailCells
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的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;
}
}
}
}
示例12: setBucketExpression
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
public static void setBucketExpression(JRDesignCrosstabBucket bucket,
String oldExpText, AgregationFunctionEnum function) {
JRDesignExpression exp = (JRDesignExpression) bucket.getExpression();
if (function == AgregationFunctionEnum.UNIQUE)
exp.setText(oldExpText);
else if (function == AgregationFunctionEnum.YEAR) {
exp.setText("new SimpleDateFormat(\"yyyy\").format(" + oldExpText
+ ")");
bucket.setValueClassName(String.class.getName());
} else if (function == AgregationFunctionEnum.MONTH) {
exp.setText("new SimpleDateFormat(\"yyyy-MM\").format("
+ oldExpText + ")");
bucket.setValueClassName(String.class.getName());
} else if (function == AgregationFunctionEnum.WEEK) {
exp.setText("new SimpleDateFormat(\"yyyy-ww\").format("
+ oldExpText + ")");
bucket.setValueClassName(String.class.getName());
} else if (function == AgregationFunctionEnum.DAY) {
exp.setText("new SimpleDateFormat(\"yyyy-MM-dd\").format("
+ oldExpText + ")");
bucket.setValueClassName(String.class.getName());
}
bucket.setExpression(exp);
}
示例13: setPropertyValue
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
public void setPropertyValue(Object id, Object value) {
JRDesignCrosstabBucket jrField = (JRDesignCrosstabBucket) getValue();
if (id.equals(JRDesignCrosstabBucket.PROPERTY_ORDER))
jrField.setOrder((SortOrderEnum) orderD.getEnumValue(value));
else if (id
.equals(JRDesignCrosstabBucket.PROPERTY_COMPARATOR_EXPRESSION))
jrField.setComparatorExpression(ExprUtil.setValues(
jrField.getComparatorExpression(), value));
else if (id.equals(JRDesignCrosstabBucket.PROPERTY_ORDER_BY_EXPRESSION))
jrField.setOrderByExpression(ExprUtil.setValues(
jrField.getOrderByExpression(), value));
else if (id.equals(JRDesignCrosstabBucket.PROPERTY_EXPRESSION))
jrField.setExpression((JRDesignExpression) ExprUtil.setValues(
jrField.getExpression(), value));
else if (id.equals(JRDesignCrosstabBucket.PROPERTY_VALUE_CLASS))
jrField.setValueClassName((String) value);
}
示例14: createJRElement
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
@Override
public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) {
JRDesignComponentElement designMap = new JRDesignComponentElement();
StandardMapComponent component = new StandardMapComponent();
JRDesignExpression exp1 = new JRDesignExpression();
exp1.setText(MapDesignConverter.DEFAULT_LATITUDE.toString() + "f"); //$NON-NLS-1$
JRDesignExpression exp2 = new JRDesignExpression();
exp2.setText(MapDesignConverter.DEFAULT_LONGITUDE.toString() + "f"); //$NON-NLS-1$
component.setLatitudeExpression(exp1);
component.setLongitudeExpression(exp2);
JRDesignExpression exp3 = new JRDesignExpression();
exp3.setText(String.valueOf(MapComponent.DEFAULT_ZOOM));
component.setZoomExpression(exp3);
designMap.setComponent(component);
designMap.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "c", //$NON-NLS-1$ //$NON-NLS-2$
"map")); //$NON-NLS-1$
StandardItemData markerData = safeGetMarkerData(component, null);
markerData.setDataset(new JRDesignElementDataset());
DefaultManager.INSTANCE.applyDefault(this.getClass(), designMap);
return designMap;
}
示例15: fillValue
import net.sf.jasperreports.engine.design.JRDesignExpression; //导入依赖的package包/类
private void fillValue(StandardItemProperty value) {
isRefresh = true;
if (isMandatory)
cprop.setEnabled(false);
evalue.setExpressionContext(expContext);
cprop.setText(Misc.nvl(value.getName()));
if (value.getValueExpression() != null) {
buseexpr.setSelection(true);
evalue.setExpression((JRDesignExpression) value.getValueExpression());
} else {
buseexpr.setSelection(false);
tvalue.setText(Misc.nvl(value.getValue()));
}
changeValueOrExpression();
isRefresh = false;
}