Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into swing-test
Browse files Browse the repository at this point in the history
* upstream/master:
  Bugfix/5045 : Modified the existing logic to comply crossref resolution with biblatex specification (JabRef#5086)
  Fix issue with missing year value in year column (JabRef#5197)
  Bump com.gradle.build-scan from 2.4 to 2.4.1 (JabRef#5199)
  Add citation commands to TexParser: autocite, blockcquote, and textcquote (JabRef#5195)
  Conversion of preferencesDialog/advancedTab, networkTab and groupsTab to mvvm (JabRef#5141)
  Fix Permissions of LaTeXintegration (JabRef#5134)
  Border for group color indicator and some space for tooltip (JabRef#5190)
  Fix issue 5152, tooltip and icon added to group cell (JabRef#5191)
  Fix tooltips in CitationsDisplay (JabRef#5188)
  • Loading branch information
Siedlerchr committed Aug 23, 2019
2 parents a78f1be + 0cb7f5f commit 18ccbb4
Show file tree
Hide file tree
Showing 53 changed files with 1,339 additions and 1,096 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
}

plugins {
id 'com.gradle.build-scan' version '2.4'
id 'com.gradle.build-scan' version '2.4.1'
id 'com.install4j.gradle' version '7.0.12'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id "com.simonharrer.modernizer" version '1.8.0-1'
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,11 @@ We want to have a look that matches our icons in the tool-bar */
-fx-fill: -jr-warn;
}

.warning-message {
-fx-fill: -jr-error;
-fx-text-fill: -jr-error;
}

.error-icon {
-fx-text-fill: -jr-error;
-fx-fill: -jr-error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void buildLayout() {
actionsList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
new ViewModelListCellFactory<FieldFormatterCleanup>()
.withText(action -> action.getField() + ": " + action.getFormatter().getName())
.withTooltip(action -> action.getFormatter().getDescription())
.withStringTooltip(action -> action.getFormatter().getDescription())
.install(actionsList);
add(actionsList, 1, 1, 3, 1);

Expand Down Expand Up @@ -171,7 +171,7 @@ private GridPane getSelectorPanel() {
formattersCombobox = new ComboBox<>(FXCollections.observableArrayList(availableFormatters));
new ViewModelListCellFactory<Formatter>()
.withText(Formatter::getName)
.withTooltip(Formatter::getDescription)
.withStringTooltip(Formatter::getDescription)
.install(formattersCombobox);
EasyBind.subscribe(formattersCombobox.valueProperty(), e -> updateDescription());
builder.add(formattersCombobox, 3, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public LinkedFilesEditor(Field field, DialogService dialogService, BibDatabaseCo
.load();

ViewModelListCellFactory<LinkedFileViewModel> cellFactory = new ViewModelListCellFactory<LinkedFileViewModel>()
.withTooltip(LinkedFileViewModel::getDescription)
.withStringTooltip(LinkedFileViewModel::getDescription)
.withGraphic(LinkedFilesEditor::createFileDisplay)
.withContextMenu(this::createContextMenuForFile)
.withOnMouseClickedEvent(this::handleItemMouseClick)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ public enum JabRefIcons implements JabRefIcon {
LATEX_FILE_DIRECTORY(MaterialDesignIcon.FOLDER_OUTLINE),
LATEX_FILE(MaterialDesignIcon.FILE_OUTLINE),
LATEX_COMMENT(MaterialDesignIcon.COMMENT_TEXT_OUTLINE),
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING);
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING),
PASSWORD_REVEALED(MaterialDesignIcon.EYE);

private final JabRefIcon icon;

Expand Down
64 changes: 40 additions & 24 deletions src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

import javax.swing.undo.UndoManager;

import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;

Expand Down Expand Up @@ -65,7 +67,7 @@ class MainTableColumnFactory {
private final CellFactory cellFactory;
private final UndoManager undoManager;
private final DialogService dialogService;


public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences preferences, ExternalFileTypes externalFileTypes, UndoManager undoManager, DialogService dialogService) {
this.database = Objects.requireNonNull(database);
Expand All @@ -78,9 +80,7 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre

public List<TableColumn<BibEntryTableViewModel, ?>> createColumns() {
List<TableColumn<BibEntryTableViewModel, ?>> columns = new ArrayList<>();

columns.add(createGroupColumn());

// Add column for linked files
if (preferences.showFileColumn()) {
columns.add(createFileColumn());
Expand Down Expand Up @@ -116,35 +116,51 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre

private TableColumn<BibEntryTableViewModel, ?> createGroupColumn() {
TableColumn<BibEntryTableViewModel, List<AbstractGroup>> column = new TableColumn<>();
column.getStyleClass().add(GROUP_COLUMN);
setExactWidth(column, 20);
Node headerGraphic = IconTheme.JabRefIcons.DEFAULT_GROUP_ICON.getGraphicNode();
Tooltip.install(headerGraphic, new Tooltip(Localization.lang("Group color")));
column.setGraphic(headerGraphic);
column.getStyleClass().add(ICON_COLUMN);
setExactWidth(column, GUIGlobals.WIDTH_ICON_COL);
column.setCellValueFactory(cellData -> cellData.getValue().getMatchedGroups(database));
new ValueTableCellFactory<BibEntryTableViewModel, List<AbstractGroup>>()
.withGraphic(this::createGroupColorRegion)
.install(column);
column.setStyle("-fx-padding: 0 0 0 0;");
column.setSortable(true);
return column;
}

private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractGroup> matchedGroups) {
Rectangle rectangle = new Rectangle();
rectangle.setWidth(3);
rectangle.setHeight(20);
Color color = matchedGroups.stream()
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
.findFirst()
.orElse(Color.TRANSPARENT);
rectangle.setFill(color);

String matchedGroupsString = matchedGroups.stream()
.map(AbstractGroup::getName)
.collect(Collectors.joining(", "));
Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString);
Tooltip.install(rectangle, tooltip);

BorderPane container = new BorderPane();
container.setLeft(rectangle);
return container;
Color groupColor = matchedGroups.stream()
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
.findFirst()
.orElse(Color.TRANSPARENT);

if (groupColor != Color.TRANSPARENT) {
Rectangle border = new Rectangle();
border.setWidth(5);
border.setHeight(20);
border.setFill(Color.DARKGRAY);

Rectangle groupRectangle = new Rectangle();
groupRectangle.setWidth(3);
groupRectangle.setHeight(18);
groupRectangle.setFill(groupColor);

StackPane container = new StackPane();
container.setMinWidth(10);
container.setAlignment(Pos.CENTER);

container.getChildren().addAll(border,groupRectangle);

String matchedGroupsString = matchedGroups.stream()
.map(AbstractGroup::getName)
.collect(Collectors.joining(", "));
Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString);
Tooltip.install(container, tooltip);
return container;
}
return new Pane();
}

private List<TableColumn<BibEntryTableViewModel, ?>> createNormalColumns() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.jabref.gui.preferences;

import java.util.List;

import javax.inject.Inject;

import javafx.scene.Node;
import javafx.scene.layout.VBox;

import org.jabref.gui.DialogService;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.preferences.JabRefPreferences;

public abstract class AbstractPreferenceTabView extends VBox implements PreferencesTab {

@Inject protected TaskExecutor taskExecutor;
@Inject protected DialogService dialogService;

protected PreferenceTabViewModel viewModel;

protected JabRefPreferences preferences;

@Override
public Node getBuilder() { return this; }

@Override
public void setValues() { viewModel.setValues(); }

@Override
public void storeSettings() { viewModel.storeSettings(); }

@Override
public boolean validateSettings() { return viewModel.validateSettings(); }

@Override
public List<String> getRestartWarnings() { return viewModel.getRestartWarnings(); }
}
67 changes: 67 additions & 0 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<?import org.controlsfx.control.textfield.CustomPasswordField?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.AdvancedTabView">
<children>
<Label styleClass="titleHeader" text="%Advanced" />
<Label styleClass="sectionHeader" text="%Remote operation" />
<Label fx:id="remoteLabel" text="%This feature lets new files be opened or imported into an already running instance of JabRef instead of opening a new instance. For instance, this is useful when you open a file in JabRef from your web browser. Note that this will prevent you from running more than one instance of JabRef at a time." textOverrun="CLIP" wrapText="true" />
<HBox alignment="CENTER_LEFT" spacing="10.0">
<children>
<CheckBox fx:id="remoteServer" text="%Listen for remote operation on port" />
<TextField fx:id="remotePort" maxWidth="100.0" HBox.hgrow="ALWAYS" />
<Button fx:id="remoteHelp" prefWidth="20.0" />
</children>
</HBox>

<Label styleClass="sectionHeader" text="%Search IEEEXplore" />
<CheckBox fx:id="useIEEELatexAbbreviations" text="%Use IEEE LaTeX abbreviations" />

<Label styleClass="sectionHeader" text="%Import conversions" />
<CheckBox fx:id="useCaseKeeper" text="%Add {} to specified title words on search to keep the correct case" />
<CheckBox fx:id="useUnitFormatter" text="%Format units by adding non-breaking separators and keeping the correct case on search" />

<Label styleClass="sectionHeader" text="%Network" />
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" hgap="10.0" vgap="10.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<CheckBox fx:id="proxyUse" text="%Use custom proxy configuration" GridPane.columnSpan="3" GridPane.rowIndex="0" />
<Label fx:id="proxyHostnameLabel" text="%Hostname" GridPane.rowIndex="1" />
<TextField fx:id="proxyHostname" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label fx:id="proxyPortLabel" text="%Port" GridPane.rowIndex="2" />
<TextField fx:id="proxyPort" maxWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<CheckBox fx:id="proxyUseAuthentication" text="%Proxy requires authentication" GridPane.columnSpan="3" GridPane.rowIndex="3" />
<Label fx:id="proxyUsernameLabel" text="%Username" GridPane.rowIndex="4" />
<TextField fx:id="proxyUsername" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label fx:id="proxyPasswordLabel" text="%Password" GridPane.rowIndex="5" />
<CustomPasswordField fx:id="proxyPassword" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Label fx:id="proxyAttentionLabel" styleClass="warning-message"
text="%Attention: Password is stored in plain text!" GridPane.columnIndex="2" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
</fx:root>

0 comments on commit 18ccbb4

Please sign in to comment.