-
Notifications
You must be signed in to change notification settings - Fork 9
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
Update default backup filename to id-name-softversion-date-time #214
Update default backup filename to id-name-softversion-date-time #214
Conversation
See discussion at https://groups.io/g/layoutcommandcontrol/topic/97184619 |
public void runRestore() { | ||
// First select a file to save to. | ||
fci.setDialogTitle("Open configuration restore file"); | ||
fci.rescanCurrentDirectory(); | ||
fci.setSelectedFile(new File("config." + rep.getRemoteNodeAsString() + ".txt")); | ||
|
||
fci.setSelectedFile(new File(generateFileName())); |
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.
This surely won't work with the date and time now being part of the filename.
Can the file chooser get something like a glob pattern?
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.
You're right that this won't end up selecting a file. This goes to the saved directory (if any), but doesn't select a file.
Unfortunately, no, there's no glob capability in the JFileChooser. Coding one is possible, but it's a non-trivial amount of work.
Another approach might be to present the last filename used by a Save (in the same session) and select that.
On Wed, Mar 1, 2023 at 5:36 AM Bob Jacobsen ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/org/openlcb/cdi/swing/CdiPanel.java
<#214 (comment)>:
> public void runRestore() {
// First select a file to save to.
fci.setDialogTitle("Open configuration restore file");
fci.rescanCurrentDirectory();
- fci.setSelectedFile(new File("config." + rep.getRemoteNodeAsString() + ".txt"));
+
+ fci.setSelectedFile(new File(generateFileName()));
You're right that this won't end up selecting a file. This goes to the
saved directory (if any), but doesn't select a file.
Unfortunately, no, there's no glob capability in the JFileChooser. Coding
one is possible, but it's a non-trivial amount of work.
Another approach might be to present the last filename used by a Save (in
the same session) and select that.
This sounds like an ok behavior. If there wasn't anything in the current
session, then just show the directory with *.txt in the chooser.
… Message ID: ***@***.***>
|
Thanks. Changes made. |
…orepeat * 'master' of github.com:openlcb/OpenLCB_Java: Address space improvements (#218) Config Node displays more info as needed (#217) Update default backup filename to id-name-softversion-date-time (#214) Automate sizing of NodeSelector JComboBox (#216) add EventID.toShortString() (#215) Allow NodeSelector user to specify length of ID string (#213) Hub - add separate options for sending / receiving line termination characters (#212) Hub Line Endings / GC Serial (#208)
Changes the default filename when doing a backup from the CDI pane. The new form is id-name-softwareversion-date-time, e.g.