Example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter.

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:com.webgocommerce.client.view.uibdempresa.UIBdEmpresaImpl.java

@Override
public void exportarData() {
    int row = 0;//from  www.  j av a  2s. c  om
    List<BdEmpresaProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ID");
    flex.setText(0, 1, "EMPRESA");
    flex.setText(0, 2, "HOST");
    flex.setText(0, 3, "PUERTO");
    flex.setText(0, 4, "ESQUEMA");
    flex.setText(0, 5, "USUSARIO BD");
    flex.setText(0, 6, "CLAVE BD");
    flex.setText(0, 7, "ESTADO");
    for (int j = 0; j < 8; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        BdEmpresaProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getIdBdEmpresa().toString());
        flex.setText(fila, 1, bean.getNombre());
        flex.setText(fila, 2, bean.getIpHost());
        flex.setText(fila, 3, bean.getPuerto().toString());
        flex.setText(fila, 4, bean.getSchema());
        flex.setText(fila, 5, bean.getUserPrincipal());
        flex.setText(fila, 6, bean.getClavePrincipal());
        flex.setText(fila, 7, bean.getEstadoActivacion());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "BdEmpresa" + (new Date()).getTime());
    /*List<BdEmpresaProxy> lista=grid.getData();
    Iterator<BdEmpresaProxy> iterador=lista.iterator();
    int contador=0;
    String id="";         
    GjsonArray array=new GjsonArray();
    while(iterador.hasNext()){
    BdEmpresaProxy bean=iterador.next();
    GjsonObject object=new GjsonObject(TypeGjson.COMPLEX,bean.getClassName());
    id=String.valueOf(contador);
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"className"), bean.getClassName());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"clavePrincipal"), bean.getClavePrincipal());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"estadoActivacion"), bean.getEstadoActivacion());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"ipHost"), bean.getIpHost());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"nombre"), bean.getNombre());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"schema"), bean.getSchema());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"userPrincipal"), bean.getUserPrincipal());
    object.putElement(new GjsonKey(id,Integer.class.getSimpleName(),"idBdEmpresa"), bean.getIdBdEmpresa());
    object.putElement(new GjsonKey(id,Integer.class.getSimpleName(),"puerto"), bean.getPuerto());
    object.putElement(new GjsonKey(id,Integer.class.getSimpleName(),"version"), bean.getVersion());
    object.putElement(new GjsonKey(id,String.class.getSimpleName(),"operacion"), bean.getOperacion());            
    array.putElement(object);
    contador=contador+1;                        
    }                    
    GjsonArray.buildJsonArrayFormat(array);       
    System.out.println(array.getGjsonArray());
    Window.alert(array.getGjsonArray().toString());
    servicioExportar.exportar(new AsyncCallback<Void>() {
            
    @Override
    public void onFailure(Throwable caught) {
        GWT.log(caught.getMessage(), caught);
    }
            
    @Override
    public void onSuccess(Void result) {
               
    }
    });*/
}

From source file:com.webgocommerce.client.view.uibdusuario.UIBdUsuarioImpl.java

@Override
public void exportarData() {
    int row = 0;/*from   w  ww  .  java2 s .  com*/
    List<BdUsuarioProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ID");
    flex.setText(0, 1, "EMPRESA");
    flex.setText(0, 2, "ESQUEMA");
    flex.setText(0, 3, "NIVEL");
    flex.setText(0, 4, "USUARIO LOG");
    flex.setText(0, 5, "CLAVE LOG");
    flex.setText(0, 6, "USUARIO BD");
    flex.setText(0, 7, "CLAVE BD");
    flex.setText(0, 8, "ESTADO");
    for (int j = 0; j < 9; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        BdUsuarioProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getIdBdUsuario().toString());
        flex.setText(fila, 1, bean.getBeanBdEmpresa().getNombre());
        flex.setText(fila, 2, bean.getSchema());
        flex.setText(fila, 3, bean.getNivel());
        flex.setText(fila, 4, bean.getCorreo());
        flex.setText(fila, 5, bean.getClave());
        flex.setText(fila, 6, bean.getUsuarioBd());
        flex.setText(fila, 7, bean.getClaveBd());
        flex.setText(fila, 8, bean.getEstadoActivacion());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "BdUsuario" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uicategorialista.UICategoriaListaImpl.java

@Override
public void exportarData() {
    int row = 0;/*from  w  w w.  j a  v  a2 s. com*/
    List<CategoriaListaProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ID");
    flex.setText(0, 1, "DESCRIPCION");
    for (int j = 0; j < 2; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        CategoriaListaProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getId().toString());
        flex.setText(fila, 1, bean.getDescripcion());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "CategoriaLista" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uiclientecall.UIClienteCallImpl.java

@Override
public void exportarData() {
    int row = 0;//from ww w. j  a  v a 2s  .  c o m
    List<ClienteCallCenterProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ESTADO");
    flex.setText(0, 1, "DNI");
    flex.setText(0, 2, "NOMBRES");
    flex.setText(0, 3, "APELLIDOS");
    flex.setText(0, 4, "FECHA");
    flex.setText(0, 5, "OBSERVACIONES");
    for (int j = 0; j < 6; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    flex.getFlexCellFormatter().getElement(0, 5).getStyle().setWidth(100, Style.Unit.EM);
    int fila = 1;
    for (int i = 0; i < row; i++) {
        ClienteCallCenterProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getEstado());
        flex.setText(fila, 1, bean.getDni());
        flex.setText(fila, 2, bean.getNombres());
        flex.setText(fila, 3, bean.getApellidos());
        flex.setText(fila, 4, dateFormat.format(bean.getFecha()));
        flex.setText(fila, 5, bean.getObservacion());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "clientecall" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uicoordinador.UICoordinadorImpl.java

@Override
public void exportarData() {
    int row = 0;/*w w w.  ja v  a  2  s .  c  om*/
    List<CoordinadorProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ID");
    flex.setText(0, 1, "DNI");
    flex.setText(0, 2, "NOMBRES");
    flex.setText(0, 3, "APELLIDOS");
    flex.setText(0, 4, "CORREO");
    flex.setText(0, 5, "CELULAR");
    for (int j = 0; j < 6; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        CoordinadorProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getId().toString());
        flex.setText(fila, 1, bean.getDni());
        flex.setText(fila, 2, bean.getNombres());
        flex.setText(fila, 3, bean.getApellidos());
        flex.setText(fila, 4, bean.getCorreo());
        flex.setText(fila, 5, bean.getCelular());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "Coordinador" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uicorreuser.UICorreUserImpl.java

@Override
public void exportarData() {
    int row = 0;/*ww w. ja  v a  2s  . c om*/
    List<UsuarioCorrelativoProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "COD");
    flex.setText(0, 1, "DOCUMENTO");
    flex.setText(0, 2, "SERIE");
    flex.setText(0, 3, "USUARIO");
    flex.setText(0, 4, "TRABAJADOR");
    flex.setText(0, 5, "PTO. EMISION");
    flex.setText(0, 6, "TIENDA");
    flex.setText(0, 7, "SUCURSAL");
    flex.setText(0, 8, "EST.");
    flex.setText(0, 9, "FECHA INI");
    flex.setText(0, 10, "FECHA FIN");
    for (int j = 0; j < 11; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        UsuarioCorrelativoProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getId().toString());
        flex.setText(fila, 1, bean.getNomDocumento());
        flex.setText(fila, 2, bean.getSerie());
        flex.setText(fila, 3, bean.getNomAcceso());
        flex.setText(fila, 4, bean.getNomUsuario());
        flex.setText(fila, 5, bean.getNomPtoEmision());
        flex.setText(fila, 6, bean.getNomTienda());
        flex.setText(fila, 7, bean.getNomSucursal());
        flex.setText(fila, 8, bean.getEstado());
        flex.setText(fila, 9, dateFormat.format(bean.getFechaIni()));
        flex.setText(fila, 10, bean.getFechaFin() != null ? dateFormat.format(bean.getFechaFin()) : "");
        fila = fila + 1;
    }
    TableToExcel.save(flex, "UserCorre" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uidocventa.UIDocVentaImpl.java

@Override
public void exportarData() {
    int row = 0;/*from   ww  w. j a  v  a 2 s .  co m*/
    List<CabeceraVentaProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "FECHA");
    flex.setText(0, 1, "TIPO DOC");
    flex.setText(0, 2, "SERIE");
    flex.setText(0, 3, "PREIMPRESO");
    flex.setText(0, 4, "RUC/DNI");
    flex.setText(0, 5, "CLIENTE");
    flex.setText(0, 6, "CONDICION");
    flex.setText(0, 7, "F. VENC");
    flex.setText(0, 8, "MONEDA");
    flex.setText(0, 9, "TIPO CAMBIO");
    flex.setText(0, 10, "TOTAL AFECTO");
    flex.setText(0, 11, "TOTAL IGV");
    flex.setText(0, 12, "TOTAL NETO");
    flex.setText(0, 13, "VENDEDOR");
    flex.setText(0, 14, "PTO. EMISION");
    flex.setText(0, 15, "TIPO VENTA");
    for (int j = 0; j < 16; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        CabeceraVentaProxy bean = lista.get(i);
        flex.setText(fila, 0, dateFormat.format(bean.getFechaEmision()));
        flex.setText(fila, 1, bean.getNomDoc());
        flex.setText(fila, 2, bean.getSerie());
        flex.setText(fila, 3, bean.getPreimpreso());
        flex.setText(fila, 4, bean.getRucCliente());
        flex.setText(fila, 5, bean.getNombreCliente());
        flex.setText(fila, 6, bean.getNomCondicionVenta());
        flex.setText(fila, 7, dateFormat.format(bean.getFechaVencimiento()));
        flex.setText(fila, 8, bean.getIdMoneda());
        flex.setText(fila, 9, bean.getTipoCambio().toString());
        flex.setText(fila, 10, bean.getTotalAfecto().toString());
        flex.setText(fila, 11, bean.getTotalIgv().toString());
        flex.setText(fila, 12, bean.getTotalNeto().toString());
        flex.setText(fila, 13, bean.getNomVendedor());
        flex.setText(fila, 14, bean.getPuntoEmsion());
        flex.setText(fila, 15, bean.getTipoVenta());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "DocVentas" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uidocventa.UIRegVentaCeImpl.java

@Override
public void exportarData() {
    int row = 0;//from w w  w.ja  v  a 2 s  .  co  m
    List<CabeceraVentaProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "FECHA");
    flex.setText(0, 1, "ESTADO DEL PROYECTO");
    flex.setText(0, 2, "SEC/SOT/PROYECTO");
    flex.setText(0, 3, "TIPO DOC");
    flex.setText(0, 4, "SERIE");
    flex.setText(0, 5, "PREIMPRESO");
    flex.setText(0, 6, "RUC");
    flex.setText(0, 7, "CLIENTE");
    flex.setText(0, 8, "MONEDA");
    flex.setText(0, 9, "TIPO CAMBIO");
    flex.setText(0, 10, "TOTAL AFECTO");
    flex.setText(0, 11, "TOTAL IGV");
    flex.setText(0, 12, "TOTAL NETO");
    flex.setText(0, 13, "TOTAL PLAN");
    flex.setText(0, 14, "PTO. EMISION");
    flex.setText(0, 15, "MESA");
    flex.setText(0, 16, "DNI VENDEDOR");
    flex.setText(0, 17, "VENDEDOR");
    flex.setText(0, 18, "AUDITOR");
    flex.setText(0, 19, "DNI SUPERVISOR");
    flex.setText(0, 20, "SUPERVISOR");
    flex.setText(0, 21, "DNI GER. ZONAL");
    flex.setText(0, 22, "GERENTE ZONAL");
    flex.setText(0, 23, "DNI COORDINADOR");
    flex.setText(0, 24, "COORDINADOR");
    flex.setText(0, 25, "OBSERVACION");
    for (int j = 0; j < 26; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        CabeceraVentaProxy bean = lista.get(i);
        flex.setText(fila, 0, dateFormat.format(bean.getFechaEmision()));
        flex.setText(fila, 1, bean.getEstadoActual());
        flex.setText(fila, 2, bean.getCodProy());
        flex.setText(fila, 3, bean.getNomDoc());
        flex.setText(fila, 4, bean.getSerie());
        flex.setText(fila, 5, bean.getPreimpreso());
        flex.setText(fila, 6, bean.getRucCliente());
        flex.setText(fila, 7, bean.getNombreCliente());
        flex.setText(fila, 8, bean.getIdMoneda());
        flex.setText(fila, 9, bean.getTipoCambio().toString());
        flex.setText(fila, 10, bean.getTotalAfecto().toString());
        flex.setText(fila, 11, bean.getTotalIgv().toString());
        flex.setText(fila, 12, bean.getTotalNeto().toString());
        flex.setText(fila, 13, bean.getTotalPlan().toString());
        flex.setText(fila, 14, bean.getPuntoEmsion());
        flex.setText(fila, 15, bean.getNomMesa());
        flex.setText(fila, 16, bean.getDniVendedor());
        flex.setText(fila, 17, bean.getNomVendedor());
        flex.setText(fila, 18, bean.getUsuarioReg());
        flex.setText(fila, 19, bean.getDniSupervisor());
        flex.setText(fila, 20, bean.getNomSupervisor());
        flex.setText(fila, 21, bean.getDniGerenteZonal());
        flex.setText(fila, 22, bean.getNomGerenteZonal());
        flex.setText(fila, 23, bean.getDniCoordinador());
        flex.setText(fila, 24, bean.getNomCoordinador());
        flex.setText(fila, 25, bean.getObservacion());
        fila = fila + 1;
    }
    TableToExcel.save(flex, "RegVentasCe" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uieditconsultor.UIEditConsultorImpl.java

@Override
public void exportarData() {
    int row = 0;/*w  ww. jav a 2s . c om*/
    List<SuperVenProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "DNI");
    flex.setText(0, 1, "CONSULTOR");
    flex.setText(0, 2, "ESTADO");
    flex.setText(0, 3, "FECHA INI");
    flex.setText(0, 4, "FECHA FIN");
    for (int j = 0; j < 5; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        SuperVenProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getDni());
        flex.setText(fila, 1, bean.getNomConsultor());
        flex.setText(fila, 2, bean.getEstado());
        flex.setText(fila, 3, bean.getFechaIni() != null ? dateFormat.format(bean.getFechaIni()) : "");
        flex.setText(fila, 4, bean.getFechaFin() != null ? dateFormat.format(bean.getFechaFin()) : "");
        fila = fila + 1;
    }
    TableToExcel.save(flex, "consultores" + (new Date()).getTime());
}

From source file:com.webgocommerce.client.view.uieditlistaprecio.UIEditListaPrecioImpl.java

@Override
public void exportarData() {
    int row = 0;//from   www.  ja va 2  s  .  c o m
    List<PrecioItemProxy> lista;
    if (!grid.getDataProvider().hasFilter()) {
        row = grid.getData().size();
        lista = grid.getData();
    } else {
        row = grid.getDataProvider().resulted.size();
        lista = grid.getDataProvider().resulted;
    }
    if (row == 0) {
        Notification not = new Notification(Notification.ALERT, "Grid sin datos");
        not.showPopup();
        return;
    }
    FlexTable flex = new FlexTable();
    flex.setText(0, 0, "ESTADO");
    flex.setText(0, 1, "CODIGO");
    flex.setText(0, 2, "DESCRIPCION");
    flex.setText(0, 3, "MARCA");
    flex.setText(0, 4, "PRECIO SD");
    flex.setText(0, 5, "DESCUENTO");
    flex.setText(0, 6, "PRECIO VENTA");
    flex.setText(0, 7, "VALOR VENTA");
    flex.setText(0, 8, "IGV");
    flex.setText(0, 9, "FECHA INI");
    flex.setText(0, 10, "FECHA FIN");
    for (int j = 0; j < 11; j++) {
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontWeight(Style.FontWeight.BOLD);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setFontSize(14, Style.Unit.PX);
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setBackgroundColor("#0170C9");
        flex.getFlexCellFormatter().getElement(0, j).getStyle().setColor("#fff");
    }
    int fila = 1;
    for (int i = 0; i < row; i++) {
        PrecioItemProxy bean = lista.get(i);
        flex.setText(fila, 0, bean.getEstadoActiva());
        flex.setText(fila, 1, bean.getCodigo());
        flex.setText(fila, 2, bean.getDescripcion());
        flex.setText(fila, 3, bean.getMarca());
        flex.setText(fila, 4, bean.getPrecioSD().toString());
        flex.setText(fila, 5, bean.getDescuento().toString());
        flex.setText(fila, 6, bean.getPrecioVenta().toString());
        flex.setText(fila, 7, bean.getValorVenta().toString());
        flex.setText(fila, 8, bean.getIgv().toString());
        flex.setText(fila, 9, bean.getFechaIni() != null ? dateFormat.format(bean.getFechaIni()) : "");
        flex.setText(fila, 10, bean.getFechaFin() != null ? dateFormat.format(bean.getFechaFin()) : "");
        fila = fila + 1;
    }
    TableToExcel.save(flex, "preciositem" + (new Date()).getTime());
}