use of io.bitsquare.arbitration.DisputeResult in project bitsquare by bitsquare.
the class DisputeSummaryWindow method addContent.
private void addContent() {
Contract contract = dispute.getContract();
if (dispute.disputeResultProperty().get() == null)
disputeResult = new DisputeResult(dispute.getTradeId(), dispute.getTraderId());
else
disputeResult = dispute.disputeResultProperty().get();
peersDisputeOptional = disputeManager.getDisputesAsObservableList().stream().filter(d -> dispute.getTradeId().equals(d.getTradeId()) && dispute.getTraderId() != d.getTraderId()).findFirst();
addInfoPane();
if (!dispute.isSupportTicket())
addCheckboxes();
addTradeAmountPayoutControls();
addFeeControls();
addPayoutAmountTextFields();
addReasonControls();
boolean applyPeersDisputeResult = peersDisputeOptional.isPresent() && peersDisputeOptional.get().isClosed();
if (applyPeersDisputeResult) {
// If the other peers dispute has been closed we apply the result to ourselves
DisputeResult peersDisputeResult = peersDisputeOptional.get().disputeResultProperty().get();
disputeResult.setBuyerPayoutAmount(peersDisputeResult.getBuyerPayoutAmount());
disputeResult.setSellerPayoutAmount(peersDisputeResult.getSellerPayoutAmount());
disputeResult.setArbitratorPayoutAmount(peersDisputeResult.getArbitratorPayoutAmount());
disputeResult.setDisputeFeePolicy(peersDisputeResult.getDisputeFeePolicy());
disputeResult.setWinner(peersDisputeResult.getWinner());
disputeResult.setLoserIsPublisher(peersDisputeResult.isLoserPublisher());
disputeResult.setReason(peersDisputeResult.getReason());
disputeResult.setSummaryNotes(peersDisputeResult.summaryNotesProperty().get());
if (disputeResult.getBuyerPayoutAmount() != null) {
log.debug("buyerPayoutAmount " + disputeResult.getBuyerPayoutAmount().toFriendlyString());
log.debug("sellerPayoutAmount " + disputeResult.getSellerPayoutAmount().toFriendlyString());
log.debug("arbitratorPayoutAmount " + disputeResult.getArbitratorPayoutAmount().toFriendlyString());
}
buyerIsWinnerRadioButton.setDisable(true);
sellerIsWinnerRadioButton.setDisable(true);
shareRadioButton.setDisable(true);
customRadioButton.setDisable(true);
loserPaysFeeRadioButton.setDisable(true);
splitFeeRadioButton.setDisable(true);
waiveFeeRadioButton.setDisable(true);
buyerPayoutAmountInputTextField.setDisable(true);
sellerPayoutAmountInputTextField.setDisable(true);
arbitratorPayoutAmountInputTextField.setDisable(true);
buyerPayoutAmountInputTextField.setEditable(false);
sellerPayoutAmountInputTextField.setEditable(false);
arbitratorPayoutAmountInputTextField.setEditable(false);
reasonWasBugRadioButton.setDisable(true);
reasonWasUsabilityIssueRadioButton.setDisable(true);
reasonProtocolViolationRadioButton.setDisable(true);
reasonNoReplyRadioButton.setDisable(true);
reasonWasScamRadioButton.setDisable(true);
reasonWasOtherRadioButton.setDisable(true);
isLoserPublisherCheckBox.setDisable(true);
isLoserPublisherCheckBox.setSelected(peersDisputeResult.isLoserPublisher());
calculatePayoutAmounts(disputeResult.getDisputeFeePolicy());
applyTradeAmountRadioButtonStates();
} else {
applyPayoutAmounts(disputeResult.disputeFeePolicyProperty().get(), tradeAmountToggleGroup.selectedToggleProperty().get());
feePaymentPolicyChanged = Bindings.createObjectBinding(() -> new Tuple2<>(disputeResult.disputeFeePolicyProperty().get(), tradeAmountToggleGroup.selectedToggleProperty().get()), disputeResult.disputeFeePolicyProperty(), tradeAmountToggleGroup.selectedToggleProperty());
feePaymentPolicyListener = (observable, oldValue, newValue) -> applyPayoutAmounts(newValue.first, newValue.second);
feePaymentPolicyChanged.addListener(feePaymentPolicyListener);
isLoserPublisherCheckBox.setSelected(false);
}
setFeeRadioButtonState();
setReasonRadioButtonState();
addSummaryNotes();
addButtons(contract);
}
Aggregations