mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Add proposalFee text field
This commit is contained in:
parent
bcc1b88bfc
commit
cf9b51a0d5
@ -160,7 +160,7 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||
}
|
||||
|
||||
protected void createEmptyProposalDisplay() {
|
||||
proposalDisplay = new ProposalDisplay(detailsGridPane, bsqFormatter, bsqWalletService, null);
|
||||
proposalDisplay = new ProposalDisplay(detailsGridPane, bsqFormatter, bsqWalletService, daoFacade);
|
||||
proposalDisplayView = proposalDisplay.getView();
|
||||
GridPane.setMargin(proposalDisplayView, new Insets(10, -10, 0, -10));
|
||||
GridPane.setRowIndex(proposalDisplayView, ++gridRow);
|
||||
@ -328,7 +328,7 @@ public abstract class BaseProposalView extends ActivatableView<GridPane, Void> {
|
||||
final Proposal proposal = item.getProposal();
|
||||
field = new HyperlinkWithIcon(proposal.getShortId());
|
||||
field.setOnAction(event -> {
|
||||
new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposal).show();
|
||||
new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposal, daoFacade).show();
|
||||
});
|
||||
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
|
||||
setGraphic(field);
|
||||
|
@ -198,7 +198,7 @@ public class CyclesView extends ActivatableViewAndModel<GridPane, Activatable> i
|
||||
}
|
||||
|
||||
private void createResultDisplay() {
|
||||
proposalsDisplay = new CycleDisplay(resultGridPane, bsqWalletService, bsqFormatter);
|
||||
proposalsDisplay = new CycleDisplay(resultGridPane, bsqWalletService, daoFacade, bsqFormatter);
|
||||
resultDisplayView = proposalsDisplay.getView();
|
||||
GridPane.setMargin(resultDisplayView, new Insets(10, -10, 0, -10));
|
||||
GridPane.setRowIndex(resultDisplayView, ++gridRow);
|
||||
|
@ -26,6 +26,7 @@ import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.voting.proposal.ProposalType;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.BsqFormatter;
|
||||
@ -68,6 +69,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class CycleDisplay {
|
||||
private final GridPane gridPane;
|
||||
private final BsqWalletService bsqWalletService;
|
||||
private final DaoFacade daoFacade;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
|
||||
private int gridRow;
|
||||
@ -78,9 +80,10 @@ public class CycleDisplay {
|
||||
private final SortedList<CycleListItem> sortedList = new SortedList<>(itemList);
|
||||
|
||||
|
||||
public CycleDisplay(GridPane gridPane, BsqWalletService bsqWalletService, BsqFormatter bsqFormatter) {
|
||||
public CycleDisplay(GridPane gridPane, BsqWalletService bsqWalletService, DaoFacade daoFacade, BsqFormatter bsqFormatter) {
|
||||
this.gridPane = gridPane;
|
||||
this.bsqWalletService = bsqWalletService;
|
||||
this.daoFacade = daoFacade;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
}
|
||||
|
||||
@ -187,7 +190,8 @@ public class CycleDisplay {
|
||||
field.setStyle(item.getColorStyle());
|
||||
field.setOnAction(event -> new ProposalDetailsWindow(bsqFormatter,
|
||||
bsqWalletService,
|
||||
item.getEvaluatedProposal().getProposal())
|
||||
item.getEvaluatedProposal().getProposal(),
|
||||
daoFacade)
|
||||
.show());
|
||||
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
|
||||
setGraphic(field);
|
||||
|
@ -21,6 +21,7 @@ import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.voting.proposal.Proposal;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.BsqFormatter;
|
||||
@ -33,6 +34,8 @@ public class ProposalDetailsWindow extends Overlay<ProposalDetailsWindow> {
|
||||
private final BsqFormatter bsqFormatter;
|
||||
private final BsqWalletService bsqWalletService;
|
||||
private final Proposal proposal;
|
||||
private final DaoFacade daoFacade;
|
||||
|
||||
private ProposalDisplay proposalDisplay;
|
||||
|
||||
|
||||
@ -40,10 +43,12 @@ public class ProposalDetailsWindow extends Overlay<ProposalDetailsWindow> {
|
||||
// Public API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public ProposalDetailsWindow(BsqFormatter bsqFormatter, BsqWalletService bsqWalletService, Proposal proposal) {
|
||||
public ProposalDetailsWindow(BsqFormatter bsqFormatter, BsqWalletService bsqWalletService, Proposal proposal,
|
||||
DaoFacade daoFacade) {
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
this.bsqWalletService = bsqWalletService;
|
||||
this.proposal = proposal;
|
||||
this.daoFacade = daoFacade;
|
||||
|
||||
type = Type.Confirmation;
|
||||
width = 950;
|
||||
@ -52,7 +57,7 @@ public class ProposalDetailsWindow extends Overlay<ProposalDetailsWindow> {
|
||||
public void show() {
|
||||
createGridPane();
|
||||
|
||||
proposalDisplay = new ProposalDisplay(gridPane, bsqFormatter, bsqWalletService, null);
|
||||
proposalDisplay = new ProposalDisplay(gridPane, bsqFormatter, bsqWalletService, daoFacade);
|
||||
proposalDisplay.createAllFields(Res.get("dao.proposal.details"), 1, Layout.GROUP_DISTANCE,
|
||||
proposal.getType(), false, true);
|
||||
|
||||
|
@ -27,6 +27,7 @@ import bisq.desktop.util.validation.BsqAddressValidator;
|
||||
import bisq.desktop.util.validation.BsqValidator;
|
||||
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.state.ext.Param;
|
||||
import bisq.core.dao.voting.proposal.Proposal;
|
||||
import bisq.core.dao.voting.proposal.ProposalConsensus;
|
||||
@ -35,12 +36,12 @@ import bisq.core.dao.voting.proposal.compensation.CompensationConsensus;
|
||||
import bisq.core.dao.voting.proposal.compensation.CompensationProposal;
|
||||
import bisq.core.dao.voting.proposal.param.ChangeParamProposal;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.util.BsqFormatter;
|
||||
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
@ -69,7 +70,9 @@ public class ProposalDisplay {
|
||||
private final int maxLengthDescriptionText;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
private final BsqWalletService bsqWalletService;
|
||||
private DaoFacade daoFacade;
|
||||
private InputTextField uidTextField;
|
||||
private TextField proposalFeeTextField;
|
||||
public InputTextField nameTextField;
|
||||
public InputTextField titleTextField;
|
||||
public InputTextField linkInputTextField;
|
||||
@ -82,15 +85,15 @@ public class ProposalDisplay {
|
||||
private HyperlinkWithIcon linkHyperlinkWithIcon;
|
||||
@Nullable
|
||||
private TxIdTextField txIdTextField;
|
||||
private final FeeService feeService;
|
||||
private final ChangeListener<String> descriptionTextAreaListener;
|
||||
private int gridRowStartIndex;
|
||||
|
||||
public ProposalDisplay(GridPane gridPane, BsqFormatter bsqFormatter, BsqWalletService bsqWalletService, @Nullable FeeService feeService) {
|
||||
public ProposalDisplay(GridPane gridPane, BsqFormatter bsqFormatter, BsqWalletService bsqWalletService,
|
||||
DaoFacade daoFacade) {
|
||||
this.gridPane = gridPane;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
this.bsqWalletService = bsqWalletService;
|
||||
this.feeService = feeService;
|
||||
this.daoFacade = daoFacade;
|
||||
|
||||
maxLengthDescriptionText = ProposalConsensus.getMaxLengthDescriptionText();
|
||||
|
||||
@ -112,17 +115,17 @@ public class ProposalDisplay {
|
||||
boolean hasAddedFields = proposalType == ProposalType.COMPENSATION_REQUEST ||
|
||||
proposalType == ProposalType.CHANGE_PARAM;
|
||||
if (isMakeProposalScreen) {
|
||||
rowSpan = hasAddedFields ? 7 : 5;
|
||||
} else if (showDetails) {
|
||||
rowSpan = hasAddedFields ? 8 : 6;
|
||||
} else if (showDetails) {
|
||||
rowSpan = hasAddedFields ? 9 : 7;
|
||||
} else {
|
||||
//noinspection IfCanBeSwitch
|
||||
if (proposalType == ProposalType.COMPENSATION_REQUEST)
|
||||
rowSpan = 5;
|
||||
else if (proposalType == ProposalType.CHANGE_PARAM)
|
||||
rowSpan = 6;
|
||||
else if (proposalType == ProposalType.CHANGE_PARAM)
|
||||
rowSpan = 7;
|
||||
else
|
||||
rowSpan = 4;
|
||||
rowSpan = 5;
|
||||
}
|
||||
|
||||
addTitledGroupBg(gridPane, gridRow, rowSpan, title, top);
|
||||
@ -155,14 +158,10 @@ public class ProposalDisplay {
|
||||
case COMPENSATION_REQUEST:
|
||||
|
||||
requestedBsqTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.requestedBsq")).second;
|
||||
if (feeService != null) {
|
||||
BsqValidator bsqValidator = new BsqValidator(bsqFormatter);
|
||||
//TODO should we use the BSQ or a BTC validator? Technically it is BTC at that stage...
|
||||
//bsqValidator.setMinValue(feeService.getCreateCompensationRequestFee());
|
||||
bsqValidator.setMinValue(CompensationConsensus.getMinCompensationRequestAmount());
|
||||
checkNotNull(requestedBsqTextField, "requestedBsqTextField must no tbe null");
|
||||
requestedBsqTextField.setValidator(bsqValidator);
|
||||
}
|
||||
BsqValidator bsqValidator = new BsqValidator(bsqFormatter);
|
||||
bsqValidator.setMinValue(CompensationConsensus.getMinCompensationRequestAmount());
|
||||
checkNotNull(requestedBsqTextField, "requestedBsqTextField must no tbe null");
|
||||
requestedBsqTextField.setValidator(bsqValidator);
|
||||
// TODO validator, addressTF
|
||||
if (showDetails) {
|
||||
bsqAddressTextField = addLabelInputTextField(gridPane, ++gridRow,
|
||||
@ -199,6 +198,9 @@ public class ProposalDisplay {
|
||||
if (!isMakeProposalScreen && showDetails)
|
||||
txIdTextField = addLabelTxIdTextField(gridPane, ++gridRow,
|
||||
Res.get("dao.proposal.display.txId"), "").second;
|
||||
|
||||
proposalFeeTextField = addLabelTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.proposalFee")).second;
|
||||
proposalFeeTextField.setText(bsqFormatter.formatCoinWithCode(daoFacade.getProposalFee()));
|
||||
}
|
||||
|
||||
public void applyProposalPayload(Proposal proposal) {
|
||||
|
@ -76,7 +76,7 @@ public class ActiveProposalListItem extends ProposalListItem {
|
||||
if (phase == DaoPhase.Phase.PROPOSAL) {
|
||||
imageView.setId("image-remove");
|
||||
button.setGraphic(imageView);
|
||||
button.setText(Res.get("dao.proposal.active.remove"));
|
||||
button.setText(Res.get("shared.remove"));
|
||||
final boolean isMyProposal = daoFacade.isMyProposal(proposal);
|
||||
button.setVisible(isMyProposal);
|
||||
button.setManaged(isMyProposal);
|
||||
|
@ -78,7 +78,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
|
||||
private final BsqWalletService bsqWalletService;
|
||||
private final WalletsSetup walletsSetup;
|
||||
private final P2PService p2PService;
|
||||
private final FeeService feeService;
|
||||
private final BSFormatter btcFormatter;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
|
||||
@ -105,7 +104,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
|
||||
this.bsqWalletService = bsqWalletService;
|
||||
this.walletsSetup = walletsSetup;
|
||||
this.p2PService = p2PService;
|
||||
this.feeService = feeService;
|
||||
this.btcFormatter = btcFormatter;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
}
|
||||
@ -291,7 +289,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
|
||||
proposalDisplay = null;
|
||||
}
|
||||
if (selectedProposalType != null) {
|
||||
proposalDisplay = new ProposalDisplay(root, bsqFormatter, bsqWalletService, feeService);
|
||||
proposalDisplay = new ProposalDisplay(root, bsqFormatter, bsqWalletService, daoFacade);
|
||||
proposalDisplay.createAllFields(Res.get("dao.proposal.create.createNew"), 1, Layout.GROUP_DISTANCE,
|
||||
selectedProposalType, true, true);
|
||||
proposalDisplay.fillWithMock();
|
||||
|
Loading…
Reference in New Issue
Block a user