Example usage for org.apache.poi.xssf.usermodel XSSFRichTextString XSSFRichTextString

List of usage examples for org.apache.poi.xssf.usermodel XSSFRichTextString XSSFRichTextString

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFRichTextString XSSFRichTextString.

Prototype

@Internal
public XSSFRichTextString(CTRst st) 

Source Link

Document

Create a rich text string from the supplied XML bean

Usage

From source file:guru.qas.martini.report.column.FeatureNameColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject result) {
    JsonObject feature = state.getFeature(result);
    JsonElement element = null == feature ? null : feature.get(KEY_NAME);
    String name = null == element ? null : element.getAsString();
    RichTextString richTextString = new XSSFRichTextString(name);
    cell.setCellValue(richTextString);// ww  w .  java 2s  . co  m
}

From source file:guru.qas.martini.report.column.LocationColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject o) {
    String line = getLine(o);/*ww w  .  j av a2  s . co  m*/
    String relative = getResource(state, o);

    StringBuilder builder = new StringBuilder(null == relative ? "" : relative);
    if (null != line) {
        int length = builder.length();
        builder.append(length > 0 ? " line " : "line ").append(line);
    }

    String value = builder.toString();
    RichTextString richTextString = new XSSFRichTextString(value);
    cell.setCellValue(richTextString);
    state.setStatus(cell, value);
}

From source file:guru.qas.martini.report.column.ScenarioDescriptionColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject o) {
    JsonElement element = o.get(KEY);//from   w  ww .  j a  v  a 2s  . com
    String description = element.isJsonPrimitive() ? element.getAsString() : null;
    String normalized = null == description ? null : description.trim().replaceAll("\\s+", " ");
    String wrapped = WordUtils.wrap(normalized, 60);
    RichTextString richTextString = new XSSFRichTextString(wrapped);
    cell.setCellValue(richTextString);
}

From source file:guru.qas.martini.report.column.ScenarioNameColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject o) {
    JsonPrimitive primitive = o.getAsJsonPrimitive("name");
    String name = null == primitive ? null : primitive.getAsString();
    RichTextString richTextString = new XSSFRichTextString(name);
    cell.setCellValue(richTextString);//  w ww.jav a 2s.c  o  m
}

From source file:guru.qas.martini.report.column.StatusColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject o) {
    JsonPrimitive primitive = o.getAsJsonPrimitive(KEY);
    String status = null == primitive ? null : primitive.getAsString();

    RichTextString richTextString = new XSSFRichTextString(status);
    cell.setCellValue(richTextString);//w w w  .j  a va  2  s .  c  o  m
    state.setStatus(cell, status);
}

From source file:guru.qas.martini.report.column.SuiteColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject result) {
    JsonElement element = result.get(KEY_SUITE);
    String suite = null == element ? null : element.getAsString();
    RichTextString richTextString = new XSSFRichTextString(suite);
    cell.setCellValue(richTextString);//from w  ww. ja va2 s .c om
}

From source file:guru.qas.martini.report.column.TagColumn.java

License:Apache License

protected void addResult(Cell cell, JsonArray array) {

    int size = array.size();
    List<String> tags = Lists.newArrayListWithExpectedSize(size);
    for (int i = 0; i < size; i++) {
        JsonElement element = array.get(i);
        String tag = getTag(element);
        tags.add(tag);//  ww  w . ja v  a  2 s .c  om
    }

    String value = Joiner.on('\n').skipNulls().join(tags);
    RichTextString richTextString = new XSSFRichTextString(value);
    cell.setCellValue(richTextString);
}

From source file:guru.qas.martini.report.column.ThemeColumn.java

License:Apache License

protected void addResult(State state, Cell cell, JsonArray categories) {
    int size = categories.size();

    LinkedHashSet<String> ordered = new LinkedHashSet<>();

    for (int i = 0; i < size; i++) {
        JsonElement element = categories.get(i);
        String category = element.getAsString();
        ordered.add(category);/*from  w ww  . ja va2  s  .  c  o m*/
    }

    String value = Joiner.on("\n").join(ordered);
    RichTextString richTextString = new XSSFRichTextString(value);
    cell.setCellValue(richTextString);

    state.setThemes(cell, ordered);
}

From source file:guru.qas.martini.report.column.ThreadColumn.java

License:Apache License

@Override
public void addResult(State state, Cell cell, JsonObject o) {
    JsonPrimitive primitive = o.getAsJsonPrimitive(KEY_GROUP);
    String group = null == primitive ? "" : primitive.getAsString();

    primitive = o.getAsJsonPrimitive(KEY_NAME);
    String thread = null == primitive ? "" : primitive.getAsString();

    String value = group.isEmpty() ? thread : String.format("%s %s", group, thread);

    RichTextString richTextString = new XSSFRichTextString(value);
    cell.setCellValue(richTextString);/*from  ww w.j a va  2  s  .  com*/
}

From source file:guru.qas.martini.report.column.TimestampColumn.java

License:Apache License

protected void addResult(Cell cell, JsonPrimitive primitive) {
    String timestamp = primitive.getAsString();

    String value;/*from   w  w  w  .  j a  v a2  s  .  co  m*/
    try {
        Date date = new Date(Long.parseLong(timestamp));
        value = String.format("%s\n(%s)", timestamp, date);
    } catch (NumberFormatException e) {
        value = timestamp;
        LOGGER.warn("unable to parse '{}' to a long", timestamp, e);
    }

    RichTextString richTextString = new XSSFRichTextString(value);
    cell.setCellValue(richTextString);
}