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

Update default backup filename to id-name-softversion-date-time #214

Merged
merged 3 commits into from
Mar 1, 2023

Conversation

bobjacobsen
Copy link
Contributor

Changes the default filename when doing a backup from the CDI pane. The new form is id-name-softwareversion-date-time, e.g.

config.02.01.57.00.04.8B-East_test_board-rev-C7b-2023-02-24-10:06:21.txt

@bobjacobsen
Copy link
Contributor Author

src/org/openlcb/cdi/swing/CdiPanel.java Outdated Show resolved Hide resolved
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()));
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@balazsracz
Copy link
Collaborator

balazsracz commented Mar 1, 2023 via email

@bobjacobsen
Copy link
Contributor Author

Thanks. Changes made.

@balazsracz balazsracz merged commit 448574a into openlcb:master Mar 1, 2023
@bobjacobsen bobjacobsen deleted the default_backup_filename branch March 1, 2023 15:52
balazsracz added a commit that referenced this pull request Mar 10, 2023
…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)
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.

2 participants