After upgrading from GWT 2.1.0 to 2.1.1, a web page
rendered using CellTable becomes frozen when a CheckboxCell is
clicked. This only happens in production mode and the browsers tested
include FireFox 3.6, Internet Exploer 8 and 10.0.648.204. In
development mode, the upgrade does not produce any perceivable
changes. We noticed that there are many changes in Data Cell Widget
classes. In GWT 2.1.1, CheckBoxCell constructors take 0 to 2
parameters, and we found out as long as the second constructor
parameter is set to true, this issue always occurs. Turning that
parameter to false prevents the bug, but then the user cannot select
any CheckboxCell. Another way to prevent this from happening is to
pass -draftCompile option to the GWT compiler. However, a side effect
of this workaround is that we don't get all the benefits of compiler
optimizations. The initial download size increases by more than 10%.
Although we might go back to GWT 2.1.0, but that would be our last
option because of the efforts needed to reverting a large amount of
code in more than one custom libraries.
             We look forward to suggestions from the GWT related teams
for a better workaround. Attached is a relevant code snippet defined
in a constructor of a class that extends CellTable. In the snippet, M
and H are generic types of our business models:
                final SingleSelectionModel<M> aSelectionModel = new
SingleSelectionModel<M>();
                setSelectionModel(aSelectionModel);
                FieldUpdater<M, Boolean> aFieldUpdater = new FieldUpdater<M,
Boolean>() {
                        public void update(int theIndex, M theModel, Boolean 
theSelectFlag)
{
                                String aRecordID = theModel.getRecordID();
                                fireEvent(new SelectionEvent<String>(aRecordID) 
{
                                });
                                aSelectionModel.setSelected(theModel, 
theSelectFlag);
                        }
                };
                createColumn(new CheckboxCell(true, true), new H<Boolean>() {
                        public Boolean getValue(M theDisplayData) {
                                return 
aSelectionModel.isSelected(theDisplayData);
                        }
                }, aFieldUpdater, this);

...

        /**
         *
         * @param <C> the cell type
         * @param theCell the cell used to render the column
         * @param theGetter the value getter for the cell
         */
        private static <C> void createColumn(Cell<C> theCell, final H<C>
theGetter, FieldUpdater<M, C> theFieldUpdater, CellTable<M> theTable)
{
                Column<M, C> aColumn = new Column<M, C>(theCell) {
                        @Override
                        public C getValue(M theModel) {
                                return theGetter.getValue(theModel);
                        }
                };
                aColumn.setFieldUpdater(theFieldUpdater);
                theTable.addColumn(aColumn, "");
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to