Examples of IConverter


Examples of com.documents4j.api.IConverter

            Console console = System.console();
            if (console == null) {
                System.out.println("This application can only be used from the command line.");
                System.exit(-1);
            }
            IConverter converter = asConverter(args);
            try {
                Logger logger = LoggerFactory.getLogger(StandaloneClient.class);
                sayHello(converter, logger, console);
                DocumentType[] documentTypes = configureConversion(console, converter.getSupportedConversions());
                console.printf("Enter '<source> [-> <target>]' for converting a file. Enter '\\q' for exiting this application.%n");
                String argument;
                do {
                    console.printf("> ");
                    argument = console.readLine();
                    if (argument != null) {
                        if (argument.equals("\\q")) {
                            break;
                        } else if (argument.equals("\\f")) {
                            documentTypes = configureConversion(console, converter.getSupportedConversions());
                        } else if (argument.trim().equals("")) {
                            continue;
                        }
                        int targetIndex = argument.indexOf("->");
                        String source = targetIndex == -1 ? argument : argument.substring(0, targetIndex);
                        File sourceFile = normalize(source);
                        if (!sourceFile.isFile()) {
                            console.printf("Input file does not exist: %s%n", sourceFile);
                            continue;
                        }
                        String target = targetIndex == -1 ? source + "." + extensionFor(documentTypes[1]) : argument.substring(targetIndex + 1);
                        File targetFile = normalize(target);
                        converter.convert(sourceFile).as(documentTypes[0])
                                .to(targetFile, new LoggingFileConsumer(sourceFile, logger)).as(documentTypes[1])
                                .schedule();
                        console.printf("Scheduled conversion: %s -> %s%n", sourceFile, targetFile);
                        logger.info("Converting {} to {}", sourceFile, targetFile);
                    } else {
                        logger.error("Error when reading from console.");
                    }
                } while (argument != null);
                sayGoodbye(converter, logger);
            } finally {
                converter.shutDown();
            }
            console.printf("The connection was successfully closed. Goodbye!%n");
        } catch (Exception e) {
            LoggerFactory.getLogger(StandaloneClient.class).error("The document conversion client terminated with an unexpected error", e);
            System.err.println(String.format("Error: %s", e.getMessage()));
View Full Code Here

Examples of com.xuggle.xuggler.video.IConverter

  private IVideoPicture convertToPicture(int streamIndex, BufferedImage image,
    long timeStamp)
  {
    // lookup the converter

    IConverter videoConverter = mVideoConverters.get(streamIndex);

    // if not found create one

    if (videoConverter == null)
    {
      IStream stream = mStreams.get(streamIndex);
      IStreamCoder coder = stream.getStreamCoder();
      videoConverter = ConverterFactory.createConverter(
        ConverterFactory.findDescriptor(image),
        coder.getPixelType(),
        coder.getWidth(), coder.getHeight(),
        image.getWidth(), image.getHeight());
      mVideoConverters.put(streamIndex, videoConverter);
    }

    // return the converter
   
    return videoConverter.toPicture(image, timeStamp);
  }
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

  {
    Object value = PropertyResolver.getValue(variableName, model);

    if (value != null)
    {
      final IConverter converter = getConverter(value.getClass());
      if (converter != null)
      {
        return converter.convertToString(value, Session.get().getLocale());
      }
      else
      {
        return value.toString();
      }
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

    settings.put("button", "\"" + triggerButton.getPath() + "\"");
  }

  protected DateConverter getDateConverter()
  {
    IConverter converter = target.getConverter(Date.class);
    if (converter instanceof DateConverter)
    {
      return (DateConverter)converter;
    }
    return super.getDateConverter();
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

            final String string = (String)newValue;
            if (!Strings.isEmpty(string)) {
                // and there is a non-null property type for the component
                if (getObjectClass() != null) {
                    // convert the String to the right type
                    IConverter converter = component.getConverter(getObjectClass());
                    if (converter != null) {
                        newValue = converter.convertToObject(string, null);
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

  }

    @Override
  protected DateConverter getDateConverter()
  {
    IConverter converter = target.getConverter(Date.class);
    if (converter instanceof DateConverter)
    {
      return (DateConverter)converter;
    }
    return super.getDateConverter();
View Full Code Here

Examples of org.apache.wicket.util.convert.IConverter

    if (modelObject != null)
    {
      // Get converter
      final Class<?> objectClass = modelObject.getClass();

      final IConverter converter = getConverter(objectClass);

      // Model string from property
      final String modelString = converter.convertToString(modelObject, getLocale());

      if (modelString != null)
      {
        // If we should escape the markup
        if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
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.