diff --git a/app/test.db b/app/test.db index f17322e832c408160978f6df80006c12296efe34..6b5878f33d62e1e63eec27b42ffdcff61c932700 100644 Binary files a/app/test.db and b/app/test.db differ diff --git a/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt b/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt index 972b6a238a1540fa0487d680c3b1c8586275c611..b6bcedb347fa0ed1e8c88809e173da778dd3dc0b 100644 --- a/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt +++ b/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt @@ -28,6 +28,7 @@ import java.util.* // http://localhost:8080/images/ const val IMAGE_MICROSERVICE = "http://18.117.170.43:8080/notes-app-images/images/" + /** * - Displays a responsive `TextArea` in a window with the text of the file passed to the `Application.launch` function * - Parameters are passed through the second parameter of the `Application.launch` in this format: @@ -141,12 +142,19 @@ class TextWindow(): Application() { notesview.columnResizePolicy = TableView.CONSTRAINED_RESIZE_POLICY + notesview.setOnMouseClicked { event-> val index = notesview.selectionModel.selectedIndex if (index != -1) { if (event.clickCount == 2) { val tempnote = DatabaseOperations.getNote(obsfs[index].id) textarea.htmlText = tempnote.text.toString() + + if(isDarkMode){ + //textarea.stylesheets.add("newFile.css") + toggleDarkMode(stage.scene, textarea, isDarkMode) + isDarkMode = !isDarkMode + } stage.title = tempnote.title browser.close() curfile = tempnote @@ -155,6 +163,7 @@ class TextWindow(): Application() { } } + val delete = Button("Delete") val open = Button("Open") @@ -163,6 +172,10 @@ class TextWindow(): Application() { if (index != -1) { val tempnote = DatabaseOperations.getNote(obsfs[index].id) textarea.htmlText = tempnote.text.toString() + if(isDarkMode){ + toggleDarkMode(stage.scene, textarea, isDarkMode) + isDarkMode = !isDarkMode + } stage.title = tempnote.title browser.close() curfile = tempnote @@ -176,13 +189,27 @@ class TextWindow(): Application() { val tempnote = DatabaseOperations.getNote(obsfs[index].id) if (curfile.id == tempnote.id) { val warning = Alert(Alert.AlertType.ERROR) + val dialogPane: DialogPane = warning.dialogPane + if(isDarkMode){ + dialogPane.stylesheets.add("alertStylesheet.css") + }else{ + dialogPane.stylesheets.remove("alertStylesheet.css") + } warning.title = "ERROR" warning.contentText = "This file is opened in program" warning.showAndWait() } else { val warningdel = Alert(Alert.AlertType.CONFIRMATION) + warningdel.title = "DELETE" - warningdel.contentText = "Do you delete this file?" + warningdel.contentText = "Do you want to delete this file?" + + val dialogPane: DialogPane = warningdel.dialogPane + if(isDarkMode){ + dialogPane.stylesheets.add("alertStylesheet.css") + }else{ + dialogPane.stylesheets.remove("alertStylesheet.css") + } val result = warningdel.showAndWait() if (result.isPresent) { when (result.get()) { @@ -197,10 +224,14 @@ class TextWindow(): Application() { } val buttoncontainer = HBox(10.0, open, delete) - val generalcontainer = VBox(notesview, buttoncontainer) VBox.setVgrow(notesview, Priority.ALWAYS) browser.scene = Scene(generalcontainer) + if(isDarkMode){ + addDarkModeBrowser(browser.scene) + }else{ + removeDarkModeBrowser(browser.scene) + } browser.show() } @@ -209,6 +240,19 @@ class TextWindow(): Application() { val warning = Alert(Alert.AlertType.CONFIRMATION) warning.title = "SAVE" warning.contentText = "Do you want to save this file?" + + val dialogPane: DialogPane = warning.dialogPane + + + if(isDarkMode){ + dialogPane.stylesheets.add("alertStylesheet.css") +// dialogPane.style = "-fx-background-color: black; -fx-text-background-color: white; -" + + }else{ + dialogPane.stylesheets.remove("alertStylesheet.css") +// dialogPane.style = "-fx-background-color: white; -fx-text-background-color: black;" + } + val result = warning.showAndWait() if (result.isPresent) { when (result.get()) { @@ -358,6 +402,7 @@ class TextWindow(): Application() { val box = VBox(menubar, anchor) VBox.setVgrow(anchor, Priority.ALWAYS) + stage.scene = Scene(box, 300.0, 300.0) diff --git a/utilities/src/main/kotlin/notes/multi/utilities/Themes.kt b/utilities/src/main/kotlin/notes/multi/utilities/Themes.kt index 89bdd53b4fb5b86a98864e659f97adad591eca3c..89eec603c1cf6301fd39b01a855e9010c1fcb10a 100644 --- a/utilities/src/main/kotlin/notes/multi/utilities/Themes.kt +++ b/utilities/src/main/kotlin/notes/multi/utilities/Themes.kt @@ -11,7 +11,7 @@ import javafx.scene.layout.VBox import javafx.scene.paint.Color import javafx.scene.text.Font import javafx.scene.web.HTMLEditor -import javafx.scene.web.WebView; +import javafx.scene.web.WebView import javax.swing.text.html.StyleSheet fun toggleDarkMode(scene: Scene, editor: HTMLEditor, isDarkMode: Boolean) { @@ -33,4 +33,26 @@ fun toggleDarkMode(scene: Scene, editor: HTMLEditor, isDarkMode: Boolean) { } //isDarkMode = !isDarkMode +} + +fun addNewDarkMode(scene: Scene, editor: HTMLEditor) { + editor.htmlText = "<body style='background-color: #black;'" + editor.htmlText + editor.style = "-fx-background-color: #black;" + scene.stylesheets.add("newFile.css") + +} + +fun removeDarkMode(scene: Scene, editor: HTMLEditor){ + editor.style = "-fx-background-color: white;" + editor.htmlText = "<body style='background-color: white;'" + editor.htmlText + scene.stylesheets.remove("newFile.css") +} +fun addDarkModeBrowser(scene: Scene) { + scene.stylesheets.add("darkthemeBrowser.css") + //isDarkMode = !isDarkMode +} + +fun removeDarkModeBrowser(scene: Scene) { + scene.stylesheets.remove("darkthemeBrowser.css") + //isDarkMode = !isDarkMode } \ No newline at end of file diff --git a/utilities/src/main/resources/alertStylesheet.css b/utilities/src/main/resources/alertStylesheet.css new file mode 100644 index 0000000000000000000000000000000000000000..1c2d2a37ce62ced87ad453fd7a0564012552ea2a --- /dev/null +++ b/utilities/src/main/resources/alertStylesheet.css @@ -0,0 +1,61 @@ +dialog-pane { + -fx-background-color: black; + -fx-padding: 0; +} + +.root{ + -fx-text-background-color: #827e7e; +} + +.dialog-pane:header .header-panel { + /*-fx-padding: 0.833em 1.166em 0.833em 1.166em; *//* 10px 14px 10px 14px */ + -fx-padding: 0.833em; /* 10px */ + -fx-background-color: black; + -fx-background-insets: 0, 0 0 1 0; +} + +.dialog-pane:header .header-panel .label { + -fx-font-size: 1.167em; /* 14px */ + -fx-wrap-text: true; +} + +.dialog-pane:header .header-panel .graphic-container { + /* This prevents the text in the header running directly into the graphic */ + -fx-padding: 0 0 0 0.833em; /* 0px 0px 0px 10px */ +} + +.dialog-pane > .button-bar > .container > .details-button { + -fx-alignment: baseline-left; + -fx-focus-traversable: false; + -fx-padding: 0.416em; /* 5px */ +} + +.dialog-pane > .button-bar > .container > .details-button.more { + -fx-graphic: url("dialog-more-details.png"); +} + +.dialog-pane > .button-bar > .container > .details-button.less { + -fx-graphic: url("dialog-fewer-details.png"); +} + +.dialog-pane > .button-bar > .container > .details-button:hover { + -fx-underline: true; +} + +.alert.confirmation.dialog-pane, +.text-input-dialog.dialog-pane, +.choice-dialog.dialog-pane { + -fx-graphic: url("dialog-confirm.png"); +} + +.alert.information.dialog-pane { + -fx-graphic: url("dialog-information.png"); +} + +.alert.error.dialog-pane { + -fx-graphic: url("dialog-error.png"); +} + +.alert.warning.dialog-pane { + -fx-graphic: url("dialog-warning.png"); +} \ No newline at end of file diff --git a/utilities/src/main/resources/darktheme.css b/utilities/src/main/resources/darktheme.css index 420062392af3dc148e872bdaff9fcbfe027cabc2..87c2f97405482f84cc68a6ef407d367164d11339 100644 --- a/utilities/src/main/resources/darktheme.css +++ b/utilities/src/main/resources/darktheme.css @@ -11,9 +11,10 @@ } #textarea .html-editor .web-view { - -fx-background-color: #f0f0f0; + -fx-background-color: black; } + .html-editor-foreground, .html-editor-background { -fx-color-label-visible: true; -fx-color-rect-x: 0; @@ -23,6 +24,11 @@ -fx-padding: 0; } +.dialog-pane { + -fx-background-color: black; + -fx-padding: 0; +} + /*.html-editor .button, .html-editor .toggle-button, .html-editor .color-picker { -fx-background-color: #292929; -fx-border-color: #E0E0E0; diff --git a/utilities/src/main/resources/darkthemeBrowser.css b/utilities/src/main/resources/darkthemeBrowser.css new file mode 100644 index 0000000000000000000000000000000000000000..297d23e3edbeaee0676c2ff5add5140bb3f47ba5 --- /dev/null +++ b/utilities/src/main/resources/darkthemeBrowser.css @@ -0,0 +1,55 @@ + + +.table-view .column-header { + -fx-background-color: #424140; + -fx-text-background-color: white; +} + +.table-view .table-cell{ + -fx-border-color: transparent; + -fx-padding: 2 0 2 10px; +} +.table-row-cell: hover { + -fx-background-color: #f56e3d; + -fx-text-background-color: orange; +} +.table-row-cell: odd{ + -fx-background-color: #1e1e1f; + -fx-background-insets: 0, 0 0 1 0; + -fx-padding: 0.0em; + -fx-text-background-color: white; +} +.table-row-cell: even{ + -fx-background-color: #48494a; + -fx-background-insets: 0, 0 0 1 0; + -fx-padding: 0.0em; + -fx-text-background-color: white; +} +.table-row-cell:selected { + -fx-background-color: #f7561b; + -fx-background-insets: 0; + -fx-background-radius: 1; +} +.root{ + -fx-background-color: #262626; +} +.table-view .virtual-flow .scroll-bar:vertical, +.table-view .virtual-flow .scroll-bar:vertical .track, +.table-view .virtual-flow .scroll-bar:vertical .track-background, +.table-view .virtual-flow .scroll-bar:horizontal, +.table-view .virtual-flow .scroll-bar:horizontal .track, +.table-view .virtual-flow .scroll-bar:horizontal .track-background { + -fx-background-color: black; +} + +.table-view .corner { + -fx-background-color: black; +} +.table-view .footer { + -fx-background-color: black; + -fx-text-fill: white; + -fx-font-weight: bold; + -fx-alignment: center-right; + -fx-padding: 5px; +} + diff --git a/utilities/src/main/resources/newFile.css b/utilities/src/main/resources/newFile.css new file mode 100644 index 0000000000000000000000000000000000000000..262a6780044e204ce535221787d467de18de45c9 --- /dev/null +++ b/utilities/src/main/resources/newFile.css @@ -0,0 +1,3 @@ +.text-area .content{ + -fx-background-color: black; + } \ No newline at end of file