@Test public void testDefaultWithNoFocusAndRemove() { createList(1, 2, 3); assertEquals(-1, focusItem.resolve(-1, 4)); }
public int resolve(final int focusIndex, final int itemCount) { if (focusIndex == -1) { return -1; } if (itemCount == 0) { return -1; } if (indicesToRemove.isEmpty()) { return focusIndex; } int newFocusIndex = calcNewFocusIndex(focusIndex, indicesToRemove); if (newFocusIndex >= itemCount - indicesToRemove.size()) { newFocusIndex = itemCount - indicesToRemove.size() - 1; } return newFocusIndex; }
ListBoxFocusItem { public int resolve(final int focusIndex, final int itemCount) { if (focusIndex == -1) { return -1; } if (itemCount == 0) { return -1; } if (indicesToRemove.isEmpty()) { return focusIndex; } int newFocusIndex = calcNewFocusIndex(focusIndex, indicesToRemove); if (newFocusIndex >= itemCount - indicesToRemove.size()) { newFocusIndex = itemCount - indicesToRemove.size() - 1; } return newFocusIndex; } }
ListBoxFocusItem { public int resolve(final int focusIndex, final int itemCount) { if (focusIndex == -1) { return -1; } if (itemCount == 0) { return -1; } if (indicesToRemove.isEmpty()) { return focusIndex; } int newFocusIndex = calcNewFocusIndex(focusIndex, indicesToRemove); if (newFocusIndex >= itemCount - indicesToRemove.size()) { newFocusIndex = itemCount - indicesToRemove.size() - 1; } return newFocusIndex; }  }
ListBoxFocusItem { public int resolve(final int focusIndex, final int itemCount) { if (focusIndex == -1) { return -1; } if (itemCount == 0) { return -1; } if (indicesToRemove.isEmpty()) { return focusIndex; } int newFocusIndex = calcNewFocusIndex(focusIndex, indicesToRemove); if (newFocusIndex >= itemCount - indicesToRemove.size()) { newFocusIndex = itemCount - indicesToRemove.size() - 1; } return newFocusIndex; }  void prepare(); void registerIndex(final int value); int resolve(final int focusIndex, final int itemCount); }
ListBoxFocusItem { public int resolve(final int focusIndex, final int itemCount) { if (focusIndex == -1) { return -1; } if (itemCount == 0) { return -1; } if (indicesToRemove.isEmpty()) { return focusIndex; } int newFocusIndex = calcNewFocusIndex(focusIndex, indicesToRemove); if (newFocusIndex >= itemCount - indicesToRemove.size()) { newFocusIndex = itemCount - indicesToRemove.size() - 1; } return newFocusIndex; }  void prepare(); void registerIndex(final int value); int resolve(final int focusIndex, final int itemCount);  }