-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialog.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.Group?> | ||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.CheckBox?> | ||
<?import javafx.scene.control.ComboBox?> | ||
<?import javafx.scene.control.DialogPane?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.PasswordField?> | ||
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
<?import javafx.scene.layout.ColumnConstraints?> | ||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.scene.layout.RowConstraints?> | ||
|
||
|
||
<DialogPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.shared.SharedDatabaseLoginDialogView"> | ||
<content> | ||
<BorderPane> | ||
<center> | ||
<BorderPane BorderPane.alignment="CENTER"> | ||
<center> | ||
<GridPane> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||
</columnConstraints> | ||
<rowConstraints> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
</rowConstraints> | ||
<children> | ||
<Label text="Database Type:" /> | ||
<ComboBox fx:id="cmbDbType" prefHeight="25.0" prefWidth="606.0" GridPane.columnIndex="1" GridPane.columnSpan="2" /> | ||
<Label text="Host/Port:" GridPane.rowIndex="1" /> | ||
<TextField fx:id="tbHost" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | ||
<TextField fx:id="tbDb" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="2" /> | ||
<TextField fx:id="tbPort" prefHeight="25.0" prefWidth="66.0" GridPane.columnIndex="2" GridPane.rowIndex="1" /> | ||
<Label text="Database:" GridPane.rowIndex="2" /> | ||
<Label text="User:" GridPane.rowIndex="3" /> | ||
<TextField fx:id="tbUser" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="3" /> | ||
<Label text="Password:" GridPane.rowIndex="4" /> | ||
<PasswordField fx:id="tbPwd" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4" /> | ||
<CheckBox fx:id="chkRememberPassword" mnemonicParsing="false" text="Remember Password" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="5" /> | ||
</children> | ||
</GridPane> | ||
</center> | ||
<bottom> | ||
<GridPane BorderPane.alignment="CENTER"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | ||
</columnConstraints> | ||
<rowConstraints> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | ||
</rowConstraints> | ||
<children> | ||
<CheckBox mnemonicParsing="false" text="Automatically save library to" GridPane.columnSpan="2" /> | ||
<TextField fx:id="tbFolder" GridPane.rowIndex="1" /> | ||
<Button fx:id="btnBrowse" mnemonicParsing="false" onAction="#openFileDialog" text="Browse" GridPane.columnIndex="1" GridPane.rowIndex="1" /> | ||
<Group /> | ||
</children> | ||
</GridPane> | ||
</bottom> | ||
</BorderPane> | ||
</center> | ||
</BorderPane> | ||
</content> | ||
</DialogPane> |
72 changes: 72 additions & 0 deletions
72
src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.jabref.gui.shared; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Optional; | ||
|
||
import javax.inject.Inject; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.ButtonType; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.ComboBox; | ||
import javafx.scene.control.PasswordField; | ||
import javafx.scene.control.TextField; | ||
|
||
import org.jabref.Globals; | ||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.util.BaseDialog; | ||
import org.jabref.gui.util.FileDialogConfiguration; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.util.FileType; | ||
import org.jabref.model.database.shared.DBMSType; | ||
import org.jabref.preferences.JabRefPreferences; | ||
|
||
import com.airhacks.afterburner.views.ViewLoader; | ||
|
||
public class SharedDatabaseLoginDialogView extends BaseDialog<Void> { | ||
|
||
@FXML private ComboBox<DBMSType> cmbDbType; | ||
@FXML private TextField tbHost; | ||
@FXML private TextField tbDb; | ||
@FXML private TextField tbPort; | ||
@FXML private TextField tbUser; | ||
@FXML private PasswordField tbPwd; | ||
@FXML private CheckBox chkRememberPassword; | ||
@FXML private TextField tbFolder; | ||
@FXML private Button btnBrowse; | ||
|
||
@Inject private DialogService dialogService; | ||
|
||
private final SharedDatabaseLoginDialogViewModel viewModel; | ||
|
||
@FXML | ||
private void initialize() { | ||
//todo | ||
} | ||
|
||
public SharedDatabaseLoginDialogView() { | ||
this.setTitle(Localization.lang("Connect to shared database")); | ||
this.setResizable(true); | ||
|
||
this.getDialogPane().getButtonTypes().addAll(ButtonType.OK); | ||
|
||
viewModel = new SharedDatabaseLoginDialogViewModel(); | ||
|
||
ViewLoader.view(this) | ||
.load() | ||
.setAsContent(this.getDialogPane()); | ||
} | ||
|
||
@FXML | ||
void openFileDialog(ActionEvent event) { | ||
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() | ||
.addExtensionFilter(FileType.BIBTEX_DB) | ||
.withDefaultExtension(FileType.BIBTEX_DB) | ||
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)) | ||
.build(); | ||
Optional<Path> exportPath = dialogService.showFileSaveDialog(fileDialogConfiguration); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/jabref/gui/shared/SharedDatabaseLoginDialogViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.jabref.gui.shared; | ||
|
||
import org.jabref.gui.AbstractViewModel; | ||
|
||
public class SharedDatabaseLoginDialogViewModel extends AbstractViewModel { | ||
|
||
} |