00002 Added needed classes from first approach.
This commit is contained in:
14
README.md
14
README.md
@@ -1,5 +1,19 @@
|
||||
# firewall-dashboard-simplified
|
||||
|
||||
@author Aaron Moser
|
||||
@date 02.12.2023
|
||||
@lastCHange 25.01.2024
|
||||
|
||||
Im Rahmen eines Hand on Seminar an der Hochschule Offenburg entwickelte Software zur Remote-ueberwachung und -veraenderung einer Firewall.
|
||||
|
||||
## Client
|
||||
Der Client wird in Java programmiert. Als UI Framework wird Java Swing verwendet.
|
||||
|
||||
## Server
|
||||
Der Server (Agent) wird in Python programmiert.
|
||||
|
||||
## Simplified
|
||||
|
||||
Project containing the Hands On Seminar code.
|
||||
|
||||
Since last approach was to cluttered, decided to simplify the design.
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>src.java</groupId>
|
||||
<artifactId>firewall-dashboard-simplified</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
BIN
my-cacerts
Normal file
BIN
my-cacerts
Normal file
Binary file not shown.
96
pom.xml
Normal file
96
pom.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>src.java</groupId>
|
||||
<artifactId>src</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson Core -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.16.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson Databind (for object mapping) -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.16.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</plugin>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
35
server.crt
Normal file
35
server.crt
Normal file
@@ -0,0 +1,35 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
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
|
||||
49fGV0I4AFMm8mcpmKCO3CQ/arX6khFSkQ==
|
||||
-----END CERTIFICATE-----
|
||||
54
server.key
Normal file
54
server.key
Normal file
@@ -0,0 +1,54 @@
|
||||
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||
MIIJnDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQINSjKXD7gH4oCAggA
|
||||
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECHAC/e+sayicBIIJSGun+GwwriRH
|
||||
NB1SeXcLPDpxIuKntT9qBB8xTpAnHA905gTZvQ7DK2dX1M6RncZq0gIW4r5me3xR
|
||||
qJUacqgJ73Z1Ir/yddmhokJW9e7BtQu3UKMNa575wQsg0RZCB21xAv9TlxfQzzS2
|
||||
vUEPwJT6WWTaQzLKOd8KT7sW62vaxreKQjCwKfBbwzC4VBBjBTD34HfzaCqBvEKA
|
||||
aPq4L6KtKkpNuz/NWCFRAPTKUxmjHqQ8avtY7CQ7+45ygfQL8VUbmsTn4arsz5T1
|
||||
DX1cJnxhZdEfNRyH9ZhHbT14TGwSQyBI3SsiFgBMrPcCPwJSI0P3hdFXa3oWXfum
|
||||
eI9s860T+VkBypfNwCTBLZ/5iOG7UrO1zetxrze+s//rEXTp/DMHF0Yp8x2nChY/
|
||||
sFbFEcmljOR4NgMhgz5wUsZh14b72IyHwG1e4Ij8X80pnF3YU4yWAfofTcPXZ3rQ
|
||||
IN4ID9n+MSu4aTdhvwQXi1q8I9XuQnyBmzpx47JLqp1dwGeQnjbkY5s4Er9OxTnF
|
||||
sMUgeCbWmZ59Tbv5wAmvBL7FkV71tLfEzsVdfSrPOBqIVBoLlmej+9c1e93u1+mP
|
||||
vWqJ/4fYwHXbcr0jWEOIStPdA+D8M4qmzRA/2bk7ptCTyzElUBjTRFkTPxQPJ5mI
|
||||
C648rPcpHvCNs7YyzALw06266L6BErZRspFhCkYWzI51mjy05LvHE8Ynx1k7egVa
|
||||
nf9xUx9kq8k5YVhumwVIZTLu1DcN+iTgAeKEe5GK/5adZJj9OKMhe85E5ei9qso6
|
||||
loWnu2RFthKoxGkJQTlidyl4Mj6L/g/tfgA6RIAA3biTN6OF56VinrTkb44PKKwf
|
||||
Xc2PCpdcdHq1a8QhleBJNJ0L4TgYgTFHop/MYH5KGhm5Rlm2VGtxngQKGoo18TIB
|
||||
45tYKId8BmZ5Nl83HJiDJr0U3AHWztlQo/1uhI0i3oRxo7q99pH94XxStV5DI3iI
|
||||
Xvu+xs3SmeysRYdsjvOcIMLmquzkEHSW4j8UJv8eUQcRCa3YLzDphmIIAQdF9LyH
|
||||
N7fvmd3e410nn5IDKukfPLs9Of9Ye7WeWZ6uJOUD+DebzjCxLtE7uNUaEIvCjIJK
|
||||
RDPC1GsVPjFt5nChBa001bhtLNl3GYUq1GiWs/ZeW7KaOB5MLttIwXvXSWfZccV8
|
||||
EwX7I3eVPJcm8Muxng2gvaWcLggjZXUn7AYMSqRM44gEvEaPIfjUErJxOSjvKMup
|
||||
/Bxgls0Lwv221/7XtTO1Q8cwX3pl6FfJfn1YbSIVv818zEExwgRw8tqaO8CRMz7A
|
||||
Uf6F6t/1/21Ij8dngof1FH1TGCYPWrhHBYwMlH8g9CmYJaklo4zkChHgfQtx+6kl
|
||||
/Qn4U07ouK/l/bjBz3C/fOPUp56op177MUeBRrqP+gxrAbw6W31uHZ/z7FyaVYth
|
||||
6SXIYb+cfZllD9I238ChOT1O8Lz2Kf4aW45KgpD0ZDSVRIt0V9WevAvQTF+aymks
|
||||
yeNw+1q+or0L0NpoxxApFW43V1Zp/9DQdoGRePRtMiYp/jhWQy+0Q1r2r+nJUa4U
|
||||
LSonplp0sppe+5cS1V1ikwrTVFbrUOCjSTjIRhpkUxT7appO/7Jttba4vt1LaaA4
|
||||
qsHw8Y0u5z+YQ3yzrr3WwxUfc1l5s5nJx4tH9KAxm9fQpDJHlaznrUTw5p7AX4Je
|
||||
AkHawCs93X+KI/WMrEDR0xE0XSUOXwAOEXMd2plxSQ9ea7LrKrMsHf7NInx3H5qi
|
||||
bJOdc//9lUS+B2LD2AO1ww4fHeXbZ2pqMNPUOxRpS/82jJGmO1KuHiNg+GkA0G5B
|
||||
FO/pDYw1CAOn5MJ8Z2vlDb51xPhA1bps6/SvIsBGLj1c3QjncyTfyBSd25spuiFb
|
||||
U0MNw15m+3CTm6/m+nxaaw4wu70KBehe/RH7DixyqIX6QwK2F5e0Cz1D7/bc/XiL
|
||||
kOGnl7TYlY8nQzUm/HJ3hl4e23z2uEmqlhKHiCsb0GjG4w+gbhSIocvsHYs/nqvF
|
||||
nIO6wJjQpZm5bCcWZjNY4PJ/XKlJ8T5EGg1V3Z/PLsUjR7rRRPMDb+qqgTot4OUA
|
||||
p8yeeAn1e//zVdttHTi+CBxaf+dVvDmlpalxqup4a6T6Iow3R0ahCjNmGw/EtHEh
|
||||
rD2GfAsoeWT4X2LLMChOK4ugnMJG665nRW1ls5HVzAIjsxSVUsOUtfMOvZj5lq8l
|
||||
W8sdENtJ3ODgoQwAsX2uc4K7wwkV3eKnnjoK5HvAUybgeBHCr+XC6BRVJzCA5Jk1
|
||||
nxVOLOQOQeLlTAd3O6KAddTbBH8F4UedepLmpccMjLOOoCS02HmPdBrRrNbY7IjD
|
||||
zlOQDF3A8gZSPQ95XLfX5t0yhLQeAJJmbAOFPzH+uNYn4VG+EdK0XylI1B6EtSUU
|
||||
YMsWf2DXmYdkhQJ7Dy1GM+PtO+21BXxs+gRdmE+T9KF+AjMdSX2smOEU5tejQxa9
|
||||
+oJEzYDCBXNZ2SXVNw18hSZXGEyr1/HlcHt0XAZKrOdX7cXHCM2XKRHe/1+nYmeZ
|
||||
TACWfE5ZdwOhViSlXZpvqFlKEvZAibykVGfnX3eDVb2neTsj/4AidZFEe4f9vj4+
|
||||
mt5cglDwl8nMrHP8kWGzH7ySCt76DvREFDgfABjrUSgwORjpSaHRouy9L6jwdQem
|
||||
1cw4baYNlJso6ROAW5R2yh1I0ObWFx71TgLFI3Eev/BSXDLcVFt/QCJX5UI2onQ+
|
||||
xk8/p51ScP1pE2Vyzl6BUmLp6byoEH06fpDxjxBV5+7Vx01Tm3FmPydl+1r0zcfC
|
||||
VOW1GcEnRIq5LuVHaG88lujmEq417de1HcLQyiSzZyz25NHhtzKT0bs/G1do2PGM
|
||||
ofrWyVjIpZpm5Shl+8Aa4FPHo+UwkjHhnVFdZqUpL+fRhrJjJbxfFEmDqZ1bguiv
|
||||
L1u6kNLPPhi7h1R7byfODQKKvVRAr3tF8+7bqiFsWAia5fYbh8GbGnNENTgYWMhj
|
||||
4oKBLAVk9RDkbqQeJJQGKbeSMQL1BEDSvKlWDQghTIAlFKDrd5Ae7VubEkS27BNa
|
||||
Ja8iv3zIZ9N38AHmT7SSYRYhpxM2PwzKJmxMcQ2YKw9vur18UlS3TmE/7DUk1pjY
|
||||
wjZvDNaRhoEgqbjszPRKN/8oLXyMhpcej5oxT8fZ1AouWu/AxlAg055iyasxNmEx
|
||||
RJkD/R0JAl/7yp5XNB0KmA==
|
||||
-----END ENCRYPTED PRIVATE KEY-----
|
||||
61
src/main/java/src/java/connect/Receiver.java
Normal file
61
src/main/java/src/java/connect/Receiver.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 26.12.2023
|
||||
* @lastChange 25.01.2024
|
||||
*/
|
||||
package src.java.connect;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import src.java.connect.client.TLSClient;
|
||||
import src.java.queues.ReceivingQueue;
|
||||
|
||||
public class Receiver extends Thread {
|
||||
private static Receiver instance = null;
|
||||
|
||||
private boolean receiverRunning = false;
|
||||
|
||||
BufferedReader reader = null;
|
||||
|
||||
private Receiver() {}
|
||||
|
||||
public static Receiver getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Receiver();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
receiverRunning = true;
|
||||
while (receiverRunning) {
|
||||
receiveData();
|
||||
}
|
||||
}
|
||||
|
||||
public void receiveData() {
|
||||
try {
|
||||
if (TLSClient.getSSLSocket().isConnected()) {
|
||||
if (reader == null) {
|
||||
reader = new BufferedReader(new InputStreamReader(TLSClient.getSSLSocket().getInputStream()));
|
||||
}
|
||||
if (reader != null) {
|
||||
String response;
|
||||
while ((response = reader.readLine()) != null) {
|
||||
//System.out.println(response);
|
||||
ReceivingQueue.getInstance().add(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopThread() {
|
||||
this.receiverRunning = false;
|
||||
}
|
||||
}
|
||||
73
src/main/java/src/java/connect/Sender.java
Normal file
73
src/main/java/src/java/connect/Sender.java
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 26.12.2023
|
||||
* @lastChange 25.01.2024
|
||||
*/
|
||||
package src.java.connect;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import src.java.connect.client.TLSClient;
|
||||
import src.java.queues.SendingQueue;
|
||||
|
||||
/**
|
||||
* TODO change pattern from singleton to dependency injection.
|
||||
*/
|
||||
public class Sender extends Thread {
|
||||
private static Sender instance = null;
|
||||
|
||||
private boolean senderRunning = false;
|
||||
|
||||
private PrintWriter writer = null;
|
||||
|
||||
private Sender() {}
|
||||
|
||||
public static Sender getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Sender();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
senderRunning = true;
|
||||
while (senderRunning) {
|
||||
try {
|
||||
// Wait until controller puts requests into sending queue.
|
||||
String item = SendingQueue.getInstance().take();
|
||||
System.out.println("Sender sends: " + item);
|
||||
sendData(item);
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("Sender thread was interrupted.");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendData(String data) {
|
||||
try {
|
||||
if (TLSClient.getSSLSocket().isConnected()) {
|
||||
if (writer == null) {
|
||||
writer = new PrintWriter(TLSClient.getSSLSocket().getOutputStream());
|
||||
}
|
||||
if (writer != null && data != null) {
|
||||
writer.println(data);
|
||||
writer.flush();
|
||||
} else {
|
||||
System.out.println("Connection is not established.");
|
||||
}
|
||||
} else {
|
||||
System.out.println("SSLSocket is null.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopThread() {
|
||||
this.senderRunning = false;
|
||||
}
|
||||
}
|
||||
13
src/main/java/src/java/connect/client/Client.java
Normal file
13
src/main/java/src/java/connect/client/Client.java
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
*/
|
||||
package src.java.connect.client;
|
||||
|
||||
import src.java.data.ConnectionData;
|
||||
|
||||
public interface Client {
|
||||
public boolean createConnection(ConnectionData connectionData);
|
||||
public void startSender();
|
||||
public void startReceiver();
|
||||
public void closeConnection();
|
||||
}
|
||||
97
src/main/java/src/java/connect/client/TLSClient.java
Normal file
97
src/main/java/src/java/connect/client/TLSClient.java
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @lastChange 25.01.2024
|
||||
*/
|
||||
package src.java.connect.client;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import src.java.connect.Receiver;
|
||||
import src.java.connect.Sender;
|
||||
import src.java.data.ConnectionData;
|
||||
|
||||
public final class TLSClient implements Client {
|
||||
|
||||
private static SSLSocket sslSocket;
|
||||
|
||||
public static synchronized SSLSocket getSSLSocket() {
|
||||
return sslSocket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createConnection(ConnectionData connectionData) {
|
||||
try {
|
||||
String ipAddress = connectionData.ipAddress();
|
||||
int port = connectionData.port();
|
||||
String keyStorePath = connectionData.keyStorePath();
|
||||
String keyStprePassPhrase = connectionData.keyStorePassphrase();
|
||||
|
||||
KeyStore truststore = KeyStore.getInstance("JKS");
|
||||
truststore.load(new FileInputStream(keyStorePath), keyStprePassPhrase.toCharArray());
|
||||
|
||||
// Create a TrustManager that trusts the certificates in the truststore
|
||||
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
trustManagerFactory.init(truststore);
|
||||
|
||||
// Create an SSL context with the trust manager
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, trustManagerFactory.getTrustManagers(), null);
|
||||
|
||||
// Set the SSL context on the SSLSocketFactory
|
||||
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
|
||||
|
||||
sslSocket = (SSLSocket) sslSocketFactory.createSocket(ipAddress, port);
|
||||
return true;
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (CertificateException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (KeyStoreException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void startSender() {
|
||||
Sender.getInstance().start();
|
||||
}
|
||||
|
||||
public void startReceiver() {
|
||||
Receiver.getInstance().start();
|
||||
}
|
||||
|
||||
public void closeConnection() {
|
||||
try {
|
||||
if (sslSocket != null) {
|
||||
sslSocket.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
97
src/main/java/src/java/controller/ControllerThread.java
Normal file
97
src/main/java/src/java/controller/ControllerThread.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package src.java.controller;
|
||||
|
||||
import src.java.connect.client.Client;
|
||||
import src.java.connect.client.TLSClient;
|
||||
import src.java.controller.interfaces.Controller;
|
||||
import src.java.controller.validate.Validate;
|
||||
import src.java.data.ConnectionData;
|
||||
import src.java.queues.SendingQueue;
|
||||
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.12.2023
|
||||
* @lastChange 25.01.2024
|
||||
*/
|
||||
|
||||
public class ControllerThread extends Thread implements Controller {
|
||||
|
||||
private final static boolean SUCCESSFUL = true;
|
||||
|
||||
private Client client = null;
|
||||
|
||||
public ControllerThread() {
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
//startThreads();
|
||||
|
||||
//this.model.getConnectionModel().setConnectionStatus(ConnectionStatus.Connected);
|
||||
//this.model.getConnectionModel().setIPAddress(ipAddress);
|
||||
//this.model.getConnectionModel().setPort(port);
|
||||
//this.model.incrementVersion();
|
||||
|
||||
//SendingQueue.getInstance().add("getSysInf");
|
||||
//SendingQueue.getInstance().add("getCon");
|
||||
//SendingQueue.getInstance().add("getNFTConf");
|
||||
|
||||
}
|
||||
|
||||
private boolean createConnectionStartThreadsAndGetInitialData(ConnectionData connectionData) {
|
||||
boolean connectToServerSuccess = createConnectionToServer(connectionData);
|
||||
|
||||
if (connectToServerSuccess) {
|
||||
startThreads();
|
||||
|
||||
//this.model.getConnectionModel().setConnectionStatus(ConnectionStatus.Connected);
|
||||
//this.model.getConnectionModel().setIPAddress(ipAddress);
|
||||
//this.model.getConnectionModel().setPort(port);
|
||||
//this.model.incrementVersion();
|
||||
|
||||
sendInitialRequests();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is called if controller received event from view, which indicates,
|
||||
* that the connect to server button was pressed. The function takes
|
||||
* a parameter of type ViewToControllerData which contains the information
|
||||
* necessary to establish a connection to a server.
|
||||
* @param viewToControllerData
|
||||
*/
|
||||
private boolean createConnectionToServer(ConnectionData connectionData) {
|
||||
//this.model.getConnectionModel().setConnectionStatus(ConnectionStatus.Pending);
|
||||
|
||||
boolean validIP = Validate.isValidIPv4Address(connectionData.ipAddress());
|
||||
boolean validPort = Validate.isValidPort(connectionData.port(), 1, 60000);
|
||||
System.out.println("IP: " + validIP + ", Port: " + validPort);
|
||||
|
||||
if (validIP) {
|
||||
if (validPort) {
|
||||
this.client = new TLSClient();
|
||||
if (this.client.createConnection(connectionData) == SUCCESSFUL) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
//TODO send event to view that port is not valid.
|
||||
}
|
||||
} else {
|
||||
//TODO send event to view that ip is not valid.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void startThreads() {
|
||||
this.client.startReceiver();
|
||||
this.client.startSender();
|
||||
}
|
||||
|
||||
private void sendInitialRequests() {
|
||||
SendingQueue.getInstance().add("getSysInf");
|
||||
SendingQueue.getInstance().add("getCon");
|
||||
SendingQueue.getInstance().add("getNFTConf");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 28.12.2023
|
||||
*/
|
||||
package src.java.controller.DataProcessing.ConnectionsProcessing;
|
||||
|
||||
/**
|
||||
* Record displays packed information about one connection at the agent side.
|
||||
*/
|
||||
public final record ConnectionInformation(
|
||||
int fileDescriptor,
|
||||
String addressFamily,
|
||||
String socketKind,
|
||||
String localAddress,
|
||||
int localPort,
|
||||
String remoteAddress,
|
||||
int remotePort,
|
||||
String status,
|
||||
int pid) {
|
||||
|
||||
public boolean equals(ConnectionInformation other) {
|
||||
return this.fileDescriptor == other.fileDescriptor && this.pid == other.pid;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return fileDescriptor + " | " +
|
||||
addressFamily + " | " +
|
||||
socketKind + " | " +
|
||||
localAddress + " | " +
|
||||
localPort + " | " +
|
||||
remoteAddress + " | " +
|
||||
remotePort + " | " +
|
||||
status + " | " +
|
||||
pid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 28.12.2023
|
||||
*/
|
||||
package src.java.controller.DataProcessing.ConnectionsProcessing;
|
||||
|
||||
/**
|
||||
* Provides a function to retrieve information from a connection string.
|
||||
* sconn(fd=9, family=<AddressFamily.AF_UNIX: 1>, type=<SocketKind.SOCK_STREAM: 1>, laddr='', raddr='', status='NONE', pid=1789)
|
||||
* fd stands for file descriptor
|
||||
* laddr: local address
|
||||
* raddr: remote address
|
||||
* pid stands for process id
|
||||
*/
|
||||
public final class ConnectionsProcessor {
|
||||
private static final int HEAD_LENGTH = 6;
|
||||
private static final int TAIL_LENGTH = 1;
|
||||
|
||||
private static final String[] ADDRESS_FAMILIES = {
|
||||
"AF_UNIX", // Unix domain sockets
|
||||
"AF_LOCAL", // Unix domain sockets
|
||||
"AF_INET", // IPv4 communication
|
||||
"AF_INET6", // IPv6 communication
|
||||
"AF_NETLINK", // Used for communication with the Linux kernel using the Netlink protocol
|
||||
"AF_PACKET", // Low-level packet manipulation
|
||||
"AF_BLUETOOTH", // Bluetooth communication
|
||||
"AF_CAN", // Controller Area Network (CAN) communication
|
||||
"AF_RDS", // Reliable Datagram Sockets (RDS) communication
|
||||
"AF_ALG", // Cryptographic socket support
|
||||
"AF_VSOCK", // Virtual Socket (vsock) communication for hypervisor-based applications
|
||||
"AF_XDP" // eXpress Data Path (XDP) socket family for high-performance packet processing
|
||||
};
|
||||
|
||||
private static final String[] SOCKET_KINDS = {
|
||||
"SOCK_STREAM", // provides a reliable, stream-oriented connection, typically used for TCP sockets
|
||||
"SOCK_DGRAM", // provides a connectionless, unreliable communication method, typically used for UDP sockets
|
||||
"SOCK_RAW", // allows low-level access to network protocols, often used for custom packet manipulation
|
||||
"SOCK_SEQPACKET", // similar to SOCK_STREAM but provides a record-oriented, connection-based socket
|
||||
"SOCK_RDM", // reliable datagram sockets
|
||||
"SOCK_PACKET" // used for low-level packet capture and injection
|
||||
};
|
||||
|
||||
private static final String[] CONNECTION_STATUSES = {
|
||||
"NONE",
|
||||
"ESTABLISHED", // socket connection is established and data can be exchanged
|
||||
"LISTEN", // socket is listening for incoming connections
|
||||
"CLOSE_WAIT", // socket is waiting for the remote end to close the connection
|
||||
"TIME_WAIT", // socket is waiting for any remaining packets to arrive after the connection is closed
|
||||
"CLOSED", // socket is closed and no longer in use
|
||||
"SYN_SENT", // socket has sent a SYN packet to initiate a connection
|
||||
"SYN_RECEIVED", // socket has received a SYN packet and is waiting for an ACK to complete the connection establishment
|
||||
"FIN_WAIT1", // socket is in the process of closing the connection
|
||||
"FIN_WAIT2" // socket is in the process of closing the connection
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes a data string which contains the information about one connection at the agents side.
|
||||
* @param dataString the string which contains the information.
|
||||
* @return an object of type ConnectionInformation.
|
||||
*/
|
||||
public static ConnectionInformation processDataString(String dataString) {
|
||||
String[] dataStringParts = removeHeadAndTail(dataString).split(" ");
|
||||
|
||||
int fileDescriptor = -1;
|
||||
String addressFamily = "";
|
||||
String socketKind = "";
|
||||
String localAddress = "";
|
||||
int localPort = -1;
|
||||
String remoteAddress = "";
|
||||
int remotePort = -1;
|
||||
String status = "";
|
||||
int pid = -1;
|
||||
|
||||
for (int i = 0; i < dataStringParts.length; i++) {
|
||||
String part = dataStringParts[i];
|
||||
|
||||
if (part.startsWith("fd")) {
|
||||
fileDescriptor = processFileDescriptor(part);
|
||||
|
||||
} else if (part.startsWith("family")) {
|
||||
addressFamily = processAddressFamily(part);
|
||||
|
||||
} else if (part.startsWith("type")) {
|
||||
socketKind = processSocketKind(part);
|
||||
|
||||
} else if (part.startsWith("laddr")) {
|
||||
localAddress = processAddress(part);
|
||||
// Check if entry after is of type port
|
||||
if (dataStringParts[i+1].startsWith("port")) {
|
||||
localPort = processPort(dataStringParts[i+1]);
|
||||
i++;
|
||||
}
|
||||
} else if (part.startsWith("raddr")) {
|
||||
remoteAddress = processAddress(part);
|
||||
// CHeck if entry after is of type port
|
||||
if (dataStringParts[i+1].startsWith("port")) {
|
||||
remotePort = processPort(dataStringParts[i+1]);
|
||||
i++;
|
||||
}
|
||||
} else if (part.startsWith("status")) {
|
||||
status = processStatus(part);
|
||||
|
||||
} else if (part.startsWith("pid")) {
|
||||
pid = processPID(part);
|
||||
|
||||
} else {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return new ConnectionInformation(fileDescriptor, addressFamily, socketKind, localAddress, localPort, remoteAddress, remotePort, status, pid);
|
||||
}
|
||||
|
||||
private static String removeHeadAndTail(String input) {
|
||||
return input.substring(HEAD_LENGTH, input.length()-TAIL_LENGTH);
|
||||
}
|
||||
|
||||
private static int processFileDescriptor(String fileDescriptorString) {
|
||||
int fileDescriptor = 0;
|
||||
try {
|
||||
fileDescriptor = Integer.valueOf(fileDescriptorString.substring(3, fileDescriptorString.length()-1));
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return fileDescriptor;
|
||||
}
|
||||
|
||||
private static String processAddressFamily(String addressFamilyString) {
|
||||
for (String addressFamily : ADDRESS_FAMILIES) {
|
||||
if (addressFamilyString.contains(addressFamily)) {
|
||||
return addressFamily;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String processSocketKind(String socketKindString) {
|
||||
for (String socketKind : SOCKET_KINDS) {
|
||||
if (socketKindString.contains(socketKind)) {
|
||||
return socketKind;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String processAddress(String addressString) {
|
||||
if (addressString.contains("''")) {
|
||||
// If it's an empty address, it contains ''
|
||||
return "";
|
||||
|
||||
} else if (addressString.contains("ip") && addressString.contains("[")) {
|
||||
String ipv6Head = "xaddr=addr(ip='[";
|
||||
// If it's an ipv6 address, since format is xaddr=addr(ip='[ipv6 address]',
|
||||
return addressString.substring(ipv6Head.length(), addressString.length()-3);
|
||||
|
||||
} else if (addressString.contains("ip")) {
|
||||
String ipv4Head = "xaddr=addr(ip='";
|
||||
// If it's an ipv4 address, since format is xaddr=addr(ip='ipv4 address',
|
||||
return addressString.substring(ipv4Head.length(), addressString.length()-2);
|
||||
|
||||
} else {
|
||||
String head = "xaddr='";
|
||||
// If it's not an empty or ip address, it is xaddr='path'
|
||||
return addressString.substring(head.length(), addressString.length()-1);
|
||||
}
|
||||
}
|
||||
|
||||
private static int processPort(String portString) {
|
||||
int port = 0;
|
||||
try {
|
||||
port = Integer.valueOf(portString.substring(5, portString.length()-2));
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
private static String processStatus(String statusString) {
|
||||
return statusString.substring(8, statusString.length()-2);
|
||||
}
|
||||
|
||||
private static int processPID(String pidString) {
|
||||
int processID = -1;
|
||||
try {
|
||||
processID = Integer.valueOf(pidString.substring(4));
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return processID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 29.12.2023
|
||||
*/
|
||||
package src.java.controller.DataProcessing.nftablesProcessing;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class NFTableInformation {
|
||||
// Outer list: tables
|
||||
// Middle lists: chains
|
||||
// Inner lists: rules
|
||||
private LinkedList<LinkedList<LinkedList<String>>> tables;
|
||||
|
||||
public NFTableInformation() {}
|
||||
|
||||
public NFTableInformation(NFTableInformation nftInf) {
|
||||
this.tables = new LinkedList<LinkedList<LinkedList<String>>>(nftInf.tables);
|
||||
}
|
||||
|
||||
// list of list of list<string>
|
||||
// -> table1
|
||||
// -> chain1
|
||||
// -> tablename
|
||||
// -> chainname
|
||||
// -> rule1
|
||||
// -> rule2
|
||||
|
||||
// -> table2
|
||||
|
||||
/*
|
||||
for (LinkedList<LinkedList<String>> table : tables) {
|
||||
for (LinkedList<String> chain : table) {
|
||||
for (String rule : chain) {
|
||||
if (rule.startsWith("{\"table")) {
|
||||
System.out.println(rule);
|
||||
} else if (rule.startsWith("{\"chain")) {
|
||||
System.out.println("\t" + rule);
|
||||
} else {
|
||||
System.out.println("\t\t" + rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public LinkedList<LinkedList<LinkedList<String>>>getTables() {
|
||||
return tables;
|
||||
}
|
||||
|
||||
public void setTables(LinkedList<LinkedList<LinkedList<String>>> tables) {
|
||||
this.tables = tables;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 29.12.2023
|
||||
* @lastChange 30.12.2023
|
||||
*/
|
||||
package src.java.controller.DataProcessing.nftablesProcessing;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeType;
|
||||
import com.fasterxml.jackson.databind.node.NullNode;
|
||||
|
||||
public final class NFTablesProcessor {
|
||||
private static final String NFT_MAIN_FIELD = "nftables";
|
||||
private static final String TABLE_FIELD = "table";
|
||||
private static final String CHAIN_FIELD = "chain";
|
||||
private static final String RULE_FIELD = "rule";
|
||||
private static final String NAME_FIELD = "name";
|
||||
|
||||
private enum FieldType {
|
||||
TABLE,
|
||||
CHAIN,
|
||||
RULE,
|
||||
NONE
|
||||
}
|
||||
|
||||
public static NFTableInformation processDataString(String data) {
|
||||
NFTableInformation nfTableInformation = new NFTableInformation();
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
LinkedList<LinkedList<LinkedList<String>>> tables = new LinkedList<LinkedList<LinkedList<String>>>();
|
||||
LinkedList<LinkedList<String>> tableChains = null;
|
||||
LinkedList<String> tableChainRules = null;
|
||||
|
||||
try {
|
||||
JsonNode nfttree = objectMapper.readTree(data);
|
||||
JsonNode mainRoot = getField(nfttree, NFT_MAIN_FIELD);
|
||||
|
||||
String lastTable = null;
|
||||
FieldType lastNodeType = FieldType.NONE;
|
||||
for (JsonNode nftObject : mainRoot) {
|
||||
// If next node is of type table
|
||||
if (isTableEntry(nftObject)) {
|
||||
switch (lastNodeType) {
|
||||
// Last node was of type table. Normally chain cares
|
||||
// about storing the table entry at the beginning of
|
||||
// the chains rules list but since table is empty,
|
||||
// the next iteration has to care about storing the
|
||||
// table at the list.
|
||||
case FieldType.TABLE: {
|
||||
tableChainRules = new LinkedList<String>();
|
||||
tableChainRules.add(lastTable);
|
||||
tableChains = new LinkedList<LinkedList<String>>();
|
||||
tableChains.add(new LinkedList<String>(tableChainRules));
|
||||
tables.add(new LinkedList<LinkedList<String>>(tableChains));
|
||||
} // Intended fall through
|
||||
case FieldType.CHAIN: // Intended fall through
|
||||
case FieldType.RULE: // Intended fall through
|
||||
case FieldType.NONE: // Intended fall through
|
||||
default: {
|
||||
// Reset all lists except tables list
|
||||
tableChainRules = new LinkedList<String>();
|
||||
tableChains = new LinkedList<LinkedList<String>>();
|
||||
}
|
||||
}
|
||||
lastNodeType = FieldType.TABLE;
|
||||
// Store current table description entry
|
||||
lastTable = nftObject.toString();
|
||||
|
||||
// If next node is chain, the node before must have been of type table, chain or rule
|
||||
} else if (isChainEntry(nftObject)) {
|
||||
switch (lastNodeType) {
|
||||
case FieldType.TABLE: {
|
||||
// Add table and chain to new table chain rules list
|
||||
tableChainRules.add(lastTable);
|
||||
tableChainRules.add(nftObject.toString());
|
||||
}break;
|
||||
case FieldType.CHAIN: // Intended fall through
|
||||
case FieldType.RULE: {
|
||||
// Add rules of last chain to chain and reset list
|
||||
tableChains.add(new LinkedList<String>(tableChainRules));
|
||||
tableChainRules = new LinkedList<String>();
|
||||
// Then add this chains description to list
|
||||
tableChainRules.add(nftObject.toString());
|
||||
}break;
|
||||
case FieldType.NONE: // Intended fall through
|
||||
default: {
|
||||
System.out.println("Error, missing table before chain.");
|
||||
}break;
|
||||
}
|
||||
lastNodeType = FieldType.CHAIN;
|
||||
|
||||
} else if (isRuleEntry(nftObject)) {
|
||||
switch (lastNodeType) {
|
||||
case FieldType.CHAIN: // Intended fall through
|
||||
case FieldType.RULE: {
|
||||
tableChainRules.add(nftObject.toString());
|
||||
}break;
|
||||
case FieldType.TABLE:// Intended fall through
|
||||
case FieldType.NONE: // Intended fall through
|
||||
default: {
|
||||
System.out.println("Error, missing chain before rule.");
|
||||
}break;
|
||||
}
|
||||
lastNodeType = FieldType.RULE;
|
||||
|
||||
} else {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
if (tableChains != null && !tableChains.isEmpty()) {
|
||||
tables.add(new LinkedList<LinkedList<String>>(tableChains));
|
||||
}
|
||||
} catch (JsonMappingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
nfTableInformation.setTables(tables);
|
||||
return nfTableInformation;
|
||||
}
|
||||
|
||||
private static boolean isTableEntry(JsonNode node) {
|
||||
return isSpecifiedEntry(node, TABLE_FIELD);
|
||||
|
||||
}
|
||||
|
||||
private static boolean isChainEntry(JsonNode node) {
|
||||
return isSpecifiedEntry(node, CHAIN_FIELD);
|
||||
}
|
||||
|
||||
private static boolean isRuleEntry(JsonNode node) {
|
||||
return isSpecifiedEntry(node, RULE_FIELD);
|
||||
}
|
||||
|
||||
private static boolean isSpecifiedEntry(JsonNode node, String type) {
|
||||
if (node.getNodeType() != JsonNodeType.NULL) {
|
||||
JsonNode maybeNode = node.get(type);
|
||||
if (maybeNode != null && maybeNode.toString() != "null") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static JsonNode getField(JsonNode node, String fieldName) {
|
||||
if (node.getNodeType() != JsonNodeType.NULL) {
|
||||
if (node.get(fieldName) != null) {
|
||||
return node.get(fieldName);
|
||||
}
|
||||
}
|
||||
return NullNode.getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package src.java.controller.interfaces;
|
||||
|
||||
public interface Controller {
|
||||
public void start();
|
||||
}
|
||||
70
src/main/java/src/java/controller/validate/Validate.java
Normal file
70
src/main/java/src/java/controller/validate/Validate.java
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 05.12.2023
|
||||
* @lastChange 25.01.2024
|
||||
*/
|
||||
|
||||
package src.java.controller.validate;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Validate {
|
||||
|
||||
/**
|
||||
* Checks if overhanded string is valid ip address, by checking if its length is 13 or less,
|
||||
* it contains exactly 4 numbers and if the numbers are in valid range.
|
||||
* @param ipv4Address
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidIPv4Address(String ipv4Address) {
|
||||
boolean isValidIPv4Address = false;
|
||||
// Maximum length of ipv4 address is 13 characters, only evaluate if
|
||||
// length of string is less or equal to 13.
|
||||
if (ipv4Address.length() <= 13) {
|
||||
String[] numbersAsString = ipv4Address.split("\\.");
|
||||
// If ip address contains exactly 4 parts splitted by dots:
|
||||
if (numbersAsString.length == 4) {
|
||||
// Transform each part to integer and check if in valid range.
|
||||
for (String numberAsString : numbersAsString) {
|
||||
int number = Integer.valueOf(numberAsString);
|
||||
if (number < 0 || number > 255) {
|
||||
isValidIPv4Address = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isValidIPv4Address = true;
|
||||
} else {
|
||||
isValidIPv4Address = false;
|
||||
}
|
||||
}
|
||||
return isValidIPv4Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if overhanded ipv6 address is valid by applying a regex to it.
|
||||
* @param ipv6Address
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidIPv6Address(String ipv6Address) {
|
||||
Pattern pattern = Pattern.compile("^([0-9a-f]{4}:){7}[0-9a-f]{4}$", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(ipv6Address);
|
||||
boolean matchFound = matcher.find();
|
||||
if(matchFound) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Port is validated by checking if in bounds of overhanded values.
|
||||
* @param port
|
||||
* @param startOfRange
|
||||
* @param endOfRange
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidPort(int port, int startOfRange, int endOfRange) {
|
||||
return (port >= startOfRange && port <= endOfRange);
|
||||
}
|
||||
}
|
||||
5
src/main/java/src/java/data/ConnectionData.java
Normal file
5
src/main/java/src/java/data/ConnectionData.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package src.java.data;
|
||||
|
||||
public final record ConnectionData(String ipAddress, int port, String keyStorePath, String keyStorePassphrase) {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package src.java;
|
||||
package src.java.main;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
20
src/main/java/src/java/queues/ReceivingQueue.java
Normal file
20
src/main/java/src/java/queues/ReceivingQueue.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 26.12.2023
|
||||
*/
|
||||
package src.java.queues;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class ReceivingQueue extends LinkedBlockingQueue<String> {
|
||||
private static ReceivingQueue instance;
|
||||
|
||||
private ReceivingQueue() {}
|
||||
|
||||
public static ReceivingQueue getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ReceivingQueue();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
20
src/main/java/src/java/queues/SendingQueue.java
Normal file
20
src/main/java/src/java/queues/SendingQueue.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 26.12.2023
|
||||
*/
|
||||
package src.java.queues;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
public class SendingQueue extends LinkedBlockingQueue<String> {
|
||||
private static SendingQueue instance;
|
||||
|
||||
private SendingQueue() {}
|
||||
|
||||
public static SendingQueue getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SendingQueue();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
63
src/main/java/src/java/view/constants/GUIConstants.java
Normal file
63
src/main/java/src/java/view/constants/GUIConstants.java
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
|
||||
package src.java.view.constants;
|
||||
|
||||
public final class GUIConstants {
|
||||
/**
|
||||
* Represents kinds of frames.
|
||||
*/
|
||||
public static enum Frame {
|
||||
MainFrame,
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents kinds of panels that can be put in main frame.
|
||||
*/
|
||||
public static enum Panel {
|
||||
MonitoringPanel,
|
||||
ControllingPanel,
|
||||
NFTableChainPanel,
|
||||
NFTableRulePanel,
|
||||
ConnectToServerPanel,
|
||||
ConnectionsTablePanel
|
||||
}
|
||||
|
||||
public static enum E_ControllingSubPanel {
|
||||
BasePanel,
|
||||
NFTableFamilyPanel,
|
||||
NFTableTablePanel,
|
||||
NFTableChainPanel,
|
||||
NFTableRulePanel,
|
||||
None
|
||||
}
|
||||
|
||||
public static enum NFTablePanel {
|
||||
NFTableTablesPanel,
|
||||
NFTableChainsPanel,
|
||||
NFTableRulesPanel
|
||||
}
|
||||
|
||||
public static enum Status {
|
||||
Connected,
|
||||
Connecting,
|
||||
Disconnected,
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents kinds of themes.
|
||||
*/
|
||||
public static enum Theme {
|
||||
Dark,
|
||||
Light
|
||||
}
|
||||
|
||||
public static enum Languages {
|
||||
German,
|
||||
English
|
||||
}
|
||||
}
|
||||
24
src/main/java/src/java/view/frames/MainFrame.java
Normal file
24
src/main/java/src/java/view/frames/MainFrame.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
* @lastChange 22.01.2024
|
||||
*/
|
||||
package src.java.view.frames;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public final class MainFrame extends JFrame {
|
||||
|
||||
public MainFrame() {
|
||||
|
||||
//this.contentPanel = new JPanel();
|
||||
//this.getContentPane().add(this.contentPanel);
|
||||
|
||||
//this.setJMenuBar(MenuBar.getMenuBar());
|
||||
|
||||
//this.setTitle(this.viewModel.get_MainFrame_ViewModel().getTitle());
|
||||
//this.setPanel(this.viewModel.get_MainFrame_ViewModel().getMainFrameActivePanel());
|
||||
//this.setLocation(this.viewModel.get_MainFrame_ViewModel().getXPosition(), this.viewModel.get_MainFrame_ViewModel().getYPosition());
|
||||
//this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
}
|
||||
65
src/main/java/src/java/view/menubar/Menu.java
Normal file
65
src/main/java/src/java/view/menubar/Menu.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
* @lastChange 07.01.2024
|
||||
*/
|
||||
|
||||
package src.java.view.menubar;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
|
||||
import src.java.view.constants.GUIConstants.Languages;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* Menu at menu bar.
|
||||
*/
|
||||
public final class Menu extends JMenu {
|
||||
private String[] translations = null;
|
||||
|
||||
/**
|
||||
* @param translations of this menus text.
|
||||
* @param actionListener belonging to this menu. Events that occur by clicking on menu depending on this.
|
||||
*/
|
||||
public Menu(final String[] translations, ActionListener actionListener) {
|
||||
this.setTranslations(translations);
|
||||
this.changeLanguage(Languages.German);
|
||||
if (actionListenerValid("constructor of Menu", actionListener)) {
|
||||
this.addActionListener(actionListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTranslations(final String[] translations) {
|
||||
if (null != translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
}
|
||||
|
||||
public void changeLanguage(Languages language) {
|
||||
if (translationsSet("changeLanguage")) {
|
||||
this.setText(translations[language.ordinal()]);
|
||||
for (int index = 0; index < this.getItemCount(); index++) {
|
||||
((MenuItem)this.getItem(index)).changeLanguage(language);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean translationsSet(String callingMethod) {
|
||||
boolean translationsSet = true;
|
||||
if (null == translations) {
|
||||
translationsSet = false;
|
||||
System.err.println("Error at " + callingMethod + " of menu item. translations are null");
|
||||
}
|
||||
return translationsSet;
|
||||
}
|
||||
|
||||
private boolean actionListenerValid(String callingMethod, ActionListener actionListener) {
|
||||
boolean actionListenerSet = true;
|
||||
if (null == actionListener) {
|
||||
actionListenerSet = false;
|
||||
System.err.println("Error at " + callingMethod + " of menu item. action listener is null");
|
||||
}
|
||||
return actionListenerSet;
|
||||
}
|
||||
}
|
||||
39
src/main/java/src/java/view/menubar/MenuBar.java
Normal file
39
src/main/java/src/java/view/menubar/MenuBar.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
* @lastChange 07.01.2024
|
||||
*/
|
||||
|
||||
package src.java.view.menubar;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import src.java.view.constants.GUIConstants.Languages;
|
||||
import src.java.view.menubar.menus.HelpMenuFactory;
|
||||
import src.java.view.menubar.menus.LanguageMenuFactory;
|
||||
|
||||
public final class MenuBar extends JMenuBar {
|
||||
|
||||
private MenuBarLanguageController languageController = null;
|
||||
|
||||
private MenuBar() {
|
||||
languageController = new MenuBarLanguageController(this);
|
||||
|
||||
this.add(HelpMenuFactory.createHelpMenu());
|
||||
this.add(LanguageMenuFactory.createLanguageMenu(languageController));
|
||||
}
|
||||
|
||||
public static MenuBar getMenuBar() {
|
||||
return new MenuBar();
|
||||
}
|
||||
|
||||
public void changeLanguage(Languages language) {
|
||||
changeLanguageOfMenus(language);
|
||||
}
|
||||
|
||||
private void changeLanguageOfMenus(Languages language) {
|
||||
for (int index = 0; index < this.getMenuCount(); index++) {
|
||||
((Menu)this.getMenu(index)).changeLanguage(language);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar;
|
||||
|
||||
public final class MenuBarLanguageController {
|
||||
private MenuBar menuBar = null;
|
||||
|
||||
public MenuBarLanguageController(MenuBar menuBar) {
|
||||
this.menuBar = menuBar;
|
||||
}
|
||||
|
||||
public Menu getMenu(int index) {
|
||||
return (Menu)this.menuBar.getMenu(index);
|
||||
}
|
||||
|
||||
public int getMenuCount() {
|
||||
return this.menuBar.getMenuCount();
|
||||
}
|
||||
}
|
||||
27
src/main/java/src/java/view/menubar/MenuBarSeparator.java
Normal file
27
src/main/java/src/java/view/menubar/MenuBarSeparator.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
/**
|
||||
* Horizontal line separator for menu bar.
|
||||
*/
|
||||
public final class MenuBarSeparator extends JMenuItem {
|
||||
|
||||
static final Color color = new Color(47, 47, 47);
|
||||
|
||||
public MenuBarSeparator() {
|
||||
this.setEnabled(false);
|
||||
this.setPreferredSize(new Dimension(0, 1));
|
||||
this.setBackground(color);
|
||||
this.setBorder(BorderFactory.createLineBorder(color, 2));
|
||||
}
|
||||
}
|
||||
62
src/main/java/src/java/view/menubar/MenuItem.java
Normal file
62
src/main/java/src/java/view/menubar/MenuItem.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
* @lastChange 07.01.2024
|
||||
*/
|
||||
|
||||
package src.java.view.menubar;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import src.java.view.constants.GUIConstants.Languages;
|
||||
|
||||
/**
|
||||
* Menu item at menu at menu bar.
|
||||
*/
|
||||
public final class MenuItem extends JMenuItem {
|
||||
private String[] translations = null;
|
||||
|
||||
/**
|
||||
* @param translations of this menu items text.
|
||||
* @param actionListener belonging to this menu item. Events that occur by clicking on menu item depending on this.
|
||||
*/
|
||||
public MenuItem(final String[] translations, ActionListener actionListener) {
|
||||
this.setTranslations(translations);
|
||||
this.changeLanguage(Languages.German);
|
||||
if (actionListenerValid("constructor of Menu", actionListener)) {
|
||||
this.addActionListener(actionListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTranslations(final String[] translations) {
|
||||
if (null != translations) {
|
||||
this.translations = translations;
|
||||
}
|
||||
}
|
||||
|
||||
public void changeLanguage(Languages language) {
|
||||
if (translationsSet("changeLanguage")) {
|
||||
this.setText(translations[language.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean translationsSet(String callingMethod) {
|
||||
boolean translationsSet = true;
|
||||
if (null == translations) {
|
||||
translationsSet = false;
|
||||
System.err.println("Error at " + callingMethod + " of menu item. translations of are null");
|
||||
}
|
||||
return translationsSet;
|
||||
}
|
||||
|
||||
private boolean actionListenerValid(String callingMethod, ActionListener actionListener) {
|
||||
boolean actionListenerSet = true;
|
||||
if (null == actionListener) {
|
||||
actionListenerSet = false;
|
||||
System.err.println("Error at " + callingMethod + " of menu item. action listener is null");
|
||||
}
|
||||
return actionListenerSet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar.menuItems;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import src.java.view.menubar.MenuItem;
|
||||
|
||||
public final class HelpMenuItemFactory {
|
||||
|
||||
public static MenuItem createManualMenuItem() {
|
||||
final String[] translations = {"Anleitung", "Manual"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
};
|
||||
|
||||
MenuItem manualMenuItem = new MenuItem(translations, actionListener);
|
||||
|
||||
return manualMenuItem;
|
||||
}
|
||||
|
||||
public static MenuItem createAboutMenuItem() {
|
||||
final String[] translations = {"Über", "About"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
};
|
||||
|
||||
MenuItem aboutMenuItem = new MenuItem(translations, actionListener);
|
||||
|
||||
return aboutMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar.menuItems;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import src.java.view.constants.GUIConstants.Languages;
|
||||
import src.java.view.menubar.MenuBarLanguageController;
|
||||
import src.java.view.menubar.MenuItem;
|
||||
|
||||
public final class LanguageMenuItemFactory {
|
||||
|
||||
public static MenuItem createGermanMenuItem(final MenuBarLanguageController languageController) {
|
||||
final String[] translations = {"Deutsch", "German"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (int index = 0; index < languageController.getMenuCount(); index++) {
|
||||
languageController.getMenu(index).changeLanguage(Languages.German);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MenuItem germanMenuItem = new MenuItem(translations, actionListener);
|
||||
|
||||
return germanMenuItem;
|
||||
}
|
||||
|
||||
public static MenuItem createEnglishMenuItem(final MenuBarLanguageController languageController) {
|
||||
final String[] translations = {"Englisch", "English"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (int index = 0; index < languageController.getMenuCount(); index++) {
|
||||
languageController.getMenu(index).changeLanguage(Languages.English);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MenuItem englishMenuItem = new MenuItem(translations, actionListener);
|
||||
|
||||
return englishMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar.menus;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import src.java.view.menubar.Menu;
|
||||
import src.java.view.menubar.menuItems.HelpMenuItemFactory;
|
||||
|
||||
public final class HelpMenuFactory {
|
||||
|
||||
|
||||
public static Menu createHelpMenu() {
|
||||
final String[] translations = {"Hilfe", "Help"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
};
|
||||
Menu helpMenu = new Menu(translations, actionListener);
|
||||
helpMenu.add(HelpMenuItemFactory.createManualMenuItem());
|
||||
helpMenu.add(HelpMenuItemFactory.createAboutMenuItem());
|
||||
return helpMenu;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 01.11.2023
|
||||
*/
|
||||
|
||||
package src.java.view.menubar.menus;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import src.java.view.menubar.Menu;
|
||||
import src.java.view.menubar.MenuBarLanguageController;
|
||||
import src.java.view.menubar.menuItems.LanguageMenuItemFactory;
|
||||
|
||||
public final class LanguageMenuFactory {
|
||||
|
||||
public static Menu createLanguageMenu(MenuBarLanguageController languageController) {
|
||||
final String[] translations = {"Sprache", "Language"};
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
}
|
||||
};
|
||||
Menu languageMenu = new Menu(translations, actionListener);
|
||||
languageMenu.add(LanguageMenuItemFactory.createGermanMenuItem(languageController));
|
||||
languageMenu.add(LanguageMenuItemFactory.createEnglishMenuItem(languageController));
|
||||
return languageMenu;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 02.12.2023
|
||||
* @lastChange 08.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ConnectToServerPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
/**
|
||||
* The panel to enter data to connect to the server.
|
||||
*/
|
||||
public final class ConnectToServerPanel extends JPanel {
|
||||
|
||||
private static ConnectToServerPanel instance = null;
|
||||
|
||||
private String serverCertStoreFilePath = "";
|
||||
|
||||
private JLabel mainMessageLabel = null;
|
||||
private JLabel ipAddressLabel = null;
|
||||
private JLabel portLabel = null;
|
||||
private JLabel serverCertStoreLabel = null;
|
||||
private JLabel serverCertStorePasswordLabel = null;
|
||||
|
||||
private JRadioButton[] ipVersionRadioButtons = null;
|
||||
|
||||
private JTextField ipAddressTextField = null;
|
||||
private JTextField portTextField = null;
|
||||
private JTextField trustStorePasswordTextField = null;
|
||||
|
||||
private JButton connectButton = null;
|
||||
private JButton trustStoreFileChooserButton = null;
|
||||
|
||||
private ConnectToServerPanel() {
|
||||
this.createComponents();
|
||||
this.addComponents();
|
||||
}
|
||||
|
||||
public static ConnectToServerPanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ConnectToServerPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates interactable components.
|
||||
*/
|
||||
private void createComponents() {
|
||||
this.createMainMessageLabel();
|
||||
|
||||
this.createIPVersionRadioButtons();
|
||||
this.createIPAddressLabel();
|
||||
this.createIPAddressTextField();
|
||||
|
||||
this.createPortLabel();
|
||||
this.createPortTextField();
|
||||
|
||||
this.createServerCertStoreLabel();
|
||||
this.createServerCertStoreFileChooserButton();
|
||||
this.createTrustStorePasswordLabel();
|
||||
this.createTrustStorePasswordTextField();
|
||||
|
||||
this.createConnectButton();
|
||||
}
|
||||
|
||||
private void addComponents() {
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
this.addMainMessageLabel();
|
||||
|
||||
this.addIPVersionRadioButtons();
|
||||
this.addIPAddressLabel();
|
||||
this.addIPAddressTextField();
|
||||
|
||||
this.addPortLabel();
|
||||
this.addPortTextField();
|
||||
|
||||
this.addServerCertStoreLabel();
|
||||
this.addServerCertStoreFileChooserButton();
|
||||
this.addTrustStorePasswordLabel();
|
||||
this.addTrustStorePasswordTextField();
|
||||
|
||||
this.addConnectButton();
|
||||
}
|
||||
|
||||
private void createMainMessageLabel() {
|
||||
this.mainMessageLabel = new JLabel();
|
||||
}
|
||||
|
||||
private void addMainMessageLabel() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 10, 0);
|
||||
this.add(this.mainMessageLabel, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createIPVersionRadioButtons() {
|
||||
ButtonGroup ipVersionRadioButtonsGroup = new ButtonGroup();
|
||||
|
||||
this.ipVersionRadioButtons = new JRadioButton[2];
|
||||
|
||||
this.ipVersionRadioButtons[0] = new JRadioButton();
|
||||
this.ipVersionRadioButtons[1] = new JRadioButton();
|
||||
|
||||
ipVersionRadioButtonsGroup.add(this.ipVersionRadioButtons[0]);
|
||||
ipVersionRadioButtonsGroup.add(this.ipVersionRadioButtons[1]);
|
||||
|
||||
this.ipVersionRadioButtons[0].setSelected(true);
|
||||
}
|
||||
|
||||
private void addIPVersionRadioButtons() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
this.add(this.ipVersionRadioButtons[0], gridBagConstraints);
|
||||
gridBagConstraints.gridy = 2;
|
||||
this.add(this.ipVersionRadioButtons[1], gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createIPAddressLabel() {
|
||||
this.ipAddressLabel = new JLabel();
|
||||
}
|
||||
|
||||
private void addIPAddressLabel() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 3;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(10, 0, 0, 0);
|
||||
this.add(this.ipAddressLabel, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createIPAddressTextField() {
|
||||
this.ipAddressTextField = new JTextField(24);
|
||||
}
|
||||
|
||||
private void addIPAddressTextField() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 4;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
this.add(this.ipAddressTextField, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createPortLabel() {
|
||||
this.portLabel = new JLabel();
|
||||
}
|
||||
|
||||
private void addPortLabel() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 5;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
this.add(this.portLabel, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createPortTextField() {
|
||||
this.portTextField = new JTextField(24);
|
||||
}
|
||||
|
||||
private void addPortTextField() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 6;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
this.add(this.portTextField, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createServerCertStoreLabel() {
|
||||
this.serverCertStoreLabel = new JLabel();
|
||||
}
|
||||
|
||||
private void addServerCertStoreLabel() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 7;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(10, 0, 0, 0);
|
||||
this.add(this.serverCertStoreLabel, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createServerCertStoreFileChooserButton() {
|
||||
|
||||
this.trustStoreFileChooserButton = new JButton();
|
||||
|
||||
this.trustStoreFileChooserButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JFileChooser fileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());
|
||||
|
||||
int fileChooserOption = fileChooser.showSaveDialog(null);
|
||||
|
||||
// if the user selects a file
|
||||
if (fileChooserOption == JFileChooser.APPROVE_OPTION) {
|
||||
serverCertStoreFilePath = fileChooser.getSelectedFile().getAbsolutePath();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addServerCertStoreFileChooserButton() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 8;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(10, 0, 0, 0);
|
||||
this.add(this.trustStoreFileChooserButton, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createTrustStorePasswordLabel() {
|
||||
this.serverCertStorePasswordLabel = new JLabel();
|
||||
}
|
||||
|
||||
private void addTrustStorePasswordLabel() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 9;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(10, 0, 0, 0);
|
||||
this.add(this.serverCertStorePasswordLabel, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createTrustStorePasswordTextField() {
|
||||
this.trustStorePasswordTextField = new JPasswordField(24);
|
||||
}
|
||||
|
||||
private void addTrustStorePasswordTextField() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 10;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
this.add(this.trustStorePasswordTextField, gridBagConstraints);
|
||||
}
|
||||
|
||||
private void createConnectButton() {
|
||||
|
||||
this.connectButton = new JButton();
|
||||
|
||||
this.connectButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
// I_ViewEvent data = new AA_ConnectToServerButtonGotPressed(
|
||||
// new AA_ConnectToServerData(
|
||||
// ipAddressTextField.getText(),
|
||||
// Integer.valueOf(portTextField.getText()),
|
||||
// serverCertStoreFilePath,
|
||||
// trustStorePasswordTextField.getText()));
|
||||
// // Pass the data to the event manager
|
||||
// view_To_ViewEventManager_Queue.add(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addConnectButton() {
|
||||
GridBagConstraints gridBagConstraints = new GridBagConstraints();
|
||||
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 11;
|
||||
gridBagConstraints.weightx = 1;
|
||||
gridBagConstraints.weighty = 1;
|
||||
gridBagConstraints.insets = new Insets(10, 0, 0, 0);
|
||||
this.add(this.connectButton, gridBagConstraints);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date
|
||||
* @lastChange 07.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ConnectionsTablePanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class ConnectionsTablePanel extends JPanel {
|
||||
|
||||
private static ConnectionsTablePanel instance = null;
|
||||
|
||||
private JPanel connectionsPanel;
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
private ConnectionsTablePanel() {
|
||||
buildPanel();
|
||||
}
|
||||
|
||||
private void buildPanel() {
|
||||
this.connectionsPanel = new JPanel();
|
||||
this.connectionsPanel.setLayout(new BoxLayout(connectionsPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
//for (ConnectionInformation connection : viewModel.get_ConnectionsPanel_ViewModel().getConnections()) {
|
||||
// System.out.println(connection);
|
||||
// JLabel connectionLabel = new JLabel(
|
||||
// connection.toString());
|
||||
// this.connectionsPanel.add(connectionLabel);
|
||||
//}
|
||||
|
||||
JLabel label = new JLabel("Verbindungen");
|
||||
|
||||
// Fills the whole rest panel (this) with scroll pane.
|
||||
this.scrollPane = new JScrollPane(connectionsPanel);
|
||||
this.scrollPane.setPreferredSize(new Dimension(300,200));
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||
labelConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
labelConstraints.gridx = 0;
|
||||
labelConstraints.gridy = 0;
|
||||
this.add(label, labelConstraints);
|
||||
|
||||
GridBagConstraints scrollPaneConstraints = new GridBagConstraints();
|
||||
scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
scrollPaneConstraints.gridx = 0;
|
||||
scrollPaneConstraints.gridy = 1;
|
||||
this.add(scrollPane, scrollPaneConstraints);
|
||||
}
|
||||
|
||||
public static ConnectionsTablePanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ConnectionsTablePanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package src.java.view.panels.ControllingPanel.BasePanel;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class ControllingBasePanel extends JPanel {
|
||||
|
||||
private static ControllingBasePanel instance = null;
|
||||
|
||||
private final JButton nftConfigButton;
|
||||
|
||||
private ControllingBasePanel() {
|
||||
nftConfigButton = new JButton("NFT Config");
|
||||
nftConfigButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO
|
||||
}
|
||||
});
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
GridBagConstraints nftConfButtonConstraints = new GridBagConstraints();
|
||||
|
||||
this.add(nftConfigButton, nftConfButtonConstraints);
|
||||
}
|
||||
|
||||
public static ControllingBasePanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ControllingBasePanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
*/
|
||||
|
||||
package src.java.view.panels.ControllingPanel;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public final class ControllingPanel extends JPanel {
|
||||
|
||||
private static ControllingPanel instance = null;
|
||||
|
||||
// private E_ControllingSubPanel activePanelType = E_ControllingSubPanel.None;
|
||||
// private Deque<E_ControllingSubPanel> previousPanelStack = new ArrayDeque<E_ControllingSubPanel>();
|
||||
// private Deque<E_ControllingSubPanel> nextPanelStack = new ArrayDeque<E_ControllingSubPanel>();
|
||||
|
||||
private ControllingPanel() {
|
||||
// this.setPanel(E_ControllingSubPanel.BasePanel);
|
||||
}
|
||||
|
||||
public static ControllingPanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ControllingPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
// public void setPanel(E_ControllingSubPanel panelType) {
|
||||
// this.removeAll();
|
||||
|
||||
// switch (panelType) {
|
||||
// case E_ControllingSubPanel.BasePanel: {
|
||||
// if (activePanelType != E_ControllingSubPanel.BasePanel) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// this.activePanelType = E_ControllingSubPanel.BasePanel;
|
||||
// this.add(ControllingBasePanel.getInstance(this));
|
||||
// }
|
||||
// }break;
|
||||
// case E_ControllingSubPanel.NFTableFamilyPanel: {
|
||||
// if (activePanelType != E_ControllingSubPanel.NFTableFamilyPanel) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// this.activePanelType = E_ControllingSubPanel.NFTableFamilyPanel;
|
||||
// this.add(NFTFamilyPanel.getInstance());
|
||||
// }
|
||||
// }break;
|
||||
// case E_ControllingSubPanel.NFTableTablePanel: {
|
||||
// if (activePanelType != E_ControllingSubPanel.NFTableTablePanel) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// this.activePanelType = E_ControllingSubPanel.NFTableTablePanel;
|
||||
// this.add(NFTablesTablePanel.getInstance());
|
||||
// }
|
||||
// }break;
|
||||
// case E_ControllingSubPanel.NFTableChainPanel: {
|
||||
// if (activePanelType != E_ControllingSubPanel.NFTableChainPanel) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// this.activePanelType = E_ControllingSubPanel.NFTableChainPanel;
|
||||
// this.add(NFTablesChainPanel.getInstance());
|
||||
// }
|
||||
// }break;
|
||||
// case E_ControllingSubPanel.NFTableRulePanel: {
|
||||
// if (activePanelType != E_ControllingSubPanel.NFTableRulePanel) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// this.activePanelType = E_ControllingSubPanel.NFTableRulePanel;
|
||||
// this.add(NFTablesRulePanel.getInstance());
|
||||
// }
|
||||
// }break;
|
||||
// default: {
|
||||
|
||||
// }break;
|
||||
// }
|
||||
// MainFrame.getInstance(null,null).setVisible(true);
|
||||
// }
|
||||
|
||||
// public void switchToPreviousPanel() {
|
||||
// if (!previousPanelStack.isEmpty()) {
|
||||
// nextPanelStack.push(activePanelType);
|
||||
// setPanel(previousPanelStack.pop());
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void switchToNextPanel() {
|
||||
// if(!nextPanelStack.isEmpty()) {
|
||||
// previousPanelStack.push(activePanelType);
|
||||
// setPanel(nextPanelStack.pop());
|
||||
// }
|
||||
// }
|
||||
|
||||
/*public void setNFTInformation(NFTablesConfigurationReceived nftConfig) {
|
||||
LinkedList<LinkedList<LinkedList<String>>> nftInformation = nftConfig.getNFTableInformation().getTables();
|
||||
|
||||
LinkedList<String> tables = new LinkedList<String>();
|
||||
|
||||
HashMap<String, String> chains = new HashMap<String, String>();
|
||||
|
||||
HashMap<String, String> rules = new HashMap<String, String>();
|
||||
|
||||
for (int tableIndex = 0; tableIndex < nftInformation.size(); tableIndex++) {
|
||||
for (int chainIndex = 0; chainIndex < nftInformation.get(tableIndex).size(); chainIndex++) {
|
||||
for (int ruleIndex = 0; ruleIndex < nftInformation.get(tableIndex).get(chainIndex).size(); ruleIndex++) {
|
||||
switch (ruleIndex) {
|
||||
case 0: {
|
||||
tables.add(nftInformation.get(tableIndex).get(chainIndex).get(0));
|
||||
}break;
|
||||
case 1: {
|
||||
chains.put(nftInformation.get(tableIndex).get(chainIndex).get(0), nftInformation.get(tableIndex).get(chainIndex).get(1));
|
||||
}break;
|
||||
default: {
|
||||
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NFTablesTablePanel.getInstance().setTables(tables);
|
||||
} */
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package src.java.view.panels.ControllingPanel;
|
||||
|
||||
import src.java.view.constants.GUIConstants.E_ControllingSubPanel;
|
||||
|
||||
public interface I_ControllingPanel_SwitchPanel {
|
||||
public void switchToPreviousPanel();
|
||||
public void switchToNextPanel();
|
||||
public void setPanel(E_ControllingSubPanel controllingSubPanel);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 04.01.2024
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTFamilyPanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
public class IPv4FamilyButton extends JButton implements ActionListener {
|
||||
private static IPv4FamilyButton instance = null;
|
||||
|
||||
private IPv4FamilyButton() {
|
||||
this.setText("IPv4");
|
||||
this.addActionListener(this);
|
||||
this.setPreferredSize(new Dimension(100,100));
|
||||
}
|
||||
|
||||
public static IPv4FamilyButton getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new IPv4FamilyButton();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'actionPerformed'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 04.01.2024
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTFamilyPanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
public class IPv6FamilyButton extends JButton implements ActionListener {
|
||||
private static IPv6FamilyButton instance = null;
|
||||
|
||||
private IPv6FamilyButton() {
|
||||
this.setText("IPv6");
|
||||
this.addActionListener(this);
|
||||
this.setPreferredSize(new Dimension(100,100));
|
||||
}
|
||||
|
||||
public static IPv6FamilyButton getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new IPv6FamilyButton();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'actionPerformed'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 04.01.2024
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTFamilyPanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
||||
public class InetFamilyButton extends JButton implements ActionListener {
|
||||
private static InetFamilyButton instance = null;
|
||||
|
||||
private InetFamilyButton() {
|
||||
this.setText("Inet");
|
||||
this.addActionListener(this);
|
||||
this.setPreferredSize(new Dimension(100,100));
|
||||
}
|
||||
|
||||
public static InetFamilyButton getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new InetFamilyButton();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'actionPerformed'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.12.2023
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTFamilyPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public final class NFTFamilyPanel extends JPanel {
|
||||
private static NFTFamilyPanel instance = null;
|
||||
|
||||
private final JLabel instruction;
|
||||
|
||||
private final JButton inetFamilyButton;
|
||||
private final JButton ipv4FamilyButton;
|
||||
private final JButton ipv6FamilyButton;
|
||||
|
||||
private NFTFamilyPanel() {
|
||||
instruction = new JLabel("Waehlen Sie die Familie aus, deren Tabellen / Ketten / Regeln Sie anschauen / veraendern moechten.");
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
this.addInstructions();
|
||||
|
||||
inetFamilyButton = InetFamilyButton.getInstance();
|
||||
ipv4FamilyButton = IPv4FamilyButton.getInstance();
|
||||
ipv6FamilyButton = IPv6FamilyButton.getInstance();
|
||||
|
||||
this.addFamilyButtons();
|
||||
}
|
||||
|
||||
private void addInstructions() {
|
||||
GridBagConstraints instructionConstraints = new GridBagConstraints();
|
||||
instructionConstraints.gridx = 0;
|
||||
instructionConstraints.gridy = 0;
|
||||
instructionConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
instructionConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
instructionConstraints.weightx = 1;
|
||||
instructionConstraints.insets = new Insets(0,0,0,0);
|
||||
this.add(instruction, instructionConstraints);
|
||||
}
|
||||
|
||||
private void addFamilyButtons() {
|
||||
GridBagConstraints buttonPanelConstraints = new GridBagConstraints();
|
||||
buttonPanelConstraints.gridx = 0;
|
||||
buttonPanelConstraints.gridy = 1;
|
||||
buttonPanelConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
buttonPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
buttonPanelConstraints.weightx = 1;
|
||||
buttonPanelConstraints.insets = new Insets(0,0,0,0);
|
||||
|
||||
JPanel familyButtonPanel = new JPanel();
|
||||
familyButtonPanel.setLayout(new FlowLayout());
|
||||
|
||||
familyButtonPanel.add(inetFamilyButton);
|
||||
familyButtonPanel.add(ipv4FamilyButton);
|
||||
familyButtonPanel.add(ipv6FamilyButton);
|
||||
|
||||
this.add(familyButtonPanel, buttonPanelConstraints);
|
||||
}
|
||||
|
||||
public static NFTFamilyPanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NFTFamilyPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 30.12.2023
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTablesChainPanel;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public final class NFTablesChainPanel extends JPanel {
|
||||
private static NFTablesChainPanel instance = null;
|
||||
|
||||
private NFTablesChainPanel() {
|
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static NFTablesChainPanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NFTablesChainPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 04.01.2024
|
||||
* @lastChange 04.01.2024
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTablesRulePanel;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public final class NFTablesRulePanel extends JPanel {
|
||||
private static NFTablesRulePanel instance = null;
|
||||
|
||||
private NFTablesRulePanel() {
|
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static NFTablesRulePanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NFTablesRulePanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 30.12.2023
|
||||
* @lastChange 30.12.2023
|
||||
*/
|
||||
package src.java.view.panels.ControllingPanel.NFTable.NFTablesTablePanel;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public final class NFTablesTablePanel extends JPanel {
|
||||
private static NFTablesTablePanel instance = null;
|
||||
|
||||
private JPanel tableListPanel = null;
|
||||
|
||||
private NFTablesTablePanel() {
|
||||
setTables(null);
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
GridBagConstraints tablesPanelConstraints = new GridBagConstraints();
|
||||
|
||||
this.add(tableListPanel, tablesPanelConstraints);
|
||||
}
|
||||
|
||||
public static NFTablesTablePanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NFTablesTablePanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setTables(List<String> tables) {
|
||||
tableListPanel = new JPanel();
|
||||
tableListPanel.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
if (tables != null) {
|
||||
|
||||
for (String table : tables) {
|
||||
//tableListPanel.add();
|
||||
}
|
||||
} else {
|
||||
//tableListPanel.add();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package src.java.view.panels.MonitoringPanel.AlarmPanel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class Alarm extends JPanel {
|
||||
private JButton button;
|
||||
|
||||
public Alarm(String message) {
|
||||
this.button = new JButton(message);
|
||||
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(button);
|
||||
}
|
||||
|
||||
public JButton getButton() {
|
||||
return button;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package src.java.view.panels.MonitoringPanel.AlarmPanel;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class AlarmPanel extends JPanel {
|
||||
private static AlarmPanel instance;
|
||||
|
||||
private JPanel alarmsPanel;
|
||||
private LinkedList<Alarm> alarms;
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
private AlarmPanel() {
|
||||
this.alarmsPanel = new JPanel();
|
||||
this.alarmsPanel.setLayout(new BoxLayout(alarmsPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
for (int i = 0; i < 41; i++) {
|
||||
Alarm alarm = new Alarm("Test " + i);
|
||||
this.alarmsPanel.add(alarm);
|
||||
}
|
||||
|
||||
JLabel label = new JLabel("Alarme");
|
||||
|
||||
// Fills the whole rest panel (this) with scroll pane.
|
||||
this.scrollPane = new JScrollPane(alarmsPanel);
|
||||
this.scrollPane.setPreferredSize(new Dimension(300,200));
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||
labelConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
labelConstraints.gridx = 0;
|
||||
labelConstraints.gridy = 0;
|
||||
this.add(label, labelConstraints);
|
||||
|
||||
GridBagConstraints scrollPaneConstraints = new GridBagConstraints();
|
||||
scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
scrollPaneConstraints.gridx = 0;
|
||||
scrollPaneConstraints.gridy = 1;
|
||||
this.add(scrollPane, scrollPaneConstraints);
|
||||
}
|
||||
|
||||
public static AlarmPanel getInstance() {
|
||||
if (null == instance) {
|
||||
instance = new AlarmPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package src.java.view.panels.MonitoringPanel.ConnectionsLineChart;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.block.BlockBorder;
|
||||
import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.chart.plot.XYPlot;
|
||||
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
|
||||
import org.jfree.chart.title.TextTitle;
|
||||
|
||||
import org.jfree.data.xy.XYDataset;
|
||||
import org.jfree.data.xy.XYSeries;
|
||||
import org.jfree.data.xy.XYSeriesCollection;
|
||||
|
||||
import org.w3c.dom.events.MouseEvent;
|
||||
|
||||
public class ConnectionsLineChartPanel extends JPanel {
|
||||
private static ConnectionsLineChartPanel instance;
|
||||
|
||||
private ConnectionsLineChartPanel() {
|
||||
XYDataset dataset = createDataset();
|
||||
JFreeChart chart = createChart(dataset);
|
||||
|
||||
ChartPanel chartPanel = new ChartPanel(chart);
|
||||
chartPanel.setBackground(Color.white);
|
||||
chartPanel.setPreferredSize(new Dimension(400,200));
|
||||
add(chartPanel);
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
// MainFrame.getInstance().setPanel(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ConnectionsLineChartPanel getInstance() {
|
||||
if (null == instance) {
|
||||
instance = new ConnectionsLineChartPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private XYDataset createDataset() {
|
||||
|
||||
var series = new XYSeries("TCP");
|
||||
series.add(1, 2);
|
||||
series.add(2, 4);
|
||||
series.add(3, 2);
|
||||
series.add(4, 5);
|
||||
series.add(5, 7);
|
||||
|
||||
var dataset = new XYSeriesCollection();
|
||||
dataset.addSeries(series);
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
private JFreeChart createChart(XYDataset dataset) {
|
||||
|
||||
JFreeChart chart = ChartFactory.createXYLineChart(
|
||||
"Zugriffe in Abh. zur Zeit",
|
||||
"Zeit",
|
||||
"Zugriffe",
|
||||
dataset,
|
||||
PlotOrientation.VERTICAL,
|
||||
true,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
XYPlot plot = chart.getXYPlot();
|
||||
|
||||
var renderer = new XYLineAndShapeRenderer();
|
||||
renderer.setSeriesPaint(0, Color.RED);
|
||||
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
|
||||
|
||||
plot.setRenderer(renderer);
|
||||
plot.setBackgroundPaint(Color.white);
|
||||
|
||||
plot.setRangeGridlinesVisible(true);
|
||||
plot.setRangeGridlinePaint(Color.BLACK);
|
||||
|
||||
plot.setDomainGridlinesVisible(true);
|
||||
plot.setDomainGridlinePaint(Color.BLACK);
|
||||
|
||||
chart.getLegend().setFrame(BlockBorder.NONE);
|
||||
|
||||
chart.setTitle(new TextTitle("Zugriffe",
|
||||
new Font("Serif", java.awt.Font.BOLD, 18)
|
||||
)
|
||||
);
|
||||
|
||||
return chart;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 31.10.2023
|
||||
*/
|
||||
|
||||
package src.java.view.panels.MonitoringPanel;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import src.java.view.panels.ConnectionsTablePanel.ConnectionsTablePanel;
|
||||
import src.java.view.panels.MonitoringPanel.AlarmPanel.AlarmPanel;
|
||||
import src.java.view.panels.MonitoringPanel.ConnectionsLineChart.ConnectionsLineChartPanel;
|
||||
import src.java.view.panels.MonitoringPanel.SystemInformationPanel.SystemInformationPanel;
|
||||
|
||||
public final class MonitoringPanel extends JPanel {
|
||||
|
||||
private static MonitoringPanel instance = null;
|
||||
|
||||
private MonitoringPanel() {
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
GridBagConstraints alarmConstraints = new GridBagConstraints();
|
||||
alarmConstraints.gridx = 0;
|
||||
alarmConstraints.gridy = 0;
|
||||
this.add(AlarmPanel.getInstance(), alarmConstraints);
|
||||
|
||||
GridBagConstraints connectionsLineCartConstraints = new GridBagConstraints();
|
||||
connectionsLineCartConstraints.gridx = 1;
|
||||
connectionsLineCartConstraints.gridy = 0;
|
||||
this.add(ConnectionsLineChartPanel.getInstance(), connectionsLineCartConstraints);
|
||||
|
||||
GridBagConstraints systemInformationConstraints = new GridBagConstraints();
|
||||
systemInformationConstraints.gridx = 0;
|
||||
systemInformationConstraints.gridy = 1;
|
||||
this.add(SystemInformationPanel.getInstance(), systemInformationConstraints);
|
||||
|
||||
GridBagConstraints connectionsPanelConstraints = new GridBagConstraints();
|
||||
connectionsPanelConstraints.gridx = 1;
|
||||
connectionsPanelConstraints.gridy = 1;
|
||||
this.add(ConnectionsTablePanel.getInstance(), connectionsPanelConstraints);
|
||||
}
|
||||
|
||||
public static MonitoringPanel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new MonitoringPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package src.java.view.panels.MonitoringPanel.SystemInformationPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class SystemInformationPanel extends JPanel {
|
||||
private static SystemInformationPanel instance;
|
||||
|
||||
private SystemInformationPanel() {
|
||||
this.setBackground(Color.red);
|
||||
this.setPreferredSize(new Dimension(300,200));
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||
labelConstraints.anchor = GridBagConstraints.NORTHWEST;
|
||||
labelConstraints.gridx = 0;
|
||||
labelConstraints.gridy = 0;
|
||||
this.add(new JLabel("System Information"), labelConstraints);
|
||||
}
|
||||
|
||||
public static SystemInformationPanel getInstance() {
|
||||
if (null == instance) {
|
||||
instance = new SystemInformationPanel();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
113
src/main/java/src/java/view/panels/StatusPanel/StatusPanel.java
Normal file
113
src/main/java/src/java/view/panels/StatusPanel/StatusPanel.java
Normal file
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* @author Aaron Moser
|
||||
* @date 09.12.2023
|
||||
* @lastChange 30.12.2023
|
||||
*/
|
||||
package src.java.view.panels.StatusPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class StatusPanel extends JPanel {
|
||||
|
||||
// private static StatusPanel instance = null;
|
||||
|
||||
// private final JPanel flowPanelWest;
|
||||
// private final JPanel flowPanelEast;
|
||||
|
||||
// private final JLabel statusLabel;
|
||||
// private final JButton monitoringButton;
|
||||
// private final JButton controllingButton;
|
||||
|
||||
// private final JButton nextControllingButton;
|
||||
// private final JButton previousControllingButton;
|
||||
|
||||
//private StatusPanel() {
|
||||
|
||||
// this.statusLabel = new JLabel(viewModel.get_StatusPanel_ViewModel().get_StatusLabel_Text() + ": " + viewModel.get_StatusPanel_ViewModel().get_ConnectionStatusLabel_Text());
|
||||
|
||||
// this.monitoringButton = new JButton();
|
||||
// this.monitoringButton.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// view_To_ViewEventManager_Queue.add(new AB_GoToMonitoringPanelButtonGotPressed());
|
||||
|
||||
// //monitoringButton.setEnabled(false);
|
||||
// //controllingButton.setEnabled(true);
|
||||
// //mainFrame.setPanel(E_MainFrameActivePanel.MonitoringPanel);
|
||||
// }
|
||||
// });
|
||||
|
||||
// this.controllingButton = new JButton();
|
||||
// this.controllingButton.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// view_To_ViewEventManager_Queue.add(new AB_GoToControllingPanelButtonGotPressed());
|
||||
// //controllingButton.setEnabled(false);
|
||||
// //monitoringButton.setEnabled(true);
|
||||
// //mainFrame.setPanel(E_MainFrameActivePanel.ControllingPanel);
|
||||
// }
|
||||
// });
|
||||
|
||||
// this.nextControllingButton = new JButton();
|
||||
// this.nextControllingButton.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// ControllingPanel.getInstance().switchToNextPanel();
|
||||
// }
|
||||
// });
|
||||
|
||||
// this.previousControllingButton = new JButton();
|
||||
// this.previousControllingButton.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// ControllingPanel.getInstance().switchToPreviousPanel();
|
||||
// }
|
||||
// });
|
||||
|
||||
// this.monitoringButton.setVisible(viewModel.get_StatusPanel_ViewModel().get_MonitoringButtonVisibility());
|
||||
// this.controllingButton.setVisible(viewModel.get_StatusPanel_ViewModel().get_ControllingButtonVisibility());
|
||||
|
||||
// this.nextControllingButton.setVisible(viewModel.get_StatusPanel_ViewModel().get_NextControllingButtonVisibility());
|
||||
// this.previousControllingButton.setVisible(viewModel.get_StatusPanel_ViewModel().get_PreviousControllingButtonVisibility());
|
||||
|
||||
// this.flowPanelWest = new JPanel();
|
||||
// this.flowPanelWest.setLayout(new FlowLayout());
|
||||
// this.flowPanelWest.add(this.statusLabel);
|
||||
// this.flowPanelWest.add(this.monitoringButton);
|
||||
// this.flowPanelWest.add(this.controllingButton);
|
||||
|
||||
// GridBagConstraints flowPanelConstraints = new GridBagConstraints();
|
||||
// flowPanelConstraints.anchor = GridBagConstraints.WEST;
|
||||
// flowPanelConstraints.gridx = 0;
|
||||
// flowPanelConstraints.weightx = 0.5;
|
||||
// flowPanelConstraints.weighty = 1;
|
||||
// flowPanelConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
// this.setLayout(new GridBagLayout());
|
||||
// this.add(this.flowPanelWest, flowPanelConstraints);
|
||||
|
||||
// this.flowPanelEast = new JPanel();
|
||||
// this.flowPanelEast.setLayout(new FlowLayout());
|
||||
// this.flowPanelEast.add(this.previousControllingButton);
|
||||
// this.flowPanelEast.add(this.nextControllingButton);
|
||||
|
||||
// GridBagConstraints flowPanelConstraintsEast = new GridBagConstraints();
|
||||
// flowPanelConstraintsEast.anchor = GridBagConstraints.EAST;
|
||||
// flowPanelConstraintsEast.gridx = 1;
|
||||
// flowPanelConstraintsEast.weightx = 0.5;
|
||||
// flowPanelConstraintsEast.weighty = 1;
|
||||
// flowPanelConstraintsEast.insets = new Insets(0, 0, 0, 0);
|
||||
// this.setLayout(new GridBagLayout());
|
||||
// this.add(this.flowPanelEast, flowPanelConstraintsEast);
|
||||
// }
|
||||
|
||||
// public static StatusPanel getInstance(I_ReadableViewModel viewModel, View_To_ViewEventManager_Queue view_To_ViewEventManager_Queue) {
|
||||
// if (instance == null) {
|
||||
// instance = new StatusPanel(viewModel, view_To_ViewEventManager_Queue);
|
||||
// }
|
||||
// return instance;
|
||||
// }
|
||||
}
|
||||
BIN
target/classes/src/java/connect/Receiver.class
Normal file
BIN
target/classes/src/java/connect/Receiver.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/connect/Sender.class
Normal file
BIN
target/classes/src/java/connect/Sender.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/connect/client/Client.class
Normal file
BIN
target/classes/src/java/connect/client/Client.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/connect/client/TLSClient.class
Normal file
BIN
target/classes/src/java/connect/client/TLSClient.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/controller/ControllerThread.class
Normal file
BIN
target/classes/src/java/controller/ControllerThread.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/src/java/controller/interfaces/Controller.class
Normal file
BIN
target/classes/src/java/controller/interfaces/Controller.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/controller/validate/Validate.class
Normal file
BIN
target/classes/src/java/controller/validate/Validate.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/data/ConnectionData.class
Normal file
BIN
target/classes/src/java/data/ConnectionData.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/main/Main.class
Normal file
BIN
target/classes/src/java/main/Main.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/queues/ReceivingQueue.class
Normal file
BIN
target/classes/src/java/queues/ReceivingQueue.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/queues/SendingQueue.class
Normal file
BIN
target/classes/src/java/queues/SendingQueue.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/src/java/view/constants/GUIConstants$Frame.class
Normal file
BIN
target/classes/src/java/view/constants/GUIConstants$Frame.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/src/java/view/constants/GUIConstants$Panel.class
Normal file
BIN
target/classes/src/java/view/constants/GUIConstants$Panel.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/constants/GUIConstants$Status.class
Normal file
BIN
target/classes/src/java/view/constants/GUIConstants$Status.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/constants/GUIConstants$Theme.class
Normal file
BIN
target/classes/src/java/view/constants/GUIConstants$Theme.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/constants/GUIConstants.class
Normal file
BIN
target/classes/src/java/view/constants/GUIConstants.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/frames/MainFrame.class
Normal file
BIN
target/classes/src/java/view/frames/MainFrame.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/menubar/Menu.class
Normal file
BIN
target/classes/src/java/view/menubar/Menu.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/menubar/MenuBar.class
Normal file
BIN
target/classes/src/java/view/menubar/MenuBar.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
target/classes/src/java/view/menubar/MenuBarSeparator.class
Normal file
BIN
target/classes/src/java/view/menubar/MenuBarSeparator.class
Normal file
Binary file not shown.
BIN
target/classes/src/java/view/menubar/MenuItem.class
Normal file
BIN
target/classes/src/java/view/menubar/MenuItem.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/src/java/view/menubar/menus/HelpMenuFactory.class
Normal file
BIN
target/classes/src/java/view/menubar/menus/HelpMenuFactory.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user