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
package com.temp.client.foundation.widget.table.column;

import java.util.List;

import com.temp.client.foundation.handler.DataClickHandler;
import com.temp.client.foundation.widget.table.DataRow;
import com.temp.client.foundation.widget.table.cell.ClickableTextListDataCell;
import com.temp.shared.utils.DisplayStringHandler;

import com.google.gwt.user.cellview.client.Column;

/**
 * A column of clickable text lists.  The cell data consists of Lists of objects of type E
 * and each element of the list is clickable
 *
 * @author paule
 *
 * @param <R> - the row type (e.g. Message)
 * @param <L> - the type of the list (e.g. ArrayList of MessageErrors)
 * @param <E> - the type of the list element (e.g. MessageError)
 */
@SuppressWarnings("rawtypes")
public class ClickableTextListDataColumn<R extends DataRow, L extends List<E>, E> extends Column<R, L> implements DataColumn {

    public static interface GetElementDisplayStringFn<E> {
        String getDisplayString(E element);
    }

    Object field;

    public ClickableTextListDataColumn(Object field,
                                                                DataClickHandler<E> clickHandler,
                                                                DisplayStringHandler<E> displayStringHandler) {
        super(new ClickableTextListDataCell<E, L>(clickHandler, displayStringHandler));
        this.field = field;
    }

    @SuppressWarnings("unchecked")
    @Override
    public L getValue(R rowData) {
        return (L) rowData.getFieldValue(field);
    }

    @Override
    public String getFieldString() {
        return field.toString();
    }
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/widget/table/column/ClickableTextListDataColumn.java

Diff revisions: vs.
Revision Author Commited Message
626 GeorgeS picture GeorgeS Wed 11 Apr, 2012 19:39:41 +0000