Subversion Repository Public Repository

litesoft

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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.googlecode.mgwt.ui.client.widget.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.celllist.*;

public class OptionList<T> extends AbstractOptionListWidget<T>
{
    private final CellListWithHeader<T> mListWithHeader;

    public OptionList( @NotNull E13nResolver pResolver, @Nullable SelectedListener<T> pSelectedListener )
    {
        super( pResolver, pSelectedListener );
        mListWithHeader = new CellListWithHeader<T>( new BasicCell<T>()
        {
            @Override
            public String getDisplayString( T pOption )
            {
                return DisplayObject.resolve( mResolver, pOption );
            }

            @Override
            public boolean canBeSelected( T pOption )
            {
                return isSelectable( pOption );
            }
        } );
        mListWithHeader.getCellList().addCellSelectedHandler( new CellSelectedHandler()
        {
            @Override
            public void onCellSelected( CellSelectedEvent event )
            {
                processSelectedIndex( event.getIndex() );
            }
        } );
        initWidget( mListWithHeader );
    }

    public OptionList( @NotNull E13nResolver pResolver )
    {
        this( pResolver, null );
    }

    public OptionList<T> round()
    {
        mListWithHeader.getCellList().setRound( true );
        return this;
    }

    public OptionList<T> header( Object pHeaderTextSource )
    {
        mListWithHeader.getHeader().setText( DisplayObject.resolve( mResolver, pHeaderTextSource ) );
        return this;
    }

    public OptionList<T> options( @Nullable List<T> pOptions )
    {
        setOptions( pOptions );
        return this;
    }

    public OptionList<T> options( @Nullable T... pOptions )
    {
        setOptions( pOptions );
        return this;
    }

    @Override
    protected void optionsUpdated( @NotNull List<T> pOptions )
    {
        mListWithHeader.getCellList().render( pOptions );
    }
}

Commits for litesoft/trunk/mobileGWT/mgwtPlus/src/org/litesoft/mgwt/client/widgets/OptionList.java

Diff revisions: vs.
Revision Author Commited Message
939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

764 Diff Diff GeorgeS picture GeorgeS Thu 12 Jul, 2012 14:22:25 +0000
756 GeorgeS picture GeorgeS Mon 09 Jul, 2012 04:45:47 +0000