/**
  * Add an item to the list.
  *
  * @param pNewWidget the new display widget
  */
 @SuppressWarnings("unchecked")
 protected void addDisplayWidget(final W pNewWidget) {
   final String itemId = getIdFromWidget(pNewWidget);
   int beforeIdx = -1;
   for (Widget w : iGuiList) {
     CbGenericListItem<W> gli = (CbGenericListItem<W>) w;
     if (itemId.compareToIgnoreCase(getIdFromWidget(gli.getDisplayWidget())) < 0) {
       beforeIdx = gli.getRowIdx();
       break;
     }
   }
   CbGenericListItem<W> newRow =
       new CbGenericListItem<W>(getSelectorCallback(), getMoreArrowCallback());
   newRow.setDisplayWidget(pNewWidget);
   if (beforeIdx < 0) {
     newRow.setRowIdx(iGuiList.getWidgetCount());
     iGuiList.add(newRow);
   } else {
     newRow.setRowIdx(beforeIdx);
     iGuiList.insert(newRow, beforeIdx);
     int i = 0;
     for (Widget w : iGuiList) {
       ((CbGenericListItem<W>) w).setRowIdx(i++);
     }
   }
   checkEmptyListHint();
 }
 /**
  * Replace the list displayed with the given one.
  *
  * @param pDisplayWidgets the new list of items to display
  */
 protected void setDisplayWidgets(final List<W> pDisplayWidgets) {
   iGuiList.clear();
   int i = 0;
   for (W w : pDisplayWidgets) {
     CbGenericListItem<W> newRow =
         new CbGenericListItem<W>(getSelectorCallback(), getMoreArrowCallback());
     newRow.setDisplayWidget(w);
     newRow.setRowIdx(i++);
     iGuiList.add(newRow);
   }
   checkEmptyListHint();
 }
 /**
  * Removes the entry with the given item ID.
  *
  * @param pItemId the unique item ID
  */
 protected void removeDisplayWidget(final String pItemId) {
   int i = 0;
   for (Iterator<Widget> iter = iGuiList.iterator(); iter.hasNext(); i++) {
     @SuppressWarnings("unchecked")
     CbGenericListItem<W> gli = (CbGenericListItem<W>) iter.next();
     if (pItemId.equals(getIdFromWidget(gli.getDisplayWidget()))) {
       iter.remove();
       i--;
     } else {
       gli.setRowIdx(i);
     }
   }
   checkEmptyListHint();
 }