예제 #1
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());
 }
예제 #2
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);
   }
 }
예제 #3
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);
   }
 }
예제 #4
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;
 }
예제 #5
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;
                }
예제 #6
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()]);
        }
예제 #7
0
 @Override
 public Object getCellValue(Object element) {
   ITransaction transaction = (ITransaction) element;
   Transaction t = transaction.getNative();
   return TransactionTypes.getTransactionType(t);
 }