Package org.yaac.shared.egql

Examples of org.yaac.shared.egql.ResultCell$ResultCellFactory


 
  @Test
  public void testEncodeDecode() {
    BlobKeyPropertyInfo blob = new BlobKeyPropertyInfo("key2");
   
    ResultCell cell = blob.populateResultCell(AutoBeanUtil.getResultCellFactory());
   
    assertEquals(blob, PropertyInfo.Builder.fromResultCell(cell));
  }
View Full Code Here


    listInfo.add(key2);
   
    BlobKeyPropertyInfo blob = new BlobKeyPropertyInfo("downloadpath");
    listInfo.add(blob);
   
    ResultCell cell = listInfo.populateResultCell(AutoBeanUtil.getResultCellFactory());
   
    assertEquals(listInfo, PropertyInfo.Builder.fromResultCell(cell));
  }
View Full Code Here

  @Test
  public void testEncodeDecode() {
    KeyInfo key1 = new KeyInfo(null, "kkk", null, 20L, "keyString");
    KeyInfo key2 = new KeyInfo(key1, "fff", null, 201L, "keyString");
   
    ResultCell cell = key2.populateResultCell(AutoBeanUtil.getResultCellFactory());
   
    assertEquals(key2, PropertyInfo.Builder.fromResultCell(cell));
  }
View Full Code Here

        if (!colMap.containsKey(cell.getTitle())) {
          SortableColumn<List<ResultCell>, SafeHtml> column =
            new SortableColumn<List<ResultCell>, SafeHtml>(new SafeHtmlCell()) {
              @Override
              public SafeHtml getValue(List<ResultCell> cells) {
                ResultCell c = lookupCell(cell.getTitle(), cells);
               
                SafeHtmlBuilder sb = new SafeHtmlBuilder();
               
                if (c == null) {  // not necessary always have this column
                  sb.appendHtmlConstant("<br/>");
                } else {
                  PropertyInfo property = PropertyInfo.Builder.fromResultCell(c);
                 
                  // populate warnings in tooltip
                  List<String> warnings = property.getWarnings();
                 
                  if (warnings != null && !warnings.isEmpty()) {
                    List<String> warningMsgs = transform(warnings, new Function<String, String>(){
                      @Override
                      public String apply(String errorCode) {
                        return errMsgs.getString(errorCode);
                      }
                    });
                   
                    sb.appendHtmlConstant(
                        "<div title='" + Joiner.on("<br/>").join(warningMsgs) + "' style='background-color: yellow;'>" +
                        property.asHtml() + "</div>");
                  } else {
                    sb.appendHtmlConstant(property.asHtml())
                  }
                }
                return sb.toSafeHtml();
              }
          };
         
          resultTable.addColumn(column, cell.getTitle());
          colMap.put(cell.getTitle(), column);
         
          sortHandler.setComparator(column, new Comparator<List<ResultCell>>() {
            @Override
            public int compare(List<ResultCell> cell1s, List<ResultCell> cell2s) {
              // dynamic columns, both c1 and c2 can be null
              ResultCell c1 = lookupCell(cell.getTitle(), cell1s);
              ResultCell c2 = lookupCell(cell.getTitle(), cell2s);
             
              if (c1 == null) {
                if (c2 == null) {
                  return 0;
                } else {
View Full Code Here

   * @param null1
   * @param object
   * @return
   */
  public static ResultCell newResultCell(PropertyType type, String ...payloads) {
    ResultCell result = newResultCell();
    result.setType(type);
    result.setPayload(Arrays.asList(payloads));
    return result;
  }
View Full Code Here

        break;
      }
     
      List<ResultCell> resultRow = new ArrayList<ResultCell>(dataRow.size());
      for (PropertyInfo dataProperty : dataRow) {
        ResultCell cell = dataProperty.populateResultCell(AutoBeanUtil.getResultCellFactory());
        resultRow.add(cell);
      }
      result.add(resultRow);
     
      decreaseRemainingResultQuota();
View Full Code Here

    }
  }

  @Override
  public ResultCell populateResultCell(ResultCellFactory factory) {
    ResultCell cell = super.populateResultCell(factory);
    cell.setType(PropertyType.TEXT);
    cell.setParent(null);
    cell.setChildren(null);
    cell.setPayload(Arrays.asList(preview, size.toString(), downloadPath));
    return cell;
  }
View Full Code Here

    }
  }

  @Override
  public ResultCell populateResultCell(ResultCellFactory factory) {
    ResultCell cell = super.populateResultCell(factory);
    cell.setType(PropertyType.BLOB);
    cell.setParent(null);
    cell.setChildren(null);
    cell.setPayload(Arrays.asList(size.toString(), downloadPath));
    return cell;
  }
View Full Code Here

    return "LongPropertyInfo [payload=" + payload + "]";
  }

  @Override
  public ResultCell populateResultCell(ResultCellFactory factory) {
    ResultCell cell = super.populateResultCell(factory);
    cell.setType(PropertyType.LONG);
    cell.setParent(null);
    cell.setChildren(null);
    cell.setPayload(Arrays.asList(payload.toString()));
    return cell;
  }
View Full Code Here

    return "ShortBlobPropertyInfo [payload=" + payload + "]";
  }

  @Override
  public ResultCell populateResultCell(ResultCellFactory factory) {
    ResultCell cell = super.populateResultCell(factory);
    cell.setType(PropertyType.SHORT_BLOB);
    cell.setParent(null);
    cell.setChildren(null);
    cell.setPayload(Arrays.asList(payload));
    return cell;
  }
View Full Code Here

TOP

Related Classes of org.yaac.shared.egql.ResultCell$ResultCellFactory

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.