@Override
  protected boolean prepareForShowing(QuickListContainer container) {
    boolean toShow = false;
    // if data list contains at least 1 element, show this popup.
    T[] data;
    if ((data = getData()).length > 0) {
      dataList.setListData(data);
      toShow = true;
    }
    // else, show popup with a "no elements" message.
    else emptyPopup.show();

    return toShow;
  }
  public QuickListWithDataList(
      QuickListContainer container, String header, String emptyPopupHeader) {
    super(container, header);

    // get the TablePopupDataList.
    dataList = getList();

    // add JScrollPane that contains the TablePopupDataList to the popup.
    JScrollPane scroll =
        new JScrollPane(
            dataList,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setBorder(null);
    scroll.getVerticalScrollBar().setFocusable(false);
    scroll.getHorizontalScrollBar().setFocusable(false);
    add(scroll);

    dataList.addFocusListener(this);

    // create TablePopupWithEmptyMsg that will be shown instead of this popup, if this
    // popup's data list won't have any elements.
    emptyPopup = new QuickListWithEmptyMsg(container, header, emptyPopupHeader);
  }