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

Enhance "file" field in General Tab of Entry-Editor #8855

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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 @@ -9,7 +9,7 @@
<?import org.jabref.gui.icon.JabRefIconView?>
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="HBox" xmlns="http://javafx.com/javafx/8.0.112"
fx:controller="org.jabref.gui.fieldeditors.LinkedFilesEditor">
<ListView fx:id="listView" prefHeight="0" HBox.hgrow="ALWAYS" maxHeight="100" />
<ListView fx:id="listView" HBox.hgrow="ALWAYS"/>
<Button onAction="#addNewFile"
styleClass="icon-button">
<graphic>
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,16 @@ public Parent getNode() {

@FXML
private void addNewFile() {
viewModel.addNewFile();
// System.out.println(listView.getPrefHeight());
int number = viewModel.addNewFile();
if(number < 3)
return;
else{
listView.setMinHeight(number*20);
// listView.setPrefHeight(number*5);
System.out.println(listView.getPrefHeight());
}
//
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public ListProperty<LinkedFileViewModel> filesProperty() {
return files;
}

public void addNewFile() {
public int addNewFile() {
Path workingDirectory = databaseContext.getFirstExistingFileDir(preferences.getFilePreferences())
.orElse(preferences.getFilePreferences().getWorkingDirectory());

Expand All @@ -155,6 +155,7 @@ public void addNewFile() {
preferences,
externalFileTypes));
});
return files.size();
}

@Override
Expand Down