Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't validate display fields in proposal display #2074

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,15 @@ public void createAllFields(String title, int gridRowStartIndex, double top, Pro
Res.get("dao.proposal.display.type"), proposalType.getDisplayName(), proposalTypeTop).second;

nameTextField = addInputTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.name"));
nameTextField.setValidator(new InputValidator());
if (isMakeProposalScreen)
nameTextField.setValidator(new InputValidator());
inputControls.add(nameTextField);

linkInputTextField = addInputTextField(gridPane, ++gridRow,
Res.get("dao.proposal.display.link"));
linkInputTextField.setPromptText(Res.get("dao.proposal.display.link.prompt"));
linkInputTextField.setValidator(new InputValidator());
if (isMakeProposalScreen)
linkInputTextField.setValidator(new InputValidator());
inputControls.add(linkInputTextField);

Tuple3<Label, HyperlinkWithIcon, VBox> tuple = FormBuilder.addTopLabelHyperlinkWithIcon(gridPane, gridRow,
Expand All @@ -222,15 +224,17 @@ public void createAllFields(String title, int gridRowStartIndex, double top, Pro
checkNotNull(requestedBsqTextField, "requestedBsqTextField must not be null");
inputControls.add(requestedBsqTextField);

BsqValidator bsqValidator = new BsqValidator(bsqFormatter);
if (proposalType == ProposalType.COMPENSATION_REQUEST) {
bsqValidator.setMinValue(daoFacade.getMinCompensationRequestAmount());
bsqValidator.setMaxValue(daoFacade.getMaxCompensationRequestAmount());
} else if (proposalType == ProposalType.REIMBURSEMENT_REQUEST) {
bsqValidator.setMinValue(daoFacade.getMinReimbursementRequestAmount());
bsqValidator.setMaxValue(daoFacade.getMaxReimbursementRequestAmount());
if (isMakeProposalScreen) {
BsqValidator bsqValidator = new BsqValidator(bsqFormatter);
if (proposalType == ProposalType.COMPENSATION_REQUEST) {
bsqValidator.setMinValue(daoFacade.getMinCompensationRequestAmount());
bsqValidator.setMaxValue(daoFacade.getMaxCompensationRequestAmount());
} else if (proposalType == ProposalType.REIMBURSEMENT_REQUEST) {
bsqValidator.setMinValue(daoFacade.getMinReimbursementRequestAmount());
bsqValidator.setMaxValue(daoFacade.getMaxReimbursementRequestAmount());
}
requestedBsqTextField.setValidator(bsqValidator);
}
requestedBsqTextField.setValidator(bsqValidator);
break;
case CHANGE_PARAM:
checkNotNull(gridPane, "gridPane must not be null");
Expand Down Expand Up @@ -264,7 +268,7 @@ public Param fromString(String string) {
paramValueTextField.clear();
String currentValue = bsqFormatter.formatParamValue(newValue, daoFacade.getParamValue(newValue));
paramValueTextField.setPromptText(Res.get("dao.param.currentValue", currentValue));
if (changeParamValidator != null) {
if (changeParamValidator != null && isMakeProposalScreen) {
ChangeParamInputValidator validator = new ChangeParamInputValidator(newValue, changeParamValidator);
paramValueTextField.setValidator(validator);
}
Expand Down