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

[WIP] Prefs: New layout for TableColumns -Tab #4927

Closed
wants to merge 3 commits 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 @@ -72,4 +72,9 @@ public String getOpenWithApplication() {
public JabRefIcon getIcon() {
return icon;
}

@Override
public String toString() {
return name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public PreferencesDialog(JabRefFrame parent, TaskExecutor taskExecutor) {
preferenceTabs.add(new GeneralTab(dialogService, prefs));
preferenceTabs.add(new FileTab(dialogService, prefs));
preferenceTabs.add(new TablePrefsTab(prefs));
preferenceTabs.add(new TableColumnsTab(prefs, frame));
preferenceTabs.add(new TableColumnsTab_Old(prefs, frame));
preferenceTabs.add(new PreviewPrefsTab(dialogService, ExternalFileTypes.getInstance(), taskExecutor));
preferenceTabs.add(new ExternalTab(frame, this, prefs));
preferenceTabs.add(new GroupsPrefsTab(prefs));
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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.ListView?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?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.CheckListView?>


<fx:root type="GridPane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.TableColumnsTabView">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label styleClass="sectionHeader" text="%Special table columns" />
<CheckListView fx:id="specialColumnsList" GridPane.rowIndex="4" />
<CheckBox mnemonicParsing="false" text="%Show URL/DOI column" GridPane.rowIndex="1" />
<RadioButton mnemonicParsing="false" text="%Show URL first" GridPane.rowIndex="2">
<toggleGroup>
<ToggleGroup fx:id="toggleDoiUrl" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="%Show DOI first" toggleGroup="$toggleDoiUrl" GridPane.rowIndex="3" />
<RadioButton mnemonicParsing="false" text="%Synchronize with keywords" GridPane.columnIndex="1" GridPane.rowIndex="1">
<toggleGroup>
<ToggleGroup fx:id="toggleSyncKeywords" />
</toggleGroup>
</RadioButton>
<RadioButton mnemonicParsing="false" text="%Write values of special fields as separate fields to BibTeX" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="\%Entry table columns" GridPane.rowIndex="5" />
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="6" />
<VBox GridPane.rowIndex="7">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TextField fx:id="name" promptText="name" />
<Button fx:id="addButton" mnemonicParsing="false" onAction="#addColumn" text="Add" />
<Button mnemonicParsing="false" onAction="#deleteSelectedColumn" text="Delete" />
</children>
</HBox>
<Button mnemonicParsing="false" onAction="#updateToCurrentColOrder" text="Update to current column order" />
</children>
</VBox>
<CheckListView fx:id="externalFillesTypesList" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="Show extra file columns" GridPane.columnIndex="1" GridPane.rowIndex="3" />
</children>
</fx:root>
57 changes: 57 additions & 0 deletions src/main/java/org/jabref/gui/preferences/TableColumnsTabView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.jabref.gui.preferences;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;

import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.model.entry.specialfields.SpecialField;

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

public class TableColumnsTabView extends GridPane {

@FXML private CheckListView<SpecialField> specialColumnsList;
@FXML private ToggleGroup toggleDoiUrl;
@FXML private ToggleGroup toggleSyncKeywords;
@FXML private TextField name;
@FXML private Button addButton;
@FXML private CheckListView<ExternalFileTypes> externalFillesTypesList;
private TableColumnsTabViewModel viewModel;

public TableColumnsTabView() {
ViewLoader.view(this)
.root(this)
.load();
}

@FXML
private void initialize() {
viewModel = new TableColumnsTabViewModel();
viewModel.enteredNameProperty().bind(name.textProperty());
}

@FXML
void addColumn(ActionEvent event) {
viewModel.addNewColumn();
}

@FXML
void deleteSelectedColumn(ActionEvent event) {

}

@FXML
void updateToCurrentColOrder(ActionEvent event) {

}

public void storeSettings() {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jabref.gui.preferences;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

import org.jabref.model.entry.specialfields.SpecialField;

public class TableColumnsTabViewModel {

private final StringProperty enteredNameProperty = new SimpleStringProperty("");
private final ObservableList<SpecialField> specialFieldColumns = FXCollections.emptyObservableList();

public TableColumnsTabViewModel() {

}

public void addNewColumn() {
// TODO Auto-generated method stub

}

public ObservableList<SpecialField> specialFieldColumnsProperty() {
return specialFieldColumns;
}

public StringProperty enteredNameProperty() {
return enteredNameProperty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.jabref.model.entry.BibtexSingleField;
import org.jabref.preferences.JabRefPreferences;

class TableColumnsTab extends Pane implements PrefsTab {
class TableColumnsTab_Old extends Pane implements PrefsTab {

private final JabRefPreferences prefs;
private boolean tableChanged;
Expand Down Expand Up @@ -90,7 +90,7 @@ class TableColumnsTab extends Pane implements PrefsTab {
*
* @param prefs a <code>JabRefPreferences</code> value
*/
public TableColumnsTab(JabRefPreferences prefs, JabRefFrame frame) {
public TableColumnsTab_Old(JabRefPreferences prefs, JabRefFrame frame) {
this.prefs = prefs;
this.frame = frame;

Expand Down Expand Up @@ -316,6 +316,7 @@ public void setValues() {
if (extraFileColumns.isSelected()) {
List<String> desiredColumns = prefs.getStringList(JabRefPreferences.LIST_OF_FILE_COLUMNS);
int listSize = listOfFileColumns.getSelectionModel().getSelectedIndex();

if (listSize < 0) {
listSize = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public String getFieldName() {
return fieldName;
}

@Override
public String toString()
{
return fieldName;
}

public boolean isSingleValueField() {
return this.values.size() == 1;
}
Expand Down