Skip to content

Commit

Permalink
Added library and entry selection boxes to the UI on "Aux file import…
Browse files Browse the repository at this point in the history
…" screen
  • Loading branch information
caitlinlilley authored and koppor committed Oct 27, 2023
1 parent e23031f commit 55f89d8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonType?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
Expand All @@ -12,7 +13,6 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import org.jabref.gui.icon.JabRefIconView?>

<DialogPane xmlns:fx="http://javafx.com/fxml/1" prefHeight="650.0" prefWidth="500.0"
xmlns="http://javafx.com/javafx/8.0.121" fx:controller="org.jabref.gui.auximport.FromAuxDialog">
<content>
Expand Down Expand Up @@ -43,6 +43,17 @@
<TextArea fx:id="statusInfos" editable="false" prefHeight="300.0" wrapText="true"/>
<Label text="%Unknown BibTeX entries:"/>
<ListView fx:id="notFoundList" prefHeight="200"/>
<VBox spacing="10">
<HBox spacing="4">
<Button onAction="#selectAllNewEntries" text="%Select all new entries"/>
<Button onAction="#selectAllEntries" text="%Select all entries"/>
<Button onAction="#unselectAll" text="%Unselect all"/>
</HBox>
<HBox spacing="4" alignment="CENTER_LEFT">
<Label text="%Select library"/>
<ComboBox fx:id="libraryListView" layoutX="16.0" layoutY="52.0"/>
</HBox>
</VBox>
</VBox>
</VBox>
</content>
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/org/jabref/gui/auximport/FromAuxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

import org.jabref.gui.DialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.LibraryTab;
import org.jabref.gui.importer.ImportEntriesViewModel;
import org.jabref.gui.theme.ThemeManager;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.FileDialogConfiguration;
Expand All @@ -22,16 +24,22 @@
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.preferences.PreferencesService;

import com.airhacks.afterburner.views.ViewLoader;
import jakarta.inject.Inject;
import org.controlsfx.control.CheckListView;

/**
* A wizard dialog for generating a new sub database from existing TeX AUX file
*/
public class FromAuxDialog extends BaseDialog<Void> {

public CheckListView<BibEntry> entriesListView;

private ImportEntriesViewModel viewModel;
public ComboBox<String> libraryListView;
private final LibraryTab libraryTab;
@FXML private ButtonType generateButtonType;
private final Button generateButton;
Expand Down Expand Up @@ -99,4 +107,23 @@ private void browseButtonClicked() {
.withInitialDirectory(preferences.getFilePreferences().getWorkingDirectory()).build();
dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file -> auxFileField.setText(file.toAbsolutePath().toString()));
}

public void unselectAll() {
entriesListView.getCheckModel().clearChecks();
}

public void selectAllNewEntries() {
unselectAll();
for (BibEntry entry : entriesListView.getItems()) {
if (!viewModel.hasDuplicate(entry)) {
entriesListView.getCheckModel().check(entry);
}
}
}

public void selectAllEntries() {
unselectAll();
entriesListView.getCheckModel().checkAll();
}

}
1 change: 1 addition & 0 deletions src/main/resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ springerNatureAPIKey=${springerNatureAPIKey}
astrophysicsDataSystemAPIKey=${astrophysicsDataSystemAPIKey}
ieeeAPIKey=${ieeeAPIKey}
biodiversityHeritageApiKey=${biodiversityHeritageApiKey}
Select\ library=Create property

0 comments on commit 55f89d8

Please sign in to comment.