de.lessvoid.nifty.controls.listbox
Class ListBoxSelectionModeSingle<T>

java.lang.Object
  extended by de.lessvoid.nifty.controls.listbox.ListBoxSelectionModeSingle<T>
Type Parameters:
T -
All Implemented Interfaces:
ListBoxSelectionMode<T>

public class ListBoxSelectionModeSingle<T>
extends Object
implements ListBoxSelectionMode<T>

A single selection mode for a Nifty ListBox. You can only select a single item. Selecting a new one will remove any previous selected items.

Author:
void

Constructor Summary
ListBoxSelectionModeSingle()
           
 
Method Summary
 void add(T item)
          Add a new element to the selection.
 void clear()
          Clear the selection.
 void enableRequiresSelection(boolean enable)
          When this is set to true the selection can't be completely de selected.
 List<T> getSelection()
          Get the selection.
 void remove(T item)
          Remove the given element from the selection.
 void removeForced(T item)
          Remove the given element from the selection.
 boolean requiresAutoSelection()
          Returns if this Selection Mode requires a selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBoxSelectionModeSingle

public ListBoxSelectionModeSingle()
Method Detail

clear

public void clear()
Description copied from interface: ListBoxSelectionMode
Clear the selection.

Specified by:
clear in interface ListBoxSelectionMode<T>

getSelection

public List<T> getSelection()
Description copied from interface: ListBoxSelectionMode
Get the selection.

Specified by:
getSelection in interface ListBoxSelectionMode<T>
Returns:
list of items

remove

public void remove(T item)
Description copied from interface: ListBoxSelectionMode
Remove the given element from the selection.

Specified by:
remove in interface ListBoxSelectionMode<T>

removeForced

public void removeForced(T item)
Description copied from interface: ListBoxSelectionMode
Remove the given element from the selection. This will remove the item even when requiresSelection is turned on. It's called when the actual item gets removed and therefore we can't keep the selection.

Specified by:
removeForced in interface ListBoxSelectionMode<T>

add

public void add(T item)
Description copied from interface: ListBoxSelectionMode
Add a new element to the selection.

Specified by:
add in interface ListBoxSelectionMode<T>

enableRequiresSelection

public void enableRequiresSelection(boolean enable)
Description copied from interface: ListBoxSelectionMode
When this is set to true the selection can't be completely de selected. There has to be at least a single selection.

Specified by:
enableRequiresSelection in interface ListBoxSelectionMode<T>
Parameters:
enable - true when the requires selection mode should be enabled

requiresAutoSelection

public boolean requiresAutoSelection()
Description copied from interface: ListBoxSelectionMode
Returns if this Selection Mode requires a selection.

Specified by:
requiresAutoSelection in interface ListBoxSelectionMode<T>
Returns:
true this selection mode requires a selection


Copyright © 2011. All Rights Reserved.