I am expecting a bunch of models to be added to a store that is
displayed by a grid. Each model identifies a column in a fixed width
parser. So the user can specify a width for each model and a start and
end position will be calculated for each. This could also happen in
any other order, for instance a user could specify a start and based
off the new start and the existing width if will recalculate the end.
These models are ordered by start-end position. No two can overlap
position. So when the first model in the tree changes from 1-20 start
to 1-22 start, every model is run through a recalculatePosition
method. I need to apply these changes in an efficient fashion. Right
now I'm making these changes in a simple for loop, and after the
changes are made to the given model I call store.update(model) and
continue on to the next model. The current example I am working with
has around 400 items in the store, its taking around 1 minute per edit
to execute the changes and display it on the grid. If the user wanted
to change the width of every item it would take over 7 hours..that is
insane. This is the entire method:


        private void resetPositionValues()
        {
                Long prevEnd = new Long(0);

                for (final ColumnDTOModel colModel : contentStore.getModels())
                {
                        if(colModel.getColDTO().getColWidth()>0){
                                final Long start = prevEnd + 1;
                                colModel.getColDTO().setColStart(start);
                                final Long end = (start + 
colModel.getColDTO().getColWidth()) - 1;
                                colModel.getColDTO().setColEnd(end);
                                prevEnd = end;
                                colModel.getColDTO().setDirty(true);
                        }else{
                                final Long start = prevEnd;
                                colModel.getColDTO().setColStart(start);
                                colModel.getColDTO().setColEnd(start);
                                prevEnd = start;
                        }

                        contentStore.update(colModel);
                }
                        contentStore.commitChanges();
        }

Is there a way I can applying these changes all at once? Thank you!

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

Reply via email to