Esempio n. 1
0
 @Override
 public Object getCellValue(Object element) {
   // NOT OK
   ITransaction t = (ITransaction) element;
   long received = t.getAmountReceived(accountId);
   long spend = t.getAmountSpend(accountId);
   return Long.valueOf(received - spend);
 }
Esempio n. 2
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   if (accountId.equals(t.getSenderId())) {
     return Convert.toUnsignedLong(t.getRecipientId());
   }
   return Convert.toUnsignedLong(t.getSenderId());
 }
Esempio n. 3
0
 @Override
 public void activate(Object element) {
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   Long id = t.getId();
   if (id != null) {
     InspectTransactionDialog.show(
         id, nxt, engine, userService, sync, contactsService);
   }
 }
Esempio n. 4
0
 @Override
 public void activate(Object element) {
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   Long id = null;
   if (accountId.equals(t.getSenderId())) {
     id = t.getRecipientId();
   } else {
     id = t.getSenderId();
   }
   if (id != null) {
     InspectAccountDialog.show(id, nxt, engine, userService, sync, contactsService);
   }
 }
Esempio n. 5
0
 @Override
 public Object getCellValue(Object element) {
   // OK
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   if (accountId.equals(t.getSenderId())) {
     if (accountId.equals(t.getRecipientId())) {
       return MONEY;
     }
     return MONEY_SEND;
   } else if (accountId.equals(t.getRecipientId())) {
     return MONEY_RECEIVED;
   }
   return null;
 }
Esempio n. 6
0
                @Override
                public Object getCellValue(Object element) {
                  ITransaction transaction = (ITransaction) element;
                  Transaction t = transaction.getNative();

                  IContact contact;
                  if (t.getSenderId().equals(accountId))
                    contact =
                        getContactsService().getContact(Convert.toUnsignedLong(t.getRecipientId()));
                  else
                    contact =
                        getContactsService().getContact(Convert.toUnsignedLong(t.getSenderId()));
                  if (contact != null) return contact.getName();

                  return EMPTY_STRING;
                }
Esempio n. 7
0
        @Override
        public Object[] getElements(Object inputElement) {
          if (accountId == null || list == null) {
            return new Object[0];
          }

          logger.info("getElements page=" + currentPage + " size=" + pageSize);
          list.ensureCapacity(currentPage * pageSize + 1);

          Pageable<ITransaction> pageable = new Pageable<ITransaction>(list.getList(), pageSize);
          pageable.setPage(currentPage);

          List<ITransaction> transactions = pageable.getListForPage();

          /* Add all pending transactions for this account */
          if (currentPage == 1) {
            List<Transaction> pending = new ArrayList<Transaction>();
            for (Transaction t : nxt.getPendingTransactions()) {
              if (accountId.equals(t.getSenderId()) || accountId.equals(t.getRecipientId())) {
                pending.add(t);
              }
            }
            if (pending.size() > 0) {
              List<Transaction> remove = new ArrayList<Transaction>();
              for (Transaction t : pending) {
                for (ITransaction it : transactions) {
                  if (t.getId().equals(it.getNative().getId())) {
                    remove.add(t);
                    break;
                  }
                }
              }
              for (Transaction t : remove) {
                nxt.getPendingTransactions().remove(t);
                pending.remove(t);
              }
              for (Transaction t : pending) {
                transactions.add(0, new TransactionHelper(nxt, t));
              }
            }
          }

          logger.info("getElements returns ELEMENTS.size=" + transactions.size());
          return transactions.toArray(new Object[transactions.size()]);
        }
Esempio n. 8
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction t = (ITransaction) element;
   return t.getStringId();
 }
Esempio n. 9
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction t = (ITransaction) element;
   return Integer.valueOf(t.getFee());
 }
Esempio n. 10
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction t = (ITransaction) element;
   return t.getTimestamp(); // Date
 }
Esempio n. 11
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   return TransactionTypes.getTransactionType(t);
 }
Esempio n. 12
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction t = (ITransaction) element;
   return Integer.valueOf(t.getNumberOfConfirmations());
 }
Esempio n. 13
0
 @Override
 public Object getCellValue(Object element) {
   // NOT OK
   ITransaction t = (ITransaction) element;
   return Long.valueOf(t.getRunningTotal()); // Long
 }