mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-03-30 04:31:04 +02:00
Update information service mechanic implemented
This commit is contained in:
@@ -6,6 +6,14 @@ public class ApplicationConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String APPLICATION_NAME = "praktiKST";
|
public static final String APPLICATION_NAME = "praktiKST";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of file to store preferences in.
|
||||||
|
*/
|
||||||
|
public static final double APPLICATION_CURRENTVERSIONNUMBER = 0.9;
|
||||||
|
|
||||||
|
public static final String VERSIONINFOURLFORUPDATES_KST4CONTEST = "https://do5amf.funkerportal.de/kst4ContestVersionInfo.xml";
|
||||||
|
public static final String VERSIONINFDOWNLOADEDLOCALFILE = "kst4ContestVersionInfo.xml";
|
||||||
|
|
||||||
public static final String DISCSTRING_DISCONNECT_AND_CLOSE = "CLOSEALL";
|
public static final String DISCSTRING_DISCONNECT_AND_CLOSE = "CLOSEALL";
|
||||||
public static final String DISCSTRING_DISCONNECT_DUE_PAWWORDERROR = "JUSTDSICCAUSEPWWRONG";
|
public static final String DISCSTRING_DISCONNECT_DUE_PAWWORDERROR = "JUSTDSICCAUSEPWWRONG";
|
||||||
public static final String DISCSTRING_DISCONNECTONLY = "ONLYDISCONNECT";
|
public static final String DISCSTRING_DISCONNECTONLY = "ONLYDISCONNECT";
|
||||||
|
|||||||
@@ -16,11 +16,7 @@ import javafx.beans.value.ObservableStringValue;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import kst4contest.ApplicationConstants;
|
import kst4contest.ApplicationConstants;
|
||||||
import kst4contest.model.ChatCategory;
|
import kst4contest.model.*;
|
||||||
import kst4contest.model.ChatMember;
|
|
||||||
import kst4contest.model.ChatMessage;
|
|
||||||
import kst4contest.model.ChatPreferences;
|
|
||||||
import kst4contest.model.ClusterMessage;
|
|
||||||
import kst4contest.utils.PlayAudioUtils;
|
import kst4contest.utils.PlayAudioUtils;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -45,6 +41,7 @@ public class ChatController {
|
|||||||
*/
|
*/
|
||||||
// private int category = ChatCategory.VUHF;
|
// private int category = ChatCategory.VUHF;
|
||||||
|
|
||||||
|
private UpdateInformation updateInformation;
|
||||||
private ChatPreferences chatPreferences;
|
private ChatPreferences chatPreferences;
|
||||||
|
|
||||||
private ChatCategory category;
|
private ChatCategory category;
|
||||||
@@ -61,6 +58,14 @@ public class ChatController {
|
|||||||
this.disconnectionPerformedByUser = disconnectionPerformedByUser;
|
this.disconnectionPerformedByUser = disconnectionPerformedByUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UpdateInformation getUpdateInformation() {
|
||||||
|
return updateInformation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateInformation(UpdateInformation updateInformation) {
|
||||||
|
this.updateInformation = updateInformation;
|
||||||
|
}
|
||||||
|
|
||||||
public String getChatState() {
|
public String getChatState() {
|
||||||
return chatState;
|
return chatState;
|
||||||
}
|
}
|
||||||
@@ -284,7 +289,6 @@ public class ChatController {
|
|||||||
private String chatState;
|
private String chatState;
|
||||||
|
|
||||||
private String hostname = "109.90.0.130";
|
private String hostname = "109.90.0.130";
|
||||||
// private String praktiKSTVersion = "wtKST 3.1.4.6";
|
|
||||||
private String praktiKSTVersion = "praktiKST 0.9b";
|
private String praktiKSTVersion = "praktiKST 0.9b";
|
||||||
private String praktiKSTVersionInfo = "2022-10 - 2022-12\ndeveloped by DO5AMF, Marc\nContact: praktimarc@gmail.com\nDonations via paypal are welcome";
|
private String praktiKSTVersionInfo = "2022-10 - 2022-12\ndeveloped by DO5AMF, Marc\nContact: praktimarc@gmail.com\nDonations via paypal are welcome";
|
||||||
|
|
||||||
@@ -506,9 +510,9 @@ public class ChatController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ChatController() {
|
public ChatController() {
|
||||||
super();
|
|
||||||
|
|
||||||
category = new ChatCategory(2);
|
super();
|
||||||
|
category = new ChatCategory(2);
|
||||||
ownChatMemberObject = new ChatMember();
|
ownChatMemberObject = new ChatMember();
|
||||||
ownChatMemberObject.setCallSign(userName);
|
ownChatMemberObject.setCallSign(userName);
|
||||||
ownChatMemberObject.setName(showedName);
|
ownChatMemberObject.setName(showedName);
|
||||||
@@ -528,6 +532,13 @@ public class ChatController {
|
|||||||
*/
|
*/
|
||||||
public ChatController(ChatMember setOwnChatMemberObject) {
|
public ChatController(ChatMember setOwnChatMemberObject) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
UpdateChecker checkForUpdates = new UpdateChecker(this);
|
||||||
|
|
||||||
|
if (checkForUpdates.downloadLatestVersionInfoXML()) {
|
||||||
|
updateInformation = checkForUpdates.parseUpdateXMLFile();
|
||||||
|
};
|
||||||
|
|
||||||
dbHandler = new DBController();
|
dbHandler = new DBController();
|
||||||
|
|
||||||
chatPreferences = new ChatPreferences();
|
chatPreferences = new ChatPreferences();
|
||||||
|
|||||||
133
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
133
src/main/java/kst4contest/controller/UpdateChecker.java
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
package kst4contest.controller;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import kst4contest.ApplicationConstants;
|
||||||
|
|
||||||
|
import kst4contest.model.UpdateInformation;
|
||||||
|
import kst4contest.utils.ApplicationFileUtils;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
|
public class UpdateChecker {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// new UpdateChecker(null).parseUpdateXMLFile();
|
||||||
|
|
||||||
|
if (new UpdateChecker(null).downloadLatestVersionInfoXML()) {
|
||||||
|
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||||
|
}
|
||||||
|
new UpdateChecker(null).parseUpdateXMLFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdateChecker(ChatController chatController) {
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("[Updatechecker: checking for updates...]");
|
||||||
|
double currentVersionNumber = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String versionInfoDownloadedFromServerFileName = ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||||
|
String versionInfoXMLURLAtServer = ApplicationConstants.VERSIONINFOURLFORUPDATES_KST4CONTEST;
|
||||||
|
double currentVersion = ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER;
|
||||||
|
//DOWNLOAD from URL, then parse, then do anything with it...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads the versioninfo-xml-file from a webserver to local. Returns true if download was successful, else false
|
||||||
|
*
|
||||||
|
* @return true if successful
|
||||||
|
*/
|
||||||
|
public boolean downloadLatestVersionInfoXML() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
InputStream in = new URL(versionInfoXMLURLAtServer).openStream();
|
||||||
|
Files.copy(in, Paths.get(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE)), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
// System.out.println(ApplicationFileUtils.getFilePath(ApplicationConstants.APPLICATION_NAME, "/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE));
|
||||||
|
// ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,ApplicationFileUtils.get,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("ERROR DOWNLOADING!" + e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdateInformation parseUpdateXMLFile() {
|
||||||
|
|
||||||
|
UpdateInformation updateInfos = new UpdateInformation();
|
||||||
|
|
||||||
|
|
||||||
|
ApplicationFileUtils.copyResourceIfRequired(ApplicationConstants.APPLICATION_NAME,"/"+ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE,ApplicationConstants.VERSIONINFDOWNLOADEDLOCALFILE);
|
||||||
|
|
||||||
|
// System.out.println("[Updatecker, Info]: restoring prefs from file " + versionInfoDownloadedFromServerFileName);
|
||||||
|
|
||||||
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
|
try {
|
||||||
|
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
} catch (ParserConfigurationException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
File xmlConfigFile = new File(versionInfoDownloadedFromServerFileName);
|
||||||
|
|
||||||
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
|
Document doc = db.parse(xmlConfigFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* latestVersion on server
|
||||||
|
*/
|
||||||
|
NodeList list = doc.getElementsByTagName("latestVersion");
|
||||||
|
if (list.getLength() != 0) {
|
||||||
|
|
||||||
|
for (int temp = 0; temp < list.getLength(); temp++) {
|
||||||
|
|
||||||
|
Node node = list.item(temp);
|
||||||
|
|
||||||
|
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
|
||||||
|
Element element = (Element) node;
|
||||||
|
updateInfos.setLatestVersionNumberOnServer(Double.parseDouble(element.getElementsByTagName("versionNumber").item(0).getTextContent()));
|
||||||
|
updateInfos.setAdminMessage(element.getElementsByTagName("adminMessage").item(0).getTextContent());
|
||||||
|
updateInfos.setMajorChanges(element.getElementsByTagName("majorChanges").item(0)
|
||||||
|
.getTextContent());
|
||||||
|
updateInfos.setLatestVersionPathOnWebserver(element.getElementsByTagName("latestVersionPathOnWebserver").item(0).getTextContent());
|
||||||
|
// System.out.println(updateInfos.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String toString = "";
|
||||||
|
|
||||||
|
toString += this.currentVersion;
|
||||||
|
|
||||||
|
return toString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,8 @@ public class ChatPreferences {
|
|||||||
*/
|
*/
|
||||||
public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml";
|
public static final String PREFERENCE_RESOURCE = "/praktiKSTpreferences.xml";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor will set the default values (also for predefined texts
|
* Default constructor will set the default values (also for predefined texts
|
||||||
* and shorts) automatically at initialization
|
* and shorts) automatically at initialization
|
||||||
@@ -209,6 +211,8 @@ public class ChatPreferences {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isLoginAFKState() {
|
public boolean isLoginAFKState() {
|
||||||
return loginAFKState;
|
return loginAFKState;
|
||||||
}
|
}
|
||||||
|
|||||||
67
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
67
src/main/java/kst4contest/model/UpdateInformation.java
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package kst4contest.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class UpdateInformation {
|
||||||
|
double latestVersionNumberOnServer;
|
||||||
|
String adminMessage, majorChanges,latestVersionPathOnWebserver;
|
||||||
|
ArrayList<String> needUpdateResourcesSinceLastVersion;
|
||||||
|
ArrayList<String[]> featureRequest;
|
||||||
|
ArrayList<String[]> bugRequests;
|
||||||
|
|
||||||
|
public double getLatestVersionNumberOnServer() {
|
||||||
|
return latestVersionNumberOnServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatestVersionNumberOnServer(double latestVersionNumberOnServer) {
|
||||||
|
this.latestVersionNumberOnServer = latestVersionNumberOnServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdminMessage() {
|
||||||
|
return adminMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdminMessage(String adminMessage) {
|
||||||
|
this.adminMessage = adminMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMajorChanges() {
|
||||||
|
return majorChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMajorChanges(String majorChanges) {
|
||||||
|
this.majorChanges = majorChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLatestVersionPathOnWebserver() {
|
||||||
|
return latestVersionPathOnWebserver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatestVersionPathOnWebserver(String latestVersionPathOnWebserver) {
|
||||||
|
this.latestVersionPathOnWebserver = latestVersionPathOnWebserver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getNeedUpdateResourcesSinceLastVersion() {
|
||||||
|
return needUpdateResourcesSinceLastVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNeedUpdateResourcesSinceLastVersion(ArrayList<String> needUpdateResourcesSinceLastVersion) {
|
||||||
|
this.needUpdateResourcesSinceLastVersion = needUpdateResourcesSinceLastVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String[]> getFeatureRequest() {
|
||||||
|
return featureRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeatureRequest(ArrayList<String[]> featureRequest) {
|
||||||
|
this.featureRequest = featureRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String[]> getBugRequests() {
|
||||||
|
return bugRequests;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBugRequests(ArrayList<String[]> bugRequests) {
|
||||||
|
this.bugRequests = bugRequests;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import java.net.URISyntaxException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import javafx.beans.value.ObservableStringValue;
|
import javafx.beans.value.ObservableStringValue;
|
||||||
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.media.Media;
|
import javafx.scene.media.Media;
|
||||||
import javafx.scene.media.MediaPlayer;
|
import javafx.scene.media.MediaPlayer;
|
||||||
import kst4contest.ApplicationConstants;
|
import kst4contest.ApplicationConstants;
|
||||||
@@ -28,31 +29,10 @@ import javafx.geometry.Pos;
|
|||||||
import javafx.geometry.VPos;
|
import javafx.geometry.VPos;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ButtonType;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ChoiceBox;
|
|
||||||
import javafx.scene.control.ContextMenu;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.Menu;
|
|
||||||
import javafx.scene.control.MenuBar;
|
|
||||||
import javafx.scene.control.MenuItem;
|
|
||||||
import javafx.scene.control.PasswordField;
|
|
||||||
import javafx.scene.control.SelectionMode;
|
|
||||||
import javafx.scene.control.Separator;
|
|
||||||
import javafx.scene.control.SplitPane;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.scene.control.TabPane;
|
|
||||||
import javafx.scene.control.TableCell;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableColumn.CellDataFeatures;
|
import javafx.scene.control.TableColumn.CellDataFeatures;
|
||||||
import javafx.scene.control.TableColumn.CellEditEvent;
|
import javafx.scene.control.TableColumn.CellEditEvent;
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.control.TableView.TableViewSelectionModel;
|
import javafx.scene.control.TableView.TableViewSelectionModel;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.Tooltip;
|
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
@@ -1742,7 +1722,7 @@ public class Kst4ContestApplication extends Application {
|
|||||||
help5.setDisable(true);
|
help5.setDisable(true);
|
||||||
MenuItem help6 = new MenuItem("Contact the author using default mail app");
|
MenuItem help6 = new MenuItem("Contact the author using default mail app");
|
||||||
MenuItem help8 = new MenuItem("Join kst4Contest newsgroup");
|
MenuItem help8 = new MenuItem("Join kst4Contest newsgroup");
|
||||||
MenuItem help9 = new MenuItem("Download the changelog / roadmap");
|
// MenuItem help9 = new MenuItem("Download the changelog / roadmap");
|
||||||
|
|
||||||
// Changelog
|
// Changelog
|
||||||
// https://e.pcloud.link/publink/show?code=XZwAoWZIap9DYqDlhhwncqAxLbU6STOh2PV
|
// https://e.pcloud.link/publink/show?code=XZwAoWZIap9DYqDlhhwncqAxLbU6STOh2PV
|
||||||
@@ -1752,12 +1732,7 @@ public class Kst4ContestApplication extends Application {
|
|||||||
|
|
||||||
getHostServices().showDocument("https://www.paypal.com/paypalme/do5amf");
|
getHostServices().showDocument("https://www.paypal.com/paypalme/do5amf");
|
||||||
|
|
||||||
// Alert a = new Alert(AlertType.INFORMATION);
|
|
||||||
//
|
|
||||||
// a.setTitle("About this software");
|
|
||||||
// a.setHeaderText("Who made it and how can you support it?");
|
|
||||||
// a.setContentText(chatcontroller.getChatPreferences().getProgramVersion());
|
|
||||||
// a.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1766,12 +1741,6 @@ public class Kst4ContestApplication extends Application {
|
|||||||
|
|
||||||
getHostServices().showDocument("http://www.x08.de");
|
getHostServices().showDocument("http://www.x08.de");
|
||||||
|
|
||||||
// Alert a = new Alert(AlertType.INFORMATION);
|
|
||||||
//
|
|
||||||
// a.setTitle("About this software");
|
|
||||||
// a.setHeaderText("Who made it and how can you support it?");
|
|
||||||
// a.setContentText(chatcontroller.getChatPreferences().getProgramVersion());
|
|
||||||
// a.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1791,14 +1760,14 @@ public class Kst4ContestApplication extends Application {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
help9.setOnAction(new EventHandler<ActionEvent>() {
|
// help9.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
public void handle(ActionEvent event) {
|
// public void handle(ActionEvent event) {
|
||||||
|
//
|
||||||
getHostServices()
|
// getHostServices()
|
||||||
.showDocument("https://e.pcloud.link/publink/show?code=XZwAoWZIap9DYqDlhhwncqAxLbU6STOh2PV");
|
// .showDocument("https://e.pcloud.link/publink/show?code=XZwAoWZIap9DYqDlhhwncqAxLbU6STOh2PV");
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
MenuItem help10 = new MenuItem("About...");
|
MenuItem help10 = new MenuItem("About...");
|
||||||
help10.setOnAction(new EventHandler<ActionEvent>() {
|
help10.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@@ -1807,14 +1776,14 @@ public class Kst4ContestApplication extends Application {
|
|||||||
Alert a = new Alert(AlertType.INFORMATION);
|
Alert a = new Alert(AlertType.INFORMATION);
|
||||||
|
|
||||||
a.setTitle("About kst4contest");
|
a.setTitle("About kst4contest");
|
||||||
a.setHeaderText("ON4KST Chatclient by DO5AMF");
|
a.setHeaderText("kst4Contest " + ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER + ": ON4KST Chatclient by DO5AMF");
|
||||||
a.setContentText(chatcontroller.getChatPreferences().getProgramVersion());
|
a.setContentText(chatcontroller.getChatPreferences().getProgramVersion());
|
||||||
a.show();
|
a.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// helpMenu.getItems().add(help1);
|
// helpMenu.getItems().add(help1);
|
||||||
helpMenu.getItems().addAll(help2, help4, help5, help6, help8, help9, help10);
|
helpMenu.getItems().addAll(help2, help4, help5, help6, help8, help10);
|
||||||
|
|
||||||
// helpMenu.getItems().add(help2);
|
// helpMenu.getItems().add(help2);
|
||||||
// helpMenu.getItems().add(help4);
|
// helpMenu.getItems().add(help4);
|
||||||
@@ -1843,6 +1812,8 @@ public class Kst4ContestApplication extends Application {
|
|||||||
|
|
||||||
Stage clusterAndQSOMonStage;
|
Stage clusterAndQSOMonStage;
|
||||||
|
|
||||||
|
Stage stage_updateStage;
|
||||||
|
|
||||||
Stage settingsStage;
|
Stage settingsStage;
|
||||||
|
|
||||||
|
|
||||||
@@ -2675,6 +2646,9 @@ public class Kst4ContestApplication extends Application {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window Cluster & qso of the other
|
||||||
|
*/
|
||||||
clusterAndQSOMonStage = new Stage();
|
clusterAndQSOMonStage = new Stage();
|
||||||
// clusterAndQSOMonStage.initStyle(StageStyle.UTILITY);
|
// clusterAndQSOMonStage.initStyle(StageStyle.UTILITY);
|
||||||
clusterAndQSOMonStage.setTitle("Cluster & QSO of the other");
|
clusterAndQSOMonStage.setTitle("Cluster & QSO of the other");
|
||||||
@@ -2686,11 +2660,104 @@ public class Kst4ContestApplication extends Application {
|
|||||||
clusterAndQSOMonStage.setScene(new Scene(pnl_directedMSGWin, 700, 500));
|
clusterAndQSOMonStage.setScene(new Scene(pnl_directedMSGWin, 700, 500));
|
||||||
clusterAndQSOMonStage.show();
|
clusterAndQSOMonStage.show();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* end Window Cluster & qso of the other
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window updates
|
||||||
|
*/
|
||||||
|
stage_updateStage = new Stage();
|
||||||
|
// clusterAndQSOMonStage.initStyle(StageStyle.UTILITY);
|
||||||
|
stage_updateStage.setTitle("Update information");
|
||||||
|
// SplitPane pnl_directedMSGWin = new SplitPane();
|
||||||
|
// apnl_directedMSGWin.setOrientation(Orientation.VERTICAL);
|
||||||
|
|
||||||
|
// pnl_directedMSGWin.getItems().addAll(initDXClusterTable(), initChatToOtherMSGTable());
|
||||||
|
|
||||||
|
stage_updateStage.setAlwaysOnTop(true);
|
||||||
|
|
||||||
|
Label lblUpdateInfo = new Label("Update aviable!");
|
||||||
|
Label lblUpdateInfo2 = new Label("Your Software version: ");
|
||||||
|
Label lblUpdateInfo3 = new Label("Newest Software version: ");
|
||||||
|
Label lblUpdateInfoChanges = new Label("Major Changes: ");
|
||||||
|
Label lblUpdateInfoAdminMessage = new Label("Admin Message: ");
|
||||||
|
Label lblUpdateInfoDownload = new Label("Downloadable here: " );
|
||||||
|
|
||||||
|
|
||||||
|
TreeView treeView = new TreeView();
|
||||||
|
|
||||||
|
GridPane upd_gridPaneUpd = new GridPane();
|
||||||
|
|
||||||
|
upd_gridPaneUpd.setPadding(new Insets(10, 10, 10, 10));
|
||||||
|
upd_gridPaneUpd.setVgap(5);
|
||||||
|
upd_gridPaneUpd.setHgap(5);
|
||||||
|
|
||||||
|
|
||||||
|
VBox vbxUpdateWindow = new VBox();
|
||||||
|
vbxUpdateWindow.setSpacing(30);
|
||||||
|
|
||||||
|
|
||||||
|
vbxUpdateWindow.getChildren().add(upd_gridPaneUpd);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfo, 0,0,1,1);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfo2, 0,1,1,1);
|
||||||
|
upd_gridPaneUpd.add(new Label("kst4Contest " + ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER+""), 1,1,1,1);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfo3, 0,2,1,1);
|
||||||
|
upd_gridPaneUpd.add(new Label("kst4Contest " + chatcontroller.getUpdateInformation().getLatestVersionNumberOnServer()+""), 1,2,1,1);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfoChanges, 0,3,1,1);
|
||||||
|
upd_gridPaneUpd.add(new Label(chatcontroller.getUpdateInformation().getMajorChanges()), 1,3,1,1);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfoAdminMessage, 0,4,1,1);
|
||||||
|
upd_gridPaneUpd.add(new Label(chatcontroller.getUpdateInformation().getAdminMessage()), 1,4,1,1);
|
||||||
|
upd_gridPaneUpd.add(lblUpdateInfoDownload, 0,5,1,1);
|
||||||
|
|
||||||
|
Hyperlink link = new Hyperlink("Download here");
|
||||||
|
link.setOnAction(e -> {
|
||||||
|
getHostServices().showDocument(chatcontroller.getUpdateInformation().getLatestVersionPathOnWebserver());
|
||||||
|
// System.out.println("The Hyperlink was clicked!");
|
||||||
|
});
|
||||||
|
|
||||||
|
// TextField upd_txtfldUpdateDownloadLink = new TextField(chatcontroller.getUpdateInformation().getLatestVersionPathOnWebserver());
|
||||||
|
// upd_txtfldUpdateDownloadLink.setEditable(false);
|
||||||
|
|
||||||
|
upd_gridPaneUpd.add(link, 1,5,1,1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// vbxUpdateWindow.getChildren().addAll(lblUpdateInfo, lblUpdateInfo2, lblUpdateInfo3, lblUpdateInfoChanges, lblUpdateInfoAdminMessage, lblUpdateInfoDownload);
|
||||||
|
vbxUpdateWindow.getChildren().add(treeView);
|
||||||
|
|
||||||
|
TreeItem rootItem = new TreeItem(ApplicationConstants.APPLICATION_NAME);
|
||||||
|
TreeItem latestVersionNumber = new TreeItem<>(chatcontroller.getUpdateInformation().getLatestVersionNumberOnServer());
|
||||||
|
TreeItem adminMessage = new TreeItem<>(chatcontroller.getUpdateInformation().getAdminMessage());
|
||||||
|
TreeItem majorChanges = new TreeItem<>(chatcontroller.getUpdateInformation().getMajorChanges());
|
||||||
|
TreeItem latestVersionPathOnWebserver = new TreeItem<>(chatcontroller.getUpdateInformation().getLatestVersionPathOnWebserver());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rootItem.getChildren().add(latestVersionNumber);
|
||||||
|
rootItem.getChildren().add(adminMessage);
|
||||||
|
rootItem.getChildren().add(majorChanges);
|
||||||
|
rootItem.getChildren().add(latestVersionPathOnWebserver);
|
||||||
|
|
||||||
|
treeView.setRoot(rootItem);
|
||||||
|
|
||||||
|
stage_updateStage.setScene(new Scene(vbxUpdateWindow, 640, 480));
|
||||||
|
|
||||||
|
if (chatcontroller.getUpdateInformation().getLatestVersionNumberOnServer() > ApplicationConstants.APPLICATION_CURRENTVERSIONNUMBER) {
|
||||||
|
stage_updateStage.show();
|
||||||
|
} else {
|
||||||
|
//nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* end Window Update
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Settings Scene
|
* Settings Scene
|
||||||
*
|
*
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
settingsStage = new Stage();
|
settingsStage = new Stage();
|
||||||
settingsStage.setTitle("Change Client seetings");
|
settingsStage.setTitle("Change Client seetings");
|
||||||
|
|||||||
Reference in New Issue
Block a user