mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Let proposal domain handle all its relevant use cases
- Previously we wrapped by default a proposal into a ballot and used that in the UI. We changed that so in the proposal phase there is only the proposal used. Once we enter the blind vote phase we move to ballot representation. - We also changed that the proposals for the append-only data store gets filled by the proposal domain once entering the blind vote phase. - We moved also the publishing, removal and republishing to the myProposalListService.
This commit is contained in:
parent
7951fc557b
commit
2705e68dc8
6 changed files with 67 additions and 57 deletions
|
@ -191,14 +191,14 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
proposalDisplayView.setManaged(false);
|
proposalDisplayView.setManaged(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showProposalDisplay(Ballot ballot) {
|
protected void showProposalDisplay(Proposal proposal) {
|
||||||
proposalDisplayView.setVisible(true);
|
proposalDisplayView.setVisible(true);
|
||||||
proposalDisplayView.setManaged(true);
|
proposalDisplayView.setManaged(true);
|
||||||
|
|
||||||
proposalDisplay.createAllFields(Res.get("dao.proposal.selectedProposal"), 0, 0, ballot.getType(),
|
proposalDisplay.createAllFields(Res.get("dao.proposal.selectedProposal"), 0, 0, proposal.getType(),
|
||||||
false, false);
|
false, false);
|
||||||
proposalDisplay.setEditable(false);
|
proposalDisplay.setEditable(false);
|
||||||
proposalDisplay.applyProposalPayload(ballot.getProposal());
|
proposalDisplay.applyProposalPayload(proposal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
protected void onSelectProposal(ProposalListItem item) {
|
protected void onSelectProposal(ProposalListItem item) {
|
||||||
selectedProposalListItem = item;
|
selectedProposalListItem = item;
|
||||||
if (item != null)
|
if (item != null)
|
||||||
showProposalDisplay(item.getBallot());
|
showProposalDisplay(item.getProposal());
|
||||||
else
|
else
|
||||||
hideProposalDisplay();
|
hideProposalDisplay();
|
||||||
}
|
}
|
||||||
|
@ -228,11 +228,11 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
abstract protected void updateProposalList();
|
abstract protected void updateProposalList();
|
||||||
|
|
||||||
protected void doUpdateProposalList(List<Ballot> list) {
|
protected void doUpdateProposalList(List<Proposal> list) {
|
||||||
proposalListItems.forEach(ProposalListItem::cleanup);
|
proposalListItems.forEach(ProposalListItem::cleanup);
|
||||||
proposalListItems.clear();
|
proposalListItems.clear();
|
||||||
proposalListItems.setAll(list.stream()
|
proposalListItems.setAll(list.stream()
|
||||||
.map(ballot -> new ProposalListItem(ballot,
|
.map(proposal -> new ProposalListItem(proposal,
|
||||||
daoFacade,
|
daoFacade,
|
||||||
bsqWalletService,
|
bsqWalletService,
|
||||||
bsqFormatter))
|
bsqFormatter))
|
||||||
|
@ -273,14 +273,14 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
public void updateItem(final ProposalListItem item, boolean empty) {
|
public void updateItem(final ProposalListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(bsqFormatter.formatDateTime(item.getBallot().getProposal().getCreationDate()));
|
setText(bsqFormatter.formatDateTime(item.getProposal().getCreationDate()));
|
||||||
else
|
else
|
||||||
setText("");
|
setText("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dateColumn.setComparator(Comparator.comparing(o3 -> o3.getBallot().getProposal().getCreationDate()));
|
dateColumn.setComparator(Comparator.comparing(o3 -> o3.getProposal().getCreationDate()));
|
||||||
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
|
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
|
||||||
tableView.getColumns().add(dateColumn);
|
tableView.getColumns().add(dateColumn);
|
||||||
tableView.getSortOrder().add(dateColumn);
|
tableView.getSortOrder().add(dateColumn);
|
||||||
|
@ -298,14 +298,14 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
public void updateItem(final ProposalListItem item, boolean empty) {
|
public void updateItem(final ProposalListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getBallot().getProposal().getName());
|
setText(item.getProposal().getName());
|
||||||
else
|
else
|
||||||
setText("");
|
setText("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nameColumn.setComparator(Comparator.comparing(o2 -> o2.getBallot().getProposal().getName()));
|
nameColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getName()));
|
||||||
tableView.getColumns().add(nameColumn);
|
tableView.getColumns().add(nameColumn);
|
||||||
|
|
||||||
TableColumn<ProposalListItem, ProposalListItem> titleColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.title"));
|
TableColumn<ProposalListItem, ProposalListItem> titleColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.title"));
|
||||||
|
@ -322,14 +322,14 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
public void updateItem(final ProposalListItem item, boolean empty) {
|
public void updateItem(final ProposalListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
setText(item.getBallot().getProposal().getTitle());
|
setText(item.getProposal().getTitle());
|
||||||
else
|
else
|
||||||
setText("");
|
setText("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
titleColumn.setComparator(Comparator.comparing(o2 -> o2.getBallot().getProposal().getTitle()));
|
titleColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getTitle()));
|
||||||
tableView.getColumns().add(titleColumn);
|
tableView.getColumns().add(titleColumn);
|
||||||
|
|
||||||
TableColumn<ProposalListItem, ProposalListItem> uidColumn = new AutoTooltipTableColumn<>(Res.get("shared.id"));
|
TableColumn<ProposalListItem, ProposalListItem> uidColumn = new AutoTooltipTableColumn<>(Res.get("shared.id"));
|
||||||
|
@ -348,8 +348,7 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
public void updateItem(final ProposalListItem item, boolean empty) {
|
public void updateItem(final ProposalListItem item, boolean empty) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
final Ballot ballot = item.getBallot();
|
final Proposal proposal = item.getProposal();
|
||||||
final Proposal proposal = ballot.getProposal();
|
|
||||||
field = new HyperlinkWithIcon(proposal.getShortId());
|
field = new HyperlinkWithIcon(proposal.getShortId());
|
||||||
field.setOnAction(event -> {
|
field.setOnAction(event -> {
|
||||||
new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposal).show();
|
new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposal).show();
|
||||||
|
@ -365,7 +364,7 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uidColumn.setComparator(Comparator.comparing(o -> o.getBallot().getUid()));
|
uidColumn.setComparator(Comparator.comparing(o -> o.getProposal().getUid()));
|
||||||
tableView.getColumns().add(uidColumn);
|
tableView.getColumns().add(uidColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,11 @@ import bisq.desktop.util.BsqFormatter;
|
||||||
import bisq.core.btc.listeners.TxConfidenceListener;
|
import bisq.core.btc.listeners.TxConfidenceListener;
|
||||||
import bisq.core.btc.wallet.BsqWalletService;
|
import bisq.core.btc.wallet.BsqWalletService;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.dao.state.period.DaoPhase;
|
|
||||||
import bisq.core.dao.state.BlockListener;
|
import bisq.core.dao.state.BlockListener;
|
||||||
import bisq.core.dao.state.blockchain.Block;
|
import bisq.core.dao.state.blockchain.Block;
|
||||||
import bisq.core.dao.state.blockchain.Tx;
|
import bisq.core.dao.state.blockchain.Tx;
|
||||||
import bisq.core.dao.voting.ballot.Ballot;
|
import bisq.core.dao.state.period.DaoPhase;
|
||||||
import bisq.core.dao.voting.ballot.vote.BooleanVote;
|
import bisq.core.dao.voting.ballot.proposal.Proposal;
|
||||||
import bisq.core.dao.voting.ballot.vote.Vote;
|
import bisq.core.dao.voting.ballot.vote.Vote;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class ProposalListItem implements BlockListener {
|
public class ProposalListItem implements BlockListener {
|
||||||
@Getter
|
@Getter
|
||||||
private final Ballot ballot;
|
private final Proposal proposal;
|
||||||
private final DaoFacade daoFacade;
|
private final DaoFacade daoFacade;
|
||||||
private final BsqWalletService bsqWalletService;
|
private final BsqWalletService bsqWalletService;
|
||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
|
@ -76,11 +75,11 @@ public class ProposalListItem implements BlockListener {
|
||||||
private Runnable onRemoveHandler;
|
private Runnable onRemoveHandler;
|
||||||
private Node actionNode;
|
private Node actionNode;
|
||||||
|
|
||||||
ProposalListItem(Ballot ballot,
|
ProposalListItem(Proposal proposal,
|
||||||
DaoFacade daoFacade,
|
DaoFacade daoFacade,
|
||||||
BsqWalletService bsqWalletService,
|
BsqWalletService bsqWalletService,
|
||||||
BsqFormatter bsqFormatter) {
|
BsqFormatter bsqFormatter) {
|
||||||
this.ballot = ballot;
|
this.proposal = proposal;
|
||||||
this.daoFacade = daoFacade;
|
this.daoFacade = daoFacade;
|
||||||
this.bsqWalletService = bsqWalletService;
|
this.bsqWalletService = bsqWalletService;
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
||||||
|
@ -104,7 +103,8 @@ public class ProposalListItem implements BlockListener {
|
||||||
daoFacade.addBlockListener(this);
|
daoFacade.addBlockListener(this);
|
||||||
|
|
||||||
phaseChangeListener = (observable, oldValue, newValue) -> {
|
phaseChangeListener = (observable, oldValue, newValue) -> {
|
||||||
applyState(newValue, ballot.getVote());
|
//TODO
|
||||||
|
//applyState(newValue, proposal.getVote());
|
||||||
};
|
};
|
||||||
|
|
||||||
voteResultChangeListener = (observable, oldValue, newValue) -> {
|
voteResultChangeListener = (observable, oldValue, newValue) -> {
|
||||||
|
@ -112,7 +112,9 @@ public class ProposalListItem implements BlockListener {
|
||||||
};
|
};
|
||||||
|
|
||||||
daoFacade.phaseProperty().addListener(phaseChangeListener);
|
daoFacade.phaseProperty().addListener(phaseChangeListener);
|
||||||
ballot.getVoteResultProperty().addListener(voteResultChangeListener);
|
|
||||||
|
//TODO
|
||||||
|
//proposal.getVoteResultProperty().addListener(voteResultChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyState(DaoPhase.Phase phase, Vote vote) {
|
public void applyState(DaoPhase.Phase phase, Vote vote) {
|
||||||
|
@ -125,7 +127,7 @@ public class ProposalListItem implements BlockListener {
|
||||||
log.error("invalid state UNDEFINED");
|
log.error("invalid state UNDEFINED");
|
||||||
break;
|
break;
|
||||||
case PROPOSAL:
|
case PROPOSAL:
|
||||||
if (daoFacade.isMyProposal(ballot.getProposal())) {
|
if (daoFacade.isMyProposal(proposal)) {
|
||||||
actionButtonIconView.setVisible(actionButton.isVisible());
|
actionButtonIconView.setVisible(actionButton.isVisible());
|
||||||
actionButton.setText(Res.get("shared.remove"));
|
actionButton.setText(Res.get("shared.remove"));
|
||||||
actionButton.setGraphic(actionButtonIconView);
|
actionButton.setGraphic(actionButtonIconView);
|
||||||
|
@ -142,7 +144,9 @@ public class ProposalListItem implements BlockListener {
|
||||||
case BLIND_VOTE:
|
case BLIND_VOTE:
|
||||||
actionNode = actionButtonIconView;
|
actionNode = actionButtonIconView;
|
||||||
actionButton.setVisible(false);
|
actionButton.setVisible(false);
|
||||||
if (ballot.getVote() != null) {
|
|
||||||
|
//TODO
|
||||||
|
/*if (proposal.getVote() != null) {
|
||||||
actionButtonIconView.setVisible(true);
|
actionButtonIconView.setVisible(true);
|
||||||
if (vote instanceof BooleanVote) {
|
if (vote instanceof BooleanVote) {
|
||||||
if (((BooleanVote) vote).isAccepted()) {
|
if (((BooleanVote) vote).isAccepted()) {
|
||||||
|
@ -155,7 +159,8 @@ public class ProposalListItem implements BlockListener {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
actionButtonIconView.setVisible(false);
|
actionButtonIconView.setVisible(false);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BREAK2:
|
case BREAK2:
|
||||||
break;
|
break;
|
||||||
|
@ -191,7 +196,7 @@ public class ProposalListItem implements BlockListener {
|
||||||
|
|
||||||
// TODO reuse from other item
|
// TODO reuse from other item
|
||||||
private void setupConfidence() {
|
private void setupConfidence() {
|
||||||
final String txId = ballot.getProposal().getTxId();
|
final String txId = proposal.getTxId();
|
||||||
Optional<Tx> optionalTx = daoFacade.getTx(txId);
|
Optional<Tx> optionalTx = daoFacade.getTx(txId);
|
||||||
if (optionalTx.isPresent()) {
|
if (optionalTx.isPresent()) {
|
||||||
Tx tx = optionalTx.get();
|
Tx tx = optionalTx.get();
|
||||||
|
@ -240,7 +245,9 @@ public class ProposalListItem implements BlockListener {
|
||||||
bsqWalletService.removeTxConfidenceListener(txConfidenceListener);
|
bsqWalletService.removeTxConfidenceListener(txConfidenceListener);
|
||||||
|
|
||||||
daoFacade.phaseProperty().removeListener(phaseChangeListener);
|
daoFacade.phaseProperty().removeListener(phaseChangeListener);
|
||||||
ballot.getVoteResultProperty().removeListener(voteResultChangeListener);
|
|
||||||
|
//TODO
|
||||||
|
// proposal.getVoteResultProperty().removeListener(voteResultChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfidence(TransactionConfidence.ConfidenceType confidenceType, int depthInBlocks, int numBroadcastPeers) {
|
private void updateConfidence(TransactionConfidence.ConfidenceType confidenceType, int depthInBlocks, int numBroadcastPeers) {
|
||||||
|
|
|
@ -35,8 +35,7 @@ import bisq.core.btc.wallet.BsqBalanceListener;
|
||||||
import bisq.core.btc.wallet.BsqWalletService;
|
import bisq.core.btc.wallet.BsqWalletService;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.dao.state.period.DaoPhase;
|
import bisq.core.dao.state.period.DaoPhase;
|
||||||
import bisq.core.dao.voting.ballot.Ballot;
|
import bisq.core.dao.voting.ballot.proposal.Proposal;
|
||||||
import bisq.core.dao.voting.ballot.vote.BooleanVote;
|
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import bisq.common.util.Tuple2;
|
import bisq.common.util.Tuple2;
|
||||||
|
@ -226,17 +225,21 @@ public class ActiveProposalsView extends BaseProposalView implements BsqBalanceL
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAccept() {
|
private void onAccept() {
|
||||||
daoFacade.setVote(selectedProposalListItem.getBallot(), new BooleanVote(true));
|
//TODO
|
||||||
|
// daoFacade.setVote(selectedProposalListItem.getProposal(), new BooleanVote(true));
|
||||||
updateStateAfterVote();
|
updateStateAfterVote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onReject() {
|
private void onReject() {
|
||||||
daoFacade.setVote(selectedProposalListItem.getBallot(), new BooleanVote(false));
|
//TODO
|
||||||
|
// daoFacade.setVote(selectedProposalListItem.getProposal(), new BooleanVote(false));
|
||||||
updateStateAfterVote();
|
updateStateAfterVote();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCancelVote() {
|
private void onCancelVote() {
|
||||||
daoFacade.setVote(selectedProposalListItem.getBallot(), null);
|
//TODO
|
||||||
|
// daoFacade.setVote(selectedProposalListItem.getProposal(), null);
|
||||||
updateStateAfterVote();
|
updateStateAfterVote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,10 +256,10 @@ public class ActiveProposalsView extends BaseProposalView implements BsqBalanceL
|
||||||
removeButton = null;
|
removeButton = null;
|
||||||
}
|
}
|
||||||
if (selectedProposalListItem != null && proposalDisplay != null) {
|
if (selectedProposalListItem != null && proposalDisplay != null) {
|
||||||
final Ballot ballot = selectedProposalListItem.getBallot();
|
final Proposal proposal = selectedProposalListItem.getProposal();
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PROPOSAL:
|
case PROPOSAL:
|
||||||
if (daoFacade.isMyProposal(ballot.getProposal())) {
|
if (daoFacade.isMyProposal(proposal)) {
|
||||||
if (removeButton == null) {
|
if (removeButton == null) {
|
||||||
removeButton = addButtonAfterGroup(detailsGridPane, proposalDisplay.incrementAndGetGridRow(), Res.get("dao.proposal.active.remove"));
|
removeButton = addButtonAfterGroup(detailsGridPane, proposalDisplay.incrementAndGetGridRow(), Res.get("dao.proposal.active.remove"));
|
||||||
removeButton.setOnAction(event -> onRemove());
|
removeButton.setOnAction(event -> onRemove());
|
||||||
|
@ -316,7 +319,7 @@ public class ActiveProposalsView extends BaseProposalView implements BsqBalanceL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateProposalList() {
|
protected void updateProposalList() {
|
||||||
doUpdateProposalList(daoFacade.getActiveOrMyUnconfirmedBallots());
|
doUpdateProposalList(daoFacade.getActiveOrMyUnconfirmedProposals());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStateAfterVote() {
|
private void updateStateAfterVote() {
|
||||||
|
@ -332,8 +335,8 @@ public class ActiveProposalsView extends BaseProposalView implements BsqBalanceL
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRemove() {
|
private void onRemove() {
|
||||||
final Ballot ballot = selectedProposalListItem.getBallot();
|
final Proposal proposal = selectedProposalListItem.getProposal();
|
||||||
if (daoFacade.removeBallot(ballot)) {
|
if (daoFacade.removeMyProposal(proposal)) {
|
||||||
hideProposalDisplay();
|
hideProposalDisplay();
|
||||||
} else {
|
} else {
|
||||||
new Popup<>().warning(Res.get("dao.proposal.active.remove.failed")).show();
|
new Popup<>().warning(Res.get("dao.proposal.active.remove.failed")).show();
|
||||||
|
@ -378,7 +381,8 @@ public class ActiveProposalsView extends BaseProposalView implements BsqBalanceL
|
||||||
ActiveProposalsView.this.selectedProposalListItem = item;
|
ActiveProposalsView.this.selectedProposalListItem = item;
|
||||||
ActiveProposalsView.this.onRemove();
|
ActiveProposalsView.this.onRemove();
|
||||||
});
|
});
|
||||||
item.applyState(currentPhase, item.getBallot().getVoteResultProperty().get());
|
//TODO
|
||||||
|
// item.applyState(currentPhase, item.getProposal().getVoteResultProperty().get());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ClosedProposalsView extends BaseProposalView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateProposalList() {
|
protected void updateProposalList() {
|
||||||
doUpdateProposalList(daoFacade.getClosedBallots());
|
doUpdateProposalList(daoFacade.getClosedProposals());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,10 @@ import bisq.core.btc.wallet.InsufficientBsqException;
|
||||||
import bisq.core.btc.wallet.WalletsSetup;
|
import bisq.core.btc.wallet.WalletsSetup;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.dao.voting.ValidationException;
|
import bisq.core.dao.voting.ValidationException;
|
||||||
import bisq.core.dao.voting.ballot.Ballot;
|
import bisq.core.dao.voting.ballot.proposal.Proposal;
|
||||||
import bisq.core.dao.voting.ballot.BallotWithTransaction;
|
|
||||||
import bisq.core.dao.voting.ballot.proposal.ProposalConsensus;
|
import bisq.core.dao.voting.ballot.proposal.ProposalConsensus;
|
||||||
import bisq.core.dao.voting.ballot.proposal.ProposalType;
|
import bisq.core.dao.voting.ballot.proposal.ProposalType;
|
||||||
|
import bisq.core.dao.voting.ballot.proposal.ProposalWithTransaction;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
|
|
||||||
|
@ -147,16 +147,16 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||||
createButton.setOnAction(null);
|
createButton.setOnAction(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publishProposalAndStoreBallot(ProposalType type) {
|
private void publishMyProposal(ProposalType type) {
|
||||||
try {
|
try {
|
||||||
final BallotWithTransaction ballotWithTransaction = getBallotWithTransaction(type);
|
final ProposalWithTransaction ballotWithTransaction = getBallotWithTransaction(type);
|
||||||
Ballot ballot = ballotWithTransaction.getBallot();
|
Proposal proposal = ballotWithTransaction.getProposal();
|
||||||
Transaction transaction = ballotWithTransaction.getTransaction();
|
Transaction transaction = ballotWithTransaction.getTransaction();
|
||||||
Coin miningFee = transaction.getFee();
|
Coin miningFee = transaction.getFee();
|
||||||
int txSize = transaction.bitcoinSerialize().length;
|
int txSize = transaction.bitcoinSerialize().length;
|
||||||
final Coin fee = daoFacade.getProposalFee();
|
final Coin fee = daoFacade.getProposalFee();
|
||||||
GUIUtil.showBsqFeeInfoPopup(fee, miningFee, txSize, bsqFormatter, btcFormatter,
|
GUIUtil.showBsqFeeInfoPopup(fee, miningFee, txSize, bsqFormatter, btcFormatter,
|
||||||
Res.get("dao.proposal"), () -> publishProposalAndStoreBallot(ballot, transaction));
|
Res.get("dao.proposal"), () -> doPublishMyProposal(proposal, transaction));
|
||||||
|
|
||||||
} catch (InsufficientMoneyException e) {
|
} catch (InsufficientMoneyException e) {
|
||||||
BSFormatter formatter = e instanceof InsufficientBsqException ? bsqFormatter : btcFormatter;
|
BSFormatter formatter = e instanceof InsufficientBsqException ? bsqFormatter : btcFormatter;
|
||||||
|
@ -178,8 +178,8 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publishProposalAndStoreBallot(Ballot ballot, Transaction transaction) {
|
private void doPublishMyProposal(Proposal proposal, Transaction transaction) {
|
||||||
daoFacade.publishBallot(ballot,
|
daoFacade.publishMyProposal(proposal,
|
||||||
transaction,
|
transaction,
|
||||||
() -> {
|
() -> {
|
||||||
proposalDisplay.clearForm();
|
proposalDisplay.clearForm();
|
||||||
|
@ -189,7 +189,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||||
errorMessage -> new Popup<>().warning(errorMessage).show());
|
errorMessage -> new Popup<>().warning(errorMessage).show());
|
||||||
}
|
}
|
||||||
|
|
||||||
private BallotWithTransaction getBallotWithTransaction(ProposalType type)
|
private ProposalWithTransaction getBallotWithTransaction(ProposalType type)
|
||||||
throws InsufficientMoneyException, TransactionVerificationException, ValidationException,
|
throws InsufficientMoneyException, TransactionVerificationException, ValidationException,
|
||||||
WalletException, IOException {
|
WalletException, IOException {
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case COMPENSATION_REQUEST:
|
case COMPENSATION_REQUEST:
|
||||||
return daoFacade.getCompensationBallotWithTransaction(proposalDisplay.nameTextField.getText(),
|
return daoFacade.getCompensationProposalWithTransaction(proposalDisplay.nameTextField.getText(),
|
||||||
proposalDisplay.titleTextField.getText(),
|
proposalDisplay.titleTextField.getText(),
|
||||||
proposalDisplay.descriptionTextArea.getText(),
|
proposalDisplay.descriptionTextArea.getText(),
|
||||||
proposalDisplay.linkInputTextField.getText(),
|
proposalDisplay.linkInputTextField.getText(),
|
||||||
|
@ -246,7 +246,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||||
createButton.setOnAction(event -> {
|
createButton.setOnAction(event -> {
|
||||||
// TODO break up in methods
|
// TODO break up in methods
|
||||||
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
|
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
|
||||||
publishProposalAndStoreBallot(selectedProposalType);
|
publishMyProposal(selectedProposalType);
|
||||||
} else {
|
} else {
|
||||||
GUIUtil.showNotReadyForTxBroadcastPopups(p2PService, walletsSetup);
|
GUIUtil.showNotReadyForTxBroadcastPopups(p2PService, walletsSetup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ import bisq.desktop.util.Layout;
|
||||||
import bisq.core.btc.wallet.BsqWalletService;
|
import bisq.core.btc.wallet.BsqWalletService;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.dao.voting.ballot.BallotList;
|
import bisq.core.dao.voting.ballot.BallotList;
|
||||||
import bisq.core.dao.voting.ballot.vote.BooleanVote;
|
|
||||||
import bisq.core.dao.voting.ballot.vote.Vote;
|
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
|
|
||||||
|
@ -178,8 +176,9 @@ public class MyVotesView extends BaseProposalView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateProposalList() {
|
protected void updateProposalList() {
|
||||||
if (selectedVoteListItem != null)
|
//TODO
|
||||||
doUpdateProposalList(selectedVoteListItem.getMyVote().getBallotList().getList());
|
//if (selectedVoteListItem != null)
|
||||||
|
// doUpdateProposalList(selectedVoteListItem.getMyVote().getBallotList().getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,7 +362,8 @@ public class MyVotesView extends BaseProposalView {
|
||||||
|
|
||||||
if (item != null && !empty) {
|
if (item != null && !empty) {
|
||||||
actionButtonIconView = new ImageView();
|
actionButtonIconView = new ImageView();
|
||||||
Vote vote = item.getBallot().getVote();
|
//TODO
|
||||||
|
/* Vote vote = item.getProposal().getVote();
|
||||||
if (vote instanceof BooleanVote) {
|
if (vote instanceof BooleanVote) {
|
||||||
if (((BooleanVote) vote).isAccepted()) {
|
if (((BooleanVote) vote).isAccepted()) {
|
||||||
actionButtonIconView.setId("accepted");
|
actionButtonIconView.setId("accepted");
|
||||||
|
@ -372,7 +372,7 @@ public class MyVotesView extends BaseProposalView {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}*/
|
||||||
|
|
||||||
setGraphic(actionButtonIconView);
|
setGraphic(actionButtonIconView);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue