Ejemplo n.º 1
0
  private void exportFile() {
    try {
      boolean currentRowOnly = chkCurrentRow.isSelected();
      File file =
          File.createTempFile("Export", "." + cboType.getSelectedItem().getValue().toString());
      childs.clear();
      for (Checkbox chkSeletionTab : chkSelectionTabForExport) {
        if (chkSeletionTab.isChecked()) {
          childs.add((GridTab) chkSeletionTab.getAttribute("tabBinding"));
        }
      }

      exporter.export(panel.getActiveGridTab(), childs, currentRowOnly, file, indxDetailSelected);

      winExportFile.onClose();
      winExportFile = null;
      AMedia media = null;
      media =
          new AMedia(
              exporter.getSuggestedFileName(panel.getActiveGridTab()),
              null,
              exporter.getContentType(),
              file,
              true);
      Filedownload.save(media);
    } catch (Exception e) {
      throw new AdempiereException(e);
    } finally {
      if (winExportFile != null) winExportFile.onClose();
    }
  }
Ejemplo n.º 2
0
 @Override
 public void onEvent(Event event) throws Exception {
   if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) winExportFile.onClose();
   else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) exportFile();
   else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) {
     panel.hideBusyMask();
   } else if (event.getTarget().equals(cboType) && event.getName().equals(Events.ON_SELECT)) {
     displayExportTabSelection();
   } else if (event.getName().equals("onExporterException")) {
     FDialog.error(0, winExportFile, "FileInvalidExtension");
     winExportFile.onClose();
   }
 }