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

Convert OO/LO SidePanel to javafx #4341

Merged
merged 53 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
79f472f
Convert OO/LO SidePanel to javafx
Siedlerchr Sep 13, 2018
42b178f
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Sep 13, 2018
6eb4ea8
rework first part of select style dialog
Siedlerchr Sep 14, 2018
0774664
add icon to delete style
Siedlerchr Sep 14, 2018
b638601
store settings, show path
Siedlerchr Sep 15, 2018
b2906b0
update from scence builder
Siedlerchr Sep 15, 2018
19e7302
fix ok button
Siedlerchr Sep 15, 2018
e044a70
add title for canceable progess dialog
Siedlerchr Sep 16, 2018
b8311e8
formatting
Siedlerchr Sep 16, 2018
9432dca
Create custom dialog which returns a dialog object
Siedlerchr Sep 22, 2018
f5470b6
pass keybinding repo as dependency
Siedlerchr Sep 22, 2018
69e9fe5
add new dialog for advanced cite
Siedlerchr Sep 23, 2018
b92445b
reload preferences in connect
Siedlerchr Sep 23, 2018
a18a88c
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Oct 13, 2018
cd7fdcb
fix checkstyle
Siedlerchr Oct 14, 2018
3a7ef14
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Oct 27, 2018
df6d717
further implement viewModel
Siedlerchr Oct 27, 2018
f9765fc
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Nov 3, 2018
aa7e740
implement viewModel
Siedlerchr Nov 3, 2018
7160ba4
remove submodule
Siedlerchr Nov 3, 2018
b7ee084
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Nov 10, 2018
44b4ef7
Display Manage citations as TextFlow in the table
Siedlerchr Nov 10, 2018
7746782
fix checkstyle
Siedlerchr Nov 10, 2018
93ac650
rework page info
Siedlerchr Nov 11, 2018
04bea3e
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Nov 17, 2018
a7ea530
use flowpane instead of textflow to prevent table row height increasing
Siedlerchr Nov 17, 2018
0c8a959
cleanup and fix codacy issues
Siedlerchr Nov 17, 2018
3b9d6c4
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Nov 25, 2018
8be8bdc
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Dec 1, 2018
3e4d135
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Dec 23, 2018
fcce787
rework dialogs
Siedlerchr Dec 23, 2018
6244c49
rework constructor and rename to CitationEntryViewModel
Siedlerchr Dec 23, 2018
ab41334
fix checkstyle and l10n issues
Siedlerchr Dec 23, 2018
ff8f419
fix order
Siedlerchr Dec 23, 2018
e9e6dfa
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Dec 24, 2018
b5fdf0e
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Dec 28, 2018
e86e396
fix style file select layout and inline variable'
Siedlerchr Dec 28, 2018
404064c
Add Book as preview as well
LinusDietz Dec 28, 2018
e9db967
Merge remote-tracking branch 'origin/ooPanel' into ooPanel
LinusDietz Dec 28, 2018
3f2ba61
change mac default settings to LO path
Siedlerchr Dec 28, 2018
b4ac024
checkstyle
Siedlerchr Dec 28, 2018
e83078e
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Dec 29, 2018
126ef78
Merge branch 'ooPanel' of github.com:JabRef/jabref into ooPanel
Siedlerchr Jan 3, 2019
50d1bd9
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Jan 10, 2019
083e83f
fix merge error
Siedlerchr Jan 10, 2019
002365e
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Jan 10, 2019
c90c1fd
first part of refactoring
Siedlerchr Jan 12, 2019
abe28b5
refactor and remove/fix obsolete tests
Siedlerchr Jan 12, 2019
2ec3fc1
Fixes #4576
Siedlerchr Jan 12, 2019
ce5daaa
Merge remote-tracking branch 'upstream/master' into ooPanel
Siedlerchr Jan 14, 2019
04676ac
use progessbar from fxdialogs
Siedlerchr Jan 14, 2019
0aa25c3
Fix autodetecting open office paths in background thread
Siedlerchr Jan 19, 2019
4987f06
fix checkstyle
Siedlerchr Jan 19, 2019
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
16 changes: 12 additions & 4 deletions src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ default void showErrorDialogAndWait(Exception exception) {
* @return true if the use clicked "YES" otherwise false
*/
boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
String optOutMessage, Consumer<Boolean> optOutAction);
String optOutMessage, Consumer<Boolean> optOutAction);

/**
* Create and display a new confirmation dialog.
Expand All @@ -151,8 +151,8 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
* @return true if the use clicked "YES" otherwise false
*/
boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
String okButtonLabel, String cancelButtonLabel,
String optOutMessage, Consumer<Boolean> optOutAction);
String okButtonLabel, String cancelButtonLabel,
String optOutMessage, Consumer<Boolean> optOutAction);

/**
* This will create and display a new dialog of the specified
Expand All @@ -162,7 +162,7 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
* @return Optional with the pressed Button as ButtonType
*/
Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String title, String content,
ButtonType... buttonTypes);
ButtonType... buttonTypes);

/**
* This will create and display a new dialog showing a custom {@link DialogPane}
Expand All @@ -172,6 +172,14 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
*/
Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane contentPane, ButtonType... buttonTypes);

/**
* This will create and display a new dialog showing a custom {@link DialogPane}
* and using custom {@link ButtonType}s.
*
* @return The created {@link FXDialog}
*/
FXDialog showCustomDialog(String title, DialogPane contentPane, ButtonType... buttonTypes);
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved

/**
* Shows a custom dialog and returns the result.
*
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/gui/FXDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con
return alert.showAndWait();
}

@Override
public FXDialog showCustomDialog(String title, DialogPane contentPane,
ButtonType... buttonTypes) {
FXDialog alert = new FXDialog(AlertType.NONE, title);
alert.setDialogPane(contentPane);
alert.getButtonTypes().setAll(buttonTypes);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(true);
return alert;
}
@Override
public <R> Optional<R> showCustomDialogAndWait(Dialog<R> dialog) {
return dialog.showAndWait();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/SidePaneManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public SidePaneManager(JabRefPreferences preferences, JabRefFrame frame) {
Stream.of(
new FileUpdatePanel(this),
new GroupSidePane(this, preferences, frame.getDialogService()),
new WebSearchPane(this, preferences, frame),
new OpenOfficeSidePanel(this, openOfficePreferences, frame))
new WebSearchPane(this, preferences, frame),
new OpenOfficeSidePanel(this, preferences, frame))
.forEach(pane -> components.put(pane.getType(), pane));

if (preferences.getBoolean(JabRefPreferences.GROUP_SIDEPANE_VISIBLE)) {
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/org/jabref/gui/openoffice/AdvancedCiteDialog.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.ButtonType?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<DialogPane prefHeight="182.0" prefWidth="390.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.openoffice.AdvancedCiteDialogView">
<content>
<VBox>
<fx:define>
<ToggleGroup fx:id="citeToggleGroup" />
</fx:define>
<children>
<RadioButton fx:id="inPar" minWidth="-Infinity" mnemonicParsing="false" text="%Cite selected entries between parenthesis">
<toggleGroup>
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
<ToggleGroup fx:id="citeToggleGroup" />
</toggleGroup>
</RadioButton>
<RadioButton fx:id="inText" minWidth="-Infinity" mnemonicParsing="false" text="%Cite selected entries with in-text citation" toggleGroup="$citeToggleGroup" />
<Label minWidth="-Infinity" text="%Extra information (e.g. page number)" />
<TextField fx:id="pageInfo" />
</children>
</VBox>
</content>
<buttonTypes>
<ButtonType fx:constant="CANCEL" />
<ButtonType fx:constant="OK" />
</buttonTypes>
</DialogPane>
113 changes: 0 additions & 113 deletions src/main/java/org/jabref/gui/openoffice/AdvancedCiteDialog.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.jabref.gui.openoffice;

import javafx.fxml.FXML;
import javafx.scene.control.ButtonType;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;

import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.l10n.Localization;

import com.airhacks.afterburner.views.ViewLoader;

public class AdvancedCiteDialogView extends BaseDialog<AdvancedCiteDialogViewModel> {

@FXML private TextField pageInfo;
@FXML private RadioButton inPar;
@FXML private RadioButton inText;
@FXML private ToggleGroup citeToggleGroup;
private AdvancedCiteDialogViewModel viewModel;

public AdvancedCiteDialogView() {

ViewLoader.view(this)
.load()
.setAsDialogPane(this);
setResultConverter(btn -> {
if (btn == ButtonType.OK) {
return viewModel;
}
return null;
});

setTitle(Localization.lang("Cite special"));
}

@FXML
private void initialize() {
viewModel = new AdvancedCiteDialogViewModel();

inPar.selectedProperty().bindBidirectional(viewModel.citeInParProperty());
inText.selectedProperty().bindBidirectional(viewModel.citeInTextProperty());
pageInfo.textProperty().bindBidirectional(viewModel.pageInfoProperty());

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

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class AdvancedCiteDialogViewModel {

private final StringProperty pageInfo = new SimpleStringProperty("");
private final BooleanProperty citeInPar = new SimpleBooleanProperty();
private final BooleanProperty citeInText = new SimpleBooleanProperty();

public StringProperty pageInfoProperty() {
return pageInfo;
}

public BooleanProperty citeInParProperty() {
return citeInPar;
}

public BooleanProperty citeInTextProperty() {
return citeInText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class BibEntryNotFoundException extends Exception {

private final String bibtexKey;


public BibEntryNotFoundException(String bibtexKey, String message) {
super(message);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.jabref.gui.openoffice;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import org.jabref.logic.openoffice.CitationEntry;

public class CitationEntryViewModel {

private final StringProperty citation = new SimpleStringProperty("");
private final StringProperty extraInformation = new SimpleStringProperty("");
private final String refMarkName;

public CitationEntryViewModel(String refMarkName, String citation, String extraInfo) {
this.refMarkName = refMarkName;
this.citation.setValue(citation);
this.extraInformation.setValue(extraInfo);
}

public CitationEntryViewModel(CitationEntry citationEntry) {
this(citationEntry.getRefMarkName(), citationEntry.getContext(), citationEntry.getPageInfo().orElse(""));
}

public CitationEntry toCitationEntry() {
return new CitationEntry(refMarkName, citation.getValue(), extraInformation.getValue());
}

public StringProperty citationProperty() {
return citation;
}

public StringProperty extraInformationProperty() {
return extraInformation;
}

public void setExtraInfo(String extraInfo) {
extraInformation.setValue(extraInfo);
}

}
Loading