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] Added number of items found #5740

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<Button text="%Select all new entries" styleClass="text-button" onAction="#selectAllNewEntries"/>
<Button text="%Unselect all" styleClass="text-button" onAction="#unselectAll"/>
</HBox>
<HBox>
<Label text="%Total items found:" styleClass="info-section"/>
<Label fx:id="totalItems"/>
<Label text="%Selected items:" styleClass="info-section"/>
<Label fx:id="selectedItems"/>
</HBox>
</VBox>
</content>
<ButtonType fx:id="importButton" text="%Import entries" buttonData="OK_DONE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class ImportEntriesDialog extends BaseDialog<Void> {

public CheckListView<BibEntry> entriesListView;
public ButtonType importButton;
public Label totalItems;
private final BackgroundTask<List<BibEntry>> task;
private ImportEntriesViewModel viewModel;
@Inject private TaskExecutor taskExecutor;
Expand All @@ -61,7 +62,6 @@ public class ImportEntriesDialog extends BaseDialog<Void> {
public ImportEntriesDialog(BibDatabaseContext database, BackgroundTask<List<BibEntry>> task) {
this.database = database;
this.task = task;

ViewLoader.view(this)
.load()
.setAsDialogPane(this);
Expand All @@ -84,7 +84,6 @@ public ImportEntriesDialog(BibDatabaseContext database, BackgroundTask<List<BibE
@FXML
private void initialize() {
viewModel = new ImportEntriesViewModel(task, taskExecutor, database, dialogService, undoManager, preferences, stateManager, fileUpdateMonitor);

Label placeholder = new Label();
placeholder.textProperty().bind(viewModel.messageProperty());
entriesListView.setPlaceholder(placeholder);
Expand Down Expand Up @@ -125,7 +124,8 @@ private void initialize() {
*/
if (entriesListView.getItems().size() == 1) {
selectAllNewEntries();
}
}
totalItems.textProperty().setValue(String.valueOf(entriesListView.getItems().size()));
Copy link
Member

Choose a reason for hiding this comment

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

It should be possible to bind the text directly to the size:
totalItems.textProperty().bind(Bindings.size(viewModel.getEntries())), which can then be moved to line 90.

Copy link
Author

Choose a reason for hiding this comment

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

It actually didn't work as you said, I just pushed some changes that were missing, I hope everything is ok.


return container;
})
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,8 @@ Cancel\ import=Cancel import
Continue\ with\ import=Continue with import
Import\ canceled=Import canceled
Select\ all\ new\ entries=Select all new entries
Total\ items\ found\:=Total items found:
Selected\ items\:=Selected items:
Select\ the\ entries\ to\ be\ imported\:=Select the entries to be imported\:
Add\ new\ String=Add new String
Remove\ selected\ Strings=Remove selected Strings
Expand Down