Package org.molgenis.util.tuple

Examples of org.molgenis.util.tuple.KeyValueTuple


    StringWriter strWriter = new StringWriter();
    CsvWriter csvWriter = new CsvWriter(strWriter);
    try
    {
      csvWriter.writeColNames(Arrays.asList("col1", "col2"));
      KeyValueTuple row1 = new KeyValueTuple();
      row1.set("col1", "val1");
      row1.set("col2", "val2");
      csvWriter.write(row1);
      assertEquals(strWriter.toString(), "\"col1\",\"col2\"\n\"val1\",\"val2\"\n");
    }
    finally
    {
View Full Code Here


    StringWriter strWriter = new StringWriter();
    CsvWriter csvWriter = new CsvWriter(strWriter, '\t');
    try
    {
      csvWriter.writeColNames(Arrays.asList("col1", "col2"));
      KeyValueTuple row1 = new KeyValueTuple();
      row1.set("col1", "val1");
      row1.set("col2", "val2");
      csvWriter.write(row1);
      assertEquals(strWriter.toString(), "\"col1\"\t\"col2\"\n\"val1\"\t\"val2\"\n");
    }
    finally
    {
View Full Code Here

    CellProcessor processor = when(mock(CellProcessor.class).processHeader()).thenReturn(true).getMock();
    Tuple headerTuple = mock(Tuple.class);
    when(headerTuple.getNrCols()).thenReturn(2);
    when(headerTuple.getColNames()).thenReturn(Arrays.asList("col1", "col2"));

    KeyValueTuple row1 = new KeyValueTuple();
    row1.set("col1", "val1");
    row1.set("col2", "val2");

    OutputStream os = mock(OutputStream.class);
    ExcelWriter excelWriter = new ExcelWriter(os);
    excelWriter.addCellProcessor(processor);
    try
View Full Code Here

      }

      ScreenMessage msg = null;

      // cleanup the request, only use ticked (marked with 'use_'
      WritableTuple tuple = new KeyValueTuple();
      for (HtmlInput<?> input : this.getFormScreen().getNewRecordForm().getInputs())
      {
        if (!request.isNull("use_" + input.getName()))
        {
          tuple.set(input.getName(), request.get(input.getName()));
        }
      }

      int row = 0;
      try
View Full Code Here

      QueryRule rule = new QueryRule(request.getString("attribute"), QueryRule.Operator.valueOf(request
          .getString("operator")), request.getString("value"));
      pager.addFilter(rule);

      // tell "my" menu to select me
      WritableTuple tuple = new KeyValueTuple();
      String aChildName = getModel().getName();
      ScreenController<?> aParent = getParent();
      while (aParent != null)
      {
        if (aParent instanceof MenuController)
        {
          tuple.set("select", aChildName);
          MenuController c = (MenuController) aParent;
          c.doSelect(tuple);
        }
        aChildName = aParent.getName();
        aParent = aParent.getParent();
View Full Code Here

    { "rawtypes" })
    @Override
    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
    {
      // transform params
      WritableTuple tuple = new KeyValueTuple();
      for (Object key : params.keySet())
      {
        if (params.get(key) instanceof SimpleScalar)
        {
          tuple.set(key.toString(), ((SimpleScalar) params.get(key)).toString());
        }
        else
        {
          tuple.set(key.toString(), params.get(key));
        }
      }

      // try to get html
      try
View Full Code Here

      int index = 1;
      for (Tuple row : this.rows)
      {
        if (index > getOffset())
        {
          KeyValueTuple tuple = new KeyValueTuple();
          for (String col : columns)
            tuple.set(col, row.get(col));
          result.add(tuple);

          count++;
          if (count >= getLimit()) break;
        }
        index++;
      }
    }
    else
    {
      for (Tuple row : this.rows)
      {
        WritableTuple tuple = new KeyValueTuple();
        for (String col : columns)
          tuple.set(col, row.get(col));
        result.add(tuple);
      }
    }
    return result;
  }
View Full Code Here

      if (colLimit > 0 || colOffset > 0)
      {
        next = it.next();
        if (next != null)
        {
          KeyValueTuple tuple = new KeyValueTuple();
          int colIndex = 1;
          int colCount = 0;
          for (String f : next.getColNames())
          {
            if (colOffset == 0 || colIndex > colOffset)
            {
              tuple.set(f, next.get(f));
              colCount++;
              if (colLimit != 0 && colCount > colLimit) break;
            }
            colIndex++;
          }
View Full Code Here

    {
      List<Tuple> editableRows = new ArrayList<Tuple>();

      for (Tuple t : this.decoratedTable.getRows())
      {
        WritableTuple tuple = new KeyValueTuple();
        for (String colName : t.getColNames())
        {
          tuple.set(colName,
              "<input style=\"width:100%; padding:0px \" type=\"text\" value=\"" + t.get(colName) + "\">");

        }

        editableRows.add(tuple);
View Full Code Here

  }

  @Override
  public String toHtml(Tuple params) throws HtmlInputException
  {
    WritableTuple tuple = new KeyValueTuple();
    for (String colName : params.getColNames())
      tuple.set(colName, params.get(colName));
    tuple.set(HIDDEN, true);
    return super.toHtml(tuple);
  }
View Full Code Here

TOP

Related Classes of org.molgenis.util.tuple.KeyValueTuple

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.