/** Update basket status panel. */
  private void updateBasketStatusPanel() {

    try {
      RIFStudySubmissionAPI service = rifSession.getRIFStudySubmissionService();
      User currentUser = rifSession.getUser();
      Geography currentGeography = rifSession.getCurrentGeography();
      GeoLevelSelect currentGeoLevelSelect = currentGeographicalArea.getGeoLevelSelect();
      GeoLevelArea currentGeoLevelArea = currentGeographicalArea.getGeoLevelArea();
      GeoLevelToMap currentGeoLevelToMap = currentGeographicalArea.getGeoLevelToMap();

      // Sensitise the control buttons appropriately to reflect
      // whether basket is empty or not
      if (currentMapAreaSelectionBasket.getSize() == 0) {
        String basketIsEmptyMessage =
            RIFJobSubmissionToolMessages.getMessage("mapAreaListSelectionPanel.basketIsEmpty");
        selectedItemsStatusTextArea.setText(basketIsEmptyMessage);

        // basket is empty
        basketControlButtonPanel.indicateEmptyState();
      } else {
        // current geo level select should only be null
        // when the application is first starting.  By this point,
        // GeoLevelSelect will not have been selected
        MapAreaSummaryData mapAreaSummaryData =
            service.getMapAreaSummaryInformation(
                currentUser,
                currentGeography,
                currentGeoLevelSelect,
                currentGeoLevelArea,
                currentGeoLevelToMap,
                currentMapAreaSelectionBasket.getMapAreas());

        // Display information about the areas currently in the basket
        StringBuilder selectedStatusMessage = new StringBuilder();
        String selectedAreasMessage =
            RIFJobSubmissionToolMessages.getMessage(
                "mapAreaListSelectionPanel.basketAreasMessage",
                String.valueOf(mapAreaSummaryData.getTotalViewAreas()),
                String.valueOf(mapAreaSummaryData.getTotalNumberToMapAreas()),
                currentGeoLevelToMap.getDisplayName());
        selectedStatusMessage.append(selectedAreasMessage);
        String totalAreaTotalPopulationMessage =
            RIFJobSubmissionToolMessages.getMessage(
                "mapAreaListSelectionPanel.totalAreaTotalPopulationMessage",
                String.valueOf(mapAreaSummaryData.getTotalPopulation()),
                String.valueOf(mapAreaSummaryData.getTotalArea()));
        selectedStatusMessage.append(totalAreaTotalPopulationMessage);
        selectedItemsStatusTextArea.setText(selectedStatusMessage.toString());

        basketControlButtonPanel.indicatePopulatedState();
      }
    } catch (RIFServiceException rifServiceException) {
      ErrorDialog.showError(parentDialog, rifServiceException.getErrorMessages());
    }
  }
  /**
   * Creates the basket control buttons panel.
   *
   * @return the j panel
   */
  private JPanel createBasketControlButtonsPanel() {

    basketControlButtonPanel = new ListEditingButtonPanel(userInterfaceFactory);
    basketControlButtonPanel.includeAddButton(null);
    basketControlButtonPanel.includeEditButton(null);
    basketControlButtonPanel.includeDeleteButton(null);
    basketControlButtonPanel.includeClearButton(null);

    String importMapDataButtonToolTipText =
        RIFJobSubmissionToolMessages.getMessage(
            "mapAreaListSelectionPanel.buttons.importMapData.toolTip");
    basketControlButtonPanel.includeImportButton(importMapDataButtonToolTipText);

    String exportMapDataButtonToolTipText =
        RIFJobSubmissionToolMessages.getMessage(
            "mapAreaListSelectionPanel.button.exportMapData.toolTip");
    basketControlButtonPanel.includeExportButton(exportMapDataButtonToolTipText);

    basketControlButtonPanel.rightJustifyButtons();
    basketControlButtonPanel.addActionListener(this);

    return basketControlButtonPanel.getPanel();
  }
  public void actionPerformed(ActionEvent event) {

    Object button = event.getSource();

    if (basketControlButtonPanel.isAddButton(button)) {
      addToBasket();
    } else if (basketControlButtonPanel.isEditButton(button)) {
    } else if (basketControlButtonPanel.isDeleteButton(button)) {
      deleteFromBasket();
    } else if (basketControlButtonPanel.isClearButton(button)) {
      clearBasket();
    } else if (basketControlButtonPanel.isImportButton(button)) {
      importMapAreas();
    } else if (basketControlButtonPanel.isExportButton(button)) {
      exportMapAreas();
    }
  }