本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignParameter类的典型用法代码示例。如果您正苦于以下问题:Java JRDesignParameter类的具体用法?Java JRDesignParameter怎么用?Java JRDesignParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRDesignParameter类属于net.sf.jasperreports.engine.design包,在下文中一共展示了JRDesignParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildJRDesignParameters
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
public static Map<String,JRDesignParameter> buildJRDesignParameters(Map<String,Object> parameters)
{
// convert parameters to JRDesignParameters so they can be parsed
HashMap<String,JRDesignParameter> jrParameters = new HashMap<String,JRDesignParameter>();
Iterator<String> iterator = parameters.keySet().iterator();
while (iterator.hasNext())
{
String key = iterator.next();
Object value = parameters.get(key);
if (value != null)
{
JRDesignParameter jrParameter = new JRDesignParameter();
jrParameter.setName(key);
jrParameter.setValueClass(value.getClass());
jrParameters.put(jrParameter.getName(), jrParameter);
}
}
return jrParameters;
}
示例2: run
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
public void run(List<JRDesignParameter> prms) {
Object sel = selection[0];
MExpression mexpr = null;
List<MFromTable> tbls = Util.getFromTables((ANode) sel);
for (JRParameter t : prms) {
if (sel instanceof AMExpression)
mexpr = run(t, (AMExpression<?>) sel);
else if (isInSelect(sel))
mexpr = run(t, (ANode) sel, -1);
sel = mexpr;
mexpr.getOperands().add(Factory.getDefaultOperand(mexpr));
ParameterPOperand pop = new ParameterPOperand(mexpr);
pop.setJrParameter((JRDesignParameter) t);
mexpr.getOperands().add(pop);
}
showDialog(mexpr);
}
示例3: getColumnText
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
public String getColumnText(Object element, int columnIndex) {
JRDesignParameter field = (JRDesignParameter) element;
switch (columnIndex) {
case 0:
return field.getName();
case 1:
if (field.isSystemDefined())
return ""; //$NON-NLS-1$
else
return Boolean.toString(field.isForPrompting());
case 2:
return Misc.nvl(field.getValueClassName(), ""); //$NON-NLS-1$
case 3:
return Misc.nvl(field.getDescription(), ""); //$NON-NLS-1$
}
return ""; //$NON-NLS-1$
}
示例4: refresh
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
/**
* When the data is refreshed is checked if the class name is a collection, in this
* case the controls to define the nested type are shown, otherwise they are hidden.
*/
@Override
public void refresh() {
setRefreshing(true);
APropertyNode element = getElement();
if (element != null) {
element.getPropertyDescriptors();
for (Object key : widgets.keySet()) {
if (key.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME)){
String type = element.getPropertyValue(JRDesignVariable.PROPERTY_VALUE_CLASS_NAME).toString();
if (isClassCollection(type)) setCompVisible(true);
else setCompVisible(false);
}
widgets.get(key).setData(element, element.getPropertyValue(key));
if (key.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION)){
// fix the visibilities mask: allows only PARAMETERS
ExpressionContext expContext = ((WTextExpression) ((SPExpression) widgets.get(key)).getControl()).getExpressionContext();
if(expContext!=null){
expContext.setVisibilities(EnumSet.of(Visibility.SHOW_PARAMETERS));
}
}
}
}
setRefreshing(false);
}
示例5: setValue
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
/**
* Set the valued edited by this dialog
*
* @param value a ParametersDTO (not null) of the parameters list that the user manipulate
* @param datasetRun the (not null) dataset run from where the value is extracted
*/
public void setValue(ParameterDTO value, MDatasetRun datasetRun) {
this.value = value;
if (value == null) {
value = new ParameterDTO();
}
//get the dataset referenced by the dataset run
JRDataset dataset = datasetRun.getJasperDesign().getDatasetMap().get(datasetRun.getPropertyValue(JRDesignDatasetRun.PROPERTY_DATASET_NAME));
if (dataset != null) {
List<JRParameter> userParameters = new ArrayList<JRParameter>();
//flag to add or not the system parameters
boolean addSystemParameters = true;
for(JRParameter param : dataset.getParameters()){
if (!param.isSystemDefined() || addSystemParameters) userParameters.add(param);
}
//the original dataset parameters are cached
datasetParameters = userParameters.toArray(new JRParameter[userParameters.size()]);
}
else datasetParameters = new JRDesignParameter[0];
if (table != null)
fillTable(table);
}
示例6: postSetValue
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
/**
* Get a list of all the datasets run used by every element, and if one or more of this are references to the dataset
* with the changed parameter search create a command that search inside them the reference to the parameter and if
* found rename it
*/
@Override
public Command postSetValue(IPropertySource target, Object prop, Object newValue, Object oldValue) {
JSSCompoundCommand c = new JSSCompoundCommand(null);
// Check if the updated element is a dataset and the updated property is the name
if (target instanceof MParameter && prop.equals(JRDesignParameter.PROPERTY_NAME)) {
MParameter mprm = (MParameter) target;
if (mprm.getParent() != null && mprm.getParent().getParent() != null) {
// Get all the references to this dataset
ANode parentElement = mprm.getParent().getParent();
c.setReferenceNodeIfNull(parentElement);
if (parentElement instanceof MDataset) {
MDataset parentDataset = (MDataset) parentElement;
List<IDatasetContainer> references = DeleteDatasetCommand.getDatasetUsage(parentDataset.getRoot()
.getChildren(), parentDataset.getPropertyActualValue(JRDesignDataset.PROPERTY_NAME).toString());
for (IDatasetContainer datasetRun : references) {
List<MDatasetRun> datasetList = datasetRun.getDatasetRunList();
for (MDatasetRun actualDataset : datasetList) {
c.add(new SetParameterName(actualDataset, oldValue.toString(), newValue.toString()));
}
}
}
}
}
return c;
}
示例7: getPropertyValue
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
@Override
public Object getPropertyValue(Object id) {
JRDesignParameter jrParameter = (JRDesignParameter) getValue();
if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION))
return jrParameter.getDescription();
if (id.equals(JRDesignParameter.PROPERTY_FOR_PROMPTING))
return new Boolean(jrParameter.isForPrompting());
if (id.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION))
return ExprUtil.getExpression(jrParameter.getDefaultValueExpression());
if (id.equals(PROPERTY_MAP)) {
return jrParameter.getPropertiesMap();
}
if (id.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME))
return jrParameter.getNestedTypeName();
return super.getPropertyValue(id);
}
示例8: setPropertyValue
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
@Override
public void setPropertyValue(Object id, Object value) {
JRDesignParameter jrParameter = (JRDesignParameter) getValue();
if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION))
jrParameter.setDescription((String) value);
else if (id.equals(JRDesignParameter.PROPERTY_FOR_PROMPTING) && isMainDataset())
jrParameter.setForPrompting(((Boolean) value).booleanValue());
else if (id.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME))
jrParameter.setNestedTypeName((String) value);
else if (id.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION))
jrParameter.setDefaultValueExpression(ExprUtil.setValues(jrParameter.getDefaultValueExpression(), value));
else if (id.equals(PROPERTY_MAP)) {
JRPropertiesMap v = (JRPropertiesMap) value;
String[] names = jrParameter.getPropertiesMap().getPropertyNames();
for (int i = 0; i < names.length; i++) {
jrParameter.getPropertiesMap().removeProperty(names[i]);
}
names = v.getPropertyNames();
for (int i = 0; i < names.length; i++)
jrParameter.getPropertiesMap().setProperty(names[i], v.getProperty(names[i]));
this.getPropertyChangeSupport().firePropertyChange(PROPERTY_MAP, false, true);
}
super.setPropertyValue(id, value);
}
示例9: createPropertyDescriptors
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
/**
* Creates the property descriptors.
*
* @param desc
* the desc
*/
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
validator = new ParameterNameValidator();
validator.setTargetNode(this);
JSSValidatedTextPropertyDescriptor nameD = new JSSValidatedTextPropertyDescriptor(JRDesignParameter.PROPERTY_NAME, Messages.common_name, validator);
nameD.setDescription(Messages.MParameterSystem_name_description);
desc.add(nameD);
NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME,
Messages.common_class);
classD.setDescription(Messages.MParameterSystem_class_description);
desc.add(classD);
classD.setHelpRefBuilder(new HelpReferenceBuilder(
"net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#parameter_class"));
defaultsMap.put(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME, "java.lang.String"); //$NON-NLS-1$
}
示例10: setPropertyValue
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
public void setPropertyValue(Object id, Object value) {
JRDesignField jrField = (JRDesignField) getValue();
if (id.equals(JRDesignParameter.PROPERTY_NAME)) {
if (!value.equals("")) {
jrField.setName((String) value);
}
} else if (id.equals(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME)){
jrField.setValueClassName((String) value);
}
else if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION)){
jrField.setDescription((String) value);
}
else if (id.equals(PROPERTY_MAP)) {
JRPropertiesMap v = (JRPropertiesMap) value;
String[] names = jrField.getPropertiesMap().getPropertyNames();
for (int i = 0; i < names.length; i++) {
jrField.getPropertiesMap().removeProperty(names[i]);
}
names = v.getPropertyNames();
for (int i = 0; i < names.length; i++)
jrField.getPropertiesMap().setProperty(names[i], v.getProperty(names[i]));
this.getPropertyChangeSupport().firePropertyChange(PROPERTY_MAP, false, true);
}
}
示例11: createInput
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
protected boolean createInput(Composite sectionClient, JRDesignParameter p, Map<String, Object> params, boolean first)
throws ClassNotFoundException {
ParameterJasper pres = new ParameterJasper(p);
// Use a custom control for the report maxcount instead of the integer standard one
if (p.getName().equals(JRParameter.REPORT_MAX_COUNT)) {
createControl(sectionClient, pres, new BooleanNumericInput(), p, first);
return true;
}
for (IDataInput in : ReportControler.inputs) {
if (in.isForType(pres.getValueClass())) {
createControl(sectionClient, pres, in.getInstance(), p, first);
return true;
}
}
return false;
}
示例12: createBParam
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
private void createBParam(FormToolkit toolkit, CTabFolder tabFolder) {
CTabItem bptab = new CTabItem(tabFolder, SWT.NONE);
bptab.setText(Messages.ParametersDialog_built_in_parameters);
ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
scompo.setExpandHorizontal(true);
scompo.setExpandVertical(true);
Composite sectionClient = toolkit.createComposite(scompo);
sectionClient.setLayout(new GridLayout(2, false));
for (JRParameter p : prompts)
if (!p.isForPrompting() || p.isSystemDefined())
createInput(toolkit, sectionClient, (JRDesignParameter) p);
sectionClient.pack();
scompo.setMinSize(sectionClient.getSize());
scompo.setContent(sectionClient);
bptab.setControl(scompo);
}
示例13: createUserParam
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
private void createUserParam(FormToolkit toolkit, CTabFolder tabFolder) {
if (canShowParameters()) {
CTabItem ptab = new CTabItem(tabFolder, SWT.NONE);
ptab.setText(Messages.ParametersDialog_user_parameters);
ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
scompo.setExpandHorizontal(true);
scompo.setExpandVertical(true);
Composite sectionClient = toolkit.createComposite(scompo);
sectionClient.setLayout(new GridLayout(2, false));
for (JRParameter p : prompts)
if (p.isForPrompting() && !p.isSystemDefined())
createInput(toolkit, sectionClient, (JRDesignParameter) p);
sectionClient.pack();
scompo.setMinSize(sectionClient.getSize());
scompo.setContent(sectionClient);
ptab.setControl(scompo);
}
}
示例14: cloneParameter
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
/**
* Utility function to duplicate a parameter. All the parameter properties
* and parameter default value expression are duplicated as well.
*/
public static JRDesignParameter cloneParameter(JRDesignParameter param)
{
JRDesignParameter newParam = new JRDesignParameter();
newParam.setName( param.getName() );
newParam.setForPrompting( param.isForPrompting() );
newParam.setSystemDefined( param.isSystemDefined() );
//newParam.setValueClass( param.getValueClass() );
newParam.setValueClassName( param.getValueClassName() );
newParam.setDescription( param.getDescription());
if (param.getDefaultValueExpression() != null)
{
newParam.setDefaultValueExpression( cloneExpression( (JRDesignExpression)param.getDefaultValueExpression()) );
}
// Duplicate properties...
replacePropertiesMap(param.getPropertiesMap(), newParam.getPropertiesMap());
return newParam;
}
示例15: ParameterNode
import net.sf.jasperreports.engine.design.JRDesignParameter; //导入依赖的package包/类
public ParameterNode(JasperDesign jd, JRDesignParameter parameter, Lookup doLkp)
{
super (Children.LEAF, new ProxyLookup(doLkp, Lookups.fixed(jd, parameter)));
this.jd = jd;
this.parameter = parameter;
setDisplayName ( parameter.getName());
super.setName( parameter.getName() );
if (parameter.isSystemDefined())
{
setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/parameter-16.png");
}
else
{
setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/parameter-16.png");
}
parameter.getEventSupport().addPropertyChangeListener(this);
}