Hi Juan,
1) i'm not yet reached that point. i'm using the stockwatcher examples
as basis for my celltable example and run it via eclipse as web
application
that's my module.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mysamplegwtohnemaven'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<!-- Specify the app entry point class. -->
<entry-point
class='de.f10rian.mySampleGwtOhneMaven.client.MySampleGwtOhneMaven'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
</module>
2) Here is my CellTableExample code. hopefully you'll see my error:
public class CellTableExample extends Composite {
private static CellTableExampleUiBinder uiBinder = GWT
.create(CellTableExampleUiBinder.class);
interface CellTableExampleUiBinder extends
UiBinder<Widget, CellTableExample> {
}
@UiField
CellTable<Person> ct;
List<Long> checkBoxSelectedIds = new ArrayList<Long>();
private final ListDataProvider<Person> dataProvider = new
ListDataProvider<Person>();
private final SingleSelectionModel<Person> singleSelectionModel = new
SingleSelectionModel<Person>();
{
singleSelectionModel.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
GWT.log("getSelectedObject" +
singleSelectionModel.getSelectedObject().toString());
}
});
}
public CellTableExample() {
initWidget(uiBinder.createAndBindUi(this));
// name column
Column<Person, String> nameCol = new Column<Person, String>(
new TextInputCell()){
public String getValue(Person object) {
return object.getName();
}
};
nameCol.setFieldUpdater(new FieldUpdater<Person, String>() {
public void update(int index, Person object, String value) {
object.setName(value);
}
});
// title column
Column<Person, String> forenameCol = new Column<Person, String>(
new TextInputCell()){
public String getValue(Person object) {
return object.getForeName();
}
};
forenameCol.setFieldUpdater(new FieldUpdater<Person, String>() {
public void update(int index, Person object, String value) {
object.setForeName(value);
}
});
/*
* add check column
*/
Column<Person, Boolean> cbCol = new Column<Person, Boolean>(new
CheckboxCell()) {
public Boolean getValue(Person object) {
GWT.log("cbCol.getValue: " + Boolean.FALSE);
return object.isSelected();
}
};
cbCol.setFieldUpdater(new FieldUpdater<Person, Boolean>() {
public void update(int index, Person object, Boolean value) {
GWT.log("cbCol.setValue: " + value);
object.setSelected(value);
}
});
// Add the columns.
ct.addColumn(forenameCol, "Forname");
ct.addColumn(nameCol, "Name");
ct.addColumn(cbCol, "Check");
// Set the width of the table and put the table in fixed width
mode.
ct.setWidth("100%", true);
// Set the width of each column.
ct.setColumnWidth(forenameCol, 200.0, Unit.PX);
ct.setColumnWidth(nameCol, 50.0, Unit.PCT);
ct.setColumnWidth(cbCol, 50.0, Unit.PCT);
ct.setSelectionModel(this.singleSelectionModel);
dataProvider.addDataDisplay(ct);
addData();
}
private void addData() {
List<Person> values = new ArrayList<Person>();
values.add(new Person("Dirk", "Nowitzki", Gender.Male));
values.add(new Person("Dwyane", "Wade", Gender.Male));
values.add(new Person("LeBron", "James", Gender.Male));
dataProvider.setList(values);
}
}
Thx
bb.f.pav
On 11 Jun., 00:37, Juan Pablo Gardella <
gardellajuanpa...@gmail.com>
wrote:
> 1) are you sure the code compile for other browser?
>
> 2) I do the same thing without problems:
>
> CheckBoxColumn<MyEntity> seleccionado = new CheckBoxColumn<MyEntity>() {
> @Override
> public Boolean getValue(MyEntity object) {
> return object.isSeleccionado();}
> };
>
> seleccionado.setFieldUpdater(fieldUpdaterForMyEntity());
>
> ...
>
> private FieldUpdater<MyEntity , Boolean> fieldUpdaterParaDeclaracion() {
>
> return new FieldUpdater<MyEntity , Boolean>() {
> @Override
> public void update(int index, MyEntity object,
> Boolean value) {
> if (value != null ) {
> object.setSelected(value.booleanValue());
>
> }
> };
> };
> }
>
> I have a selected var. instance (is transient) for query if the entity is
> selectable.
>
> Juan
>
> 2011/6/10 bb.f.pav <
bb.f....@googlemail.com>