Identifying User Selections in a Dimension List

Because users can select one or more members at a time from a DimensionList, you must respond differently when the user has selected a single member and when the user has selected multiple members. The selection that you identify is used as a member step in the Selection object to be applied to a query.

Example: Identifying a single selected member in a DimensionList

The following example shows how to identify the single member that the user has selected from the DimensionList.


//Add a listener to the DimensionList dimensionList.addDimensionListListener(new DimensionListAdapter() {  public void dimensionSelected(DimensionListEvent e)     //Retrieve the selected member.     //The index is the position of the member in the data model.     {      String strMember = (String)dimensionList.getSelectedValue();     } });

Example: Identifying multiple selected members in a DimensionList

The following example shows how to identify the multiple members that the user has selected from the DimensionList. The code is nearly identical to that for identifying a single selected member, except for the last line of code.


//Add a listener to the DimensionList dimensionList.addDimensionListListener(new DimensionListAdapter() {  public void dimensionSelected(DimensionListEvent e)     //Retrieve the selected members.     //The index is the position of the member in the data model.     {      String[] strMembers = (String[])dimensionList.getSelectedValues();     } });

Dimension List Bean