server

Clone or download

refactored about tab

Modified Files

--- 'a/src/main/java/com/stream_pi/server/window/Base.java'
+++ b/src/main/java/com/stream_pi/server/window/Base.java
@@ -17,6 +17,8 @@ import com.stream_pi.util.loggerhelper.S
import com.stream_pi.util.platform.Platform;
import javafx.application.HostServices;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
import javafx.scene.image.Image;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
@@ -104,8 +106,8 @@ public abstract class Base extends Stack
getStage().getIcons().add(new Image(Main.class.getResourceAsStream("app_icon.png")));
- getStage().setMinWidth(500);
- getStage().setMinHeight(500);
+ getStage().setMinWidth(710);
+ getStage().setMinHeight(530);
serverInfo = ServerInfo.getInstance();
--- 'a/src/main/java/com/stream_pi/server/window/settings/About.java'
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.stream_pi.server.window.settings;
-
-import com.stream_pi.action_api.ActionAPI;
-import com.stream_pi.server.info.License;
-import com.stream_pi.server.info.ServerInfo;
-import com.stream_pi.server.Main;
-import javafx.application.HostServices;
-import javafx.geometry.Insets;
-import javafx.geometry.Pos;
-import javafx.scene.control.Hyperlink;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextArea;
-import javafx.scene.image.Image;
-import javafx.scene.image.ImageView;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.VBox;
-
-public class About extends VBox{
-
- private HostServices hostServices;
-
- public About(HostServices hostServices)
- {
- getStyleClass().add("about");
- this.hostServices = hostServices;
-
- setAlignment(Pos.TOP_CENTER);
-
- Image appIcon = new Image(Main.class.getResourceAsStream("app_icon.png"));
- ImageView appIconImageView = new ImageView(appIcon);
- appIconImageView.setFitHeight(196);
- appIconImageView.setFitWidth(182);
-
- Label licenseLabel = new Label("License");
- licenseLabel.getStyleClass().add("about_license_label");
-
- VBox.setMargin(licenseLabel, new Insets(20, 0 , 10 ,0));
-
- TextArea licenseTextArea = new TextArea(License.getLicense());
- licenseTextArea.getStyleClass().add("about_license_text_area");
- licenseTextArea.setWrapText(false);
- licenseTextArea.setEditable(false);
- licenseTextArea.setMaxWidth(600);
-
- VBox.setVgrow(licenseTextArea, Priority.ALWAYS);
-
- HBox links = new HBox();
- links.getStyleClass().add("about_links_box");
-
- Hyperlink github = new Hyperlink("GitHub");
- github.setOnAction(event -> openWebpage("https://github.com/Stream-Pi"));
-
- Hyperlink discord = new Hyperlink("Discord");
- discord.setOnAction(event -> openWebpage("https://discord.gg/BExqGmk"));
-
- Hyperlink website = new Hyperlink("Website");
- website.setOnAction(event -> openWebpage("https://stream-pi.com"));
-
- Hyperlink twitter = new Hyperlink("Twitter");
- twitter.setOnAction(event -> openWebpage("https://twitter.com/Stream_Pi"));
-
- Hyperlink matrix = new Hyperlink("Matrix");
- matrix.setOnAction(event -> openWebpage("https://matrix.to/#/#stream-pi_general:matrix.org"));
-
- links.setAlignment(Pos.CENTER);
- links.getChildren().addAll(github, matrix, discord, website, twitter);
-
- Hyperlink donateButton = new Hyperlink("DONATE");
- donateButton.setOnAction(event -> openWebpage("https://www.patreon.com/streampi"));
- donateButton.getStyleClass().add("about_donate_hyperlink");
-
- ServerInfo serverInfo = ServerInfo.getInstance();
-
- Label versionText = new Label(serverInfo.getVersion().getText() + " - "+ serverInfo.getPlatform().getUIName() + " - "+ serverInfo.getReleaseStatus().getUIName());
- versionText.getStyleClass().add("about_version_label");
-
- Label commStandardLabel = new Label("Comm Standard "+serverInfo.getCommStandardVersion().getText());
- commStandardLabel.getStyleClass().add("about_comm_standard_label");
-
- Label minThemeAPILabel = new Label("Min ThemeAPI "+serverInfo.getMinThemeSupportVersion().getText());
- minThemeAPILabel.getStyleClass().add("about_min_theme_api_label");
-
- Label minActionAPILabel = new Label("Min ActionAPI "+serverInfo.getMinPluginSupportVersion().getText());
- minActionAPILabel.getStyleClass().add("about_min_action_api_label");
-
- Label currentActionAPILabel = new Label("ActionAPI "+ ActionAPI.API_VERSION.getText());
- currentActionAPILabel.getStyleClass().add("about_current_action_api_label");
-
- getChildren().addAll(appIconImageView, licenseLabel, licenseTextArea, links, donateButton, versionText, commStandardLabel, minThemeAPILabel, minActionAPILabel, currentActionAPILabel);
- }
-
- public void openWebpage(String url) {
- hostServices.showDocument(url);
- }
-}
--- /dev/null
+++ b/src/main/java/com/stream_pi/server/window/settings/About/About.java
@@ -0,0 +1,95 @@
+package com.stream_pi.server.window.settings.About;
+
+import com.stream_pi.action_api.ActionAPI;
+import com.stream_pi.server.info.ServerInfo;
+import com.stream_pi.server.Main;
+import javafx.application.HostServices;
+import javafx.geometry.Pos;
+import javafx.scene.control.*;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.VBox;
+
+public class About extends VBox
+{
+
+ private HostServices hostServices;
+
+ public About(HostServices hostServices)
+ {
+ getStyleClass().add("about");
+ this.hostServices = hostServices;
+
+ setAlignment(Pos.TOP_CENTER);
+
+ Image appIcon = new Image(Main.class.getResourceAsStream("app_icon.png"));
+ ImageView appIconImageView = new ImageView(appIcon);
+ appIconImageView.setFitHeight(196);
+ appIconImageView.setFitWidth(182);
+
+ TabPane tabPane = new TabPane();
+ tabPane.getStyleClass().add("settings_about_tab_internal");
+ tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
+ tabPane.setMaxWidth(600);
+ VBox.setVgrow(tabPane, Priority.ALWAYS);
+
+ Tab licenseTab = new Tab("License");
+ licenseTab.setContent(new LicenseTab());
+
+
+ Tab contributorsTab = new Tab("Contributors");
+ contributorsTab.setContent(new ContributorsTab());
+
+ Tab contactTab = new Tab("Contact");
+ contactTab.setContent(new ContactTab(hostServices));
+
+ tabPane.getTabs().addAll(licenseTab, contributorsTab, contactTab);
+
+
+ Hyperlink donateButton = new Hyperlink("DONATE");
+ donateButton.setOnAction(event -> openWebpage("https://www.patreon.com/streampi"));
+ donateButton.getStyleClass().add("about_donate_hyperlink");
+
+ ServerInfo serverInfo = ServerInfo.getInstance();
+
+ Label versionText = new Label(serverInfo.getVersion().getText() + " - "+ serverInfo.getPlatform().getUIName() + " - "+ serverInfo.getReleaseStatus().getUIName());
+ versionText.getStyleClass().add("about_version_label");
+
+ Label commStandardLabel = new Label("Comm Standard "+serverInfo.getCommStandardVersion().getText());
+ commStandardLabel.getStyleClass().add("about_comm_standard_label");
+
+ Label minThemeAPILabel = new Label("Min ThemeAPI "+serverInfo.getMinThemeSupportVersion().getText());
+ minThemeAPILabel.getStyleClass().add("about_min_theme_api_label");
+
+ Label minActionAPILabel = new Label("Min ActionAPI "+serverInfo.getMinPluginSupportVersion().getText());
+ minActionAPILabel.getStyleClass().add("about_min_action_api_label");
+
+ Label currentActionAPILabel = new Label("ActionAPI "+ ActionAPI.API_VERSION.getText());
+ currentActionAPILabel.getStyleClass().add("about_current_action_api_label");
+
+ HBox hBox = new HBox(versionText, getSep(),
+ commStandardLabel, getSep(),
+ minThemeAPILabel, getSep(),
+ minActionAPILabel, getSep(),
+ currentActionAPILabel);
+
+ hBox.setAlignment(Pos.CENTER);
+ hBox.setSpacing(10);
+
+ getChildren().addAll(appIconImageView, tabPane, donateButton, hBox);
+ }
+
+ public void openWebpage(String url)
+ {
+ hostServices.showDocument(url);
+ }
+
+ private Label getSep()
+ {
+ Label label = new Label("|");
+ label.getStyleClass().add("separator_ui_label");
+ return label;
+ }
+}
--- /dev/null
+++ b/src/main/java/com/stream_pi/server/window/settings/About/ContactTab.java
@@ -0,0 +1,49 @@
+package com.stream_pi.server.window.settings.About;
+
+import javafx.application.HostServices;
+import javafx.geometry.Insets;
+import javafx.scene.control.Hyperlink;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.layout.VBox;
+
+
+public class ContactTab extends ScrollPane
+{
+ private final HostServices hostServices;
+
+
+ public ContactTab(HostServices hostServices)
+ {
+ this.hostServices = hostServices;
+
+ getStyleClass().add("about_contact_tab_scroll_pane");
+
+ Hyperlink github = new Hyperlink("GitHub");
+ github.setOnAction(event -> openWebpage("https://github.com/Stream-Pi"));
+
+ Hyperlink discord = new Hyperlink("Discord");
+ discord.setOnAction(event -> openWebpage("https://discord.gg/BExqGmk"));
+
+ Hyperlink website = new Hyperlink("Website");
+ website.setOnAction(event -> openWebpage("https://stream-pi.com"));
+
+ Hyperlink twitter = new Hyperlink("Twitter");
+ twitter.setOnAction(event -> openWebpage("https://twitter.com/Stream_Pi"));
+
+ Hyperlink matrix = new Hyperlink("Matrix");
+ matrix.setOnAction(event -> openWebpage("https://matrix.to/#/#stream-pi_general:matrix.org"));
+
+
+ VBox vBox = new VBox(github, discord, website, twitter, matrix);
+ vBox.setSpacing(10.0);
+
+ setContent(vBox);
+ }
+
+
+ public void openWebpage(String url)
+ {
+ hostServices.showDocument(url);
+ }
+
+}
--- /dev/null
+++ b/src/main/java/com/stream_pi/server/window/settings/About/Contributor.java
@@ -0,0 +1,49 @@
+package com.stream_pi.server.window.settings.About;
+
+public class Contributor
+{
+ private String name = null;
+ private String email = null;
+ private String description = null;
+ private String location = null;
+
+ public Contributor(String name, String email, String description, String location)
+ {
+ this.name = name;
+ this.email = email;
+ this.description = description;
+ this.location = location;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+}
\ No newline at end of file
--- /dev/null
+++ b/src/main/java/com/stream_pi/server/window/settings/About/ContributorsTab.java
@@ -0,0 +1,75 @@
+package com.stream_pi.server.window.settings.About;
+
+import javafx.scene.control.Label;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.scene.layout.VBox;
+
+public class ContributorsTab extends VBox
+{
+
+ public ContributorsTab()
+ {
+ getStyleClass().add("about_license_contributors_vbox");
+
+ TableView<Contributor> tableView = new TableView<>();
+ tableView.getStyleClass().add("about_license_contributors_table_view");
+
+ TableColumn<Contributor, String> descriptionColumn = new TableColumn<>("Description");
+ descriptionColumn.setReorderable(false);
+ descriptionColumn.setPrefWidth(170);
+ descriptionColumn.setResizable(false);
+ descriptionColumn.setCellValueFactory(new PropertyValueFactory<>("description"));
+
+ TableColumn<Contributor, String> nameColumn = new TableColumn<>("Name (GitHub)");
+ nameColumn.setReorderable(false);
+ nameColumn.setPrefWidth(220);
+ nameColumn.setResizable(false);
+ nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
+
+ TableColumn<Contributor, String> emailColumn = new TableColumn<>("Email");
+ emailColumn.setReorderable(false);
+ emailColumn.setPrefWidth(200);
+ emailColumn.setResizable(false);
+ emailColumn.setCellValueFactory(new PropertyValueFactory<>("email"));
+
+ TableColumn<Contributor, String> locationColumn = new TableColumn<>("Location");
+ locationColumn.setReorderable(false);
+ locationColumn.setPrefWidth(100);
+ locationColumn.setResizable(false);
+ locationColumn.setCellValueFactory(new PropertyValueFactory<>("location"));
+
+
+ tableView.getColumns().addAll(descriptionColumn, nameColumn, emailColumn, locationColumn);
+
+ tableView.setPrefWidth(descriptionColumn.getPrefWidth() + nameColumn.getPrefWidth() + emailColumn.getPrefWidth());
+
+
+
+ tableView.getItems().addAll(
+ new Contributor("Debayan Sutradhar (rnayabed)",
+ "debayansutradhar3@gmail.com",
+ "Original Author, Maintainer",
+ "India"),
+ new Contributor("Abhinay Agarwal (abhinayagarwal)",
+ "",
+ "Refactoring, Minor Fixes",
+ "India"),
+ new Contributor("Jordan Duabe (j4ckofalltrades)",
+ "jordan.duabe@gmail.com",
+ "Minor Fix (#0dafac9)",
+ "Australia")
+ );
+
+ Label disclaimerLabel = new Label("This contributor list shows only those who have contributed " +
+ "to the Server Source code.\nTo know about the contributors of Action API, Theme API, Util, " +
+ "visit the respective repositories.");
+
+ disclaimerLabel.getStyleClass().add("about_license_contributors_disclaimer_label");
+
+ disclaimerLabel.setWrapText(true);
+
+ getChildren().addAll(tableView, disclaimerLabel);
+ }
+}
--- /dev/null
+++ b/src/main/java/com/stream_pi/server/window/settings/About/LicenseTab.java
@@ -0,0 +1,16 @@
+package com.stream_pi.server.window.settings.About;
+
+
+import com.stream_pi.server.info.License;
+import javafx.scene.control.TextArea;
+
+public class LicenseTab extends TextArea
+{
+ public LicenseTab()
+ {
+ setText(License.getLicense());
+ getStyleClass().add("about_license_text_area");
+ setWrapText(false);
+ setEditable(false);
+ }
+}
--- 'a/src/main/java/com/stream_pi/server/window/settings/SettingsBase.java'
+++ b/src/main/java/com/stream_pi/server/window/settings/SettingsBase.java
@@ -2,6 +2,7 @@ package com.stream_pi.server.window.sett
import com.stream_pi.server.connection.ServerListener;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
+import com.stream_pi.server.window.settings.About.About;
import javafx.application.HostServices;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
--- 'a/src/main/java/module-info.java'
+++ b/src/main/java/module-info.java
@@ -1,4 +1,5 @@
-module com.stream_pi.server {
+module com.stream_pi.server
+{
uses com.stream_pi.action_api.action.Action;
uses com.stream_pi.action_api.externalplugin.NormalAction;
@@ -21,5 +22,8 @@ module com.stream_pi.server {
requires java.sql;
+ opens com.stream_pi.server.window.settings;
+
exports com.stream_pi.server;
+ opens com.stream_pi.server.window.settings.About;
}
\ No newline at end of file
--- 'a/src/main/resources/com/stream_pi/server/style.css'
+++ b/src/main/resources/com/stream_pi/server/style.css
@@ -272,4 +272,14 @@
.split-pane-divider {
-fx-padding: 2;
+}
+
+.separator_ui_label
+{
+ -fx-text-fill: grey;
+}
+
+.about_license_contributors_disclaimer_label
+{
+ -fx-min-height : 50;
}
\ No newline at end of file
M style_classes.txt
+8 −3
--- 'a/style_classes.txt'
+++ b/style_classes.txt
@@ -101,9 +101,14 @@ settings
Each Titled Pane - client_settings_each_client_accordion_each_titled_pane
Content VBox - client_settings_each_client_accordion_each_profile_box
About - about
- License Label - about_license_label
- License Text Area - about_license_text_area
- Links HBox - about_links_box
+
+ Tab Pane - settings_about_tab_internal
+ License Tab (Text Area) - about_license_text_area
+ Contributors Tab (VBox) - about_license_contributors_vbox
+ Table View - about_license_contributors_table_view
+ Disclaimer Label - about_license_contributors_disclaimer_label
+ Contact Tab (Scroll Pane) - about_contact_tab_scroll_pane
+
DONATE Hyperlink - about_donate_hyperlink
Version Label - about_version_label