Package org.pentaho.reporting.libraries.base.util

Examples of org.pentaho.reporting.libraries.base.util.CSVQuoter


    {
      throw new NullPointerException();
    }

    final ElementStyleSheet[] sheets = styleSheet.getParents();
    final CSVQuoter quoter = new CSVQuoter(' ', '\'');
    StringBuffer parents = null;
    for (int i = 0; i < sheets.length; i++)
    {
      final ElementStyleSheet sheet = sheets[i];
      if (sheet.isGlobalDefault())
      {
        continue;
      }

      if (parents == null)
      {
        parents = new StringBuffer(sheets.length * 30);
      }
      final String quoted = quoter.doQuoting(sheet.getName());
      if (parents.length() > 0)
      {
        parents.append(' ');
      }
      parents.append(quoted);
View Full Code Here


        if (separator.length() == 0)
        {
          throw new IllegalArgumentException("CSV separate cannot be an empty string.");
        }

        quoter = new CSVQuoter(separator.charAt(0));
      }

      if (documentContentItem == null)
      {
        if (contentLocation == null)
View Full Code Here

      throw new BeanException("Value must be a array");
    }
   
    final int size = Array.getLength(o);
    final StringBuffer buffer = new StringBuffer(size * 25);
    final CSVQuoter quoter = new CSVQuoter(',', '"');
    for (int i = 0; i < size; i++)
    {
      if (i != 0)
      {
        buffer.append(',');
      }
      final Object o1 = Array.get(o, i);
      if (o1 != null)
      {
        final String original = elementConverter.toAttributeValue(o1);
        if (original.length() == 0)
        {
          buffer.append("\"\"");
        }
        else
        {
          buffer.append(quoter.doQuoting(original));
        }
      }
    }
    return buffer.toString();
  }
View Full Code Here

      if (raw.getClass().isArray() == false)
      {
        throw new ReportDataFactoryException("For parameter " + name + " Expected array, but got " + raw);
      }

      final CSVQuoter quoter = new CSVQuoter(';');
      final String arrayType = type.substring(0, type.length() - 5);
      final StringBuffer b = new StringBuffer();
      final int length = Array.getLength(raw);
      for (int i = 0; i < length; i++)
      {
        final Object o = Array.get(raw, i);
        if (i > 0)
        {
          b.append(";");
        }
        final String str = parameterToString(name + "[" + i + "]", arrayType, pattern, o);
        b.append(quoter.doQuoting(str));
      }
    }
    throw new ReportDataFactoryException("Unknown type " + type + " for parameter " + name);
  }
View Full Code Here

    protected Transferable createTransferable(final JComponent c)
    {
      final JList lcomp = (JList) c;
      final StringBuilder b = new StringBuilder();
      final CSVQuoter quoter = new CSVQuoter(',', '"');
      final Object[] selectedValues = lcomp.getSelectedValues();
      for (int i = 0; i < selectedValues.length; i++)
      {
        if (i != 0)
        {
          b.append(',');
        }
        final Object value = selectedValues[i];
        b.append(quoter.doQuoting(String.valueOf(value)));
      }

      return new StringSelection(b.toString());
    }
View Full Code Here

        {
          throw new ReportDataFactoryException("For parameter " + name + " Expected array, but got " + raw.getClass());
        }
      }

      final CSVQuoter quoter = new CSVQuoter(';');
      final String arrayType = type.substring(0, type.length() - 5);
      final StringBuilder b = new StringBuilder();
      final int length = Array.getLength(raw);
      for (int i = 0; i < length; i++)
      {
        final Object o = Array.get(raw, i);
        if (i > 0)
        {
          b.append(";");
        }
        final String str = parameterToString(name + "[" + i + "]", arrayType, pattern, o);
        b.append(quoter.doQuoting(str));
      }
      return b.toString();
    }
    throw new ReportDataFactoryException("Unknown type " + type + " for parameter " + name);
  }
View Full Code Here

      }
      return new TypeValuePair(TextType.TYPE, b.toString());
    }
    else
    {
      final CSVQuoter quoter = new CSVQuoter(quote.charAt(0), quote.charAt(0), true);
      StringBuilder b = new StringBuilder();
      while (sequence.hasNext())
      {
        final Object o = sequence.next();
        if (o != null)
        {
          b.append(quoter.doQuoting(String.valueOf(o)));
        }
        if (sequence.hasNext())
        {
          b.append(separator);
        }
View Full Code Here

      throw new BeanException("Value must be a array");
    }
   
    final int size = Array.getLength(o);
    final StringBuilder buffer = new StringBuilder(size * 25);
    final CSVQuoter quoter = new CSVQuoter(',', '"');
    for (int i = 0; i < size; i++)
    {
      if (i != 0)
      {
        buffer.append(',');
      }
      final Object o1 = Array.get(o, i);
      if (o1 != null)
      {
        final String original = elementConverter.toAttributeValue(o1);
        if (original.length() == 0)
        {
          buffer.append("\"\"");
        }
        else
        {
          buffer.append(quoter.doQuoting(original));
        }
      }
    }
    return buffer.toString();
  }
View Full Code Here

        if (separator.length() == 0)
        {
          throw new IllegalArgumentException("CSV separate cannot be an empty string.");
        }

        quoter = new CSVQuoter(separator.charAt(0));
      }

      if (documentContentItem == null)
      {
        if (contentLocation == null)
View Full Code Here

          ("org.pentaho.reporting.engine.classic.core.modules.output.table.csv.Encoding",
              EncodingRegistry.getPlatformDefaultEncoding());
    }


    quoter = new CSVQuoter(separator.charAt(0));
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.base.util.CSVQuoter

Copyright © 2018 www.massapicom. 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.