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