Ejemplo n.º 1
0
 @Override
 public String formatCell(BigDecimal value, ValueSpecification valueSpec) {
   DoubleValueFormatter formatter = getFormatter(valueSpec);
   String formattedNumber = formatter.format(value);
   String formattedValue;
   if (formatter.isCurrencyAmount()) {
     Set<String> currencyValues = valueSpec.getProperties().getValues(ValuePropertyNames.CURRENCY);
     String ccy;
     if (currencyValues == null) {
       formattedValue = formattedNumber;
     } else if (currencyValues.isEmpty()) {
       formattedValue = formattedNumber;
     } else {
       ccy = currencyValues.iterator().next();
       formattedValue = ccy + " " + formattedNumber;
     }
   } else {
     formattedValue = formattedNumber;
   }
   return formattedValue;
 }
Ejemplo n.º 2
0
  @Override
  protected void addRowDetails(UniqueId target, int rowId, Map<String, Object> details) {
    PortfolioRow row = _rowIdToRowMap.get(rowId);
    details.put("indent", row.getDepth());
    if (row.getParentRow() != null) {
      final int[] parentRowIds = getGridStructure().getRowIds(row.getParentRow().getTarget());
      details.put("parentRowId", parentRowIds[0]);
    }
    ComputationTargetType targetType = row.getTarget().getType();
    details.put("type", targetType.toString());

    if (targetType == ComputationTargetType.POSITION) {
      Position position = row.getPosition();
      details.put("posId", position.getUniqueId());
      details.put("position", position.getSecurity().getName());
      DoubleValueFormatter formatter = new DoubleValueOptionalDecimalPlaceFormatter();
      details.put(
          "quantity",
          position.getQuantity().signum() == 0 ? "0" : formatter.format(position.getQuantity()));
    } else {
      details.put("position", row.getAggregateName());
    }
  }