Search in sources :

Example 1 with DisputeResult

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);
}
Also used : Tuple2(io.bitsquare.common.util.Tuple2) Contract(io.bitsquare.trade.Contract) DisputeResult(io.bitsquare.arbitration.DisputeResult)

Aggregations

DisputeResult (io.bitsquare.arbitration.DisputeResult)1 Tuple2 (io.bitsquare.common.util.Tuple2)1 Contract (io.bitsquare.trade.Contract)1