/** * Mark the list item with the given ID. * * @param pItemId item ID */ @SuppressWarnings("unchecked") public void setMarked(final String pItemId) { if (LOG.isTraceEnabled()) { LOG.enter( "setMarked", //$NON-NLS-1$ new String[] {"pItemId"}, new Object[] {pItemId}); // $NON-NLS-1$ } boolean clear = pItemId == null || pItemId.equals( getIdFromWidget( ((CbGenericListItem<W>) iGuiList.getWidget(iMarkedIdx)).getDisplayWidget())); clearMarker(); if (pItemId != null && !clear) { int idx = 0; for (Iterator<Widget> iter = iGuiList.iterator(); iter.hasNext(); idx++) { CbGenericListItem<W> gli = (CbGenericListItem<W>) iter.next(); W w = gli.getDisplayWidget(); if (pItemId.equals(getIdFromWidget(w))) { setMarked(idx); break; } } } LOG.exit("setMarked"); // $NON-NLS-1$ }
/** * Getter. * * @return the ID of the marked entry */ @SuppressWarnings("unchecked") public String getMarkedID() { LOG.enter("getMarkedID"); // $NON-NLS-1$ if (LOG.isDetailEnabled()) { LOG.detail( "getMarkedID", //$NON-NLS-1$ "iMarkedIdx = " + iMarkedIdx); // $NON-NLS-1$ } String result = null; if (iMarkedIdx >= 0 && iMarkedIdx < iGuiList.getWidgetCount()) { result = getIdFromWidget( ((CbGenericListItem<W>) iGuiList.getWidget(iMarkedIdx)).getDisplayWidget()); } LOG.exit("getMarkedID", result); // $NON-NLS-1$ return result; }