-
Notifications
You must be signed in to change notification settings - Fork 58
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
Enhancement - multichoice type ahead dropdownlist #2256
base: master
Are you sure you want to change the base?
Enhancement - multichoice type ahead dropdownlist #2256
Conversation
Unit test config fix
Fields that have been updated with the latest type-ahead MultiChoiceParameterType: File -> Export -> ToGeoJSON/ To GeoPackage -> Attributes Data Access View:
Analytic View: |
…o export attribute
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could've added more comments but the general patterns were:
- add final where appropriate
- fix formatting
- make copyright 2025 on new classes
Also if you could add a whatsnew entry, that would be great.
Some feedback from testing: if you type an invalid value, the red indicating invalid isn't as visible as you would ideally like (only a faint border). If we could get the box fully coloured red when an invalid value is present, that would be great.
I also did note that the type ahead only worked when adding to the end of the list, and not in the middle. Perhaps that is an addition for later on though
if (empty) { | ||
setGraphic(null); | ||
} else { | ||
setGraphic(new ImageView(img)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be made a ternary statement?
field.setId(mcPluginParameter.isRequired() && field.getCheckModel().isEmpty() ? "invalid selection" : ""); | ||
field.setStyle("invalid selection".equals(field.getId()) ? "-fx-color: #8A1D1D" : ""); | ||
@Override | ||
public ConstellationInputListener getFieldChangeListener(PluginParameter<MultiChoiceParameterValue> parameter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter final
field.setStyle("invalid selection".equals(field.getId()) ? "-fx-color: #8A1D1D" : ""); | ||
@Override | ||
public ConstellationInputListener getFieldChangeListener(PluginParameter<MultiChoiceParameterValue> parameter) { | ||
return (ConstellationInputListener<List<ParameterValue>>) (List<ParameterValue> newValue) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newValue
can either be final or explicit type (and brackets) removed
isAdjusting = false; | ||
@Override | ||
public PluginParameterListener getPluginParameterListener() { | ||
return (PluginParameter<?> parameter, ParameterChange change) -> Platform.runLater(() -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameters final or remove explicit types
@SuppressWarnings("unchecked") //mcPluginParameter is a MultiChoiceParameter | ||
final PluginParameter<MultiChoiceParameterValue> mcPluginParameter = (PluginParameter<MultiChoiceParameterValue>) parameter; | ||
switch (change) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra whitespace here
primaryInput = area; | ||
} | ||
default -> { | ||
TextField field = new TextField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
|
||
//The up down arrows allow for navigation to the begining and start of a line | ||
//This is being remapped to ALT + left and ALT + right for consistency between textArea and textField | ||
field.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter final or omit specific type for lambda
* Binds the heightProperty of a Rectangle to the height property of the {@link TextInputControl}. | ||
* @param bindables | ||
*/ | ||
public void bindHeightProperty(Rectangle... bindables) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter final
* @param bindables | ||
*/ | ||
public void bindHeightProperty(Rectangle... bindables) { | ||
for (Rectangle bindable : bindables){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
* Sets the text value of the {@link TextInputControl}. | ||
* @param stringValue | ||
*/ | ||
public void setText(String stringValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final (and finals elsewhere in the class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a test and it looks like its working well. I agree with the other review comments.
It would also be good to fix the code smells sonar has identified
Includes update on year in copyright, code formatting, added whatsnew and changelog, made input field all red on error
Prerequisites
Reviewed the checklist
Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
for the "CI / Unit Tests") to complete first. Failed Unit tests can be
debugged by adding the label "verbose logging" to the GitHub PR.
Description of the Change
The original ticket was to add ability to type ahead in MultiChoiceParameterType drop down lists.
But because there are a number of different versions of the Multichoice input field, this might be a good opportunity to create a united look & feel for all input fields, beginning with this one.
The main idea is to use ConstellationInput and ParameterInputPane and extend from them for specific types of input.
Each input field will allow the implementation of a left button, input area and a right button.
+----------------------------------------------------+
| Left Button | Input Area | Right Button |
+---------------------------------------------------+
Various listeners will allow communication between components.
Alternate Designs
The alternative is to work on each individual drop down list and customise.
Why Should This Be In Core?
This should be in core so that the look and feel of all input fields will have the same look and feel and work in the same way.
Benefits
This should be in core so that the look and feel of all input fields will have the same look and feel and work in the same way.
Possible Drawbacks
All input fields will have to be reviewed/modified.
Verification Process
Applicable Issues
#1012
#1877