protected void takeSnapshot() {
    if (snapshot.getSnapshotTaken() != null) return;

    contentPanel.mask("Please wait while the snapshot is compiled.");

    takeSnapshotService.takeSnapshot(
        snapshot.getSnapshotId(),
        new AsyncCallback<SnapshotInstance>() {
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            if (caught instanceof IllegalArgumentException)
              MessageBox.alert("Alert", caught.getMessage(), null);
            else {
              MessageBox.alert("Alert", "Take snapshot failed unexpectedly.", null);
              System.out.println(caught.getClass().getName());
              System.out.println(caught.getMessage());
            }
            contentPanel.unmask();
          }

          public void onSuccess(SnapshotInstance result) {
            snapshot.setSnapshotTaken(result.getSnapshotTaken());
            snapshot.setSnapshotRows(result.getSnapshotRows());
            snapshot.setExcelFilename(result.getExcelFilename());
            if (parentCardPanel != null) {
              parentCardPanel.reflectSnapshotChanges(snapshot);
            }
            contentPanel.unmask();
            if (store != null) store.getLoader().load();
          }
        });
  }
  private void loadContratos() {
    mainPanel.mask("Carregando dados. Aguarde...");
    InstanceService.CONTRATO_SERVICE.pesquisa(
        null,
        tfData.getValue(),
        new AsyncCallback<List<DTOContrato>>() {

          @Override
          public void onSuccess(List<DTOContrato> contratos) {
            storeContratos.removeAll();
            storeContratos.add(contratos);
            mainPanel.unmask();
          }

          @Override
          public void onFailure(Throwable caught) {
            WebMessageBox.error(caught.getMessage());
            mainPanel.unmask();
          }
        });
  }