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

[WIP] File Magic Wizard Issue #380 #7172

Closed
wants to merge 1 commit into from

Conversation

emugdan
Copy link

@emugdan emugdan commented Dec 8, 2020

This is the first draft for File Magic Wizard (Issue #380).
The File Wizard should automatically synchronize local files with the corresponding BibEntries of a JabRef Library when executed.
koppor#380

This project is part of the course "software engineering" at Universität Basel.
@flurfis, @yasminmeier, @maxjappert

  • Change in CHANGELOG.md described (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

Screenshot 2020-12-08 152906

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Hi guys, I know, it's only a draft, but I took the opportunity to take a first look into your PR and made some quick remarks. It's already a great start, yet some little issues about codestyle and design patterns are open. I put also two questions in the comments. I didn't comment yet on the tests, because they seem still very much work in progress.
Hope I could help a little bit. Happy coding!

* Here the wizard starts working. The method is activated when the "Start" button is pressed in the wizard interface.
*/
private void startWizard() {
directory = new File(viewModel.getDirectoryProperty().get());
Copy link
Member

Choose a reason for hiding this comment

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

Please use nio.Path

private void startWizard() {
directory = new File(viewModel.getDirectoryProperty().get());

if(!directory.exists()) {
Copy link
Member

Choose a reason for hiding this comment

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

Files.exists(...)

import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import java.awt.*;
Copy link
Member

Choose a reason for hiding this comment

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

Wildcard-imports are not allowed by checkstyle.
Neither is awt...

import com.airhacks.afterburner.views.ViewLoader;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
Copy link
Member

Choose a reason for hiding this comment

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

Please set up checkstyle configuration according to our workspace set up guide.
Wildcard imports are not allowed.

Comment on lines +36 to +37
FileInputStream fis = new FileInputStream(checkedFilesListFile);
ObjectInputStream ois = new ObjectInputStream(fis);
Copy link
Member

Choose a reason for hiding this comment

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

Please use meaningful variable names.

Comment on lines +40 to +49
public void updateProgress(BibEntry entry, int progress) {
double percent;
if(progress == 0) {
percent = 0;
} else {
percent = (double) progress / numberOfBibEntries;
progressBar.setProgress(percent);
}
Platform.runLater(() -> progressLabel.setText((int) (percent * 100) + "% complete, currently handling " + entry.getAuthorTitleYear(30)));
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be part of the viewModel.
Please use a StringProperty or any other binding

Comment on lines +55 to +62
public void stopRunning() {
running = false;
Platform.runLater(() -> progressLabel.setText(Localization.lang("Cancelling, please wait...")));
}

public boolean isRunning() {
return running;
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be part of the ViewModel.
Use properties.

int numberOfBibEntries;
boolean running;

public FileWizardProgressDialog(int numberOfBibEntries) {
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you use our existing background task architecture?

/**
* Serializes the list of already checked BibEntries, making the information survive past runtime.
*/
public void serializeCheckedFiles(List<String> checkedFilesList, File checkedFilesListFile) {
Copy link
Member

Choose a reason for hiding this comment

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

nio.Path

/**
* Deserializes the list of already checked BibEntry, minimizing redundant work for the Wizard.
*/
public List<String> deserializeCheckedFilesList(File checkedFilesListFile) {
Copy link
Member

Choose a reason for hiding this comment

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

nio.Path

@calixtus
Copy link
Member

This PR refs #4652 and #5453

@koppor
Copy link
Member

koppor commented Dec 12, 2020

Thank you for submitting the PR. To support discussions on the feature, could you please also upload your nice UML diagram from the presentation? Then, the whole functionality gets more clear.

@koppor
Copy link
Member

koppor commented Dec 14, 2020

I think, following diagrams are relevant:

grafik

grafik

@tobiasdiez
Copy link
Member

I think the first two steps (in green) should be incorporated in the "Lookup > Search for unlinked local files" feature. There, instead of only suggesting importing the pdf as a new entry, JabRef should also suggest to link the file to a fitting existing entry (by adding a button in the file tree next to the file for which an entry might already exist).

@koppor
Copy link
Member

koppor commented Jan 4, 2021

We had a long dicussion at in the devcall about the functionality of your PR. The UML diagrams really helped to understand what is going on. We decided the we follow the principle "separation of concerns". Thus, we keep local disk search separate from online identifier-based search. - The idea of the dialog (refined by Tobias) was put as separate issue at #7288.

Nevertheless, thank you for your efforts and we hope, you learned much for your future software engineering endeavors.

@koppor koppor closed this Jan 4, 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

Successfully merging this pull request may close these issues.

4 participants