Hi,I wanted to to tell you that I am not able to re paint the
CellBrowser by ListDataProvider . My code is:


public class CustomTreeModel implements TreeViewModel {

        private ArticuloFormularioSeleccionCategoriaUIHandlers iuHandler;

        private final SingleSelectionModel<String> selectionModel = new
SingleSelectionModel<String>();

        // Mapa de prueba q simula el servicio del server de consulta de
categoria relacionada
        public static HashMap<String, ArrayList<String>> categorias = new
HashMap<String, ArrayList<String>>();

        /**
         * Get the {@link NodeInfo} that provides the children of the
specified value.
         */
        @Override
        public <T> NodeInfo<?> getNodeInfo(T value) {

                String categoriaSelected = value == null ? null : (String) 
value;

                CategoriaProvider dataProvider = new 
CategoriaProvider(iuHandler,
categoriaSelected);

                // Return a node info that pairs the data with a cell.
                return new DefaultNodeInfo<String>(dataProvider, new TextCell(),
selectionModel, null);
        }

        public void cargarDatos() {

        }

        /**
         * Check if the specified value represents a leaf node. Leaf nodes
cannot be opened.
         */
        public boolean isLeaf(Object value) {
                ArrayList<String> subCategorias = 
categorias.get(value.toString());
                return (subCategorias == null) ? true : false;
        }

        public String getCategoriaSeleccionada() {
                return selectionModel.getSelectedObject();
        }

        public SingleSelectionModel getSelecctionHandler() {
                return this.selectionModel;
        }

        public ArticuloFormularioSeleccionCategoriaUIHandlers getIuHandler()
{
                return iuHandler;
        }

        public void
setIuHandler(ArticuloFormularioSeleccionCategoriaUIHandlers iuHandler)
{
                this.iuHandler = iuHandler;
        }

        public class CategoriaProvider extends ListDataProvider<String> {

                private ArticuloFormularioSeleccionCategoriaUIHandlers 
uiHandler;
                private String categoriaSeleccionada;

                public
CategoriaProvider(ArticuloFormularioSeleccionCategoriaUIHandlers
uiHandler, String categoria) {
                        super();
                        this.categoriaSeleccionada = categoria;
                        this.uiHandler = uiHandler;
                }

                @Override
                protected void onRangeChanged(final HasData<String> display) {
                        super.onRangeChanged(display);

                        if (uiHandler == null)
                                return;


                        if (categoriaSeleccionada == null) {
        
uiHandler.getCategoriaDeArticuloClientService().obtenerCategoriasDeArticulos(new
AsyncCallback<ArrayList<CategoriaDeArticuloDto>>() {

                                        @Override
                                        public void 
onSuccess(ArrayList<CategoriaDeArticuloDto> result) {


                                                ArrayList<String> categorias =
convertCategoriaDeArticuloDto(result);

                                                List list = getList();

                                                list.addAll(categorias);


                                                
updateRowCount(categorias.size(), true);
                                                updateRowData(0, categorias);
                                                refresh();

                                        }

                                        @Override
                                        public void onFailure(Throwable caught) 
{
                                                caught.printStackTrace();
                                                // TODO falta log de error

                                        }
                                });

                        }

                }

        }

        public ArrayList<String>
convertCategoriaDeArticuloDto(ArrayList<CategoriaDeArticuloDto>
result) {

                ArrayList<String> categoriasString = new ArrayList<String>();

                if (result == null)
                        return categoriasString;

                for (CategoriaDeArticuloDto dto : result) {
                        categoriasString.add(dto.nombre);
                }

                return categoriasString;

        }

}

Anyone know why this happens?


Thank you very much!
Jero.



-- 
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