Skip to content

Commit

Permalink
Added MenuButtons to IntegrityCheckDialog (#5955)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus committed Feb 19, 2020
1 parent 58f1db5 commit b18b4d3
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 25 deletions.
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- we changed the open office panel to show buttons in rows of three instead of going straight down to save space as the button expanded out to take up unnecessary horizontal space [#5479] (https://github.com/JabRef/jabref/issues/5479)

- We changed the open office panel to show buttons in rows of three instead of going straight down to save space as the button expanded out to take up unnecessary horizontal space. [#5479](https://github.com/JabRef/jabref/issues/5479)
- We cleaned up the group add/edit dialog. [#5826](https://github.com/JabRef/jabref/pull/5826)
- We reintroduced the index column. [#5844](https://github.com/JabRef/jabref/pull/5844)
- Filenames of external files can no longer contain curly braces. [#5926](https://github.com/JabRef/jabref/pull/5926)
- We made the filters more easily accessible in the integrity check dialog. [#5955](https://github.com/JabRef/jabref/pull/5955)
- We reimplemented and improved the dialog "Customize entry types" [#4719](https://github.com/JabRef/jabref/issues/4719)
- Filenames of external files can no longer contain curly braces


### Fixed

- We fixed and issue where pdf files will not open under some KDE linux distributions when using okular. [#5253](https://github.com/JabRef/jabref/issues/5253)
- We fixed an issue where the Medline fetcher was only working when JabRef was running from source. [#5645](https://github.com/JabRef/jabref/issues/5645)
- We fixed some visual issues in the dark theme. [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753)
- We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779)
- We improved the performance, especially changing field values in the entry should feel smoother now.
- We improved the performance, especially changing field values in the entry should feel smoother now. [#5843](https://github.com/JabRef/jabref/issues/5843)
- We fixed an issue where the ampersand character wasn't rendering correctly on previews. [#3840](https://github.com/JabRef/jabref/issues/3840)
- We fixed an issue where an erroneous "The library has been modified by another program" message was shown when saving. [#4877](https://github.com/JabRef/jabref/issues/4877)
- We fixed an issue where the file extension was missing after downloading a file (we now fall-back to pdf). [#5816](https://github.com/JabRef/jabref/issues/5816)
Expand All @@ -35,12 +35,12 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed several issues concerning managing external file types: Now everything is usable and fully functional. Previously, there were problems with the radio buttons, with saving the settings and with loading an input field value. Furthermore, different behavior for Windows and other operating systems was given, which was unified as well. [#5846](https://github.com/JabRef/jabref/issues/5846)
- We fixed an issue where entries containing Unicode charaters were not parsed correctly [#5899](https://github.com/JabRef/jabref/issues/5899)
- We fixed an issue where an entry containing an external filename with curly braces could not be saved. Curly braces are now longer allowed in filenames. [#5899](https://github.com/JabRef/jabref/issues/5899)
- We fixed an issue where changing the type of an entry did not update the main table [#5906](https://github.com/JabRef/jabref/issues/5906)
- We fixed an issue where opening a library from the recent libraries menu was not possible [#5939](https://github.com/JabRef/jabref/issues/5939)

- We fixed an issue where changing the type of an entry did not update the main table. [#5906](https://github.com/JabRef/jabref/issues/5906)
- We fixed an issue where opening a library from the recent libraries menu was not possible. [#5939](https://github.com/JabRef/jabref/issues/5939)

### Removed
- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action.

- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action. [#5869](https://github.com/JabRef/jabref/issues/5869)


## [5.0-beta] – 2019-12-15
Expand Down
36 changes: 21 additions & 15 deletions src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.fxml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonType?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<DialogPane xmlns:fx="http://javafx.com/fxml/1" prefHeight="600.0" prefWidth="700.0"
xmlns="http://javafx.com/javafx/8.0.121" fx:controller="org.jabref.gui.integrity.IntegrityCheckDialog">
<content>
<AnchorPane>
<ScrollPane fitToHeight="true" fitToWidth="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<TableView fx:id="messagesTable">
<columns>
<TableColumn fx:id="keyColumn" prefWidth="150.0" text="%BibTeX key"/>
<TableColumn fx:id="fieldColumn" prefWidth="110.0" text="%Field"/>
<TableColumn fx:id="messageColumn" prefWidth="400" text="%Message"/>
</columns>
</TableView>
</ScrollPane>
</AnchorPane>
<VBox spacing="4.0">
<TableView fx:id="messagesTable" prefHeight="550" prefWidth="700.0" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="keyColumn" prefWidth="150.0" text="%BibTeX key" />
<TableColumn fx:id="fieldColumn" prefWidth="110.0" text="%Field" />
<TableColumn fx:id="messageColumn" prefWidth="400" text="%Message" />
</columns>
</TableView>
<HBox maxHeight="30" spacing="4.0">
<MenuButton fx:id="keyFilterButton" prefHeight="30.0" maxHeight="30.0" text="%BibTeX key filters" />
<MenuButton fx:id="fieldFilterButton" prefHeight="30.0" maxHeight="30.0" text="%Field filters" />
<MenuButton fx:id="messageFilterButton" prefHeight="30.0" maxHeight="30.0" text="%Message filters" />
<Button onAction="#clearFilters" text="%Clear filters" />
</HBox>
</VBox>
</content>
<ButtonType fx:constant="CLOSE"/>
<ButtonType fx:constant="CLOSE" />
</DialogPane>
72 changes: 70 additions & 2 deletions src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.collections.ListChangeListener;
import javafx.fxml.FXML;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuButton;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.input.MouseButton;
import javafx.stage.Modality;

import org.jabref.gui.BasePanel;
Expand All @@ -25,7 +28,11 @@ public class IntegrityCheckDialog extends BaseDialog<Void> {
@FXML private TableColumn<IntegrityMessage, String> keyColumn;
@FXML private TableColumn<IntegrityMessage, String> fieldColumn;
@FXML private TableColumn<IntegrityMessage, String> messageColumn;
@FXML private MenuButton keyFilterButton;
@FXML private MenuButton fieldFilterButton;
@FXML private MenuButton messageFilterButton;
private IntegrityCheckDialogViewModel viewModel;
private TableFilter<IntegrityMessage> tableFilter;

public IntegrityCheckDialog(List<IntegrityMessage> messages, BasePanel basePanel) {
this.messages = messages;
Expand Down Expand Up @@ -59,7 +66,68 @@ private void initialize() {
fieldColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getField().getDisplayName()));
messageColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getMessage()));

TableFilter.forTableView(messagesTable)
.apply();
tableFilter = TableFilter.forTableView(messagesTable)
.apply();

tableFilter.getColumnFilter(keyColumn).ifPresent(columnFilter -> {
ContextMenu keyContextMenu = keyColumn.getContextMenu();
if (keyContextMenu != null) {
keyFilterButton.setContextMenu(keyContextMenu);
keyFilterButton.setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.PRIMARY) {
if (keyContextMenu.isShowing()) {
keyContextMenu.setX(event.getScreenX());
keyContextMenu.setY(event.getScreenY());
} else {
keyContextMenu.show(keyFilterButton, event.getScreenX(), event.getScreenY());
}
}
});
}
});

tableFilter.getColumnFilter(fieldColumn).ifPresent(columnFilter -> {
ContextMenu fieldContextMenu = fieldColumn.getContextMenu();
if (fieldContextMenu != null) {
fieldFilterButton.setContextMenu(fieldContextMenu);
fieldFilterButton.setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.PRIMARY) {
if (fieldContextMenu.isShowing()) {
fieldContextMenu.setX(event.getScreenX());
fieldContextMenu.setY(event.getScreenY());
} else {
fieldContextMenu.show(fieldFilterButton, event.getScreenX(), event.getScreenY());
}
}
});
}
});

tableFilter.getColumnFilter(messageColumn).ifPresent(columnFilter -> {
ContextMenu messageContextMenu = messageColumn.getContextMenu();
if (messageContextMenu != null) {
messageFilterButton.setContextMenu(messageContextMenu);
messageFilterButton.setOnMouseClicked(event -> {
if (event.getButton() == MouseButton.PRIMARY) {
if (messageContextMenu.isShowing()) {
messageContextMenu.setX(event.getScreenX());
messageContextMenu.setY(event.getScreenY());
} else {
messageContextMenu.show(messageFilterButton, event.getScreenX(), event.getScreenY());
}
}
});
}
});
}

public void clearFilters() {
if (tableFilter != null) {
tableFilter.resetFilter();
messagesTable.getColumns().forEach(column -> {
tableFilter.selectAllValues(column);
column.setGraphic(null);
});
}
}
}
4 changes: 4 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,10 @@ Keyword\ delimiter=Keyword delimiter
Hierarchical\ keyword\ delimiter=Hierarchical keyword delimiter
Escape\ ampersands=Escape ampersands
BibTeX\ key\ filters=BibTeX key filters
Field\ filters=Field filters
Message\ filters=Message filters
Clear\ filters=Clear filters
Add\ new\ Field=Add new Field
Add\ new\ entry\ type=Add new entry type
Expand Down

0 comments on commit b18b4d3

Please sign in to comment.