litesoft
@ 939
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
package org.litesoft.mgwt.client.widgets; import java.util.*; import org.litesoft.commonfoundation.annotations.*; import org.litesoft.core.util.*; import org.litesoft.core.util.externalization.*; import com.google.gwt.event.dom.client.*; import com.googlecode.mgwt.ui.client.widget.*; public class OptionListBox<T> extends AbstractOptionListWidget<T> { private final MListBox mListBox = new MListBox(); public OptionListBox( @NotNull E13nResolver pResolver, @Nullable SelectedListener<T> pSelectedListener ) { super( pResolver, pSelectedListener ); mListBox.addChangeHandler( new ChangeHandler() { @Override public void onChange( ChangeEvent event ) { processSelectedIndex( mListBox.getSelectedIndex() ); } } ); initWidget( mListBox ); } public OptionListBox( @NotNull E13nResolver pResolver ) { this( pResolver, null ); } public OptionListBox<T> options( @Nullable List<T> pOptions ) { setOptions( pOptions ); return this; } public OptionListBox<T> options( @Nullable T... pOptions ) { setOptions( pOptions ); return this; } @Override protected void optionsUpdated( @NotNull List<T> pOptions ) { mListBox.clear(); for ( T zOption : pOptions ) { mListBox.addItem( DisplayObject.resolve( mResolver, zOption ) ); } } } |