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

Dr2 1966 add ability to drag and drop files into text boxes #510

Merged
merged 7 commits into from
Nov 11, 2024

Conversation

techncl
Copy link
Contributor

@techncl techncl commented Oct 31, 2024

No description provided.

Copy link
Contributor

@sparkhi sparkhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good, there are a couple of things

  1. Steve had mentioned of the possibility of dropping the files generally into the top area (Feature Request: Drag and drop files into the CSV and CSVS text boxes #472) and the code picking up and putting the correct file in the respective text boxes. I think for this to work, you will need to have the top panel as a "drop target" instead of the textbox. I have not looked into it, so I leave it to you if this is easily changeable

  2. The error reporting area is for the validation errors, the input errors should be reported on the UI as messageboxes, this should be an easy change. You could simply do something like JOptionPane.showMessageDialog(null, s"Please drag only 1 file into the '${label.text}' text box.", "Error", JOptionPane.ERROR_MESSAGE) instead of outputToReport

The first parameter null will actually leave the error dialog without parent, hence it will appear in the middle of the screen. A couple more lines would be to pass the SJXFrame into the ContentPanel
new ContentPanel(settings, this) so that private class ContentPanel(settingsPanel: SettingsPanel, parentFrame: SJXFrame) extends Panel

then you can simply make use of the parentFrame.peer as a parent of the dialog.
JOptionPane.showMessageDialog(parentFrame.peer, s"Please drag only 1 file into the '${label.text}' text box.", "Error", JOptionPane.ERROR_MESSAGE)

}
}
}
txtCsvFile.setTransferHandler(new FileDropHandler(".csv", lblCsvFile))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this line above the FileDropDownHandler class definition, just so that it stays close to the textBox creation from readability perspective

@techncl techncl merged commit 2a38743 into master Nov 11, 2024
12 checks passed
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

Successfully merging this pull request may close these issues.

3 participants