[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [birt-report-designer-dev] How can I fill a list-box with Birt Report Designer API ?
|
Hi,
I've found the solution !!! :)
To add values :
- create your values via the StructureFactory.createSelectionChoice() method
- pass the values using the ScalarParameter PropertyHandle
Here is the code :
public static void buildReportParameters(ElementFactory designFactory,
ReportDesignHandle designHandle){
ScalarParameterHandle scalarParameterHandle =
designFactory.newScalarParameter("filtre_service");
try {
scalarParameterHandle.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC);
scalarParameterHandle.setDataType(DesignChoiceConstants.PARAM_TYPE_STRING);
scalarParameterHandle.setParamType("simple");
scalarParameterHandle.setPromptText("Application");
scalarParameterHandle.setControlType(DesignChoiceConstants.PARAM_CONTROL_LIST_BOX);
SelectionChoice choix_1 = StructureFactory.createSelectionChoice();
choix_1.setValue("valeur_1");
choix_1.setLabel("libelle_1");
SelectionChoice choix_2 = StructureFactory.createSelectionChoice();
choix_2.setValue("valeur_2");
choix_2.setLabel("libelle_2");
PropertyHandle propHandle =
scalarParameterHandle.getPropertyHandle(ScalarParameter.SELECTION_LIST_PROP);
propHandle.addItem(choix_1);
propHandle.addItem(choix_2);
scalarParameterHandle.setDistinct(true);
scalarParameterHandle.setCategory("Unformatted");
designHandle.getParameters().add(scalarParameterHandle);
} catch (SemanticException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Bye.
flo
flo_rian wrote:
>
> Hi,
> I've got a little problem.
> I'd like to create a report (.rptdesign file) with Birt API (without using
> eclipse graphic tool).
> I'd like to create a 'report parameter' which have a static list.
> How can I add values to this static list ?
>
> Here is an extract of my code :
>
> public static void buildReportParameters(ElementFactory designFactory,
> ReportDesignHandle designHandle){
> ScalarParameterHandle scalarParameterHandle =
> designFactory.newScalarParameter("filtre_service");
>
> try {
>
> scalarParameterHandle.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC);
>
> scalarParameterHandle.setDataType(DesignChoiceConstants.PARAM_TYPE_STRING);
> scalarParameterHandle.setParamType("simple");
> scalarParameterHandle.setPromptText("Application");
>
> scalarParameterHandle.setControlType(DesignChoiceConstants.PARAM_CONTROL_LIST_BOX);
>
>
>
> scalarParameterHandle.setDistinct(true);
> scalarParameterHandle.setCategory("Unformatted");
>
> designHandle.getParameters().add(scalarParameterHandle);
> } catch (SemanticException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> }
> Thanks.
> flo
>
>
--
View this message in context: http://www.nabble.com/How-can-I-fill-a-list-box-with-Birt-Report-Designer-API---tp21326466p21376380.html
Sent from the Eclipse BIRT - Report Designer - Dev mailing list archive at Nabble.com.