@Override
  public void initContextData(Session session, Context uiSharedContext) {
    selectedMethod = uiSharedContext.getSessionManagementMethod();
    if (log.isDebugEnabled())
      log.debug(
          "Initializing configuration panel for session management method: "
              + selectedMethod
              + " for context "
              + uiSharedContext.getName());

    // If something was already configured, find the type and set the UI accordingly
    if (selectedMethod != null) {
      // If the proper type is already selected, just rebind the data
      if (shownMethodType != null && shownMethodType.isTypeForMethod(selectedMethod)) {
        if (shownMethodType.hasOptionsPanel()) shownConfigPanel.bindMethod(selectedMethod);
        return;
      }

      // Select what needs to be selected
      for (SessionManagementMethodType type : extension.getSessionManagementMethodTypes())
        if (type.isTypeForMethod(selectedMethod)) {
          // Selecting the type here will also force the selection listener to run and
          // change the config panel accordingly
          getSessionManagementMethodsComboBox().setSelectedItem(type);
          break;
        }
    }
  }
  /**
   * Gets the session management methods combo box.
   *
   * @return the session management methods combo box
   */
  protected JComboBox<SessionManagementMethodType> getSessionManagementMethodsComboBox() {
    if (sessionManagementMethodsComboBox == null) {
      Vector<SessionManagementMethodType> methods =
          new Vector<>(extension.getSessionManagementMethodTypes());
      sessionManagementMethodsComboBox = new JComboBox<>(methods);
      sessionManagementMethodsComboBox.setSelectedItem(null);

      // Prepare the listener for the change of selection
      sessionManagementMethodsComboBox.addItemListener(
          new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
              if (e.getStateChange() == ItemEvent.SELECTED) {
                // Prepare the new session management method
                log.debug("Selected new Session Management type: " + e.getItem());
                SessionManagementMethodType type = ((SessionManagementMethodType) e.getItem());

                // If no session management method was previously selected or it's a
                // different class, create it now
                if (selectedMethod == null || !type.isTypeForMethod(selectedMethod)) {
                  // Create the new session management method
                  selectedMethod = type.createSessionManagementMethod(getContextIndex());
                }

                // Show the status panel and configuration button, if needed
                changeMethodConfigPanel(type);
                if (type.hasOptionsPanel()) shownConfigPanel.bindMethod(selectedMethod);
              }
            }
          });
    }
    return sessionManagementMethodsComboBox;
  }