de.lessvoid.nifty.controls.listbox
Interface ListBoxView<T>

Type Parameters:
T - The Item this class is a view for.
All Known Implementing Classes:
ListBoxControl, ListBoxViewNull

public interface ListBoxView<T>

The representation of a ListBoxView from the world of a ListBox.

Author:
void

Method Summary
 void display(List<T> captions, int focusElementIndex, List<Integer> selectionElements)
          Display the given descriptions.
 int getWidth(T item)
          Return the width of the given item.
 void publish(ListBoxSelectionChangedEvent<T> event)
          Publish this event.
 void scrollTo(int newPosition)
          Scroll the view to the given position.
 void updateTotalCount(int newCount)
          Updates the view with the total count of elements currently in the ListBox.
 void updateTotalWidth(int newWidth)
          Update the ListBox view with the given width.
 

Method Detail

display

void display(List<T> captions,
             int focusElementIndex,
             List<Integer> selectionElements)
Display the given descriptions.

Parameters:
captions -

updateTotalCount

void updateTotalCount(int newCount)
Updates the view with the total count of elements currently in the ListBox. This can be used to update the scrollbar.

Parameters:
newCount - the new count to display

updateTotalWidth

void updateTotalWidth(int newWidth)
Update the ListBox view with the given width. This is used to update the horizontal scrollbar to a new maximum value.

Parameters:
newWidth - new maximum width of all items in the ListBox

scrollTo

void scrollTo(int newPosition)
Scroll the view to the given position.

Parameters:
newPosition - the new index to scroll to

publish

void publish(ListBoxSelectionChangedEvent<T> event)
Publish this event.

Parameters:
event - the event to publish

getWidth

int getWidth(T item)
Return the width of the given item. This is used to keep track of the maximum width of all items in the ListBox to update the horizontal Scrollbar correctly.

Parameters:
item - the item to get the width for
Returns:
the width of the item


Copyright © 2011. All Rights Reserved.