Skip to content

Commit 72399dc

Browse files
authored
Remove unnecessary spacing and margin in the AutomaticFieldEditor (#13792)
* fix: Update the UI for the automatic field editor * docs: Update CHANGELOG.md * docs: Update CHANGELOG.md * fix: Get the keep changes button to properly show
1 parent 65aed83 commit 72399dc

File tree

9 files changed

+97
-172
lines changed

9 files changed

+97
-172
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
118118
- We fixed an issue where "Copy to" was enabled even if no other library was opened. [#13280](https://github.com/JabRef/jabref/pull/13280)
119119
- We fixed an issue where the groups were still displayed after closing all libraries. [#13382](https://github.com/JabRef/jabref/issues/13382)
120120
- Enhanced field selection logic in the Merge Entries dialog when fetching from DOI to prefer valid years and entry types. [#12549](https://github.com/JabRef/jabref/issues/12549)
121+
- We removed unnecessary spacing and margin in the AutomaticFieldEditor. [#13792](https://github.com/JabRef/jabref/pull/13792)
121122

122123
### Removed
123124

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package org.jabref.gui.edit.automaticfiededitor;
22

3-
import javafx.scene.layout.AnchorPane;
3+
import javafx.scene.layout.VBox;
44

5-
public abstract class AbstractAutomaticFieldEditorTabView extends AnchorPane implements AutomaticFieldEditorTab {
5+
public abstract class AbstractAutomaticFieldEditorTabView extends VBox implements AutomaticFieldEditorTab {
66

77
@Override
8-
public AnchorPane getContent() {
8+
public VBox getContent() {
99
return this;
1010
}
1111
}

jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/AutomaticFieldEditorDialog.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,11 @@ public AutomaticFieldEditorDialog(StateManager stateManager, UndoManager undoMan
6060
}
6161
return "";
6262
});
63-
64-
// This will prevent all dialog buttons from having the same size
65-
// Read more: https://stackoverflow.com/questions/45866249/javafx-8-alert-different-button-sizes
66-
getDialogPane().getButtonTypes().stream()
67-
.map(getDialogPane()::lookupButton)
68-
.forEach(btn -> ButtonBar.setButtonUniformSize(btn, false));
6963
}
7064

7165
@FXML
7266
public void initialize() {
73-
viewModel = new AutomaticFieldEditorViewModel(selectedEntries, database, undoManager, stateManager);
67+
viewModel = new AutomaticFieldEditorViewModel(database, undoManager, stateManager);
7468

7569
for (AutomaticFieldEditorTab tabModel : viewModel.getFieldEditorTabs()) {
7670
NotificationPaneAdapter notificationPane = new NotificationPaneAdapter(tabModel.getContent());

jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/AutomaticFieldEditorViewModel.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.jabref.gui.edit.automaticfiededitor;
22

3-
import java.util.List;
4-
53
import javax.swing.undo.UndoManager;
64

75
import javafx.collections.FXCollections;
@@ -14,7 +12,6 @@
1412
import org.jabref.gui.edit.automaticfiededitor.renamefield.RenameFieldTabView;
1513
import org.jabref.gui.undo.NamedCompound;
1614
import org.jabref.model.database.BibDatabase;
17-
import org.jabref.model.entry.BibEntry;
1815

1916
public class AutomaticFieldEditorViewModel extends AbstractViewModel {
2017
public static final String NAMED_COMPOUND_EDITS = "EDIT_FIELDS";
@@ -23,7 +20,7 @@ public class AutomaticFieldEditorViewModel extends AbstractViewModel {
2320

2421
private final UndoManager undoManager;
2522

26-
public AutomaticFieldEditorViewModel(List<BibEntry> selectedEntries, BibDatabase database, UndoManager undoManager, StateManager stateManager) {
23+
public AutomaticFieldEditorViewModel(BibDatabase database, UndoManager undoManager, StateManager stateManager) {
2724
this.undoManager = undoManager;
2825
fieldEditorTabs.addAll(
2926
new EditFieldContentTabView(database, stateManager),

jabgui/src/main/resources/org/jabref/gui/Base.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,3 +3157,31 @@ journalInfo .grid-cell-b {
31573157
-fx-border-color: -jr-error;
31583158
-fx-border-width: 1px;
31593159
}
3160+
3161+
/* Automatic Field Editor */
3162+
.edit-field-content-pane {
3163+
-fx-padding: 0em 1em;
3164+
-fx-spacing: 1em;
3165+
}
3166+
3167+
.edit-field-content-pane .text-field {
3168+
-fx-padding: 0.5625em 0.75em;
3169+
}
3170+
3171+
.edit-field-content-pane .actions {
3172+
-fx-spacing: 0.75em;
3173+
-fx-alignment: BASELINE_LEFT;
3174+
}
3175+
3176+
.edit-field-content-pane .grid-pane {
3177+
-fx-hgap: 0.75em;
3178+
-fx-vgap: 0.75em;
3179+
}
3180+
3181+
.edit-field-content-pane .grid-pane .label {
3182+
-fx-min-width: 3.5em;
3183+
}
3184+
3185+
.automatic-field-editor .button-bar .button:default {
3186+
-fx-min-width: 12em;
3187+
}

jabgui/src/main/resources/org/jabref/gui/edit/automaticfiededitor/AutomaticFieldEditorDialog.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<?import javafx.scene.control.TabPane?>
66
<DialogPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
77
fx:controller="org.jabref.gui.edit.automaticfiededitor.AutomaticFieldEditorDialog"
8-
prefHeight="400.0" prefWidth="600.0">
8+
prefHeight="400.0" prefWidth="600.0" styleClass="automatic-field-editor">
99
<content>
1010
<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE"/>
1111
</content>
12-
<ButtonType fx:id="saveButton" text="%Keep Modifications" buttonData="OK_DONE"/>
12+
<ButtonType text="%Keep Modifications" buttonData="OK_DONE" />
1313
<ButtonType fx:constant="CANCEL"/>
1414
</DialogPane>
Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,39 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import javafx.geometry.Insets?>
43
<?import javafx.scene.control.Button?>
54
<?import javafx.scene.control.CheckBox?>
65
<?import javafx.scene.control.ComboBox?>
76
<?import javafx.scene.control.Label?>
8-
<?import javafx.scene.layout.AnchorPane?>
97
<?import javafx.scene.layout.ColumnConstraints?>
108
<?import javafx.scene.layout.GridPane?>
119
<?import javafx.scene.layout.HBox?>
1210
<?import javafx.scene.layout.RowConstraints?>
13-
<fx:root prefHeight="400.0" prefWidth="600.0" type="AnchorPane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.edit.automaticfiededitor.copyormovecontent.CopyOrMoveFieldContentTabView">
14-
<children>
15-
<GridPane hgap="8.0" layoutX="16.0" layoutY="246.0" minHeight="160.0" prefHeight="230.0" prefWidth="568.0" vgap="8.0" AnchorPane.leftAnchor="16.0" AnchorPane.rightAnchor="16.0" AnchorPane.topAnchor="8.0">
16-
<columnConstraints>
17-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="379.20001220703125" minWidth="40.0" prefWidth="65.00001220703125" />
18-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="726.3999938964844" minWidth="10.0" prefWidth="324.1999877929687" />
19-
<ColumnConstraints hgrow="SOMETIMES" maxWidth="726.3999938964844" minWidth="10.0" prefWidth="206.5999877929687" />
20-
</columnConstraints>
21-
<rowConstraints>
22-
<RowConstraints maxHeight="35.200015258789065" minHeight="10.0" prefHeight="20.800006103515624" vgrow="SOMETIMES" />
23-
<RowConstraints maxHeight="33.000008010864256" minHeight="8.999984741210938" prefHeight="23.39999389648438" vgrow="SOMETIMES" />
24-
<RowConstraints maxHeight="33.000008010864256" minHeight="10.0" prefHeight="26.60001220703125" vgrow="SOMETIMES" />
25-
<RowConstraints maxHeight="35.99998168945312" minHeight="10.0" prefHeight="35.99998168945312" vgrow="SOMETIMES" />
26-
<RowConstraints maxHeight="25.600012207031256" minHeight="10.0" prefHeight="23.20001831054688" vgrow="SOMETIMES" />
27-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
28-
</rowConstraints>
29-
<children>
30-
<Label prefHeight="19.0" prefWidth="48.0" text="%From" GridPane.rowIndex="2" />
31-
<Label text="%To" GridPane.rowIndex="3" />
32-
<ComboBox fx:id="fromFieldComboBox" editable="true" minWidth="-Infinity" prefHeight="32.0" prefWidth="150.0" GridPane.columnIndex="1" GridPane.hgrow="NEVER" GridPane.rowIndex="2" GridPane.vgrow="NEVER" />
33-
<ComboBox fx:id="toFieldComboBox" editable="true" minWidth="-Infinity" prefHeight="32.0" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
34-
<CheckBox fx:id="overwriteFieldContentCheckBox"
35-
mnemonicParsing="false" prefHeight="19.0" prefWidth="210.0" text="%Overwrite field content" GridPane.columnSpan="2147483647" GridPane.rowIndex="4" />
36-
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" spacing="8.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="5">
37-
<children>
38-
<Button fx:id="copyContentButton"
39-
mnemonicParsing="false" onAction="#copyContent" text="%Copy content" />
40-
<Button fx:id="moveContentButton"
41-
mnemonicParsing="false" onAction="#moveContent" text="%Move content" />
42-
<Button fx:id="swapContentButton"
43-
mnemonicParsing="false" onAction="#swapContent" text="%Swap content" />
44-
</children>
45-
</HBox>
46-
<HBox alignment="CENTER_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" GridPane.columnSpan="3" GridPane.rowSpan="2">
47-
<children>
48-
<Label alignment="BOTTOM_LEFT" minHeight="-Infinity" minWidth="-Infinity" styleClass="sectionHeader" text="%Copy or move the content of one field to another">
49-
<HBox.margin>
50-
<Insets bottom="10.0" />
51-
</HBox.margin>
52-
</Label>
53-
</children>
54-
<GridPane.margin>
55-
<Insets />
56-
</GridPane.margin>
57-
</HBox>
58-
</children>
59-
</GridPane>
60-
</children>
11+
<?import javafx.scene.layout.VBox?>
12+
13+
<fx:root type="VBox" styleClass="edit-field-content-pane" xmlns="http://javafx.com/javafx/17"
14+
xmlns:fx="http://javafx.com/fxml/1"
15+
fx:controller="org.jabref.gui.edit.automaticfiededitor.copyormovecontent.CopyOrMoveFieldContentTabView">
16+
<Label styleClass="sectionHeader" text="%Copy or move the content of one field to another"/>
17+
<GridPane styleClass="grid-pane">
18+
<columnConstraints>
19+
<ColumnConstraints hgrow="NEVER"/>
20+
<ColumnConstraints hgrow="ALWAYS"/>
21+
</columnConstraints>
22+
<rowConstraints>
23+
<RowConstraints/>
24+
<RowConstraints/>
25+
</rowConstraints>
26+
<Label text="%From" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
27+
<ComboBox fx:id="fromFieldComboBox" editable="true" maxWidth="Infinity" GridPane.columnIndex="1"
28+
GridPane.rowIndex="0"/>
29+
<Label text="%To" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
30+
<ComboBox fx:id="toFieldComboBox" editable="true" maxWidth="Infinity" GridPane.columnIndex="1"
31+
GridPane.rowIndex="1"/>
32+
</GridPane>
33+
<CheckBox fx:id="overwriteFieldContentCheckBox" mnemonicParsing="false" text="%Overwrite field content"/>
34+
<HBox styleClass="actions">
35+
<Button fx:id="copyContentButton" mnemonicParsing="false" onAction="#copyContent" text="%Copy content"/>
36+
<Button fx:id="moveContentButton" mnemonicParsing="false" onAction="#moveContent" text="%Move content"/>
37+
<Button fx:id="swapContentButton" mnemonicParsing="false" onAction="#swapContent" text="%Swap content"/>
38+
</HBox>
6139
</fx:root>
Lines changed: 22 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
4-
<?import javafx.geometry.Insets?>
53
<?import javafx.scene.control.Button?>
64
<?import javafx.scene.control.CheckBox?>
75
<?import javafx.scene.control.ComboBox?>
86
<?import javafx.scene.control.Label?>
97
<?import javafx.scene.control.Separator?>
108
<?import javafx.scene.control.TextField?>
11-
<?import javafx.scene.layout.AnchorPane?>
12-
<?import javafx.scene.layout.ColumnConstraints?>
13-
<?import javafx.scene.layout.GridPane?>
149
<?import javafx.scene.layout.HBox?>
15-
<?import javafx.scene.layout.RowConstraints?>
10+
<?import javafx.scene.layout.VBox?>
1611
<?import org.jabref.gui.icon.JabRefIconView?>
17-
<fx:root prefHeight="400.0" prefWidth="600.0" type="AnchorPane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.edit.automaticfiededitor.editfieldcontent.EditFieldContentTabView">
18-
<children>
19-
<GridPane hgap="8.0" prefWidth="568.0" vgap="8.0" AnchorPane.leftAnchor="16.0" AnchorPane.rightAnchor="16.0" AnchorPane.topAnchor="0.0">
20-
<columnConstraints>
21-
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
22-
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
23-
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
24-
</columnConstraints>
25-
<rowConstraints>
26-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
27-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
28-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
29-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
30-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
31-
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
32-
</rowConstraints>
33-
<children>
34-
<CheckBox fx:id="overwriteFieldContentCheckBox"
35-
mnemonicParsing="false" text="%Overwrite field content" GridPane.columnSpan="2147483647" GridPane.rowIndex="3">
36-
<GridPane.margin>
37-
<Insets left="2.0" />
38-
</GridPane.margin>
39-
</CheckBox>
40-
<HBox prefHeight="100.0" prefWidth="200.0" spacing="8.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="4">
41-
<children>
42-
<Button fx:id="setValueButton" mnemonicParsing="false" onAction="#setFieldValue" text="%Set" />
43-
<Button fx:id="appendValueButton" mnemonicParsing="false" onAction="#appendToFieldValue" text="%Append" />
44-
<Separator maxHeight="1.7976931348623157E308" minWidth="10.0" orientation="VERTICAL" prefWidth="11.0" />
45-
<Button fx:id="clearFieldButton" mnemonicParsing="false" onAction="#clearField" text="%Clear field content" >
46-
<graphic>
47-
<JabRefIconView glyph="DELETE_ENTRY"/>
48-
</graphic>
49-
</Button>
50-
</children>
51-
</HBox>
52-
<HBox spacing="8.0" GridPane.columnSpan="3" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.vgrow="NEVER">
53-
<children>
54-
<ComboBox fx:id="fieldComboBox" editable="true" maxHeight="1.7976931348623157E308" minHeight="36.0" prefHeight="36.0" prefWidth="184.0" HBox.hgrow="ALWAYS" />
55-
<TextField fx:id="fieldValueTextField" minHeight="32.0" minWidth="-Infinity" prefHeight="36.0" prefWidth="184.0" promptText="%Set or append content" HBox.hgrow="ALWAYS"/>
56-
</children>
57-
</HBox>
58-
<HBox alignment="BOTTOM_LEFT" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" GridPane.hgrow="ALWAYS" GridPane.rowSpan="2" GridPane.vgrow="ALWAYS">
59-
<children>
60-
<Label alignment="BOTTOM_LEFT" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" styleClass="sectionHeader" text="%Edit field content for selected entries">
61-
<HBox.margin>
62-
<Insets bottom="10.0" />
63-
</HBox.margin>
64-
</Label>
65-
</children>
66-
</HBox>
67-
</children>
68-
</GridPane>
69-
</children>
12+
<fx:root type="VBox" styleClass="edit-field-content-pane" xmlns="http://javafx.com/javafx/17"
13+
xmlns:fx="http://javafx.com/fxml/1"
14+
fx:controller="org.jabref.gui.edit.automaticfiededitor.editfieldcontent.EditFieldContentTabView">
15+
<Label styleClass="sectionHeader" text="%Edit field content for selected entries"/>
16+
<HBox styleClass="actions">
17+
<ComboBox fx:id="fieldComboBox" editable="true" HBox.hgrow="ALWAYS"/>
18+
<TextField fx:id="fieldValueTextField" promptText="%Set or append content" HBox.hgrow="ALWAYS"/>
19+
</HBox>
20+
<CheckBox fx:id="overwriteFieldContentCheckBox" mnemonicParsing="false" text="%Overwrite field content"/>
21+
<HBox styleClass="actions">
22+
<Button fx:id="setValueButton" mnemonicParsing="false" onAction="#setFieldValue" text="%Set"/>
23+
<Button fx:id="appendValueButton" mnemonicParsing="false" onAction="#appendToFieldValue"
24+
text="%Append"/>
25+
<Separator orientation="VERTICAL"/>
26+
<Button fx:id="clearFieldButton" mnemonicParsing="false" onAction="#clearField"
27+
text="%Clear field content">
28+
<graphic>
29+
<JabRefIconView glyph="DELETE_ENTRY"/>
30+
</graphic>
31+
</Button>
32+
</HBox>
7033
</fx:root>

0 commit comments

Comments
 (0)