use of io.bitsquare.trade.Trade in project bitsquare by bitsquare.
the class LockedView method setDetailsColumnCellFactory.
private void setDetailsColumnCellFactory() {
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
detailsColumn.setCellFactory(new Callback<TableColumn<LockedListItem, LockedListItem>, TableCell<LockedListItem, LockedListItem>>() {
@Override
public TableCell<LockedListItem, LockedListItem> call(TableColumn<LockedListItem, LockedListItem> column) {
return new TableCell<LockedListItem, LockedListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final LockedListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
Optional<Tradable> tradableOptional = getTradable(item);
if (tradableOptional.isPresent()) {
field = new HyperlinkWithIcon("Locked in MultiSig for trade with ID: " + item.getAddressEntry().getShortOfferId(), AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip("Open popup for details"));
setGraphic(field);
} else if (item.getAddressEntry().getContext() == AddressEntry.Context.ARBITRATOR) {
setGraphic(new Label("Arbitrator's fee"));
} else {
setGraphic(new Label("No details available"));
}
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
}
use of io.bitsquare.trade.Trade in project bitsquare by bitsquare.
the class PendingTradesDataModel method doOpenDispute.
private void doOpenDispute(boolean isSupportTicket, Transaction depositTx) {
Log.traceCall("depositTx=" + depositTx);
byte[] depositTxSerialized = null;
byte[] payoutTxSerialized = null;
String depositTxHashAsString = null;
String payoutTxHashAsString = null;
if (depositTx != null) {
depositTxSerialized = depositTx.bitcoinSerialize();
depositTxHashAsString = depositTx.getHashAsString();
} else {
log.warn("depositTx is null");
}
Trade trade = getTrade();
if (trade != null) {
Transaction payoutTx = trade.getPayoutTx();
if (payoutTx != null) {
payoutTxSerialized = payoutTx.bitcoinSerialize();
payoutTxHashAsString = payoutTx.getHashAsString();
} else {
log.debug("payoutTx is null at doOpenDispute");
}
final Arbitrator acceptedArbitratorByAddress = user.getAcceptedArbitratorByAddress(trade.getArbitratorNodeAddress());
checkNotNull(acceptedArbitratorByAddress, "acceptedArbitratorByAddress must no tbe null");
Dispute dispute = new Dispute(disputeManager.getDisputeStorage(), trade.getId(), // traderId
keyRing.getPubKeyRing().hashCode(), trade.getOffer().getDirection() == Offer.Direction.BUY ? isOfferer : !isOfferer, isOfferer, keyRing.getPubKeyRing(), trade.getDate(), trade.getContract(), trade.getContractHash(), depositTxSerialized, payoutTxSerialized, depositTxHashAsString, payoutTxHashAsString, trade.getContractAsJson(), trade.getOffererContractSignature(), trade.getTakerContractSignature(), acceptedArbitratorByAddress.getPubKeyRing(), isSupportTicket);
trade.setDisputeState(Trade.DisputeState.DISPUTE_REQUESTED);
if (p2PService.isBootstrapped()) {
sendOpenNewDisputeMessage(dispute, false);
} else {
new Popup().information("You need to wait until you are fully connected to the network.\n" + "That might take up to about 2 minutes at startup.").show();
}
} else {
log.warn("trade is null at doOpenDispute");
}
}
use of io.bitsquare.trade.Trade in project bitsquare by bitsquare.
the class ClosedTradesView method setAvatarColumnCellFactory.
private TableColumn<ClosedTradableListItem, ClosedTradableListItem> setAvatarColumnCellFactory() {
avatarColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
avatarColumn.setCellFactory(new Callback<TableColumn<ClosedTradableListItem, ClosedTradableListItem>, TableCell<ClosedTradableListItem, ClosedTradableListItem>>() {
@Override
public TableCell<ClosedTradableListItem, ClosedTradableListItem> call(TableColumn<ClosedTradableListItem, ClosedTradableListItem> column) {
return new TableCell<ClosedTradableListItem, ClosedTradableListItem>() {
@Override
public void updateItem(final ClosedTradableListItem newItem, boolean empty) {
super.updateItem(newItem, empty);
if (newItem != null && !empty && newItem.getTradable() instanceof Trade) {
int numPastTrades = model.getNumPastTrades(newItem.getTradable());
Trade trade = (Trade) newItem.getTradable();
String hostName = trade.getTradingPeerNodeAddress() != null ? trade.getTradingPeerNodeAddress().hostName : "";
Node identIcon = new PeerInfoIcon(hostName, "Trading peers onion address: " + hostName, numPastTrades, privateNotificationManager, newItem.getTradable().getOffer());
setPadding(new Insets(-2, 0, -2, 0));
if (identIcon != null)
setGraphic(identIcon);
} else {
setGraphic(null);
}
}
};
}
});
return avatarColumn;
}
use of io.bitsquare.trade.Trade in project bitsquare by bitsquare.
the class PendingTradesDataModel method doSelectItem.
private void doSelectItem(PendingTradesListItem item) {
if (item != null) {
Trade trade = item.getTrade();
isOfferer = tradeManager.isMyOffer(trade.getOffer());
if (trade.getDepositTx() != null)
txId.set(trade.getDepositTx().getHashAsString());
else
txId.set("");
notificationCenter.setSelectedTradeId(trade.getId());
} else {
notificationCenter.setSelectedTradeId(null);
}
selectedItemProperty.set(item);
}
Aggregations