createFeedbackParameter() - 7 Parameter
Parameters: |
fieldname |
|
|
displayName |
|
|
hint |
|
|
defaultValues |
|
|
values |
|
|
dispNames |
|
|
displayStyle |
|
Result: |
none |
|
This creates a parameter prompt that will be present the user with a collection of items to choose from. The component has to specify the list of options. A good example of this is the print component (org.pentaho.plugin.print.PrintComponent) which creates a list of printers available to the component and then calls createFeedbackParameter() to let the user select a printer.
fieldname: specifies the id of the form element for this prompt. This id will appear on the request when the user clicks to submit their selections. If the action sequence does not define an input from the request that matches this id, the component will never receive the value selected by the user, and an infinite loop can occur where the user is continually prompted for the same thing without end.
displayName: the text that the user will see as the label for the parameter.
hint: a help tip that the user will see next to the parameter.
defaultValues: an object that stores the default value(s) that will be automatically selected for the user when they see the prompt page. This object can be a String, or String array. If the control type specified in displayStyle is not capable of selecting multiple items but a String array is provided for the defaultValues, the single item selected cannot be predicted.
values: an ordered list of values that the user will select from. This collection stores the values that you want the component to receive back when the user selects something. If you want the user to see the items described with different names to the ones in this list the component must supply a dispNames map.
dispNames: a Map that stores a user-friendly description for each value. If the map does not store a description for a given value the value will be shown to the user. If there are no user-friendly descriptions for any values you can pass a null for this parameter.
displayStyle: specifies the control that should be used to present the choices to the user. The allowed values are:
Style Tag |
Control |
---|---|
radio: |
Radio buttons |
select: |
A dropdown select/combo box |
list: |
A singl select list box |
list-multi: |
A multi-select list box |
check-multi: |
A multi-select collection of check boxes |
check-multi-scroll: |
A scrolling, multi-select set of check boxes |
check-multi-scroll-2-column: |
A scrolling, two-column, multi-select set of check boxes |
check-multi-scroll-3-column: |
A scrolling, three-column, multi-select set of check boxes |
check-multi-scroll-4-column: |
A scrolling, four-column, multi-select set of check boxes |
Example
The printer component creates a list of printer names for the user to select from. It uses the last printer used as the default selection. It does not provide a hint to the user or provide a mapping of display names for the printer names. It specifies that a select list (combo box) should be used to get the users input.
ArrayList values = new ArrayList(); for (int i = 0; i < services.length; i++) { String value = services\[i\].getName(); values.add(value); } createFeedbackParameter("printer-name", "Printer Name", "", lastPrinterName, values, null, "select"); promptNeeded();