Examples of ConvertDataForViewingException


Examples of org.cishell.reference.gui.persistence.view.core.exceptiontypes.ConvertDataForViewingException

              CSV_FILE_EXTENSION);
       
          return new FileWithExtension(
            csvFileForViewing, CSV_FILE_EXTENSION);
        } catch (FileCopyingException csvFileCopyingException) {
          throw new ConvertDataForViewingException(
            csvFileCopyingException);
        }
      } else if (dataIsCSVCompatible(data, converterManager)) {
        /*
         * The data is either a CSV file already or CSV-convertible.
         * This needs to be handled specially so data that can be
         *  viewed in Excel gets viewed in Excel.
         */
        File preparedFileForViewing = prepareFileForViewing(
          data, CSV_FILE_EXTENSION, converterManager);
       
        return new FileWithExtension(preparedFileForViewing, CSV_FILE_EXTENSION);
      } else if (dataIsFile(data, dataFormat)) {
        /*
         * The data is already a text-based file, so it just needs to
         *  be copied to a temporary file for viewing in the default
         *  text-viewing program.
         */
        return new FileWithExtension(prepareTextFileForViewing(data), TXT_FILE_EXTENSION);
      } else if (convertersExist(
        data, ANY_FILE_EXTENSION_FILTER, converterManager)) {
        /*
         * The data is an another type, but it can be converted to a
         *  text-based file type for viewing in the default
         *  text-viewing program.
         */
        return new FileWithExtension(
          convertDataToTextFile(data, converterManager, ciShellContext),
          "txt");
      } else {
        String exceptionMessage = String.format(
          "No converters exist for the data \"%s\".",
          data.getMetadata().get(DataProperty.LABEL));

        throw new ConvertDataForViewingException(exceptionMessage);
      }
    } catch (ConvertDataForViewingException e) {
      String exceptionMessage = String.format(
        "There was a problem when preparing the data \"%s\" for viewing.",
        data.getMetadata().get(DataProperty.LABEL));
View Full Code Here

Examples of org.cishell.reference.gui.persistence.view.core.exceptiontypes.ConvertDataForViewingException

      String exceptionMessage = String.format(
        "A ConversionException occurred when converting the data \"%s\" to %s.",
        dataLabel,
        fileExtension);
     
      throw new ConvertDataForViewingException(exceptionMessage, e);
    } catch (FileCopyingException temporaryFileCopyingException) {
      String exceptionMessage = String.format(
        "A FileCopyingException occurred when converting the data \"%s\" to %s.",
        dataLabel,
        fileExtension);
     
      throw new ConvertDataForViewingException(
        exceptionMessage, temporaryFileCopyingException);
    }
  }
View Full Code Here

Examples of org.cishell.reference.gui.persistence.view.core.exceptiontypes.ConvertDataForViewingException

      String exceptionMessage =
        "An IOException occurred when creating the temporary file \"" +
        cleanedSuggestedFileName + "." + fileExtension +
        "\" for viewing the data \"" + dataLabel + "\".";
     
      throw new ConvertDataForViewingException(
        exceptionMessage, temporaryFileCreationException);
    } catch (FileCopyingException fileCopyingException) {
      throw new ConvertDataForViewingException(fileCopyingException);
    }
  }
View Full Code Here

Examples of org.cishell.reference.gui.persistence.view.core.exceptiontypes.ConvertDataForViewingException

          "A ConversionException occurred when converting the data \"%s\" " +
          "to a file format.";
        String exceptionMessage = String.format(
          format, originalData.getMetadata().get(DataProperty.LABEL));
       
        throw new ConvertDataForViewingException(exceptionMessage, e);
      }
    } else {
      /*
       * There are several converters available, so the user will
       *  need to select how the dataToView is to be converted.
       */
      try {
        return convertDataBasedOffUserChosenConverter(
          originalData, converters, ciShellContext);
      } catch (ConversionException conversionException) {
        String exceptionMessage = String.format(
          "A ConversionException occurred when converting the data \"%s\".",
          originalData.getMetadata().get(DataProperty.LABEL));
       
        throw new ConvertDataForViewingException(exceptionMessage, conversionException);
      } catch (UserCanceledDataViewSelectionException e) {
        String format =
          "A UserCanceledDataViewSelectionException occurred " +
          "when the user did not choose a converter for the " +
          "data \"%s\".";
        String exceptionMessage = String.format(
          format, originalData.getMetadata().get(DataProperty.LABEL));
       
        throw new ConvertDataForViewingException(exceptionMessage, e);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.