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

dataset manager: change how pull-down list of dataset types handles typed-in letters #44

Closed
cseppan opened this issue Apr 12, 2021 · 5 comments
Assignees

Comments

@cseppan
Copy link
Collaborator

cseppan commented Apr 12, 2021

For the Show Datasets of Type pull-down in the Dataset Manager window, typing a letter immediately selects the first dataset type starting with that letter. See if this can be changed to just go to that letter in the pull-down and not select the item.

@cseppan
Copy link
Collaborator Author

cseppan commented Aug 5, 2021

Currently the dataset types menu has an action listener, typeAction()

https://github.com/USEPA-OAQPS/emf/blob/9e2d935119c2418ad6477ba735ce67b39ab5a6aa/EMF/src/client/gov/epa/emissions/framework/client/data/dataset/DatasetsBrowserWindow.java#L115-L119

For a JComboBox, the action listener gets called whenever an item is selected. This means that typing in a single letter will fire the action event (because almost every letter matches a dataset type), which isn't what we want so this action listener needs to be removed.

I see three different ways of interacting with the dataset types menu:

  1. With the mouse, the user opens the popup menu and clicks on the item. A PopupMenuListener for popupMenuWillBecomeInvisible() seems like it should work in this case.
  2. The user opens the popup menu (either with the mouse or keyboard), uses the up and down arrows to select an item or types letters, then hits Enter to close the popup. The same popupMenuWillBecomeInvisible listener should be good here.
  3. The user never opens the popup menu, just types letters to select an item. I'm not sure how this case should work in terms of user expectations. Right now (with the action listener removed), the user can tab to the Name Contains field and hit Enter to trigger the reload.

So, I'd suggest adding a PopupMenuListener to call typeAction() when the popup menu is closed (becomes invisible), and we'll see how that works out.

@ddelvecchio
Copy link
Collaborator

Catherine, please test in Mac and Windows. I want to make sure it's functioning as expected.

@ddelvecchio
Copy link
Collaborator

ddelvecchio commented Aug 19, 2021

Back to square one with the code, the code has basically been reverted back to the original code.

A new set of eyes should look at this in the future.

@cseppan
Copy link
Collaborator Author

cseppan commented Aug 26, 2021

To prevent the datasets from being loaded as soon as a letter is typed, I updated the actionListener to only call typeAction() if the dataset types popup menu is not open.

https://github.com/USEPA-OAQPS/emf/blob/86a783ce30c7707fbf06181925e03c22ac0cbac1/EMF/src/client/gov/epa/emissions/framework/client/data/dataset/DatasetsBrowserWindow.java#L123-L133

Then I added a popupMenuWillBecomeInvisible listener to trigger the datasets to load when the popup menu is closed.

https://github.com/USEPA-OAQPS/emf/blob/86a783ce30c7707fbf06181925e03c22ac0cbac1/EMF/src/client/gov/epa/emissions/framework/client/data/dataset/DatasetsBrowserWindow.java#L134-L146

I also added in the variable dsTypeLoaded to keep track of the currently loaded dataset type so that if the user selects the same dataset type the datasets don't bother getting refetched.

@cseppan
Copy link
Collaborator Author

cseppan commented Aug 26, 2021

Looking at commit 1648b60, the problem with that code was the key listener that got added. There's no need to specifically listen for the Enter key being pressed because the default Java behavior does what we want.

@cseppan cseppan closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants