Compare commits

...

No commits in common. "verze3" and "main" have entirely different histories.
verze3 ... main

193 changed files with 6617 additions and 10282 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.log

84
build.xml Normal file
View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="jNetClient" default="default" basedir=".">
<description>Builds, tests, and runs the project jNetClient.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="jNetClient-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<target name="-post-compile">
<copy todir="${build.classes.dir}">
<fileset dir="resources"/>
</copy>
</target>
<target name="-post-jar">
<copy todir="${dist.jar.dir}">
<fileset dir="resources"/>
</copy>
</target>
</project>

14
config.properties Normal file
View File

@ -0,0 +1,14 @@
autoconnect = true
debug = true
port = 1225
server = localhost
user = michal
volume = 75
start_minimalized = false
password = Michal2407
sound = true
debuger = true
sound_one_online=sound/schema1/one_online.wav
sound_next_offline=sound/schema1/next_offline.wav
sound_all_online = sound/schema1/all_online.wav
sound_first_offline=sound/schema1/first_offline.wav

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

164
log
View File

@ -1,164 +0,0 @@
25.08.26 23:45:18 I ---------------------------------------------
25.08.26 23:45:18 I jNet Client
25.08.26 23:45:18 I Version: 1 (Tue Aug 25 22:22:02 CEST 2026)
25.08.26 23:45:18 I ---------------------------------------------
25.08.26 23:45:18 I
25.08.26 23:45:18 I Loading config ...
25.08.26 23:45:18 I successfully
25.08.26 23:45:18 I Debug mode
25.08.26 23:45:18 I Nalezen putty.exe v: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app\putty.exe
25.08.26 23:45:18 I Nalezen winbox.exe v: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app\winbox.exe
25.08.26 23:45:18 I Nalezen smsc_sdv.exe v: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app\smsc_sdv.exe
25.08.26 23:45:18 I Nalezen smsc_bth.exe v: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app\smsc_bth.exe
25.08.26 23:45:18 I Nalezen smsc_bt.exe v: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app\smsc_bt.exe
25.08.26 23:45:18 I RemoteAdminTools inicializovan, app dir: C:\Users\cucky\Documents\NetBeansProjects\jNet\jNetClient\src\main\resources\app
25.08.26 23:45:19 I Connected to server
25.08.26 23:45:19 D Received message ID: 102
25.08.26 23:45:19 D Received message ID: 103
25.08.26 23:45:19 D Received message ID: 111
25.08.26 23:45:19 D Received message ID: 105
25.08.26 23:45:19 D Received message ID: 109
25.08.26 23:45:19 D Received message ID: 113
25.08.26 23:45:19 D Received message ID: 112
25.08.26 23:45:19 D Received message ID: 116
25.08.26 23:45:19 D Received message ID: 106
25.08.26 23:45:19 D Received message ID: 124
25.08.26 23:45:19 D Received message ID: 131
25.08.26 23:45:19 D Received message ID: 132
25.08.26 23:45:23 D Received message ID: 134
25.08.26 23:45:26 D Received message ID: 133
25.08.26 23:45:27 D Received message ID: 134
25.08.26 23:45:33 D Received message ID: 134
25.08.26 23:45:37 D Received message ID: 134
25.08.26 23:45:43 D Received message ID: 134
25.08.26 23:45:47 D Received message ID: 134
25.08.26 23:45:53 D Received message ID: 134
25.08.26 23:45:56 D Received message ID: 133
25.08.26 23:45:57 D Received message ID: 134
25.08.26 23:46:03 D Received message ID: 134
25.08.26 23:46:07 D Received message ID: 134
25.08.26 23:46:13 D Received message ID: 134
25.08.26 23:46:17 D Received message ID: 134
25.08.26 23:46:23 D Received message ID: 134
25.08.26 23:46:26 D Received message ID: 133
25.08.26 23:46:27 D Received message ID: 134
25.08.26 23:46:33 D Received message ID: 134
25.08.26 23:46:37 D Received message ID: 134
25.08.26 23:46:43 D Received message ID: 134
25.08.26 23:46:47 D Received message ID: 134
25.08.26 23:46:51 D Received message ID: 134
25.08.26 23:46:53 D Received message ID: 134
25.08.26 23:46:56 D Received message ID: 133
25.08.26 23:46:57 D Received message ID: 134
25.08.26 23:47:03 D Received message ID: 134
25.08.26 23:47:07 D Received message ID: 134
25.08.26 23:47:13 D Received message ID: 134
25.08.26 23:47:17 D Received message ID: 134
25.08.26 23:47:23 D Received message ID: 134
25.08.26 23:47:26 D Received message ID: 133
25.08.26 23:47:27 D Received message ID: 134
25.08.26 23:47:33 D Received message ID: 134
25.08.26 23:47:37 D Received message ID: 134
25.08.26 23:47:43 D Received message ID: 134
25.08.26 23:47:47 D Received message ID: 134
25.08.26 23:47:53 D Received message ID: 134
25.08.26 23:47:56 D Received message ID: 133
25.08.26 23:47:57 D Received message ID: 134
25.08.26 23:48:03 D Received message ID: 134
25.08.26 23:48:07 D Received message ID: 134
25.08.26 23:48:13 D Received message ID: 134
25.08.26 23:48:17 D Received message ID: 134
25.08.26 23:48:23 D Received message ID: 134
25.08.26 23:48:28 D Received message ID: 130
25.08.26 23:48:28 D Received message ID: 133
25.08.26 23:48:28 D Received message ID: 134
25.08.26 23:48:28 D Received message ID: 117
25.08.26 23:48:28 D Received message ID: 108
25.08.26 23:48:33 D Received message ID: 134
25.08.26 23:48:36 D Received message ID: 118
25.08.26 23:48:36 D Received message ID: 108
25.08.26 23:48:37 D Received message ID: 134
25.08.26 23:48:43 D Received message ID: 134
25.08.26 23:48:47 D Received message ID: 134
25.08.26 23:48:53 D Received message ID: 134
25.08.26 23:48:56 D Received message ID: 133
25.08.26 23:48:57 D Received message ID: 134
25.08.26 23:49:03 D Received message ID: 134
25.08.26 23:49:07 D Received message ID: 134
25.08.26 23:49:13 D Received message ID: 134
25.08.26 23:49:17 D Received message ID: 134
25.08.26 23:49:23 D Received message ID: 134
25.08.26 23:49:26 D Received message ID: 133
25.08.26 23:49:27 D Received message ID: 134
25.08.26 23:49:33 D Received message ID: 134
25.08.26 23:49:37 D Received message ID: 134
25.08.26 23:49:43 D Received message ID: 134
25.08.26 23:49:47 D Received message ID: 134
25.08.26 23:49:53 D Received message ID: 134
25.08.26 23:49:56 D Received message ID: 133
25.08.26 23:49:57 D Received message ID: 134
25.08.26 23:50:03 D Received message ID: 134
25.08.26 23:50:07 D Received message ID: 134
25.08.26 23:50:13 D Received message ID: 134
25.08.26 23:50:17 D Received message ID: 134
25.08.26 23:50:21 D Received message ID: 134
25.08.26 23:50:23 D Received message ID: 134
25.08.26 23:50:26 D Received message ID: 133
25.08.26 23:50:27 D Received message ID: 134
25.08.26 23:50:33 D Received message ID: 134
25.08.26 23:50:37 D Received message ID: 134
25.08.26 23:50:43 D Received message ID: 134
25.08.26 23:50:47 D Received message ID: 134
25.08.26 23:50:53 D Received message ID: 134
25.08.26 23:50:56 D Received message ID: 133
25.08.26 23:50:57 D Received message ID: 134
25.08.26 23:51:03 D Received message ID: 134
25.08.26 23:51:07 D Received message ID: 134
25.08.26 23:51:13 D Received message ID: 134
25.08.26 23:51:17 D Received message ID: 134
25.08.26 23:51:23 D Received message ID: 134
25.08.26 23:51:26 D Received message ID: 133
25.08.26 23:51:27 D Received message ID: 134
25.08.26 23:51:33 D Received message ID: 134
25.08.26 23:51:37 D Received message ID: 134
25.08.26 23:51:43 D Received message ID: 134
25.08.26 23:51:47 D Received message ID: 134
25.08.26 23:51:53 D Received message ID: 134
25.08.26 23:51:56 D Received message ID: 133
25.08.26 23:51:57 D Received message ID: 134
25.08.26 23:52:01 D Received message ID: 134
25.08.26 23:52:03 D Received message ID: 134
25.08.26 23:52:07 D Received message ID: 134
25.08.26 23:52:13 D Received message ID: 134
25.08.26 23:52:17 D Received message ID: 134
25.08.26 23:52:23 D Received message ID: 134
25.08.26 23:52:26 D Received message ID: 133
25.08.26 23:52:27 D Received message ID: 134
25.08.26 23:52:33 D Received message ID: 134
25.08.26 23:52:37 D Received message ID: 134
25.08.26 23:52:43 D Received message ID: 134
25.08.26 23:52:47 D Received message ID: 134
25.08.26 23:52:53 D Received message ID: 134
25.08.26 23:52:56 D Received message ID: 133
25.08.26 23:52:57 D Received message ID: 134
25.08.26 23:53:03 D Received message ID: 134
25.08.26 23:53:07 D Received message ID: 134
25.08.26 23:53:13 D Received message ID: 134
25.08.26 23:53:17 D Received message ID: 134
25.08.26 23:53:23 D Received message ID: 134
25.08.26 23:53:26 D Received message ID: 133
25.08.26 23:53:27 D Received message ID: 134
25.08.26 23:53:33 D Received message ID: 134
25.08.26 23:53:37 D Received message ID: 134
25.08.26 23:53:43 D Received message ID: 134
25.08.26 23:53:47 D Received message ID: 134
25.08.26 23:53:53 D Received message ID: 134
25.08.26 23:53:56 D Received message ID: 133
25.08.26 23:53:57 D Received message ID: 134
25.08.26 23:54:03 D Received message ID: 134
25.08.26 23:54:07 D Received message ID: 134
25.08.26 23:54:13 D Received message ID: 134
25.08.26 23:54:17 D Received message ID: 134
25.08.26 23:54:23 D Received message ID: 134
25.08.26 23:54:23 I Connection reset by server
25.08.26 23:54:23 I Connection inactive ..... reconnect initiated

756
log.log Normal file
View File

@ -0,0 +1,756 @@
04.02.25 17:54:36 I ---------------------------------------------
04.02.25 17:54:36 I jNet Client
04.02.25 17:54:36 I Version: 1 (Tue Feb 04 17:54:07 CET 2025)
04.02.25 17:54:36 I ---------------------------------------------
04.02.25 17:54:36 I
04.02.25 17:54:36 I Loading config ...
04.02.25 17:54:36 I successfully
04.02.25 17:54:36 D Debug mode on
04.02.25 17:54:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:54:42 E Zkousim se znovu pripojit...
04.02.25 17:54:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:54:47 E Zkousim se znovu pripojit...
04.02.25 17:54:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:54:52 E Zkousim se znovu pripojit...
04.02.25 17:54:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:54:57 E Zkousim se znovu pripojit...
04.02.25 17:54:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:02 E Zkousim se znovu pripojit...
04.02.25 17:55:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:07 E Zkousim se znovu pripojit...
04.02.25 17:55:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:12 E Zkousim se znovu pripojit...
04.02.25 17:55:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:17 E Zkousim se znovu pripojit...
04.02.25 17:55:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:22 E Zkousim se znovu pripojit...
04.02.25 17:55:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:27 E Zkousim se znovu pripojit...
04.02.25 17:55:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:32 E Zkousim se znovu pripojit...
04.02.25 17:55:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:37 E Zkousim se znovu pripojit...
04.02.25 17:55:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:42 E Zkousim se znovu pripojit...
04.02.25 17:55:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:47 E Zkousim se znovu pripojit...
04.02.25 17:55:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:52 E Zkousim se znovu pripojit...
04.02.25 17:55:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:55:57 E Zkousim se znovu pripojit...
04.02.25 17:55:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:02 E Zkousim se znovu pripojit...
04.02.25 17:56:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:07 E Zkousim se znovu pripojit...
04.02.25 17:56:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:12 E Zkousim se znovu pripojit...
04.02.25 17:56:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:17 E Zkousim se znovu pripojit...
04.02.25 17:56:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:22 E Zkousim se znovu pripojit...
04.02.25 17:56:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:27 E Zkousim se znovu pripojit...
04.02.25 17:56:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:32 E Zkousim se znovu pripojit...
04.02.25 17:56:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:37 E Zkousim se znovu pripojit...
04.02.25 17:56:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:42 E Zkousim se znovu pripojit...
04.02.25 17:56:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:47 E Zkousim se znovu pripojit...
04.02.25 17:56:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:52 E Zkousim se znovu pripojit...
04.02.25 17:56:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:56:57 E Zkousim se znovu pripojit...
04.02.25 17:56:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:02 E Zkousim se znovu pripojit...
04.02.25 17:57:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:07 E Zkousim se znovu pripojit...
04.02.25 17:57:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:12 E Zkousim se znovu pripojit...
04.02.25 17:57:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:17 E Zkousim se znovu pripojit...
04.02.25 17:57:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:22 E Zkousim se znovu pripojit...
04.02.25 17:57:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:27 E Zkousim se znovu pripojit...
04.02.25 17:57:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:32 E Zkousim se znovu pripojit...
04.02.25 17:57:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:37 E Zkousim se znovu pripojit...
04.02.25 17:57:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:42 E Zkousim se znovu pripojit...
04.02.25 17:57:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:47 E Zkousim se znovu pripojit...
04.02.25 17:57:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:52 E Zkousim se znovu pripojit...
04.02.25 17:57:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:57:57 E Zkousim se znovu pripojit...
04.02.25 17:57:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:02 E Zkousim se znovu pripojit...
04.02.25 17:58:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:07 E Zkousim se znovu pripojit...
04.02.25 17:58:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:12 E Zkousim se znovu pripojit...
04.02.25 17:58:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:17 E Zkousim se znovu pripojit...
04.02.25 17:58:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:22 E Zkousim se znovu pripojit...
04.02.25 17:58:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:27 E Zkousim se znovu pripojit...
04.02.25 17:58:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:32 E Zkousim se znovu pripojit...
04.02.25 17:58:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:37 E Zkousim se znovu pripojit...
04.02.25 17:58:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:42 E Zkousim se znovu pripojit...
04.02.25 17:58:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:47 E Zkousim se znovu pripojit...
04.02.25 17:58:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:52 E Zkousim se znovu pripojit...
04.02.25 17:58:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:58:57 E Zkousim se znovu pripojit...
04.02.25 17:58:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:02 E Zkousim se znovu pripojit...
04.02.25 17:59:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:07 E Zkousim se znovu pripojit...
04.02.25 17:59:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:12 E Zkousim se znovu pripojit...
04.02.25 17:59:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:17 E Zkousim se znovu pripojit...
04.02.25 17:59:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:22 E Zkousim se znovu pripojit...
04.02.25 17:59:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:27 E Zkousim se znovu pripojit...
04.02.25 17:59:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:32 E Zkousim se znovu pripojit...
04.02.25 17:59:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:37 E Zkousim se znovu pripojit...
04.02.25 17:59:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:42 E Zkousim se znovu pripojit...
04.02.25 17:59:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:47 E Zkousim se znovu pripojit...
04.02.25 17:59:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:52 E Zkousim se znovu pripojit...
04.02.25 17:59:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 17:59:57 E Zkousim se znovu pripojit...
04.02.25 17:59:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:02 E Zkousim se znovu pripojit...
04.02.25 18:0:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:07 E Zkousim se znovu pripojit...
04.02.25 18:0:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:12 E Zkousim se znovu pripojit...
04.02.25 18:0:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:17 E Zkousim se znovu pripojit...
04.02.25 18:0:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:22 E Zkousim se znovu pripojit...
04.02.25 18:0:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:27 E Zkousim se znovu pripojit...
04.02.25 18:0:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:32 E Zkousim se znovu pripojit...
04.02.25 18:0:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:37 E Zkousim se znovu pripojit...
04.02.25 18:0:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:42 E Zkousim se znovu pripojit...
04.02.25 18:0:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:47 E Zkousim se znovu pripojit...
04.02.25 18:0:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:52 E Zkousim se znovu pripojit...
04.02.25 18:0:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:0:57 E Zkousim se znovu pripojit...
04.02.25 18:0:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:02 E Zkousim se znovu pripojit...
04.02.25 18:1:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:07 E Zkousim se znovu pripojit...
04.02.25 18:1:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:12 E Zkousim se znovu pripojit...
04.02.25 18:1:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:17 E Zkousim se znovu pripojit...
04.02.25 18:1:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:22 E Zkousim se znovu pripojit...
04.02.25 18:1:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:27 E Zkousim se znovu pripojit...
04.02.25 18:1:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:32 E Zkousim se znovu pripojit...
04.02.25 18:1:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:37 E Zkousim se znovu pripojit...
04.02.25 18:1:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:42 E Zkousim se znovu pripojit...
04.02.25 18:1:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:47 E Zkousim se znovu pripojit...
04.02.25 18:1:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:52 E Zkousim se znovu pripojit...
04.02.25 18:1:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:1:57 E Zkousim se znovu pripojit...
04.02.25 18:1:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:02 E Zkousim se znovu pripojit...
04.02.25 18:2:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:07 E Zkousim se znovu pripojit...
04.02.25 18:2:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:12 E Zkousim se znovu pripojit...
04.02.25 18:2:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:17 E Zkousim se znovu pripojit...
04.02.25 18:2:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:22 E Zkousim se znovu pripojit...
04.02.25 18:2:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:27 E Zkousim se znovu pripojit...
04.02.25 18:2:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:32 E Zkousim se znovu pripojit...
04.02.25 18:2:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:37 E Zkousim se znovu pripojit...
04.02.25 18:2:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:42 E Zkousim se znovu pripojit...
04.02.25 18:2:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:47 E Zkousim se znovu pripojit...
04.02.25 18:2:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:52 E Zkousim se znovu pripojit...
04.02.25 18:2:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:2:57 E Zkousim se znovu pripojit...
04.02.25 18:2:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:02 E Zkousim se znovu pripojit...
04.02.25 18:3:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:07 E Zkousim se znovu pripojit...
04.02.25 18:3:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:12 E Zkousim se znovu pripojit...
04.02.25 18:3:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:17 E Zkousim se znovu pripojit...
04.02.25 18:3:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:22 E Zkousim se znovu pripojit...
04.02.25 18:3:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:27 E Zkousim se znovu pripojit...
04.02.25 18:3:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:32 E Zkousim se znovu pripojit...
04.02.25 18:3:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:37 E Zkousim se znovu pripojit...
04.02.25 18:3:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:42 E Zkousim se znovu pripojit...
04.02.25 18:3:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:47 E Zkousim se znovu pripojit...
04.02.25 18:3:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:52 E Zkousim se znovu pripojit...
04.02.25 18:3:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:3:57 E Zkousim se znovu pripojit...
04.02.25 18:3:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:02 E Zkousim se znovu pripojit...
04.02.25 18:4:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:07 E Zkousim se znovu pripojit...
04.02.25 18:4:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:12 E Zkousim se znovu pripojit...
04.02.25 18:4:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:17 E Zkousim se znovu pripojit...
04.02.25 18:4:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:22 E Zkousim se znovu pripojit...
04.02.25 18:4:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:27 E Zkousim se znovu pripojit...
04.02.25 18:4:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:32 E Zkousim se znovu pripojit...
04.02.25 18:4:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:37 E Zkousim se znovu pripojit...
04.02.25 18:4:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:42 E Zkousim se znovu pripojit...
04.02.25 18:4:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:47 E Zkousim se znovu pripojit...
04.02.25 18:4:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:52 E Zkousim se znovu pripojit...
04.02.25 18:4:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:4:57 E Zkousim se znovu pripojit...
04.02.25 18:4:57 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:02 E Zkousim se znovu pripojit...
04.02.25 18:5:02 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:07 E Zkousim se znovu pripojit...
04.02.25 18:5:07 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:12 E Zkousim se znovu pripojit...
04.02.25 18:5:12 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:17 E Zkousim se znovu pripojit...
04.02.25 18:5:17 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:22 E Zkousim se znovu pripojit...
04.02.25 18:5:22 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:27 E Zkousim se znovu pripojit...
04.02.25 18:5:27 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:32 E Zkousim se znovu pripojit...
04.02.25 18:5:32 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:37 E Zkousim se znovu pripojit...
04.02.25 18:5:37 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:42 E Zkousim se znovu pripojit...
04.02.25 18:5:42 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:47 E Zkousim se znovu pripojit...
04.02.25 18:5:47 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:52 E Zkousim se znovu pripojit...
04.02.25 18:5:52 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:5:57 E Zkousim se znovu pripojit...
04.02.25 18:5:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:03 E Zkousim se znovu pripojit...
04.02.25 18:6:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:08 E Zkousim se znovu pripojit...
04.02.25 18:6:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:13 E Zkousim se znovu pripojit...
04.02.25 18:6:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:18 E Zkousim se znovu pripojit...
04.02.25 18:6:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:23 E Zkousim se znovu pripojit...
04.02.25 18:6:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:28 E Zkousim se znovu pripojit...
04.02.25 18:6:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:33 E Zkousim se znovu pripojit...
04.02.25 18:6:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:38 E Zkousim se znovu pripojit...
04.02.25 18:6:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:43 E Zkousim se znovu pripojit...
04.02.25 18:6:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:48 E Zkousim se znovu pripojit...
04.02.25 18:6:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:53 E Zkousim se znovu pripojit...
04.02.25 18:6:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:6:58 E Zkousim se znovu pripojit...
04.02.25 18:6:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:03 E Zkousim se znovu pripojit...
04.02.25 18:7:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:08 E Zkousim se znovu pripojit...
04.02.25 18:7:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:13 E Zkousim se znovu pripojit...
04.02.25 18:7:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:18 E Zkousim se znovu pripojit...
04.02.25 18:7:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:23 E Zkousim se znovu pripojit...
04.02.25 18:7:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:28 E Zkousim se znovu pripojit...
04.02.25 18:7:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:33 E Zkousim se znovu pripojit...
04.02.25 18:7:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:38 E Zkousim se znovu pripojit...
04.02.25 18:7:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:43 E Zkousim se znovu pripojit...
04.02.25 18:7:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:48 E Zkousim se znovu pripojit...
04.02.25 18:7:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:53 E Zkousim se znovu pripojit...
04.02.25 18:7:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:7:58 E Zkousim se znovu pripojit...
04.02.25 18:7:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:03 E Zkousim se znovu pripojit...
04.02.25 18:8:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:08 E Zkousim se znovu pripojit...
04.02.25 18:8:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:13 E Zkousim se znovu pripojit...
04.02.25 18:8:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:18 E Zkousim se znovu pripojit...
04.02.25 18:8:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:23 E Zkousim se znovu pripojit...
04.02.25 18:8:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:28 E Zkousim se znovu pripojit...
04.02.25 18:8:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:33 E Zkousim se znovu pripojit...
04.02.25 18:8:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:38 E Zkousim se znovu pripojit...
04.02.25 18:8:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:43 E Zkousim se znovu pripojit...
04.02.25 18:8:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:48 E Zkousim se znovu pripojit...
04.02.25 18:8:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:53 E Zkousim se znovu pripojit...
04.02.25 18:8:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:8:58 E Zkousim se znovu pripojit...
04.02.25 18:8:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:03 E Zkousim se znovu pripojit...
04.02.25 18:9:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:08 E Zkousim se znovu pripojit...
04.02.25 18:9:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:13 E Zkousim se znovu pripojit...
04.02.25 18:9:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:18 E Zkousim se znovu pripojit...
04.02.25 18:9:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:23 E Zkousim se znovu pripojit...
04.02.25 18:9:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:28 E Zkousim se znovu pripojit...
04.02.25 18:9:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:33 E Zkousim se znovu pripojit...
04.02.25 18:9:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:38 E Zkousim se znovu pripojit...
04.02.25 18:9:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:43 E Zkousim se znovu pripojit...
04.02.25 18:9:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:48 E Zkousim se znovu pripojit...
04.02.25 18:9:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:53 E Zkousim se znovu pripojit...
04.02.25 18:9:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:9:58 E Zkousim se znovu pripojit...
04.02.25 18:9:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:03 E Zkousim se znovu pripojit...
04.02.25 18:10:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:08 E Zkousim se znovu pripojit...
04.02.25 18:10:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:13 E Zkousim se znovu pripojit...
04.02.25 18:10:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:18 E Zkousim se znovu pripojit...
04.02.25 18:10:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:23 E Zkousim se znovu pripojit...
04.02.25 18:10:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:28 E Zkousim se znovu pripojit...
04.02.25 18:10:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:33 E Zkousim se znovu pripojit...
04.02.25 18:10:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:38 E Zkousim se znovu pripojit...
04.02.25 18:10:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:43 E Zkousim se znovu pripojit...
04.02.25 18:10:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:48 E Zkousim se znovu pripojit...
04.02.25 18:10:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:53 E Zkousim se znovu pripojit...
04.02.25 18:10:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:10:58 E Zkousim se znovu pripojit...
04.02.25 18:10:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:03 E Zkousim se znovu pripojit...
04.02.25 18:11:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:08 E Zkousim se znovu pripojit...
04.02.25 18:11:08 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:13 E Zkousim se znovu pripojit...
04.02.25 18:11:13 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:18 E Zkousim se znovu pripojit...
04.02.25 18:11:18 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:23 E Zkousim se znovu pripojit...
04.02.25 18:11:23 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:28 E Zkousim se znovu pripojit...
04.02.25 18:11:28 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:33 E Zkousim se znovu pripojit...
04.02.25 18:11:33 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:38 E Zkousim se znovu pripojit...
04.02.25 18:11:38 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:43 E Zkousim se znovu pripojit...
04.02.25 18:11:43 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:48 E Zkousim se znovu pripojit...
04.02.25 18:11:48 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:53 E Zkousim se znovu pripojit...
04.02.25 18:11:53 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:11:58 E Zkousim se znovu pripojit...
04.02.25 18:11:58 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:12:03 E Zkousim se znovu pripojit...
04.02.25 18:12:03 E Pripojeni selhalo: Connection refused: getsockopt: localhost/127.0.0.1:1225
04.02.25 18:12:08 E Zkousim se znovu pripojit...
04.02.25 18:12:08 D -> Message type: 1
04.02.25 18:12:08 D <- Message type: 1
04.02.25 18:12:08 D -> Message type: 3
04.02.25 18:12:08 D <- Message type: 4
04.02.25 18:12:08 D -> Message type: 5
04.02.25 18:12:08 I Log in to server
04.02.25 18:12:08 D -> Message type: 9
04.02.25 18:12:08 D -> Message type: 7
04.02.25 18:12:08 D -> Message type: 13
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 8
04.02.25 18:12:08 D -> Message type: 11
04.02.25 18:12:08 D -> Message type: 11
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 100
04.02.25 18:12:08 D -> Message type: 14
04.02.25 18:12:08 D -> Message type: 110
04.02.25 18:12:08 D -> Message type: 107
04.02.25 18:12:08 D -> Message type: 107
04.02.25 18:12:28 D -> Message type: 101
04.02.25 18:12:35 D -> Message type: 108
04.02.25 18:12:35 D -> Message type: 101
04.02.25 18:12:54 E Spojeni bylo ukonceno
04.02.25 18:12:59 E Zkousim se znovu pripojit...
04.02.25 18:12:59 D -> Message type: 1
04.02.25 18:12:59 D <- Message type: 1
04.02.25 18:12:59 D -> Message type: 3
04.02.25 18:12:59 D <- Message type: 4
04.02.25 18:12:59 D -> Message type: 5
04.02.25 18:12:59 I Log in to server
04.02.25 18:12:59 D -> Message type: 9
04.02.25 18:12:59 D -> Message type: 7
04.02.25 18:12:59 D -> Message type: 13
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 8
04.02.25 18:12:59 D -> Message type: 11
04.02.25 18:12:59 D -> Message type: 11
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 100
04.02.25 18:12:59 D -> Message type: 14
04.02.25 18:12:59 D -> Message type: 110
04.02.25 18:12:59 D -> Message type: 107
04.02.25 18:12:59 D -> Message type: 107
04.02.25 18:14:13 D -> Message type: 101
04.02.25 18:14:20 D -> Message type: 108
04.02.25 18:14:20 D -> Message type: 101
04.02.25 18:14:25 D -> Message type: 101
04.02.25 18:14:32 D -> Message type: 108
04.02.25 18:14:32 D -> Message type: 101
04.02.25 18:14:37 D -> Message type: 101
04.02.25 18:14:44 D -> Message type: 108
04.02.25 18:14:44 D -> Message type: 101
04.02.25 18:14:49 D -> Message type: 101
04.02.25 18:14:55 D -> Message type: 108
04.02.25 18:14:55 D -> Message type: 101
04.02.25 18:15:01 D -> Message type: 101
04.02.25 18:15:07 D -> Message type: 108
04.02.25 18:15:07 D -> Message type: 101
04.02.25 18:15:12 D -> Message type: 101
04.02.25 18:15:19 D -> Message type: 108
04.02.25 18:15:19 D -> Message type: 101
04.02.25 18:16:32 D -> Message type: 101
04.02.25 18:16:39 D -> Message type: 108
04.02.25 18:16:39 D -> Message type: 101
04.02.25 18:18:27 E Spojeni bylo ukonceno
04.02.25 18:18:32 E Zkousim se znovu pripojit...
04.02.25 18:18:32 D -> Message type: 1
04.02.25 18:18:32 D <- Message type: 1
04.02.25 18:18:32 D -> Message type: 3
04.02.25 18:18:32 D <- Message type: 4
04.02.25 18:18:32 D -> Message type: 5
04.02.25 18:18:32 I Log in to server
04.02.25 18:18:32 D -> Message type: 9
04.02.25 18:18:32 D -> Message type: 7
04.02.25 18:18:32 D -> Message type: 13
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 8
04.02.25 18:18:32 D -> Message type: 11
04.02.25 18:18:32 D -> Message type: 11
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:32 D -> Message type: 100
04.02.25 18:18:33 D -> Message type: 14
04.02.25 18:18:33 D -> Message type: 110
04.02.25 18:18:33 D -> Message type: 107
04.02.25 18:18:33 D -> Message type: 107
04.02.25 18:18:53 D -> Message type: 101
04.02.25 18:20:08 E Spojeni bylo ukonceno
04.02.25 18:20:13 E Zkousim se znovu pripojit...
04.02.25 18:20:13 D -> Message type: 1
04.02.25 18:20:13 D <- Message type: 1
04.02.25 18:20:13 D -> Message type: 3
04.02.25 18:20:13 D <- Message type: 4
04.02.25 18:20:13 D -> Message type: 5
04.02.25 18:20:13 I Log in to server
04.02.25 18:20:13 D -> Message type: 9
04.02.25 18:20:13 D -> Message type: 7
04.02.25 18:20:13 D -> Message type: 13
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 8
04.02.25 18:20:13 D -> Message type: 11
04.02.25 18:20:13 D -> Message type: 11
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 100
04.02.25 18:20:13 D -> Message type: 14
04.02.25 18:20:13 D -> Message type: 110
04.02.25 18:20:13 D -> Message type: 107
04.02.25 18:20:13 D -> Message type: 107
04.02.25 18:28:05 D -> Message type: 108
04.02.25 18:28:05 D -> Message type: 101
04.02.25 18:28:06 D -> Message type: 101
04.02.25 18:29:45 D -> Message type: 108
04.02.25 18:29:45 D -> Message type: 101
04.02.25 18:29:46 D -> Message type: 101
04.02.25 18:34:14 D -> Message type: 108
04.02.25 18:34:14 D -> Message type: 101
04.02.25 18:34:15 D -> Message type: 101
04.02.25 18:35:53 D -> Message type: 108
04.02.25 18:35:53 D -> Message type: 101
04.02.25 18:35:54 D -> Message type: 101
04.02.25 18:38:18 D -> Message type: 108
04.02.25 18:38:18 D -> Message type: 101
04.02.25 18:38:19 D -> Message type: 101
04.02.25 18:39:31 D -> Message type: 108
04.02.25 18:39:31 D -> Message type: 101
04.02.25 18:39:32 D -> Message type: 101
04.02.25 18:40:31 D -> Message type: 108
04.02.25 18:40:31 D -> Message type: 101
04.02.25 18:40:32 D -> Message type: 101
04.02.25 18:44:12 D -> Message type: 108
04.02.25 18:44:12 D -> Message type: 101
04.02.25 18:44:13 D -> Message type: 101
04.02.25 18:44:43 D -> Message type: 108
04.02.25 18:44:43 D -> Message type: 101
04.02.25 18:44:44 D -> Message type: 101
04.02.25 18:46:19 D -> Message type: 108
04.02.25 18:46:19 D -> Message type: 101
04.02.25 18:46:20 D -> Message type: 101
04.02.25 18:48:13 D -> Message type: 108
04.02.25 18:48:13 D -> Message type: 101
04.02.25 18:48:14 D -> Message type: 101
04.02.25 18:49:37 D -> Message type: 108
04.02.25 18:49:37 D -> Message type: 101
04.02.25 18:49:38 D -> Message type: 101
04.02.25 18:54:18 D -> Message type: 108
04.02.25 18:54:18 D -> Message type: 101
04.02.25 18:54:19 D -> Message type: 101
04.02.25 18:59:24 D -> Message type: 108
04.02.25 18:59:24 D -> Message type: 101
04.02.25 18:59:27 D -> Message type: 101
04.02.25 18:59:56 D -> Message type: 108
04.02.25 18:59:56 D -> Message type: 101
04.02.25 18:59:57 D -> Message type: 101
04.02.25 19:11:38 D -> Message type: 108
04.02.25 19:11:38 D -> Message type: 101
04.02.25 19:11:39 D -> Message type: 101
04.02.25 19:14:33 D -> Message type: 108
04.02.25 19:14:33 D -> Message type: 101
04.02.25 19:14:34 D -> Message type: 101
04.02.25 19:20:55 D -> Message type: 108
04.02.25 19:20:55 D -> Message type: 101
04.02.25 19:20:56 D -> Message type: 101
04.02.25 19:24:30 D -> Message type: 108
04.02.25 19:24:30 D -> Message type: 101
04.02.25 19:24:31 D -> Message type: 101
04.02.25 19:29:23 D -> Message type: 108
04.02.25 19:29:23 D -> Message type: 101
04.02.25 19:29:24 D -> Message type: 101
04.02.25 19:34:17 D -> Message type: 108
04.02.25 19:34:17 D -> Message type: 101
04.02.25 19:34:18 D -> Message type: 101
04.02.25 19:44:31 D -> Message type: 108
04.02.25 19:44:31 D -> Message type: 101
04.02.25 19:44:32 D -> Message type: 101
04.02.25 19:48:14 D -> Message type: 108
04.02.25 19:48:14 D -> Message type: 101
04.02.25 19:48:15 D -> Message type: 101
04.02.25 19:59:37 D -> Message type: 108
04.02.25 19:59:37 D -> Message type: 101
04.02.25 19:59:38 D -> Message type: 101
04.02.25 20:0:02 D -> Message type: 108
04.02.25 20:0:02 D -> Message type: 101
04.02.25 20:0:06 D -> Message type: 101
04.02.25 20:8:49 D -> Message type: 108
04.02.25 20:8:49 D -> Message type: 101
04.02.25 20:8:50 D -> Message type: 101
04.02.25 20:9:35 D -> Message type: 108
04.02.25 20:9:35 D -> Message type: 101
04.02.25 20:9:36 D -> Message type: 101
04.02.25 20:17:35 D -> Message type: 108
04.02.25 20:17:35 D -> Message type: 101
04.02.25 20:17:36 D -> Message type: 101
04.02.25 20:19:33 D -> Message type: 108
04.02.25 20:19:33 D -> Message type: 101
04.02.25 20:19:34 D -> Message type: 101
04.02.25 20:19:47 D -> Message type: 108
04.02.25 20:19:47 D -> Message type: 101
04.02.25 20:19:48 D -> Message type: 101
04.02.25 20:23:18 D -> Message type: 108
04.02.25 20:23:18 D -> Message type: 101
04.02.25 20:23:19 D -> Message type: 101
04.02.25 20:24:28 D -> Message type: 108
04.02.25 20:24:28 D -> Message type: 101
04.02.25 20:24:29 D -> Message type: 101
04.02.25 20:24:33 D -> Message type: 108
04.02.25 20:24:33 D -> Message type: 101
04.02.25 20:24:34 D -> Message type: 101
04.02.25 20:26:06 D -> Message type: 108
04.02.25 20:26:06 D -> Message type: 101
04.02.25 20:26:07 D -> Message type: 101
04.02.25 20:34:17 D -> Message type: 108
04.02.25 20:34:17 D -> Message type: 101
04.02.25 20:34:18 D -> Message type: 101
04.02.25 20:44:50 D -> Message type: 108
04.02.25 20:44:50 D -> Message type: 101
04.02.25 20:44:53 D -> Message type: 108
04.02.25 20:44:53 D -> Message type: 101
04.02.25 20:44:54 D -> Message type: 101
04.02.25 20:44:55 D -> Message type: 101
04.02.25 20:52:08 D -> Message type: 108
04.02.25 20:52:08 D -> Message type: 101
04.02.25 20:52:09 D -> Message type: 101
04.02.25 20:54:29 D -> Message type: 108
04.02.25 20:54:29 D -> Message type: 101
04.02.25 20:54:30 D -> Message type: 101
04.02.25 21:8:32 D -> Message type: 108
04.02.25 21:8:32 D -> Message type: 101
04.02.25 21:8:33 D -> Message type: 101
04.02.25 21:13:54 D -> Message type: 108
04.02.25 21:13:54 D -> Message type: 101
04.02.25 21:13:55 D -> Message type: 101
04.02.25 21:29:31 D -> Message type: 108
04.02.25 21:29:31 D -> Message type: 101
04.02.25 21:29:32 D -> Message type: 101
04.02.25 21:30:11 D -> Message type: 108
04.02.25 21:30:11 D -> Message type: 101
04.02.25 21:30:12 D -> Message type: 101
04.02.25 21:30:18 D -> Message type: 108
04.02.25 21:30:18 D -> Message type: 101
04.02.25 21:30:19 D -> Message type: 101
04.02.25 21:39:31 D -> Message type: 108
04.02.25 21:39:31 D -> Message type: 101
04.02.25 21:39:32 D -> Message type: 101
04.02.25 21:40:04 D -> Message type: 108
04.02.25 21:40:04 D -> Message type: 101
04.02.25 21:40:05 D -> Message type: 101
04.02.25 21:41:08 D -> Message type: 108
04.02.25 21:41:08 D -> Message type: 101
04.02.25 21:41:09 D -> Message type: 101
04.02.25 21:53:54 D -> Message type: 108
04.02.25 21:53:54 D -> Message type: 101
04.02.25 21:53:55 D -> Message type: 101
04.02.25 21:54:05 D -> Message type: 108
04.02.25 21:54:05 D -> Message type: 101
04.02.25 21:54:06 D -> Message type: 101
04.02.25 21:54:38 D -> Message type: 108
04.02.25 21:54:38 D -> Message type: 101
04.02.25 21:54:39 D -> Message type: 101
04.02.25 22:4:46 D -> Message type: 108
04.02.25 22:4:46 D -> Message type: 101
04.02.25 22:4:48 D -> Message type: 101
04.02.25 22:10:03 D -> Message type: 108
04.02.25 22:10:03 D -> Message type: 101
04.02.25 22:10:04 D -> Message type: 101
04.02.25 22:39:33 D -> Message type: 108
04.02.25 22:39:33 D -> Message type: 101
04.02.25 22:39:34 D -> Message type: 101
04.02.25 22:52:23 D -> Message type: 108
04.02.25 22:52:23 D -> Message type: 101
04.02.25 22:52:24 D -> Message type: 101
04.02.25 22:54:16 D -> Message type: 108
04.02.25 22:54:16 D -> Message type: 101
04.02.25 22:54:17 D -> Message type: 101

3
manifest.mf Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.5.1:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dio.netty.noUnsafe=true -Dio.netty.tryUnsafe=false</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.5.1:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dio.netty.noUnsafe=true -Dio.netty.tryUnsafe=false -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.5.1:exec</goal>
</goals>
<properties>
<exec.vmArgs>-Dio.netty.noUnsafe=true -Dio.netty.tryUnsafe=false</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
<exec.appArgs></exec.appArgs>
</properties>
</action>
</actions>

1789
nbproject/build-impl.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=2260700f
build.xml.script.CRC32=a5a5f7c0
build.xml.stylesheet.CRC32=f85dc8f2@1.113.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2260700f
nbproject/build-impl.xml.script.CRC32=379f78cb
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.113.0.48

View File

@ -0,0 +1,110 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=jNetClient
application.vendor=cucky
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/jNetClient.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/jNetClient
endorsed.classpath=
excludes=
file.reference.apache-commons-configuration2-2.9.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-configuration2-2.9.0.jar
file.reference.apache-commons-lang3-3.12.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-lang3-3.12.0.jar
file.reference.apache-commons-logging-1.2.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-logging-1.2.jar
file.reference.apache-commons-text-1.10.0.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\apache-commons-text-1.10.0.jar
file.reference.netty-all-4.1.68.Final.jar=C:\\Users\\cucky\\Documents\\NetBeansProjects\\jar_files\\netty-all-4.1.68.Final.jar
includes=**
jar.compress=false
javac.classpath=\
${reference.jNetLib.jar}:\
${file.reference.apache-commons-configuration2-2.9.0.jar}:\
${file.reference.netty-all-4.1.68.Final.jar}:\
${file.reference.apache-commons-logging-1.2.jar}:\
${file.reference.apache-commons-text-1.10.0.jar}:\
${file.reference.apache-commons-lang3-3.12.0.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=23
javac.target=23
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=jNetClient
main.class=jnet.client.Client
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.jNetLib=../jNetLib
reference.jNetLib.jar=${project.jNetLib}/dist/jNetLib.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

25
nbproject/project.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>jNetClient</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>jNetLib</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>

65
pom.xml
View File

@ -1,65 +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>jnet</groupId>
<artifactId>jNetClient</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>26</maven.compiler.release>
<exec.mainClass>jnet.client.Client</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.118.Final</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jNetLib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<!-- Nastavení názvu výsledného JAR -->
<finalName>jNetClient</finalName>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

BIN
resources/app/winbox.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
autoconnect = true
debug = true
port = 1225
server = localhost
user = michal
volume = 75
start_minimalized = false
password = Michal2407
sound = true
debuger = true
sound_one_online=sound/schema1/one_online.wav
sound_next_offline=sound/schema1/next_offline.wav
sound_all_online = sound/schema1/all_online.wav
sound_first_offline=sound/schema1/first_offline.wav

View File

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 424 B

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 725 B

View File

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 644 B

View File

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 634 B

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

View File

Before

Width:  |  Height:  |  Size: 769 B

After

Width:  |  Height:  |  Size: 769 B

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 362 B

View File

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

View File

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 397 B

View File

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

View File

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 802 B

View File

Before

Width:  |  Height:  |  Size: 1023 B

After

Width:  |  Height:  |  Size: 1023 B

View File

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

110
src/jnet/client/Client.java Normal file
View File

@ -0,0 +1,110 @@
package jnet.client;
import jnet.client.gui.Window;
import jnet.client.network.NettyClient;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import jnet.client.gui.Tray;
import jnet.lib.BuilddDate;
import jnet.lib.LogFile;
import jnet.lib.PropertiesManager;
import jnet.lib.object.Event;
import jnet.lib.object.Map;
import jnet.lib.object.ObjectType;
import jnet.lib.object.OnlineClients;
import jnet.lib.object.ServerConfig;
import jnet.lib.object.SnmpProfile;
import jnet.lib.object.User;
public class Client {
// verze serveru
public static final int CLIENT_VERSION = 1;
// nazev aplikace
public static final String APP_NAME = "jNet";
public static List<Map> maps = new CopyOnWriteArrayList<>();
//public static List<MapObject> mapObject = new ArrayList<>();
public static List<OnlineClients> onlineClients = new ArrayList<>();
public static List<ObjectType> objectType = new ArrayList<>();
public static List<SnmpProfile> snmpProfile = new ArrayList<>();
public static List<User> users = new ArrayList<>();
public static List<Event> events = new ArrayList<>();
public static User user;
public static boolean connected = false;
public static Window okno = new Window();
public static Thread clientThread;
public static PropertiesManager config;
public static ServerConfig serverConfig;
public static void main(String[] args) throws InterruptedException {
LogFile.clear();
LogFile.printInfo("---------------------------------------------");
LogFile.printInfo(" jNet Client ");
LogFile.printInfo(" Version: " + CLIENT_VERSION + " (" + BuilddDate.get() + ")");
LogFile.printInfo("---------------------------------------------");
LogFile.printInfo("");
///
/// load config
///
LogFile.printInfo("Loading config ...");
try {
// Načtení existující konfigurace, pokud soubor existuje
config = new PropertiesManager("config.properties");
config.load();
LogFile.printInfo(" successfully");
} catch (PropertiesManager.FileException | PropertiesManager.ConfigException ex) {
LogFile.printErr(" fail. " + ex.getMessage());
System.exit(0);
}
///
/// debug rezim ?
///
if (config.getBoolean("debug")) {
LogFile.setDebug(true);
LogFile.printDebug("Debug mode on");
}
///
/// tray icon
///
new Tray().createAndShowTray();
///
/// spustit minimalozovane ?
///
if (config.getBoolean("start_minimalized")) {
okno.setVisible(false);
} else {
okno.setVisible(true);
}
// Spuštění klienta v novém vlákně
NettyClient client = new NettyClient(config.getString("server"), config.getInt("port"));
clientThread = new Thread(client);
clientThread.start();
}
//TODO TODO TODO TODO TODO TODO
static void setConnected() {
// nastavení serveru jako pripojeny
connected = true;
// smazání seznamu map
maps.clear();
// smazani object typu
objectType.clear();
// smazani uzivatelu
users.clear();
}
}

View File

@ -0,0 +1,292 @@
package jnet.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
import javax.swing.JOptionPane;
import jnet.client.gui.UIUpdater;
import jnet.client.network.NettyClient;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.object.Connection;
import jnet.lib.object.Event;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
import jnet.lib.object.ObjectType;
import jnet.lib.object.OnlineClients;
import jnet.lib.object.ServerConfig;
import jnet.lib.object.SnmpProfile;
import jnet.lib.object.User;
import jnet.lib.snmp.DeviceInfo;
import jnet.lib.snmp.Interface;
public class ClientMessageParser {
private static final java.util.Map<Integer, Consumer<Message>> handlers = new HashMap<>();
static {
handlers.put(Message.CLIENT_VERSION, ClientMessageParser::handleClientVersion);
handlers.put(Message.UPDATE, ClientMessageParser::handleUpdate);
handlers.put(Message.AUTH_REQUEST, ClientMessageParser::handleAuthRequest);
handlers.put(Message.AUTH_SUCEFULL, ClientMessageParser::handleAuthSuccessful);
handlers.put(Message.AUTH_FAIL, ClientMessageParser::handleAuthFail);
handlers.put(Message.ONLINE_CLIENTS, ClientMessageParser::handleOnlineClients);
handlers.put(Message.OBJECT_TYPE, ClientMessageParser::handleObjectType);
handlers.put(Message.USER, ClientMessageParser::handleUser);
handlers.put(Message.USER_INFO, ClientMessageParser::handleUserInfo);
handlers.put(Message.MAP, ClientMessageParser::handleMap);
handlers.put(Message.STATUS_UPDATE, ClientMessageParser::handleStatusUpdate);
handlers.put(Message.SET_MAP_LOCK, ClientMessageParser::handleSetMapLock);
handlers.put(Message.SNMP_PROFILE, ClientMessageParser::handleSnmpProfile);
handlers.put(Message.EVENT_LIST, ClientMessageParser::handleEventList);
handlers.put(Message.EVENT_NEW, ClientMessageParser::handleEventNew);
handlers.put(Message.EVENT_UPDATE, ClientMessageParser::handleEventUpdate);
handlers.put(Message.ADD_OBJECT, ClientMessageParser::handleAddObject);
handlers.put(Message.REMOVE_OBJECT, ClientMessageParser::handleRemoveObject);
handlers.put(Message.UPDATE_OBJECT, ClientMessageParser::handleUpdateObject);
handlers.put(Message.MAP_REMOVE, ClientMessageParser::handleMapRemove);
handlers.put(Message.USER_EDIT, ClientMessageParser::handleUserEdit);
handlers.put(Message.DELETE_LOG, ClientMessageParser::handleDeleteLog);
handlers.put(Message.SERVER_CONFIG, ClientMessageParser::handleServerConfig);
handlers.put(Message.SNMP_OBJECT_INFO, ClientMessageParser::handleSnmpObjectInfo);
handlers.put(Message.SNMP_OBJECT_INTERFACE, ClientMessageParser::handleSnmpObjectInterface);
handlers.put(Message.SNMP_TEST, ClientMessageParser::handleSnmpTest);
handlers.put(Message.SNMP_CONNECTION_INTERFACE, ClientMessageParser::handleSnmpConnectionInterface);
handlers.put(Message.CONNECTION_NEW, ClientMessageParser::handleConnectionNew);
handlers.put(Message.TRAFFIC, ClientMessageParser::handlerTraffic);
handlers.put(Message.CONNECTION_UPDATE, ClientMessageParser::handlerConnectionUpdate);
}
public static void parse(Message msg) {
LogFile.printDebug("-> Message type: " + msg.getType());
handlers.getOrDefault(msg.getType(), m -> LogFile.printErr("Neznámý typ zprávy")).accept(msg);
}
private static void handleClientVersion(Message msg) {
NettyClient.send(Message.CLIENT_VERSION, Client.CLIENT_VERSION);
}
private static void handleUpdate(Message msg) {
LogFile.printInfo("Received update request");
// TODO: Dialogové okno s informací o aktualizaci a odpočtem k jejímu provedení
}
private static void handleAuthRequest(Message msg) {
String[] userPass = {Client.config.getString("user"), Client.config.getString("password"), String.valueOf(OnlineClients.PLATFORM_PC)};
NettyClient.send(Message.AUTH, userPass);
}
private static void handleAuthSuccessful(Message msg) {
LogFile.printInfo("Log in to server");
Client.setConnected();
}
private static void handleAuthFail(Message msg) {
LogFile.printInfo("Authorization failed on server");
JOptionPane.showMessageDialog(null, "Chybné přihlašovací údaje!", "Chyba", JOptionPane.ERROR_MESSAGE);
}
private static void handleOnlineClients(Message msg) {
Client.onlineClients = (ArrayList<OnlineClients>) msg.getMsg();
}
private static void handleObjectType(Message msg) {
Client.objectType.add((ObjectType) msg.getMsg());
}
private static void handleUser(Message msg) {
Client.users.add((User) msg.getMsg());
}
private static void handleUserInfo(Message msg) {
Client.user = (User) msg.getMsg();
}
private static void handleMap(Message msg) {
Map map = (Map) (Map) msg.getMsg();
Client.maps.add(map);
// aktualizace UI
UIUpdater.updateMapTree();
UIUpdater.updateTray();
}
private static void handleStatusUpdate(Message msg) {
int[] o = (int[]) msg.getMsg();
int obj_id = o[0];
int status = o[1];
for (Map map : Client.maps) {
for (MapObject mapObject : map.getObjects()) {
if (mapObject.getId() == obj_id) {
mapObject.setStatus(status);
// aktualizace UI
UIUpdater.updateMapTree();
UIUpdater.updateTray();
UIUpdater.updateMapView();
break;
}
}
}
SoundManager.changeStatus(status);
}
private static void handleSetMapLock(Message msg) {
int[] data_lock = (int[]) msg.getMsg();
for (Map map : Client.maps) {
if (map.getId() == data_lock[0]) {
map.setLock((data_lock[1] == 1));
break;
}
}
}
private static void handleSnmpProfile(Message msg) {
Client.snmpProfile.add((SnmpProfile) msg.getMsg());
}
private static void handleEventList(Message msg) {
Client.events = (ArrayList<Event>) msg.getMsg();
}
private static void handleEventNew(Message msg) {
Client.events.add((Event) msg.getMsg());
}
private static void handleEventUpdate(Message msg) {
Event event_update = (Event) msg.getMsg();
for (int i = 0; i < Client.events.size(); i++) {
if (event_update.getId() == Client.events.get(i).getId()) {
Client.events.set(i, event_update);
break;
}
}
}
private static void handleAddObject(Message msg) {
MapObject mo = (MapObject) msg.getMsg();
for (Map map : Client.maps) {
if (map.getId() == mo.getMap()) {
map.getObjects().add(mo);
UIUpdater.updateMapView();
break;
}
}
}
private static void handleRemoveObject(Message msg) {
int objId = (int) msg.getMsg();
for (Map map : Client.maps) {
for (MapObject object : map.getObjects()) {
if (object.getId() == objId) {
map.getObjects().remove(object);
}
}
}
// aktualizace UI
UIUpdater.updateMapTree();
UIUpdater.updateTray();
}
private static void handleUpdateObject(Message msg) {
MapObject mo = (MapObject) msg.getMsg();
for (Map map : Client.maps) {
for (int i = 0; i < map.getObjects().size(); i++) {
if (map.getObjects().get(i).getId() == mo.getId()) {
map.getObjects().set(i, mo);
UIUpdater.updateMapView();
break;
}
}
}
}
private static void handleMapRemove(Message msg) {
int mapId = (int) msg.getMsg();
Client.maps.removeIf(map -> map.getId() == mapId);
}
private static void handleUserEdit(Message msg) {
User ue = (User) msg.getMsg();
Client.users.removeIf(user -> user.getId() == ue.getId());
}
private static void handleDeleteLog(Message msg) {
int objId = (int) msg.getMsg();
Client.events.removeIf(event -> event.getObject() == objId);
}
private static void handleServerConfig(Message msg) {
Client.serverConfig = (ServerConfig) msg.getMsg();
}
private static void handleSnmpObjectInfo(Message msg) {
Object[] msg_obj = (Object[]) msg.getMsg();
String frame = (String) msg_obj[0];
DeviceInfo di = (DeviceInfo) msg_obj[1];
UIUpdater.updateObjectInfo(frame, di);
}
private static void handleSnmpObjectInterface(Message msg) {
Object[] msg_obj = (Object[]) msg.getMsg();
String frame = (String) msg_obj[0];
List<Interface> iface = (List<Interface>) msg_obj[1];
UIUpdater.updateObjectInterface(frame, iface);
}
private static void handleSnmpTest(Message msg) {
Object[] msg_obj = (Object[]) msg.getMsg();
String frame = (String) msg_obj[0];
boolean result = (boolean) msg_obj[1];
UIUpdater.showResultSnmpTest(frame, result);
}
private static void handleSnmpConnectionInterface(Message msg) {
Object[] msg_obj = (Object[]) msg.getMsg();
String frame = (String) msg_obj[0];
List<Interface> iface = (List<Interface>) msg_obj[1];
UIUpdater.updateConnectionInterface(frame, iface);
}
private static void handleConnectionNew(Message msg) {
Connection c = (Connection) msg.getMsg();
for (Map map : Client.maps) {
if (map.getId() == c.getMap()) {
map.getConnection().add(c);
System.out.println("jnet.client.ClientMessageParser.handleConnectionNew()");
}
}
UIUpdater.updateMapView();
}
private static void handlerTraffic(Message msg) {
Object[] o = (Object[]) msg.getMsg();
for (Map map : Client.maps) {
for (Connection connection : map.getConnection()) {
if (connection.getId() == (int) o[0]) {
connection.setRx((long) o[1]);
connection.setTx((long) o[2]);
break;
}
}
}
}
private static void handlerConnectionUpdate(Message msg) {
Connection c = (Connection) msg.getMsg();
// upravi v seznamu
for (Map map : Client.maps) {
List<Connection> connections = map.getConnection();
for (int i = 0; i < connections.size(); i++) {
if (connections.get(i).getId() == c.getId()) {
connections.set(i, c);
}
}
}
// update map view
UIUpdater.updateMapView();
}
}

View File

@ -0,0 +1,105 @@
package jnet.client;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import jnet.lib.LogFile;
public class ExtAppManager {
private String PUTTY_PATH = "app/putty.exe";
private String WINBOX_PATH = "app/winbox.exe";
private static List<Process> processes;
public ExtAppManager() {
processes = new ArrayList<>();
}
private void runApp(List<String> commands) {
try {
ProcessBuilder processBuilder = new ProcessBuilder(commands);
Process process = processBuilder.start();
processes.add(process);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
LogFile.printInfo("Terminating an external application...");
process.destroy();
}));
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
}
public void closeApp() {
for (Process process : processes) {
if (process.isAlive()) {
process.destroy();
LogFile.printInfo("Terminating an external application ...");
}
}
}
public void runSshPutty(String address, String username, String password, int port) {
List<String> params = new ArrayList<>();
params.add(PUTTY_PATH);
params.add("-ssh");
params.add(username + "@" + address);
if (!password.equals("")) {
params.add("-pw");
params.add(password);
}
params.add(String.valueOf(port));
runApp(params);
LogFile.printInfo("Run Putty SSH (" + address + ")");
}
public void runTelnetPutty(String address, String username, String password, int port) {
List<String> params = new ArrayList<>();
params.add(PUTTY_PATH);
params.add("-telnet ");
params.add(username + "@" + address);
if (!password.equals("")) {
params.add("-pw");
params.add(password);
}
params.add(String.valueOf(port));
runApp(params);
LogFile.printInfo("Run Putty Telnet (" + address + ")");
}
public void runWinbox(String address, String username, String password, int port) {
List<String> params = new ArrayList<>();
params.add(WINBOX_PATH);
params.add(address + ":" + port);
params.add(username);
params.add(password);
runApp(params);
LogFile.printInfo("Run Winbox (" + address + ")");
}
public void runWeb(int verze, String address, String port) {
try {
Desktop desktop = Desktop.getDesktop();
URI uri;
if (verze == 0) {
uri = new URI("http://" + address + ":" + port);
} else {
uri = new URI("https://" + address + ":" + port);
}
desktop.browse(uri);
} catch (URISyntaxException ex) {
Logger.getLogger(ExtAppManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(ExtAppManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -0,0 +1,120 @@
package jnet.client;
import java.io.File;
import java.io.IOException;
import java.util.ListIterator;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import jnet.lib.Status;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
public class SoundManager {
private static int count = 0;
public static void playOnline(){
int count = 0;
for (Map map : Client.maps) {
for (MapObject object : map.getObjects()) {
if (object.getStatus() == Status.OFFLINE && count != 0) {
playNextOffline();
break;
} else if (object.getStatus() == Status.OFFLINE) {
count++;
playFirstOffline();
break;
}
}
}
}
public static void changeStatus(int state){
if (Client.config.getBoolean("sound")) {
if (count == 0 && state == Status.OFFLINE) {
count++;
playFirstOffline();
} else if (count > 0 && state == Status.OFFLINE) {
count++;
playNextOffline();
} else if (count != 1 && state == Status.OK) {
count--;
playOneOnline();
} else if (count == 1 && state == Status.OK) {
count--;
playAllOnline();
}
}
}
public static void playOneOnline(){
playSound(Client.config.getString("sound_one_online"), Client.config.getInt("volume"));
}
public static void playAllOnline(){
playSound(Client.config.getString("sound_all_online"), Client.config.getInt("volume"));
}
public static void playFirstOffline(){
playSound(Client.config.getString("sound_first_offline"), Client.config.getInt("volume"));
}
public static void playNextOffline(){
playSound(Client.config.getString("sound_next_offline"), Client.config.getInt("volume"));
}
public static void playSound(String filePath, int volume) {
try {
File zvukovySoubor = new File(filePath);
AudioInputStream audioStream = AudioSystem.getAudioInputStream(zvukovySoubor);
// Získání zvukového klipu
Clip clip = AudioSystem.getClip();
clip.open(audioStream);
// Nastavení hlasitosti
FloatControl ovladaniHlasitosti = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
setVolume(ovladaniHlasitosti, volume);
// Přehrání zvuku
clip.start();
// Čekání na dokončení přehrávání
Thread.sleep(clip.getMicrosecondLength() / 1000);
} catch (UnsupportedAudioFileException e) {
System.out.println("Nepodporovaný formát souboru.");
} catch (IOException e) {
System.out.println("Chyba při načítání souboru.");
}
catch (LineUnavailableException e) {
System.out.println("Zvukové zařízení není dostupné.");
} catch (InterruptedException e) {
System.out.println("Přehrávání bylo přerušeno.");
}
}
/**
* Nastavení hlasitosti.
* @param volumeControl Objekt pro ovládání hlasitosti.
* @param percent Požadovaná hlasitost v procentech (0 - 100).
*/
private static void setVolume(FloatControl volumeControl, int percent) {
float min = volumeControl.getMinimum(); // Minimální hodnota v dB
float max = volumeControl.getMaximum(); // Maximální hodnota v dB
float range = max - min;
float value = min + (range * percent / 100); // Výpočet hodnoty v dB
volumeControl.setValue(value);
}
}

View File

@ -5,47 +5,31 @@ import java.awt.BorderLayout;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.ListIterator;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import jnet.lib.EventComparator;
import jnet.lib.Status;
import jnet.lib.object.Node;
import jnet.lib.object.Site;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
public class EventsPanel extends JPanel {
private static final int DEFAULT_LIMIT = 50;
private DefaultTableModel tableModel;
private JTable table;
public EventsPanel() {
setLayout(new BorderLayout());
String[] column = {"Začátek", "Konec", "Délka", "Stav", "Mapa", "Zařízení"};
tableModel = new DefaultTableModel(column, 0) {
int limit = 50;
String column[] = {"Začátek", "Konec", "Délka", "Stav", "Mapa", "Zařízení"};
DefaultTableModel tableModel = new DefaultTableModel(column, 0) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
table = new JTable(tableModel);
table.setRowHeight(30);
add(new JScrollPane(table), BorderLayout.CENTER);
refresh(); // naplní tabulku
}
/**
* Obnoví obsah tabulky podle aktuálních dat v Client.events.
*/
public void refresh() {
tableModel.setRowCount(0); // smaže všechny řádky
int limit = DEFAULT_LIMIT;
Collections.sort(Client.events, new EventComparator());
Collections.reverse(Client.events);
@ -54,25 +38,25 @@ public class EventsPanel extends JPanel {
}
for (int i = 0; i < limit; i++) {
String[] info = getObjetInfo(Client.events.get(i).getNode());
// pokud se objekt nenajde, info bude null – ošetříme
if (info == null) {
info = new String[]{"Neznámá", "Neznámé"};
}
Object[] row = {
String[] info = getObjetInfo(Client.events.get(i).getObject());
Object[] d = {
getDate(Client.events.get(i).getStart()),
getDate(Client.events.get(i).getEnd()),
getDuration(Client.events.get(i).getStart(), Client.events.get(i).getEnd()),
Status.getStatusName(Client.events.get(i).getStatus()),
Client.events.get(i).getDescription(),
info[0],
info[1]
};
tableModel.addRow(row);
info[1]};
tableModel.addRow(d);
}
tableModel.fireTableDataChanged();
JTable table = new JTable(tableModel);
table.setRowHeight(30);
this.setLayout(new BorderLayout()); // Ujistěte se, že používáte vhodný layout
this.add(new JScrollPane(table), BorderLayout.CENTER); // Ujistěte se, že je tabulka ve JScrollPane
}
// -- stávající pomocné metody (getDate, getDuration, getObjetInfo) zůstávají beze změny --
private String getDate(long date) {
if (date != 0) {
SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
@ -84,22 +68,31 @@ public class EventsPanel extends JPanel {
private String getDuration(long startTime, long endTime) {
if (endTime != 0) {
long difference = endTime - startTime;
// převod na sekundy, minuty, hodiny
long seconds = difference / 1000;
long minutes = difference / (1000 * 60);
long hours = difference / (1000 * 60 * 60);
SimpleDateFormat ft = new SimpleDateFormat("HH:mm:ss");
return hours + "h " + minutes + "m " + seconds + "s";
}
return "";
}
private String[] getObjetInfo(int id) {
for (Site map : Client.site) {
for (Node mapObject : map.getNode()) {
for (Map map : Client.maps) {
for (MapObject mapObject : map.getObjects()) {
if (mapObject.getId() == id) {
return new String[]{map.getName(), mapObject.getName()};
if (map.getId() == mapObject.getMap()) {
String[] data = {map.getName(), mapObject.getName()};
return data;
}
}
}
}
return null;
}
}
}

View File

@ -0,0 +1,149 @@
package jnet.client.gui;
import jnet.client.Client;
import jnet.client.gui.dialog.AddMapDialog;
import jnet.client.network.NettyClient;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.util.Collections;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
import jnet.lib.LogFile;
import jnet.lib.MapComparator;
import jnet.lib.Message;
import jnet.lib.object.Map;
public class MapTree extends JTree {
static DefaultTreeModel model;
static DefaultMutableTreeNode root = new DefaultMutableTreeNode("Mapy");
private static JTree tree;
public MapTree() {
tree = this;
// neni videt root element
this.setRootVisible(false);
// povoli pouze jeden vybrany radek
this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
model = new DefaultTreeModel(root);
this.setModel(model);
this.setCellRenderer(new MapTreeCellRenderer());
//this.setComponentPopupMenu(getPopUpMenu());
MouseListener ml = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) getLastSelectedPathComponent();
if (SwingUtilities.isRightMouseButton(e)) {
// right click
if (node != null) {
Object obj = node.getUserObject();
getContextMenuMap(e, (Map) obj);
}
} else if (SwingUtilities.isLeftMouseButton(e)) {
// left click
if (!node.isRoot()) {
if (e.getClickCount() == 1) { // jednoduchy klik
} else if (e.getClickCount() == 2) { // dvojklik
Object obj = node.getUserObject();
Window.setMapView((Map) obj);
}
}
}
}
};
addMouseListener(ml);
}
private static void getContextMenuMap(MouseEvent e, Map m) {
try {
JMenuItem mapAdd = new JMenuItem("Přidat mapu", new ImageIcon(ImageIO.read(MapTree.class.getResourceAsStream("/img/add.png"))));
mapAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new AddMapDialog().setVisible(true);
}
});
JMenuItem mapDelete = new JMenuItem("Smazat mapu", new ImageIcon(ImageIO.read(MapTree.class.getResourceAsStream("/img/trash.png"))));
mapDelete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int option = JOptionPane.showConfirmDialog(
null,
"Smazat mapu " + m.getName() + " a všechny její objekty ?",
"Potvrzení akce",
JOptionPane.YES_NO_OPTION
);
if (option == JOptionPane.YES_OPTION) {
NettyClient.send(Message.MAP_REMOVE, m.getId());
}
}
});
JPopupMenu menu = new JPopupMenu();
if (Client.user.isAddMap()) {
menu.add(mapAdd);
}
if (Client.user.isRemoveMap()) {
menu.add(mapDelete);
}
menu.show(e.getComponent(), e.getX(), e.getY());
} catch (IOException ex) {
LogFile.printErr("MapTree error: " + ex.getMessage());
}
}
private static void expandAllNodes(JTree tree, int startingIndex, int rowCount) {
for (int i = startingIndex; i < rowCount; ++i) {
tree.expandRow(i);
}
if (tree.getRowCount() != rowCount) {
expandAllNodes(tree, rowCount, tree.getRowCount());
}
}
public static void reload() {
try {
root.removeAllChildren();
Collections.sort(Client.maps, new MapComparator());
for (Map map : Client.maps) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(map);
root.add(node);
}
model.reload();
expandAllNodes(tree, 0, tree.getRowCount());
} catch (Exception e) {
LogFile.printErr("Map tree error: " + e);
}
}
}

View File

@ -0,0 +1,63 @@
package jnet.client.gui;
import java.awt.Component;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import jnet.lib.Status;
import jnet.lib.object.Map;
public class MapTreeCellRenderer extends DefaultTreeCellRenderer {
private JLabel label;
private BufferedImage image;
public MapTreeCellRenderer() {
label = new JLabel();
}
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
label = (JLabel) super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
Object o = ((DefaultMutableTreeNode) value).getUserObject();
if (o instanceof Map) {
try {
Map m = (Map) o;
String imagePath = "";
switch (m.getStatus()) {
case Status.OK: // online
imagePath = "/img/flag_green.png";
break;
case Status.WARNING: // warning
imagePath = "/img/flag_orange.png";
break;
case Status.OFFLINE: // offline
imagePath = "/img/flag_red.png";
break;
default: // other
imagePath = "/img/flag_gray.png";
}
image = ImageIO.read(getClass().getResourceAsStream(imagePath));
if (image != null) {
label.setIcon(new ImageIcon(image));
}
label.setText(m.getName());
} catch (Exception ex) {
System.err.println("Error tree icon: " + ex.getMessage());
}
}
// EmptyBorder(int top, int left, int bottom, int right)
EmptyBorder border = new EmptyBorder(7, 25, 3, 3);
label.setBorder(border);
return label;
}
}

View File

@ -0,0 +1,101 @@
package jnet.client.gui;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.client.gui.dialog.LoginDialog;
import jnet.client.network.NettyClient;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
import jnet.lib.LogFile;
class MenuPanel extends JPanel {
public MenuPanel() {
setPreferredSize(new Dimension(50, 50));
setLayout(new FlowLayout(FlowLayout.LEFT));
// tlacitko pripojit / odpojit
try {
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/connect.png"));
JButton bLogin = new JButton(new ImageIcon(buttonIcon));
bLogin.setFocusPainted(false);
bLogin.setContentAreaFilled(false);
bLogin.setToolTipText("Připojit / Odpojit");
bLogin.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (NettyClient.isConnected()) {
NettyClient.disconnect();
} else {
new LoginDialog().setVisible(true);
}
}
});
add(bLogin);
} catch (IOException ex) {
LogFile.printErr("File not found: image connect.png");
}
// tlacitko nastaveni
try {
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/settings.png"));
JButton bSettings = new JButton(new ImageIcon(buttonIcon));
bSettings.setFocusPainted(false);
bSettings.setContentAreaFilled(false);
bSettings.setToolTipText("Nastavení programu");
bSettings.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Window.showSettings();
}
});
add(bSettings);
} catch (IOException ex) {
LogFile.printErr("File not found: image settings.png");
}
// tlacitko log
try {
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/log.png"));
JButton bLog = new JButton(new ImageIcon(buttonIcon));
bLog.setFocusPainted(false);
bLog.setContentAreaFilled(false);
bLog.setToolTipText("Log událostí");
bLog.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Window.showEvents();
}
});
add(bLog);
} catch (IOException ex) {
LogFile.printErr("File not found: image log.png");
}
// tlacitko server settings
try {
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/server_settings.png"));
JButton bServerSettings = new JButton(new ImageIcon(buttonIcon));
bServerSettings.setFocusPainted(false);
bServerSettings.setContentAreaFilled(false);
bServerSettings.setToolTipText("Nastavení serveru");
bServerSettings.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Window.showServerSettings(ServerSettingsPanel.TAB_DEFAULT);
}
});
add(bServerSettings);
} catch (IOException ex) {
LogFile.printErr("File not found: image server_settings.png");
}
}
}

View File

@ -0,0 +1,252 @@
package jnet.client.gui;
import jnet.client.Client;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
public class SettingsPanel extends JPanel {
public SettingsPanel() {
show();
}
public void show() {
this.setLayout(null);
this.setPreferredSize(new Dimension(300, 800));
JLabel nadpisLabel = new JLabel("Obecné nastavení");
nadpisLabel.setBounds(20, 20, 400, 25);
nadpisLabel.setFont(nadpisLabel.getFont().deriveFont(20f));
this.add(nadpisLabel);
JCheckBox runMinimalized = new JCheckBox("Spouštět minimalizovaně");
runMinimalized.setBounds(30, getNextY(nadpisLabel) + 20, 400, 25);
runMinimalized.setSelected(Client.config.getBoolean("start_minimalized"));
this.add(runMinimalized);
JCheckBox enableDebug = new JCheckBox("Debug režim");
enableDebug.setBounds(30, getNextY(runMinimalized), 400, 25);
enableDebug.setSelected(Client.config.getBoolean("debug"));
this.add(enableDebug);
JLabel nadpisSoundLabel = new JLabel("Zvuky");
nadpisSoundLabel.setBounds(20, getNextY(enableDebug) + 20, 400, 25);
nadpisSoundLabel.setFont(nadpisLabel.getFont().deriveFont(20f));
this.add(nadpisSoundLabel);
JCheckBox enableSounds = new JCheckBox("Povolit zvuky");
enableSounds.setBounds(30, getNextY(nadpisSoundLabel), 400, 25);
enableSounds.setSelected(Client.config.getBoolean("sound"));
this.add(enableSounds);
// slider nastaveni hlasitosti
JLabel hlasLabel = new JLabel("Hlasitost");
hlasLabel.setBounds(30, getNextY(enableSounds), 80, 25);
this.add(hlasLabel);
JSlider volumeSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 50);
volumeSlider.setBounds(110, getNextY(enableSounds), 200, 50);
volumeSlider.setValue(Client.config.getInt("volume"));
volumeSlider.setPaintTrack(true);
volumeSlider.setPaintTicks(true);
volumeSlider.setPaintLabels(true);
volumeSlider.setMajorTickSpacing(50);
JLabel sliderValue = new JLabel(volumeSlider.getValue() + " %");
sliderValue.setBounds(350, getNextY(enableSounds), 50, 25);
this.add(sliderValue);
volumeSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sliderValue.setText(volumeSlider.getValue() + " %");
}
});
this.add(volumeSlider);
// vyber souboru vse online
JLabel fileAllOkLabel = new JLabel("Zvuk vše online:");
fileAllOkLabel.setBounds(30, getNextY(volumeSlider), 150, 25);
this.add(fileAllOkLabel);
JTextField filePathFieldAllOk = new JTextField(25);
filePathFieldAllOk.setEditable(false);
filePathFieldAllOk.setBounds(200, getNextY(volumeSlider), 200, 25);
filePathFieldAllOk.setText(Client.config.getString("sound_all_online"));
this.add(filePathFieldAllOk);
JButton selectFileButtonAllOk = new JButton("Vyber soubor");
selectFileButtonAllOk.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Vytvoření JFileChooser
JFileChooser fileChooser = new JFileChooser();
// Nastavení filtru souborů (volitelné)
FileNameExtensionFilter filter = new FileNameExtensionFilter("Zvukove soubory WAV", "wav");
fileChooser.setFileFilter(filter);
// Zobrazení dialogu pro výběr souboru
int result = fileChooser.showOpenDialog(null);
// Zpracování výsledku
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
filePathFieldAllOk.setText(selectedFile.getAbsolutePath());
} else {
filePathFieldAllOk.setText(Client.config.getString("sound_all_online"));
}
}
});
selectFileButtonAllOk.setBounds(420, getNextY(volumeSlider), 80, 25);
this.add(selectFileButtonAllOk);
// vyber souboru jeden online
JLabel fileOneOkLabel = new JLabel("Zvuk jeden online:");
fileOneOkLabel.setBounds(30, getNextY(filePathFieldAllOk), 150, 25);
this.add(fileOneOkLabel);
JTextField filePathFieldOneOk = new JTextField(25);
filePathFieldOneOk.setEditable(false);
filePathFieldOneOk.setText(Client.config.getString("sound_one_online"));
filePathFieldOneOk.setBounds(200, getNextY(filePathFieldAllOk), 200, 25);
this.add(filePathFieldOneOk);
JButton selectFileButtonOneOk = new JButton("Vyber soubor");
selectFileButtonOneOk.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Vytvoření JFileChooser
JFileChooser fileChooser = new JFileChooser();
// Nastavení filtru souborů (volitelné)
FileNameExtensionFilter filter = new FileNameExtensionFilter("Zvukove soubory WAV", "wav");
fileChooser.setFileFilter(filter);
// Zobrazení dialogu pro výběr souboru
int result = fileChooser.showOpenDialog(null);
// Zpracování výsledku
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
filePathFieldOneOk.setText(selectedFile.getAbsolutePath());
} else {
filePathFieldOneOk.setText(Client.config.getString("sound_one_online"));
}
}
});
selectFileButtonOneOk.setBounds(420, getNextY(filePathFieldAllOk), 80, 25);
this.add(selectFileButtonOneOk);
// vyber souboru první offline
JLabel fileFirstKoLabel = new JLabel("Zvuk první offline:");
fileFirstKoLabel.setBounds(30, getNextY(filePathFieldOneOk), 150, 25);
this.add(fileFirstKoLabel);
JTextField filePathFieldFirstKo = new JTextField(25);
filePathFieldFirstKo.setEditable(false);
filePathFieldFirstKo.setText(Client.config.getString("sound_first_offline"));
filePathFieldFirstKo.setBounds(200, getNextY(filePathFieldOneOk), 200, 25);
this.add(filePathFieldFirstKo);
JButton selectFileButtonFirstKo = new JButton("Vyber soubor");
selectFileButtonFirstKo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Vytvoření JFileChooser
JFileChooser fileChooser = new JFileChooser();
// Nastavení filtru souborů (volitelné)
FileNameExtensionFilter filter = new FileNameExtensionFilter("Zvukove soubory WAV", "wav");
fileChooser.setFileFilter(filter);
// Zobrazení dialogu pro výběr souboru
int result = fileChooser.showOpenDialog(null);
// Zpracování výsledku
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
filePathFieldFirstKo.setText(selectedFile.getAbsolutePath());
} else {
filePathFieldFirstKo.setText(Client.config.getString("sound_first_offline"));
}
}
});
selectFileButtonFirstKo.setBounds(420, getNextY(filePathFieldOneOk), 80, 25);
this.add(selectFileButtonFirstKo);
// vyber souboru dalsi offline
JLabel filefirstNextLabel = new JLabel("Zvuk další offline:");
filefirstNextLabel.setBounds(30, getNextY(filePathFieldFirstKo), 150, 25);
this.add(filefirstNextLabel);
JTextField filePathFieldNextKo = new JTextField(25);
filePathFieldNextKo.setEditable(false);
filePathFieldNextKo.setText(Client.config.getString("sound_next_offline"));
filePathFieldNextKo.setBounds(200, getNextY(filePathFieldFirstKo), 200, 25);
this.add(filePathFieldNextKo);
JButton selectFileButtonNextKo = new JButton("Vyber soubor");
selectFileButtonNextKo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Vytvoření JFileChooser
JFileChooser fileChooser = new JFileChooser();
// Nastavení filtru souborů (volitelné)
FileNameExtensionFilter filter = new FileNameExtensionFilter("Zvukove soubory WAV", "wav");
fileChooser.setFileFilter(filter);
// Zobrazení dialogu pro výběr souboru
int result = fileChooser.showOpenDialog(null);
// Zpracování výsledku
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
filePathFieldNextKo.setText(selectedFile.getAbsolutePath());
} else {
filePathFieldNextKo.setText(Client.config.getString("sound_next_offline"));
}
}
});
selectFileButtonNextKo.setBounds(420, getNextY(filePathFieldFirstKo), 80, 25);
this.add(selectFileButtonNextKo);
// tlacitko uložit
JButton b = new JButton("Uložit");
b.setBounds(20, getNextY(filePathFieldNextKo)+50, 100, 30);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Client.config.setBoolean("debuger", enableDebug.isSelected());
Client.config.setBoolean("start_minimalized", runMinimalized.isSelected());
Client.config.setBoolean("sound", enableSounds.isSelected());
Client.config.setInt("volume", volumeSlider.getValue());
Client.config.save();
}
});
this.add(b);
}
private int getNextY(Component p) {
return p.getY() + p.getHeight() + 30;
}
}

View File

@ -0,0 +1,67 @@
package jnet.client.gui;
import jnet.client.gui.dialog.OnlineClientsDialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import jnet.lib.LogFile;
public class StatusBar extends JPanel {
private JLabel message;
private JLabel online;
private JButton btnOnline;
public StatusBar() {
super();
super.setPreferredSize(new Dimension(100, 35));
setLayout(null);
online = new JLabel("Odpojeno");
online.setBounds(10, 0, 100, 30);
add(online);
message = new JLabel("");
message.setBounds(250, 0, 100, 30);
add(message);
// tlacitko zobrazujici klienty
try {
BufferedImage buttonIcon = ImageIO.read(getClass().getResourceAsStream("/img/online_clients.png"));
btnOnline = new JButton(new ImageIcon(buttonIcon));
btnOnline.setFocusPainted(false);
btnOnline.setContentAreaFilled(false);
btnOnline.setBorderPainted(false);
btnOnline.setToolTipText("Online uživatelé");
btnOnline.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO jeli offlice vypnout tlačítko
new OnlineClientsDialog();
}
});
btnOnline.setBounds(200, 0, 32, 32);
add(btnOnline);
} catch (IOException ex) {
LogFile.printErr("File not found: image online_clinets.png");
}
}
public void setMessage(String text) {
message.setText(text);
}
public void setConectionStatus(String state){
online.setText(state);
}
}

View File

@ -2,15 +2,12 @@ package jnet.client.gui;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import jnet.client.Client;
import jnet.lib.LogFile;
import jnet.lib.ResourceLoader;
import jnet.lib.Status;
import jnet.lib.object.Site;
import jnet.lib.object.Map;
public class Tray {
@ -38,18 +35,12 @@ public class Tray {
trayIcon = new TrayIcon(loadImage("/img/flag_gray.png"), Client.APP_NAME, menu);
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(e -> {
boolean visible = Client.okno.isVisible();
Client.okno.setVisible(!visible);
if (!visible) {
// Okno bylo skryté – po zobrazení ho uvedeme do normálního režimu
Client.okno.setExtendedState(JFrame.NORMAL);
Client.okno.toFront();
}
// Dvojklik - obnovit/minimalizovat okno
Client.okno.setVisible(!Client.okno.isVisible());
});
tray = SystemTray.getSystemTray();
tray.add(trayIcon);
refresh();
} catch (IOException | AWTException ex) {
LogFile.printErr("TrayIcon error: " + ex.getMessage());
@ -57,20 +48,13 @@ public class Tray {
}
private static BufferedImage loadImage(String path) throws IOException {
File input = ResourceLoader.getFile(path);
if (input == null) {
throw new IOException("Soubor nenalezen: " + path);
try (var input = Tray.class.getResourceAsStream(path)) {
if (input == null) {
throw new IOException("Soubor nenalezen: " + path);
}
return ImageIO.read(input);
}
return ImageIO.read(input);
}
public static void showMessage(String title, String message) {
if (trayIcon != null) {
trayIcon.displayMessage(title, message, TrayIcon.MessageType.INFO);
}
}
public static void setIcon(String icon) {
try {
@ -97,17 +81,17 @@ public class Tray {
}
public static void refresh() {
for (Site map : Client.site) {
int status = map.getSiteState();
setStatusOnline(); // Výchozí stav
for (Map map : Client.maps) {
int status = map.getStatus();
if (status == Status.OFFLINE) {
setStatusOffline();
return;
}
if (status == Status.WARNING) {
setStatusWarning();
return;
}
}
setStatusOnline();
}
}

View File

@ -0,0 +1,83 @@
package jnet.client.gui;
import jnet.client.gui.mapview.MapView;
import javax.swing.*;
import java.awt.Window;
import java.util.List;
import jnet.client.gui.dialog.ConnectionDialog;
import jnet.client.gui.dialog.object.ObjectDialog;
import jnet.lib.snmp.DeviceInfo;
import jnet.lib.snmp.Interface;
public class UIUpdater {
public static void updateMapUI() {
SwingUtilities.invokeLater(() -> {
MapTree.reload();
Tray.refresh();
});
}
public static void updateMapTree() {
SwingUtilities.invokeLater(() -> {
MapTree.reload();
});
}
public static void updateTray() {
SwingUtilities.invokeLater(() -> {
Tray.refresh();
});
}
public static void updateMapView() {
SwingUtilities.invokeLater(() -> {
MapView.updateMapView();
});
}
public static void updateObjectInfo(String frameName, DeviceInfo di) {
for (Window w : JFrame.getWindows()) {
if (w instanceof JFrame && frameName.equals(w.getName())) {
SwingUtilities.invokeLater(() -> {
((ObjectDialog) w).setDeviceInfo(di);
});
return;
}
}
}
public static void updateObjectInterface(String frameName, List<Interface> iface) {
for (Window w : JFrame.getWindows()) {
if (w instanceof JFrame && frameName.equals(w.getName())) {
SwingUtilities.invokeLater(() -> {
((ObjectDialog) w).setDeviceInterface(iface);
});
return;
}
}
}
public static void showResultSnmpTest(String frameName, boolean result) {
for (Window w : JFrame.getWindows()) {
if (w instanceof JFrame && frameName.equals(w.getName())) {
SwingUtilities.invokeLater(() -> {
((ObjectDialog) w).showResultSnmpTest(result);
});
return;
}
}
}
public static void updateConnectionInterface(String frameName, List<Interface> iface) {
for (Window w : JFrame.getWindows()) {
if (w instanceof JFrame && frameName.equals(w.getName())) {
SwingUtilities.invokeLater(() -> {
((ConnectionDialog) w).updateInterface(iface);
});
return;
}
}
}
}

View File

@ -0,0 +1,156 @@
package jnet.client.gui;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.client.gui.mapview.MapView;
import jnet.client.Client;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import jnet.lib.LogFile;
import jnet.lib.object.Map;
public class Window extends JFrame {
public static int currentMapIndex;
private static StatusBar statusBar;
private static JSplitPane jsp;
private static JTabbedPane serverSettings;
public Window() {
super(Client.APP_NAME); //titulek okna
//identifikator okna
this.setName("mainWindow");
Dimension d = new Dimension(1024, 800);
this.setPreferredSize(d);
this.setSize(d);
this.setLocationRelativeTo(null);
try {
this.setIconImage(ImageIO.read(getClass().getResourceAsStream("/img/app.png")));
} catch (IOException ex) {
LogFile.printErr("APP icon exception");
}
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent windowEvent) {
// vola se pri zavreni okna krizkem
Object[] options = {
"Ukončit",
"Minimalizovat"
};
int n = JOptionPane.showOptionDialog(windowEvent.getWindow(),
"Ukončit nebo minimalozovat do lišty ?",
"Ukončit",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, //do not use a custom Icon
options, //the titles of buttons
options[1]); //default button title
if (n == 0) {
LogFile.printInfo("Ukoncit");
System.exit(0);
}
}
@Override
public void windowDeiconified(WindowEvent e) {
// vola se pri obnoveni z listy
}
@Override
public void windowIconified(WindowEvent e) {
// pri minimalizaci
setVisible(false);
}
});
this.setLayout(new BorderLayout());
this.add(new MenuPanel(), BorderLayout.NORTH);
// oddelovac leve a prave strany
jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
jsp.setDividerSize(5);
// levy panel
JPanel leftPanel = new JPanel();
leftPanel.setBackground(Color.WHITE);
leftPanel.setPreferredSize(new Dimension(200, 250));
leftPanel.setLayout(new BorderLayout());
leftPanel.add(new MapTree(), BorderLayout.PAGE_START);
//leftPanel.add(new MapList(), BorderLayout.PAGE_START);
jsp.add(leftPanel, JSplitPane.LEFT);
jsp.add(new JPanel(), JSplitPane.RIGHT);
this.add(jsp, BorderLayout.CENTER);
statusBar = new StatusBar();
this.add(statusBar, BorderLayout.SOUTH);
this.pack();
}
public void blinkTaskBar() {
toFront();
}
public static void setStatusBarMessage(String message) {
statusBar.setMessage(message);
}
public static void setConectionStatus(String state) {
statusBar.setConectionStatus(state);
}
// prepnuti na stranku nastaveni
public static void showSettings() {
SettingsPanel set = new SettingsPanel();
JScrollPane scroll = new JScrollPane(set);
JScrollBar verticalBar = scroll.getVerticalScrollBar();
verticalBar.setUnitIncrement(20);
jsp.add(scroll, JSplitPane.RIGHT);
}
// prepnuti mapy
public static void setMapView(Map map) {
MapView mv = new MapView(map);
JScrollPane scroll = new JScrollPane(mv);
jsp.add(scroll, JSplitPane.RIGHT);
}
public static void showServerSettings(int table) {
ServerSettingsPanel mv = new ServerSettingsPanel();
mv.setTable(table);
JScrollPane scroll = new JScrollPane(mv);
jsp.add(scroll, JSplitPane.RIGHT);
}
public static void showEvents() {
EventsPanel ep = new EventsPanel();
jsp.add(ep, JSplitPane.RIGHT);
}
// public static void showMessage(String text){
// // TODO co s tim ? nechat nebo vytvořit dialog ?
// //new ServerMessageDialog(text);
// JOptionPane.showMessageDialog(null, text);
// }
}

View File

@ -0,0 +1,144 @@
package jnet.client.gui.dialog;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.client.gui.Window;
import jnet.client.network.NettyClient;
import java.awt.Color;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.util.Base64;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.filechooser.FileNameExtensionFilter;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.object.ObjectType;
public class AddDeviceTypeDialog extends JDialog {
private JLabel info = new JLabel("PNG obrázek o šířce 32px");
private JTextField nazevText = new JTextField();
private String img_str = "";
public AddDeviceTypeDialog() {
setTitle("Přidat typ zařízení");
setSize(300, 180);
setLocationRelativeTo(null);
setAlwaysOnTop(false);
JPanel panel = new JPanel();
add(panel);
placeComponents(panel);
}
private void placeComponents(JPanel panel) {
panel.setLayout(null);
JLabel serverLabel = new JLabel("Název:");
serverLabel.setBounds(20, 10, 80, 25);
panel.add(serverLabel);
nazevText.setBounds(110, 10, 160, 25);
panel.add(nazevText);
JLabel portLabel = new JLabel("Obrázek");
portLabel.setBounds(20, 40, 80, 25);
panel.add(portLabel);
JButton btnBrowse = new JButton("Browse");
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
browseButtonActionPerformed(e);
}
});
btnBrowse.setBounds(110, 40, 160, 25);
panel.add(btnBrowse);
info.setBounds(20, 70, 200, 25);
panel.add(info);
JButton addButton = new JButton("Přidat");
addButton.setBounds(20, 100, 90, 25);
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (nazevText.getText().length() > 3) {
ObjectType ot = new ObjectType(nazevText.getText(), img_str);
NettyClient.send(Message.NEW_OBJECT_TYPE, ot);
// refresh tabulky
//TODO
Window.showServerSettings(ServerSettingsPanel.TAB_DEVICE_TYPE);
// zavreni dialogu
dispose();
} else {
info.setForeground(Color.RED);
info.setText("Název je moc krátký");
}
}
});
panel.add(addButton);
JButton closeButton = new JButton("Storno");
closeButton.setBounds(185, 100, 80, 25);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.add(closeButton);
}
private void browseButtonActionPerformed(ActionEvent evt) {
JFileChooser fc = new JFileChooser(".");
fc.addChoosableFileFilter(new FileNameExtensionFilter("Image Files PNG", "png"));
int res = fc.showOpenDialog(null);
try {
if (res == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
String ext = "png";
// TODO doresit overeni správného typu souboru
//String ext = FilenameUtils.getExtension("C:\\Users\\Michal\\Documents\\NetBeansProjects\\jGuardClient\\img\\app.png"); // returns "exe"
if (ext.equals("png")) {
Image image = ImageIO.read(file);
BufferedImage bimg = ImageIO.read(file);
if (bimg.getWidth() == 32) {
info.setText("");
img_str = encodeFileToBase64Binary(file);
} else {
info.setForeground(Color.RED);
info.setText("Chybný rozměr obrázku");
}
} else {
info.setForeground(Color.RED);
info.setText("Chybný formát obrázku");
}
}
} catch (Exception e) {
LogFile.printErr("File choose exception: " + e.getMessage());
}
}
private static String encodeFileToBase64Binary(File file) throws Exception {
FileInputStream fileInputStreamReader = new FileInputStream(file);
byte[] bytes = new byte[(int) file.length()];
fileInputStreamReader.read(bytes);
return new String(Base64.getEncoder().encode(bytes), "UTF-8");
}
}

View File

@ -0,0 +1,73 @@
package jnet.client.gui.dialog;
import jnet.client.network.NettyClient;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jnet.lib.Message;
public class AddMapDialog extends JDialog {
public AddMapDialog() {
setTitle("Přidat mapu");
setSize(320,180);
setLocationRelativeTo(null);
setAlwaysOnTop(true);
setResizable(false);
JPanel panel = new JPanel();
add(panel);
placeComponents(panel);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
private JPanel placeComponents(JPanel panel) {
panel.setLayout(null);
JLabel serverLabel = new JLabel("Název");
serverLabel.setBounds(20, 20, 80, 25);
panel.add(serverLabel);
JTextField nameText = new JTextField();
nameText.setBounds(110, 20, 160, 25);
panel.add(nameText);
JLabel error = new JLabel("");
error.setBounds(110, 45, 160, 25);
error.setForeground(Color.red);
panel.add(error);
JButton button = new JButton("Přidat");
button.setBounds(120, 80, 80, 25);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!nameText.getText().equals("")) {
NettyClient.send(Message.MAP_ADD, nameText.getText());
dispose();
} else {
error.setText("Název nesmí být prázdný");
}
}
});
panel.add(button);
return panel;
}
}

View File

@ -1,41 +1,33 @@
package jnet.client.gui.dialog;
import java.awt.HeadlessException;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import jnet.client.Client;
import jnet.client.client.NettyClientManager;
import jnet.lib.LogFile;
import jnet.client.network.NettyClient;
import jnet.lib.Message;
import jnet.lib.ResourceLoader;
import jnet.lib.object.Interface;
import jnet.lib.object.Node;
import jnet.lib.object.NodeConnection;
import jnet.lib.object.Site;
import jnet.lib.object.Connection;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
import jnet.lib.snmp.Interface;
public class DialogConnection extends JFrame {
public class ConnectionDialog extends JFrame {
private Node startObj;
private Node endObj;
private MapObject startObj;
private MapObject endObj;
private Boolean newObject;
private List<Interface> iface = new ArrayList<>();
private NodeConnection connection = new NodeConnection();
private JLabel loadingLabel;
private Connection connection = new Connection();
private JComboBox<String> typComboBox = new JComboBox<String>(new DefaultComboBoxModel(new String[]{
"Neznámé",
@ -55,42 +47,30 @@ public class DialogConnection extends JFrame {
private JComboBox<String> sourceDeviceComboBox = new JComboBox<>();
private JComboBox<Item> sourceInterfaceComboBox = new JComboBox<>();
// public DialogConnection(Node startObj, Node endObj, boolean newObject) throws HeadlessException {
// this.startObj = startObj;
// this.endObj = endObj;
// this.newObject = newObject;
//
// init();
// }
public DialogConnection(NodeConnection connection, boolean newObject) throws HeadlessException {
public ConnectionDialog(MapObject startObj, MapObject endObj) throws HeadlessException {
this.startObj = startObj;
this.endObj = endObj;
this.newObject = true;
init();
}
public ConnectionDialog(Connection connection) throws HeadlessException {
this.connection = connection;
this.newObject = newObject;
this.newObject = false;
// nastaveni pocatecniho a koncoveho objektu podle id
for (Site map : Client.site) {
for (Node object : map.getNode()) {
if (object.getId() == connection.getNodeFrom()) {
for (Map map : Client.maps) {
for (MapObject object : map.getObjects()) {
if (object.getId() == connection.getSourceObj()) {
this.startObj = object;
}
if (object.getId() == connection.getNodeTo()) {
if (object.getId() == connection.getDestinationObj()) {
this.endObj = object;
}
}
}
sourceDeviceComboBox.setEnabled(false);
sourceInterfaceComboBox.setEnabled(false);
if (!newObject) {
if (connection.isReadTraffic()) {
readTraffic.setSelected(true);
sourceDeviceComboBox.setEnabled(true);
sourceDeviceComboBox.setSelectedItem(startObj.getName());
sourceInterfaceComboBox.setEnabled(true);
sourceInterfaceComboBox.setSelectedItem(connection.getTrafficIface());
}
}
init();
}
@ -127,17 +107,6 @@ public class DialogConnection extends JFrame {
typLabel.setBounds(x, 100, 140, 25);
add(typLabel);
try {
loadingLabel = new JLabel();
loadingLabel.setBounds(410, 300, 35, 35);
Image image = ImageIO.read(ResourceLoader.getFile("/img/wait.png"));
loadingLabel.setIcon(new ImageIcon(image));
loadingLabel.setVisible(false);
add(loadingLabel);
} catch (IOException ex) {
LogFile.printErr(ex.getMessage());
}
typComboBox.setBounds(200, 100, 200, 25);
add(typComboBox);
@ -163,6 +132,7 @@ public class DialogConnection extends JFrame {
sourceDeviceComboBox.addItem(startObj.getName());
sourceDeviceComboBox.addItem(endObj.getName());
sourceDeviceComboBox.setEnabled(false);
sourceDeviceComboBox.setBounds(200, 250, 200, 25);
sourceDeviceComboBox.addActionListener(new ActionListener() {
@Override
@ -176,6 +146,7 @@ public class DialogConnection extends JFrame {
sourceInterfaceLabel.setBounds(x, 300, 140, 25);
add(sourceInterfaceLabel);
sourceInterfaceComboBox.setEnabled(false);
sourceInterfaceComboBox.setBounds(200, 300, 200, 25);
add(sourceInterfaceComboBox);
@ -204,31 +175,29 @@ public class DialogConnection extends JFrame {
// nastaveni hodnot upravovaného spojení
typComboBox.setSelectedIndex(connection.getType());
readTraffic.setSelected(connection.isReadTraffic());
sourceDeviceComboBox.setSelectedIndex((connection.getTrafficNode() == startObj.getId() ? 0 : 1));
sourceDeviceComboBox.setSelectedIndex((connection.getTrafficObject() == startObj.getId() ? 0 : 1));
}
}
private void loadIface() {
loadingLabel.setVisible(true);
Node obj;
MapObject obj;
if (sourceDeviceComboBox.getSelectedIndex() == 0) {
obj = startObj;
} else {
obj = endObj;
}
Object[] o = {this.getName(), obj};
NettyClientManager.sendMessage(Message.NODE_CONNECTION_SNMP_INTERFACE, o);
NettyClient.send(Message.SNMP_CONNECTION_INTERFACE, o);
}
public void updateInterface(List<Interface> iface) {
loadingLabel.setVisible(false);
this.iface = iface;
sourceInterfaceComboBox.removeAllItems();
for (Interface ifs : iface) {
Item item = new Item(ifs.getId(), ifs.getShortDescription() + " (" + ifs.getAlias() + ")");
Item item = new Item(ifs.getId(), ifs.getDescription());
sourceInterfaceComboBox.addItem(item);
// pokud se nejedna o nový objekt a souhlasi index rozhrani nastavit polozku v seznamu
if (!newObject && ifs.getId() == connection.getTrafficIface()) {
@ -245,17 +214,17 @@ public class DialogConnection extends JFrame {
connection.setReadTraffic(readTraffic.isSelected());
if (readTraffic.isSelected()) {
// pokud je zapnute cteni nastavi zdrojovy objekt a interface
connection.setTrafficNode(sourceDeviceComboBox.getSelectedIndex() == 0 ? startObj.getId() : endObj.getId());
connection.setTrafficObject(sourceDeviceComboBox.getSelectedIndex() == 0 ? startObj.getId() : endObj.getId());
connection.setTrafficIface(sellectedIface.getId());
}
if (newObject) {
connection.setNodeFrom(startObj.getId());
connection.setNodeTo(endObj.getId());
connection.setSite(startObj.getSiteId());
NettyClientManager.sendMessage(Message.NODE_CONNECTION_NEW, connection);
connection.setSourceObj(startObj.getId());
connection.setDestinationObj(endObj.getId());
connection.setMap(startObj.getMap());
NettyClient.send(Message.CONNECTION_NEW, connection);
} else {
NettyClientManager.sendMessage(Message.NODE_CONNECTION_EDIT, connection);
NettyClient.send(Message.CONNECTION_UPDATE, connection);
}
}

View File

@ -0,0 +1,128 @@
package jnet.client.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Font;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
public class DialogLocalPing extends Thread {
public DialogLocalPing(String ip) {
// Spuštění vlákna pro ping
new Thread(() -> runPing(ip)).start();
}
private static void runPing(String host) {
int countOk = 0;
int countKo = 0;
ArrayList<Double> times = new ArrayList<>();
Border margin = BorderFactory.createEmptyBorder(20, 20, 20, 20); // 10px nahoře a dole, 20px vlevo a vpravo
JFrame frame = new JFrame("Ping " + host);
// Vytvoření hlavního okna
frame.setSize(450, 400);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
// Hlavní panel
JPanel mainPanel = new JPanel(new BorderLayout());
// Textová oblast pro logy
JTextArea logTextArea = new JTextArea();
logTextArea.setEditable(false); // Zamezení úprav uživatelem
logTextArea.setFont(new Font("Monospaced", Font.PLAIN, 12)); // Monospace font pro logy
logTextArea.setBorder(margin);
// Posuvník pro textovou oblast
JScrollPane scrollPane = new JScrollPane(logTextArea);
//scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
// panel statistik
JLabel stat = new JLabel("test");
stat.setBorder(margin);
mainPanel.add(scrollPane, BorderLayout.CENTER); // TextArea uprostřed
mainPanel.add(stat, BorderLayout.SOUTH); // JLabel na spodek
// Přidání hlavního panelu do okna
frame.add(mainPanel);
// Zobrazení okna
frame.setVisible(true);
try {
// Použití správného příkazu pro OS
String os = System.getProperty("os.name").toLowerCase();
String command = os.contains("win") ? "ping -t " + host : "ping " + host;
Process process = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String firstLine = reader.readLine(); // Tento řádek bude přeskočen
String secondLine = reader.readLine(); // Tento řádek bude přeskočen
Pattern pattern1 = Pattern.compile("time=([0-9.]+)ms");
Pattern pattern2 = Pattern.compile("time[<]?([0-9.]+)ms");
String line;
while ((line = reader.readLine()) != null) {
Matcher matcher1 = pattern1.matcher(line);
Matcher matcher2 = pattern2.matcher(line);
if (matcher1.find()) {
// čas 1ms a vice
double time = Double.valueOf(matcher1.group(1));
countOk++;
times.add(time);
appendText(logTextArea, "Odpověď od " + host + " za " + time + " ms");
} else if (matcher2.find()) {
// cas mene nez 1 ms
double time = 0;
countOk++;
times.add(time);
appendText(logTextArea, "Odpověď od " + host + " za " + time + " ms");
} else {
countKo++;
appendText(logTextArea, line);
}
// aktualizace statistik
stat.setText("Odesláno: " + (countOk + countKo) + " "
+ "úspěšně: " + countOk + " "
+ "neuspěšně: " + countKo + " "
+ "průmerny čas: " + calculateAverage(times) + " ms");
}
} catch (Exception e) {
appendText(logTextArea, "Chyba při provádění pingu: " + e.getMessage());
}
}
private static void appendText(JTextArea logTextArea, String text) {
SwingUtilities.invokeLater(() -> {
logTextArea.append(text + "\n");
logTextArea.setCaretPosition(logTextArea.getDocument().getLength()); // Auto-scroll dolů
});
}
public static double calculateAverage(ArrayList<Double> list) {
double sum = 0;
// Sečítání všech hodnot v ArrayListu
for (double value : list) {
sum += value;
}
// Vypočítání průměru
return Math.round(sum / list.size());
}
}

View File

@ -0,0 +1,104 @@
package jnet.client.gui.dialog;
import jnet.client.Client;
import jnet.client.network.NettyClient;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class LoginDialog extends JDialog {
public LoginDialog() {
setTitle("Přihlásit");
setSize(300, 250);
setLocationRelativeTo(null);
setResizable(false);
setAlwaysOnTop(true);
JPanel panel = new JPanel();
add(panel);
placeComponents(panel);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
private void placeComponents(JPanel panel) {
panel.setLayout(null);
JLabel serverLabel = new JLabel("Server");
serverLabel.setBounds(20, 10, 80, 25);
panel.add(serverLabel);
JTextField serverText = new JTextField(Client.config.getString("server"));
serverText.setBounds(110, 10, 160, 25);
panel.add(serverText);
JLabel portLabel = new JLabel("Port");
portLabel.setBounds(20, 40, 80, 25);
panel.add(portLabel);
JTextField portText = new JTextField(Client.config.getString("port"));
portText.setBounds(110, 40, 160, 25);
panel.add(portText);
JLabel userLabel = new JLabel("Uživatel");
userLabel.setBounds(20, 70, 80, 25);
panel.add(userLabel);
JTextField userText = new JTextField(Client.config.getString("user"));
userText.setBounds(110, 70, 160, 25);
panel.add(userText);
JLabel passwordLabel = new JLabel("Heslo");
passwordLabel.setBounds(20, 100, 80, 25);
panel.add(passwordLabel);
JPasswordField passwordText = new JPasswordField(Client.config.getString("password"));
passwordText.setBounds(110, 100, 160, 25);
panel.add(passwordText);
JButton loginButton = new JButton("Přihlásit");
loginButton.setBounds(20, 155, 90, 25);
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// ulozeni prihlasovacich udaju
Client.config.setString("server", serverText.getText());
Client.config.setString("port", new String(portText.getText()));
Client.config.setString("user", userText.getText());
Client.config.setString("password", new String(passwordText.getPassword()));
Client.config.save();
// pripojeni klienta
NettyClient client = new NettyClient(serverText.getText(), Integer.valueOf(portText.getText()));
Client.clientThread = new Thread(client);
Client.clientThread.start();
// zavreni dialogu
dispose();
}
});
panel.add(loginButton);
JButton closeButton = new JButton("Storno");
closeButton.setBounds(185, 155, 80, 25);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.add(closeButton);
}
}

View File

@ -3,6 +3,7 @@ package jnet.client.gui.dialog;
import jnet.client.Client;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.Box;
@ -13,12 +14,11 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import jnet.lib.LogFile;
import jnet.lib.ResourceLoader;
import jnet.lib.object.OnlineClients;
public class DialogOnlineClients extends JDialog {
public class OnlineClientsDialog extends JDialog {
public DialogOnlineClients() {
public OnlineClientsDialog() {
setTitle("Online klienti");
setLocationRelativeTo(null);
setAlwaysOnTop(true);
@ -35,10 +35,10 @@ public class DialogOnlineClients extends JDialog {
JLabel line = new JLabel(" " + oc.getUsername() + " (" + oc.getIp() + ")");
switch (oc.getPlatform()) {
case OnlineClients.PLATFORM_MOBILE:
line.setIcon(new ImageIcon(ImageIO.read(ResourceLoader.getFile("/img/platform_android.png"))));
line.setIcon(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/img/platform_android.png"))));
break;
case OnlineClients.PLATFORM_PC:
line.setIcon(new ImageIcon(ImageIO.read(ResourceLoader.getFile("/img/platform_pc.png"))));
line.setIcon(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/img/platform_pc.png"))));
break;
}
panel.add(line);

View File

@ -0,0 +1,157 @@
package jnet.client.gui.dialog;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.client.gui.Window;
import jnet.client.network.NettyClient;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jnet.lib.Message;
import jnet.lib.object.User;
public class UserDialog extends JDialog {
JTextField userName = new JTextField();
JLabel userNameLabel = new JLabel("Uživatelské jméno");
JTextField password = new JTextField();
JLabel passwordLabel = new JLabel("Heslo");
JCheckBox setServer = new JCheckBox("Nastavit server");
JCheckBox addMap = new JCheckBox("Přidat mapu");
JCheckBox deleteMap = new JCheckBox("Odebrat mapu");
JCheckBox editMap = new JCheckBox("Upravit mapu");
JCheckBox addObjekt = new JCheckBox("Přidat objekt");
JCheckBox deleteObjekt = new JCheckBox("Odebrat objekt");
JCheckBox editObjekt = new JCheckBox("Upravit objekt");
User user;
public UserDialog(User user) {
this.user = user;
if (user == null) {
setTitle("Přidat uživatele");
} else {
setTitle("Upravit uživatele");
}
setSize(400, 600);
setLocationRelativeTo(null);
setAlwaysOnTop(false);
JPanel panel = new JPanel();
add(panel);
placeComponents(panel);
if (user != null) {
userName.setText(user.getUsername());
setServer.setSelected(user.isEditServer());
addMap.setSelected(user.isAddMap());
deleteMap.setSelected(user.isRemoveMap());
editMap.setSelected(user.isEditMap());
addObjekt.setSelected(user.isAddObject());
deleteObjekt.setSelected(user.isRemoveObject());
editObjekt.setSelected(user.isEditObject());
} else {
password.setText(generateRandomString(8));
}
}
private void placeComponents(JPanel panel) {
panel.setLayout(null);
userName.setBounds(20, 10, 180, 25);
panel.add(userName);
userNameLabel.setBounds(210, 10, 160, 25);
panel.add(userNameLabel);
password.setBounds(20, 60, 180, 25);
panel.add(password);
passwordLabel.setBounds(210, 60, 160, 25);
panel.add(passwordLabel);
setServer.setBounds(20, 110, 300, 25);
panel.add(setServer);
addMap.setBounds(20, 160, 300, 25);
panel.add(addMap);
deleteMap.setBounds(20, 210, 300, 25);
panel.add(deleteMap);
editMap.setBounds(20, 260, 300, 25);
panel.add(editMap);
addObjekt.setBounds(20, 310, 300, 25);
panel.add(addObjekt);
deleteObjekt.setBounds(20, 360, 300, 25);
panel.add(deleteObjekt);
editObjekt.setBounds(20, 410, 300, 25);
panel.add(editObjekt);
JButton button = new JButton();
if (user == null) {
button.setText("Přidat");
} else {
button.setText("Upravit");
}
button.setBounds(20, 460, 90, 25);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (userName.getText().length() > 3) {
User u = new User(
0,
userName.getText(),
password.getText(),
addMap.isSelected(),
deleteMap.isSelected(),
editMap.isSelected(),
addObjekt.isSelected(),
deleteObjekt.isSelected(),
editObjekt.isSelected(),
setServer.isSelected());
if (user == null) {
NettyClient.send(Message.USER, u);
} else {
u.setId(user.getId());
NettyClient.send(Message.USER_EDIT, u);
}
Window.showServerSettings(ServerSettingsPanel.TAB_USERS);
dispose();
} else {
JOptionPane.showMessageDialog(null, "Uživatelské jméno musí být delší než 3 znaky", "Chyba", JOptionPane.WARNING_MESSAGE);
}
}
});
panel.add(button);
}
public static String generateRandomString(int length) {
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
int index = random.nextInt(characters.length());
sb.append(characters.charAt(index));
}
return sb.toString();
}
}

View File

@ -1,10 +1,9 @@
package jnet.client.gui.dialog.node;
package jnet.client.gui.dialog.object;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JDialog;
@ -19,17 +18,16 @@ import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import jnet.client.Client;
import jnet.client.client.NettyClientManager;
import jnet.client.network.NettyClient;
import jnet.lib.Message;
import jnet.lib.Status;
import jnet.lib.object.DeviceInfo;
import jnet.lib.object.Interface;
import jnet.lib.object.Node;
import jnet.lib.object.SnmpProfile;
import jnet.lib.object.MapObject;
import jnet.lib.snmp.DeviceInfo;
import jnet.lib.snmp.Interface;
public class DialogNodeDevice extends JFrame {
public class ObjectDialog extends JFrame {
private Node obj;
private MapObject obj;
private int mapId;
private Boolean newObject;
@ -37,14 +35,14 @@ public class DialogNodeDevice extends JFrame {
private TabSettings tabSettings;
private TabServices tabServices;
private TabEvents tabEvents;
private TabProbes tabProbes;
private JButton snmpTest = new JButton("Test SNMP");
private JButton btnRefresh = new JButton("Obnovit");
private JDialog progress;
public DialogNodeDevice(Node obj) {
public ObjectDialog(MapObject obj) {
this.obj = obj;
this.mapId = obj.getMap();
this.newObject = false;
// identifikator okna
@ -52,19 +50,17 @@ public class DialogNodeDevice extends JFrame {
init();
}
public DialogNodeDevice(Node obj, boolean newObject) {
public ObjectDialog(MapObject obj, boolean newObject) {
this.obj = obj;
this.mapId = obj.getMap();
this.newObject = newObject;
if (newObject) {
obj.setProbe(new ArrayList<>());
}
init();
}
private void init() {
if (newObject) {
setTitle("Nové zařízení");
setTitle("Nový objekt");
} else {
setTitle(obj.getName());
}
@ -85,20 +81,19 @@ public class DialogNodeDevice extends JFrame {
tabSettings = new TabSettings(obj, newObject);
tabServices = new TabServices(obj, newObject);
tabEvents = new TabEvents(obj);
tabProbes = new TabProbes(obj, this);
tabbedPane.addTab("Informace", tabInfo);
tabbedPane.addTab("Události", tabEvents);
tabbedPane.addTab("Nastaveni", tabSettings);
tabbedPane.addTab("Služby", tabServices);
tabbedPane.addTab("Sondy", tabProbes);
tabbedPane.addTab("Události", tabEvents);
//tabbedPane.addTab("Sondy", tabSondy());
// Přidání listeneru na změnu tabu
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int selectedIndex = tabbedPane.getSelectedIndex();
if (selectedIndex == 2) { // pokud je zobrazena zalozka nastaveni zobrazit tlačítko test snmp
if (selectedIndex == 1) { // pokud je zobrazena zalozka nastaveni zobrazit tlačítko test snmp
snmpTest.setVisible(true);
} else {
snmpTest.setVisible(false);
@ -113,10 +108,9 @@ public class DialogNodeDevice extends JFrame {
// pokud se jedna o novy objekt
if (newObject) {
tabbedPane.setSelectedIndex(2); // prepne na kartu nastaveni
tabbedPane.setSelectedIndex(1); // prepne na kartu nastaveni
tabbedPane.setEnabledAt(0, false); // vypne kartu informace
tabbedPane.setEnabledAt(1, false); // vypne kartu udalosti
tabbedPane.setEnabledAt(4, false); // vypne kartu udalosti
tabbedPane.setEnabledAt(3, false); // vypne kartu udalosti
} else {
// pokud se nejsedna o novy objekt odeslat snmp pozadavek na ziskani informaci o zarizeni
snmpRequest();
@ -139,14 +133,14 @@ public class DialogNodeDevice extends JFrame {
return;
}
// ulozeni do objektu
obj.setType(Node.NODE_DEVICE);
obj.setMap(mapId);
obj.setName(nazev);
obj.setIp(ip);
obj.setUser(tabSettings.getUser());
obj.setPassword(new String(tabSettings.getPassword()));
obj.setIcon(Client.deviceType.get(tabSettings.getObjType()).getId());
obj.setObjectType(Client.objectType.get(tabSettings.getObjType()).getId());
obj.setSnmpProfile(Client.snmpProfile.get(tabSettings.getSnmpProfile()).getId());
obj.setPing(tabSettings.isActive());
obj.setActive(tabSettings.isActive());
obj.setDescription(tabSettings.getDesc());
obj.setLocation(tabSettings.getLoc());
@ -183,7 +177,7 @@ public class DialogNodeDevice extends JFrame {
obj.setSmsPort(smsPort);
obj.setSmsVerze(tabServices.getSmsVersion());
if (!obj.isPing() || newObject) {
if (!obj.isActive() || newObject) {
obj.setStatus(Status.NA);
}
// ArrayList<SnmpProbe> probe = new ArrayList<>();
@ -191,12 +185,11 @@ public class DialogNodeDevice extends JFrame {
// probe.addAll(obj.getSnmpProbe());
// }
// obj.setSnmpProbe(probe);
if (newObject) {
NettyClientManager.sendMessage(new Message(Message.NODE_ADD, obj));
dispose();
NettyClient.send(Message.ADD_OBJECT, obj);
} else {
NettyClientManager.sendMessage(new Message(Message.NODE_CHANGE, obj));
dispose();
NettyClient.send(Message.UPDATE_OBJECT, obj);
}
}
});
@ -215,9 +208,8 @@ public class DialogNodeDevice extends JFrame {
snmpTest.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SnmpProfile profile = Client.snmpProfile.get(tabSettings.getSnmpProfile());
Object[] o = {tabSettings.getIp(), profile.getPort(), profile.getVersion(), profile.getCommunityRead(), getName()};
NettyClientManager.sendMessage(Message.SNMP_TEST, o);
Object[] o = {getName(), obj};
NettyClient.send(Message.SNMP_TEST, o);
progress = showProgress();
}
});
@ -248,7 +240,6 @@ public class DialogNodeDevice extends JFrame {
}
}
public void setDeviceInfo(DeviceInfo di) {
this.tabInfo.setName(di.getSysName());
this.tabInfo.setDesc(di.getSysDescr());
@ -293,11 +284,8 @@ public class DialogNodeDevice extends JFrame {
private void snmpRequest() {
Object[] data = {getName(), this.obj};
NettyClientManager.sendMessage(Message.NODE_SNMP_INFO, data);
NettyClientManager.sendMessage(Message.NODE_SNMP_INTERFACE, data);
NettyClient.send(Message.SNMP_OBJECT_INFO, data);
NettyClient.send(Message.SNMP_OBJECT_INTERFACE, data);
}
public void refreshProbeTab() {
tabProbes.loadData();
}
}

View File

@ -1,4 +1,4 @@
package jnet.client.gui.dialog.node;
package jnet.client.gui.dialog.object;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -12,20 +12,21 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import jnet.client.Client;
import jnet.client.network.NettyClient;
import jnet.lib.EventComparator;
import jnet.lib.LogFile;
import jnet.lib.Status;
import jnet.lib.Message;
import jnet.lib.object.Event;
import jnet.lib.object.Node;
import jnet.lib.object.MapObject;
public class TabEvents extends JPanel {
private Node obj;
private MapObject obj;
public TabEvents(Node obj) {
public TabEvents(MapObject obj) {
this.obj = obj;
String column[] = {"Začátek", "Konec", "Délka", "Stav"};
String column[] = {"Začátek", "Konec", "Stav"};
DefaultTableModel tableModel = new DefaultTableModel(column, 0) {
@Override
@ -36,15 +37,15 @@ public class TabEvents extends JPanel {
};
try {
// TODO pri vytvareni noveho objektu to vyhodi chybu
Collections.sort(Client.events, new EventComparator());
Collections.reverse(Client.events);
for (Event e : Client.events) {
if (e.getNode()== obj.getId()) {
if (e.getObject() == obj.getId()) {
Object[] d = {
getDate(e.getStart()),
getDate(e.getEnd()),
getDuration(e.getStart(), e.getEnd()),
Status.getStatusName(e.getStatus())};
e.getDescription()};
tableModel.addRow(d);
}
@ -62,7 +63,7 @@ public class TabEvents extends JPanel {
@Override
public void actionPerformed(ActionEvent e) {
tableModel.setRowCount(0);
//NettyClient.send(Message.DELETE_LOG, obj.getId());
NettyClient.send(Message.DELETE_LOG, obj.getId());
}
});
@ -77,16 +78,5 @@ public class TabEvents extends JPanel {
}
return "";
}
private String getDuration(long startTime, long endTime) {
if (endTime != 0) {
long difference = endTime - startTime;
long seconds = difference / 1000;
long minutes = difference / (1000 * 60);
long hours = difference / (1000 * 60 * 60);
return hours + "h " + minutes + "m " + seconds + "s";
}
return "";
}
}

View File

@ -1,4 +1,4 @@
package jnet.client.gui.dialog.node;
package jnet.client.gui.dialog.object;
import java.util.List;
import javax.swing.JLabel;
@ -6,13 +6,15 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import jnet.lib.object.Interface;
import jnet.lib.object.Node;
import jnet.client.network.NettyClient;
import jnet.lib.Message;
import jnet.lib.object.MapObject;
import jnet.lib.snmp.Interface;
public class TabInfo extends JPanel {
private String frameName;
private Node obj;
private MapObject obj;
private JLabel uptime = new JLabel();
private JLabel name = new JLabel();
private JLabel description = new JLabel();
@ -20,7 +22,7 @@ public class TabInfo extends JPanel {
private DefaultTableModel tableModel;
private JTable ifaceTable;
public TabInfo(String frameName, Node obj) {
public TabInfo(String frameName, MapObject obj) {
this.obj = obj;
this.frameName = frameName;
init();
@ -65,7 +67,7 @@ public class TabInfo extends JPanel {
this.add(uptime);
y = y + 30;
String column[] = {"Název", "Popis portu", "Stav", "Admin", "Rychlost", "Typ"};
String column[] = {"Název", "Stav", "Admin", "Rychlost", "Typ", "Poslední změna"};
tableModel = new DefaultTableModel(column, 0) {
@Override
public boolean isCellEditable(int row, int column) {
@ -76,11 +78,11 @@ public class TabInfo extends JPanel {
ifaceTable = new JTable(tableModel);
ifaceTable.getTableHeader().setReorderingAllowed(false); // Zakáže přeskupování sloupců
ifaceTable.getTableHeader().setResizingAllowed(false); // Zakáže změnu velikosti sloupců
ifaceTable.getColumnModel().getColumn(0).setPreferredWidth(80); // Sloupec 0 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(1).setPreferredWidth(120); // Sloupec 1 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(0).setPreferredWidth(150); // Sloupec 0 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(1).setPreferredWidth(40); // Sloupec 1 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(2).setPreferredWidth(40); // Sloupec 2 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(3).setPreferredWidth(40); // Sloupec 3 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(4).setPreferredWidth(40); // Sloupec 4 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(3).setPreferredWidth(50); // Sloupec 3 bude mít šířku 100 px
ifaceTable.getColumnModel().getColumn(4).setPreferredWidth(60); // Sloupec 4 bude mít šířku 100 px
//ifaceTable.getColumnModel().getColumn(5).setPreferredWidth(100); // Sloupec 5 bude mít šířku 100 px
JScrollPane tableScroll = new JScrollPane(ifaceTable);
@ -109,13 +111,12 @@ public class TabInfo extends JPanel {
tableModel.setRowCount(0);
for (Interface i : iface) {
Object[] d = {
i.getShortDescription(),
i.getAlias(),
i.getDescription(),
i.getOperStatus(),
i.getAdminStatus(),
i.getSpeed(),
i.getType()
};
i.getType(),
i.getLastChangeTime()};
tableModel.addRow(d);
}
ifaceTable.revalidate();

View File

@ -1,4 +1,4 @@
package jnet.client.gui.dialog.node;
package jnet.client.gui.dialog.object;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
@ -6,11 +6,11 @@ import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jnet.lib.object.Node;
import jnet.lib.object.MapObject;
class TabServices extends JPanel {
private Node obj;
private MapObject obj;
private boolean newObject;
private JCheckBox winboxBox = new JCheckBox("Winbox");
@ -26,7 +26,7 @@ class TabServices extends JPanel {
private JTextField portSms = new JTextField("5020");
private JComboBox<String> smsVerzeComboBox = new JComboBox<String>();
public TabServices(Node obj, boolean newObject) {
public TabServices(MapObject obj, boolean newObject) {
this.obj = obj;
this.newObject = newObject;
@ -94,7 +94,7 @@ class TabServices extends JPanel {
sms_verze.setBounds(260, 150, 60, 25);
this.add(sms_verze);
smsVerzeComboBox.setModel(new DefaultComboBoxModel(new String[]{"SDV", "BTH", "BT"}));
smsVerzeComboBox.setModel(new DefaultComboBoxModel(new String[]{"SDV", "BT"}));
smsVerzeComboBox.setBounds(320, 150, 80, 25);
this.add(smsVerzeComboBox);

View File

@ -1,10 +1,13 @@
package jnet.client.gui.dialog.node;
package jnet.client.gui.dialog.object;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
@ -13,13 +16,15 @@ import javax.swing.JPasswordField;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import jnet.client.Client;
import jnet.lib.object.Node;
import jnet.lib.object.DeviceType;
import jnet.client.network.NettyClient;
import jnet.lib.Message;
import jnet.lib.object.MapObject;
import jnet.lib.object.ObjectType;
import jnet.lib.object.SnmpProfile;
public class TabSettings extends JPanel {
private Node obj;
private MapObject obj;
private boolean newObject;
private JTextField nazevText = new JTextField();
@ -35,7 +40,7 @@ public class TabSettings extends JPanel {
private JTextArea descriptionText = new JTextArea();
private JComboBox<String> snmpProfileComboBox = new JComboBox<String>();
public TabSettings(Node obj, boolean newObject) {
public TabSettings(MapObject obj, boolean newObject) {
this.obj = obj;
this.newObject = newObject;
@ -64,12 +69,12 @@ public class TabSettings extends JPanel {
ipWarning.setVisible(false);
this.add(ipWarning);
JLabel typLabel = new JLabel("Ikona");
JLabel typLabel = new JLabel("Typ");
typLabel.setBounds(20, 130, 80, 25);
this.add(typLabel);
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
for (DeviceType ot : Client.deviceType) {
for (ObjectType ot : Client.objectType) {
model.addElement(ot.getName());
}
@ -103,7 +108,7 @@ public class TabSettings extends JPanel {
snmpProfileComboBox.setBounds(390, 130, 160, 25);
this.add(snmpProfileComboBox);
JLabel disableLabel = new JLabel("Ping");
JLabel disableLabel = new JLabel("Aktivní");
disableLabel.setBounds(20, 180, 80, 25);
this.add(disableLabel);
@ -133,8 +138,8 @@ public class TabSettings extends JPanel {
ipText.setText(obj.getIp());
userText.setText(obj.getUser());
hesloText.setText(obj.getPassword());
for (int i = 0; i < Client.deviceType.size() - 1; i++) {
if (obj.getIcon()== Client.deviceType.get(i).getId()) {
for (int i = 0; i < Client.objectType.size() - 1; i++) {
if (obj.getObjectType() == Client.objectType.get(i).getId()) {
typeComboBox.setSelectedIndex(i);
}
}
@ -144,7 +149,7 @@ public class TabSettings extends JPanel {
snmpProfileComboBox.setSelectedIndex(i);
}
}
disableCheBox.setSelected(obj.isPing());
disableCheBox.setSelected(obj.isActive());
descriptionText.setText(obj.getDescription());
locationText.setText(obj.getLocation());
} else {

View File

@ -0,0 +1,64 @@
package jnet.client.gui.mapview;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Line2D;
import jnet.client.gui.dialog.ConnectionDialog;
public class ConnectionListener implements MouseListener {
private final double TOLERANCE = 10;
private PaintConnection selectedConnection;
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
// dvojité kliknutí
if (MapView.paintConnection == null) {
return;
}
selectedConnection = findObjectAt(e.getPoint());
if (selectedConnection != null) {
new ConnectionDialog(selectedConnection.getConnection());
}
}
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
private boolean isPointNearLine(Point p, Line2D line, double tolerance) {
return line.ptSegDist(p) <= tolerance; // Zkontroluje vzdálenost bodu od čáry
}
private PaintConnection findObjectAt(Point p) {
for (PaintConnection node : MapView.paintConnection) {
Line2D.Double line = new Line2D.Double(node.getFrom().getX(), node.getFrom().getY(), node.getTo().getX(), node.getTo().getY());
//node.setSelected(false);
if (isPointNearLine(p, line, TOLERANCE)) {
return node;
}
}
return null;
}
}

View File

@ -0,0 +1,136 @@
package jnet.client.gui.mapview;
import jnet.client.Client;
import jnet.client.network.NettyClient;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.Timer;
import jnet.lib.LogFile;
import jnet.lib.object.Connection;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
public class MapView extends JPanel {
public static List<PaintObject> paintObjects = new ArrayList<>();
public static List<PaintConnection> paintConnection = new ArrayList<>();
private BufferedImage lockImage;
private BufferedImage unlockImage;
private static Map map;
public MapView(Map map) {
this.map = map;
LogFile.printDebug("View map: " + map.getName());
paintObjects.clear();
paintConnection.clear();
try {
lockImage = ImageIO.read(getClass().getResourceAsStream("/img/lock.png"));
unlockImage = ImageIO.read(getClass().getResourceAsStream("/img/unlock.png"));
} catch (IOException ex) {
LogFile.printErr("File not found: " + ex);
}
loadConnection(map.getId());
loadObject(map.getId());
this.addMouseMotionListener(new MapViewAction(map));
this.addMouseListener(new MapViewAction(map));
this.addMouseListener(new ConnectionListener());
// periodicke prekreslovani
Timer timer = new Timer(100, (ActionEvent ae) -> {
if (NettyClient.isConnected()) {
this.setBackground(Color.white);
} else {
this.setBackground(Color.LIGHT_GRAY);
}
repaint();
});
timer.start();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g.create();
// vykresleni lock/unlock mapy
g.drawImage(map.isLock() ? lockImage : unlockImage, 0, 0, this);
// vykresleni stavajicich propojeni
for (PaintConnection c : paintConnection) {
c.paint(g2);
}
// Kreslení nového propojení
if (MapViewAction.createConnection && MapViewAction.startConMapObject != null && MapViewAction.endConnPoint != null) {
g.setColor(Color.RED); // Barva propojení
g.drawLine(
MapViewAction.startConMapObject.getPoint().x, MapViewAction.startConMapObject.getPoint().y,
MapViewAction.endConnPoint.x, MapViewAction.endConnPoint.y
);
}
// vykresleni objektu
for (PaintObject paintObject : paintObjects) {
paintObject.paint(g2);
}
}
public static void updateMapView(Map map) {
if (map.equals(MapView.map)) {
// obnoveni propojeni
paintConnection.clear();
loadConnection(map.getId());
// obnoveni objektu
paintObjects.clear();
loadObject(map.getId());
}
}
public static void updateMapView() {
if (map.equals(MapView.map)) {
// obnoveni propojeni
paintConnection.clear();
loadConnection(map.getId());
// obnoveni objektu
paintObjects.clear();
// nahrat objekty
loadObject(map.getId());
}
}
private static void loadObject(int mapId) {
for (Map map : Client.maps) {
for (MapObject obj : map.getObjects()) {
if (obj.getMap() == mapId) {
paintObjects.add(new PaintObject(obj));
}
}
}
}
private static void loadConnection(int mapId) {
for (Map map : Client.maps) {
for (Connection con : map.getConnection()) {
if (con.getMap() == mapId) {
paintConnection.add(new PaintConnection(con));
}
}
}
}
}

View File

@ -0,0 +1,300 @@
package jnet.client.gui.mapview;
import jnet.client.Client;
import jnet.client.ExtAppManager;
import jnet.client.gui.dialog.DialogLocalPing;
import jnet.client.network.NettyClient;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import jnet.client.gui.dialog.ConnectionDialog;
import jnet.client.gui.dialog.object.ObjectDialog;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
public class MapViewAction implements MouseMotionListener, MouseListener {
private Map map;
public MapViewAction(Map map) {
this.map = map;
}
private static PaintObject selectedObject;
private static Point offset;
public static boolean createConnection = false;
public static PaintObject startConMapObject;
public static PaintObject endConMapObject;
public static Point endConnPoint;
@Override
public void mouseClicked(MouseEvent e) {
// vola se pri kliknuti v mape
}
@Override
public void mousePressed(MouseEvent e) { // vola se pri stisknuti tlacitka
// vyhledani jestli se kliklo na nejaky objekt
if (MapView.paintObjects == null) {
return;
}
selectedObject = findObjectAt(e.getPoint());
if (selectedObject != null) {
handleObjectSelection(e);
}
}
@Override
public void mouseReleased(MouseEvent e) { // vola se pri uvolneni tlacitka
if (selectedObject != null) {
handleObjectRelease(e);
} else if (e.getButton() == MouseEvent.BUTTON3) {
rigthClick(e);
}
selectedObject = null;
offset = null;
if (createConnection && startConMapObject != null) {
endConMapObject = findObjectAt(e.getPoint());
if (endConMapObject != null && endConMapObject != startConMapObject) {
// Uložení propojení mezi objekty
new ConnectionDialog(startConMapObject.getObject(), endConMapObject.getObject());
}
createConnection = false;
startConMapObject = null;
endConMapObject = null;
endConnPoint = null;
}
}
@Override
public void mouseEntered(MouseEvent e) {
// vola se pri vstupu kurzoru
}
@Override
public void mouseExited(MouseEvent e) {
// vola se pri opusteni kurzoru
}
@Override
public void mouseDragged(MouseEvent e) {
if (map.isLock() || !Client.user.isEditMap()) {
return;
}
if (createConnection) {
endConnPoint = findNearestObject(e.getPoint());
} else if (selectedObject != null && offset != null) {
moveObject(e);
}
}
@Override
public void mouseMoved(MouseEvent e) {
}
private PaintObject findObjectAt(Point p) {
for (PaintObject node : MapView.paintObjects) {
node.setSelected(false);
if (node.contains(p)) {
return node;
}
}
return null;
}
private Point findNearestObject(Point p) {
for (PaintObject node : MapView.paintObjects) {
if (node.contains(p)) {
return node.getPoint();
}
}
return p;
}
private void handleObjectSelection(MouseEvent e) {
selectedObject.setSelected(true);
if (createConnection) {
startConMapObject = selectedObject;
endConnPoint = e.getPoint();
} else {
offset = new Point(
selectedObject.getBoxX() - e.getX(),
selectedObject.getBoxY() - e.getY()
);
}
}
private void handleObjectRelease(MouseEvent e) {
if (!map.isLock() && positionChanged()) {
NettyClient.send(Message.OBJECT_MOVE, new int[]{
selectedObject.getId(),
(int) selectedObject.getX(),
(int) selectedObject.getY()
});
}
if (e.getClickCount() == 2) {
doubleClickOnObject(selectedObject);
}
if (e.getButton() == MouseEvent.BUTTON3) {
rightClickOnObject(e, selectedObject);
}
}
private boolean positionChanged() {
return offset != null && (offset.x != 0 || offset.y != 0);
}
private void moveObject(MouseEvent e) {
Point to = new Point(e.getX() + offset.x, e.getY() + offset.y);
selectedObject.setPosition(to);
}
private void doubleClickOnObject(PaintObject selectedObject) {
int id = selectedObject.getId();
for (Map map : Client.maps) {
for (MapObject object : map.getObjects()) {
if (object.getId() == id) {
//new ObjectDialog(map.getId(), object, false);
new ObjectDialog(object);
break;
}
}
}
}
private void rigthClick(MouseEvent me) {
JPopupMenu menu = new JPopupMenu();
// zamek mapy
JMenuItem itemLock;
if (map.isLock()) {
itemLock = new JMenuItem("Odemknout mapu", loadImageIcon("/img/unlock.png"));
} else {
itemLock = new JMenuItem("Zamknout mapu", loadImageIcon("/img/lock.png"));
}
itemLock.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (map.isLock()) {
int[] d = {map.getId(), 0};
NettyClient.send(Message.SET_MAP_LOCK, d);
} else {
int[] d = {map.getId(), 1};
NettyClient.send(Message.SET_MAP_LOCK, d);
}
}
});
menu.add(itemLock);
// polozka pridat objekt
if (Client.user.isAddObject()) {
JMenuItem itemAdd = createMenuAction("Přidat objekt", "/img/add.png", new Runnable() {
@Override
public void run() {
MapObject mo = new MapObject();
mo.setX(me.getX());
mo.setY(me.getY());
mo.setMap(map.getId());
new ObjectDialog(mo, true);
}
});
itemAdd.setEnabled(!map.isLock());
menu.add(itemAdd);
}
// polozka pridani propojeni
JMenuItem itemPropoj = createMenuAction("Přidat propojení", "/img/arrow.png", new Runnable() {
@Override
public void run() {
startConMapObject = null;
endConnPoint = null;
createConnection = true;
}
});
menu.add(itemPropoj);
menu.show(me.getComponent(), me.getX(), me.getY());
}
private void rightClickOnObject(MouseEvent e, PaintObject obj) {
JPopupMenu menu = new JPopupMenu();
if (obj.getObject().isWinbox()) {
JMenuItem itemWinbox = createMenuAction("Winbox", "/img/winbox.png", ()
-> new ExtAppManager().runWinbox(obj.getObject().getIp(), obj.getObject().getUser(), obj.getObject().getPassword(), Integer.valueOf(obj.getObject().getWinboxPort()))
);
menu.add(itemWinbox);
}
if (obj.getObject().isWeb()) {
JMenuItem itemWeb = createMenuAction("Otevřít v prohlížeči", "/img/browser.png", ()
-> new ExtAppManager().runWeb(obj.getObject().getWebVerze(), obj.getObject().getIp(), obj.getObject().getWebPort())
);
menu.add(itemWeb);
}
if (obj.getObject().isSsh()) {
JMenuItem itemSsh = createMenuAction("SSH", "/img/ssh.png", ()
-> new ExtAppManager().runSshPutty(obj.getObject().getIp(), obj.getObject().getUser(), obj.getObject().getPassword(), Integer.parseInt(obj.getObject().getSshPort()))
);
menu.add(itemSsh);
}
// ping na objekt
JMenuItem itemPingRemote = new JMenuItem("Ping", loadImageIcon("/img/ping.png"));
itemPingRemote.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
});
menu.add(itemPingRemote);
// ping na objekt
JMenuItem itemPingLocal = createMenuAction("Ping (lokální)", "/img/ping.png", new Runnable() {
@Override
public void run() {
DialogLocalPing dp = new DialogLocalPing(obj.getObject().getIp());
Thread pingThread = new Thread(dp);
pingThread.start();
}
});
menu.add(itemPingLocal);
// odebrani objektu
if (Client.user.isRemoveObject()) {
JMenuItem itemRemove = createMenuAction("Odebrat", "/img/trash.png", () -> NettyClient.send(Message.REMOVE_OBJECT, obj.getId()));
itemRemove.setEnabled(!map.isLock());
menu.add(itemRemove);
}
// zobrazeni menu
menu.show(e.getComponent(), e.getX(), e.getY());
}
private ImageIcon loadImageIcon(String path) {
try {
return new ImageIcon(ImageIO.read(MapViewAction.class.getResourceAsStream(path)));
} catch (IOException ex) {
LogFile.printErr("MapView error: " + ex.getMessage());
return null; // nebo nějaká výchozí ikona
}
}
private JMenuItem createMenuAction(String label, String iconPath, Runnable action) {
JMenuItem menuItem = new JMenuItem(label, loadImageIcon(iconPath));
menuItem.addActionListener(e -> action.run());
return menuItem;
}
}

View File

@ -0,0 +1,195 @@
package jnet.client.gui.mapview;
import java.awt.BasicStroke;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.RoundRectangle2D;
import jnet.client.Client;
import jnet.lib.object.Connection;
import jnet.lib.object.Map;
import jnet.lib.object.MapObject;
public class PaintConnection extends Rectangle {
private Connection con;
private Graphics2D g2;
private Point from = null;
private Point to = null;
private String connection_text;
private Font font = new Font("Helvetica", Font.PLAIN, 10);
public PaintConnection(Connection con) {
this.con = con;
}
public void paint(Graphics g) {
refreshData();
g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
switch (con.getType()) {
case Connection.TYPE_OTHER:
g2.setStroke(new BasicStroke(5));
connection_text = "";
break;
case Connection.TYPE_GE:
g2.setStroke(new BasicStroke(5));
connection_text = "GE";
break;
case Connection.TYPE_FE:
g2.setStroke(new BasicStroke(3));
connection_text = "FE";
break;
case Connection.TYPE_E:
g2.setStroke(new BasicStroke(1));
connection_text = "E";
break;
case Connection.TYPE_10GE:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "10 GE";
break;
case Connection.TYPE_100M_FIBER:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "100M Fiber";
break;
case Connection.TYPE_1G_FIBER:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "1G Fiber";
break;
case Connection.TYPE_10G_FIBER:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "10G Fiber";
break;
case Connection.TYPE_WIRELESS:
float[] dashingPattern = {2f, 2f};
g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, dashingPattern, 2.0f));
connection_text = "Wireless";
break;
case Connection.TYPE_TUNEL:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "Tunel";
break;
case Connection.TYPE_VLAN:
g2.setStroke(new BasicStroke(5)); // TODO doresit tvar cary
connection_text = "VLAN";
break;
}
g2.draw(new Line2D.Double(this.from, this.to));
// stred cary
int stredX = (from.x + to.x) / 2; // Střed čáry (x)
int stredY = (from.y + to.y) / 2; // Střed čáry (y)
if (con.isReadTraffic()) {
// vyska, sirka
int sirka = 80;
int vyska = 42;
// vypocitani pocatecnich bodu
int x = stredX - sirka / 2;
int y = stredY - vyska / 2;
// TODO az bude vyresni detekce kliku na caru tak tyto promenen uplne zrusit
int xObdelnik, x2Obdelnik, yObdelnik, y2Obdelnik;
xObdelnik = x;
x2Obdelnik = x + sirka;
yObdelnik = y;
y2Obdelnik = y + vyska;
// zmeni barvu na cernou
g2.setPaint(new Color(220, 220, 220));
// vykresli oblast pro rx, tx
RoundRectangle2D.Double box = new RoundRectangle2D.Double(x, y, sirka, vyska, 10, 10);
g2.fill(box);
// zmeni barvu na cernou
g2.setPaint(new Color(0, 0, 0));
// nastavi font
g2.setFont(font);
// vypise typ
g2.drawString(connection_text, x + (int) (box.getWidth() / 2) - (getStringWidth(connection_text) / 2), y + 12);
// vypise TX
String tx = "Tx: " + con.getTx();
g2.drawString(tx, x + (int) (box.getWidth() / 2) - (getStringWidth(tx) / 2), y + 24);
// vypise RX
String rx = "Rx: " + con.getRx();
g2.drawString(rx, x + (int) (box.getWidth() / 2) - (getStringWidth(rx) / 2), y + 36);
} else {
// Výpočet úhlu otočení
double angle = Math.atan2(to.y - from.y, to.x - from.x);
// Uložení aktuálního transformu
AffineTransform oldTransform = g2.getTransform();
// Vytvoření nového transformu pro otočení textu
AffineTransform transform = new AffineTransform();
transform.translate(stredX, stredY); // Přesun do středu čáry
transform.rotate(angle); // Otočení podle úhlu čáry
g2.setTransform(transform);
g2.setColor(Color.RED);
// Posunutí textu, aby byl lépe vidět (mírně nad čárou)
g2.drawString(connection_text, -g2.getFontMetrics().stringWidth(connection_text) / 2, -5);
// Obnovení původního transformu
g2.setTransform(oldTransform);
}
}
private void refreshData() {
// ziskani souradnic
for (Map map : Client.maps) {
if (con.getMap() == map.getId()) {
for (MapObject obj : map.getObjects()) {
if (obj.getId() == con.getSourceObj()) {
from = new Point(obj.getX(), obj.getY());
}
if (obj.getId() == con.getDestinationObj()) {
to = new Point(obj.getX(), obj.getY());
}
}
}
}
}
private int getStringWidth(String text) {
//return g.getFontMetrics().stringWidth(text);
Canvas c = new Canvas();
FontMetrics fm = c.getFontMetrics(font);
return fm.stringWidth(text);
}
public Point getFrom() {
return this.from;
}
public Point getTo() {
return this.to;
}
public Connection getConnection() {
return this.con;
}
}

View File

@ -0,0 +1,253 @@
package jnet.client.gui.mapview;
import jnet.client.Client;
import java.awt.BasicStroke;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import javax.imageio.ImageIO;
import jnet.lib.LogFile;
import jnet.lib.object.MapObject;
import jnet.lib.object.ObjectType;
public class PaintObject extends Rectangle {
private MapObject obj;
private Image icon;
private int x;
private int y;
private int boxX = 0;
private int boxY;
private int paddingBoxu = 20;
private int sirka;
private int vyska;
private RoundRectangle2D box;
private Graphics2D g2;
private Boolean selected = false;
private Font fontNormal12 = new Font("Arial", Font.PLAIN, 12);
private Font fontBold12 = new Font("Arial", Font.BOLD, 12);
private Font fontNormalSmall = new Font("Arial", Font.PLAIN, 10);
public PaintObject(MapObject obj) {
this.obj = obj;
vypocitat_rozmery();
}
/**
* vypocita vyšku boxu
*/
private void vypocitat_rozmery() {
// padding top
vyska = 5;
// vyska obrazku
if (this.icon != null) {
vyska += this.icon.getHeight(null);
}
// vyska prvniho radku s nazvem zarizeni
vyska += getStringHeight(fontBold12);
// vyska druheho radku s ip adresou (pokud je vyplnena)
if (!obj.getIp().equals("")) {
vyska += 5; // mezera mezi radky
vyska += getStringHeight(fontNormal12);
}
// padding bottom
vyska += 5;
//sirka boxu
List<Integer> sList = new ArrayList<Integer>();
sList.add(getStringWidth(obj.getName(), fontBold12) + paddingBoxu);
sList.add(getStringWidth(obj.getIp(), fontNormal12) + paddingBoxu);
sirka = Collections.max(sList);
}
public void paint(Graphics g) {
g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// nastaveni pozice x, y objektu
this.x = obj.getX();
this.y = obj.getY();
// nastaveni ikony objektu
try {
for (ObjectType ot : Client.objectType) {
if (ot.getId() == obj.getObjectType()) {
byte[] decodedBytes = Base64.getDecoder().decode(ot.getImgStr());
ByteArrayInputStream bis = new ByteArrayInputStream(decodedBytes);
this.icon = ImageIO.read(bis);
break;
}
}
} catch (IOException ex) {
LogFile.printErr("Object icon exception: " + ex.getMessage());
}
vypocitat_rozmery();
/* TODO box gradient
GradientPaint redtowhite = new GradientPaint(x, y, Color.red, 200, y,Color.blue);
g2.setPaint(redtowhite);
*/
// status objektu
switch (obj.getStatus()) {
case 1: // online
g2.setPaint(new Color(83, 241, 83));
break;
case 2: // warning
g2.setPaint(new Color(255, 131, 0));
break;
case 3: // offline
g2.setPaint(new Color(221, 63, 63));
break;
default: // other
g2.setPaint(new Color(172, 172, 172));
}
// vypocitani pocatecnich souradnic
boxX = x - (sirka / 2);
boxY = y - (vyska / 2);
// vykresleni boxu
box = new RoundRectangle2D.Double(boxX, boxY, sirka, vyska, 10, 10);
g2.fill(box);
if (selected) {
g2.setStroke(new BasicStroke(1.5f));
g2.setColor(Color.BLACK);
g2.draw(box);
}
//
// nacteni ikonka zarizeni
if (icon != null) {
int imgX = boxX + sirka / 2 - (icon.getWidth(null) / 2);
int imgY = boxY + 5;
g.drawImage(icon, imgX, imgY, null);
boxY += icon.getHeight(null); // pricte vysku ikonky
} else {
}
// vypsani nazvu prvku
g2.setPaint(Color.BLACK);
g2.setFont(fontBold12);
g2.drawString(obj.getName(), boxX + (int) (box.getWidth() / 2) - (getStringWidth(obj.getName(), g2.getFont()) / 2), boxY + getStringHeight(g2.getFont()));
// vypsani ip prvku
boxY += 20;
g2.setFont(fontNormal12);
g2.drawString(obj.getIp(), boxX + (int) (box.getWidth() / 2) - (getStringWidth(obj.getIp(), g2.getFont()) / 2), boxY + getStringHeight(g2.getFont()));
// vypsani snmp sond
g2.setFont(fontNormalSmall);
/*
for (SnmpProbe snmpProbe : obj.getSnmpProbe()) {
if (snmpProbe.isView()) {
boxY += 20;
String str = snmpProbe.getName() + ": " + snmpProbe.getValue();
g2.drawString(str, boxX + (int) (box.getWidth() / 2) - (getStringWidth(str, g2.getFont()) / 2), boxY + getStringHeight(g2.getFont()));
}
}
*/
this.setBounds(boxX, boxY, sirka, vyska);
}
public int getBoxX() {
return (int) box.getX();
}
public int getBoxY() {
return (int) box.getY();
}
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
public int getBoxWidth() {
return sirka;
}
public int getBoxHeight() {
return vyska;
}
public void setSelected(Boolean value) {
this.selected = value;
}
private int getStringWidth(String text, Font font) {
Canvas c = new Canvas();
FontMetrics fm = c.getFontMetrics(font);
return fm.stringWidth(text);
}
private int getStringHeight(Font font) {
Canvas c = new Canvas();
FontMetrics fm = c.getFontMetrics(font);
return fm.getHeight();
}
@Override
public boolean contains(Point p) {
if ((box.getMinX() < p.getX() && p.getX() < box.getMaxX()) && (box.getMinY() < p.getY() && p.getY() < box.getMaxY())) {
return true;
} else {
return false;
}
}
public void setPosition(Point p) {
obj.setX(p.x + sirka / 2);
obj.setY(p.y + vyska / 2);
}
public int getId() {
return obj.getId();
}
public MapObject getObject() {
return obj;
}
public Point getPoint() {
Point p = new Point();
p.x = this.x;
p.y = this.y;
return p;
}
}

View File

@ -0,0 +1,242 @@
package jnet.client.gui.serversettings;
import jnet.client.Client;
import jnet.client.gui.dialog.AddDeviceTypeDialog;
import jnet.client.gui.dialog.UserDialog;
import jnet.client.network.NettyClient;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.DefaultTableModel;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.object.SnmpProfile;
import jnet.lib.object.User;
public class ServerSettingsPanel extends JTabbedPane {
public static final int TAB_DEFAULT = 0;
public static final int TAB_DEVICE_TYPE = 1;
public static final int TAB_USERS = 2;
public static final int TAB_SNMP_PROFILE = 3;
public ServerSettingsPanel() {
this.addTab("Základní", tabZakladni());
this.addTab("Typy zařízení", tabZarizeni());
this.addTab("Uživatelé", tabUsers());
this.addTab("SNMP", tabSnmpProfile());
// vola se pri zmene zalozky
this.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
}
});
}
public void setTable(int table) {
this.setSelectedIndex(table);
}
private Component tabZakladni() {
JPanel panel = new JPanel();
panel.setLayout(null);
int x1 = 80;
int x2 = 150;
JLabel pingLabel = new JLabel("Ping");
pingLabel.setFont(pingLabel.getFont().deriveFont(20f));
pingLabel.setBounds(20, 20, 150, 25);
panel.add(pingLabel);
JTextField repeateField = new JTextField(String.valueOf(Client.serverConfig.getPingAttempt()));
repeateField.setBounds(x1, 60, 50, 25);
panel.add(repeateField);
JLabel repeateLabel = new JLabel("Opakovat ping každých ... sekund");
repeateLabel.setBounds(x2, 60, 300, 25);
panel.add(repeateLabel);
JTextField pokusuField = new JTextField(String.valueOf(Client.serverConfig.getPingAttempt()));
pokusuField.setBounds(x1, 100, 50, 25);
panel.add(pokusuField);
JLabel pokusuLabel = new JLabel("Počet pokusů před vyhodnocenim offline");
pokusuLabel.setBounds(x2, 100, 300, 25);
panel.add(pokusuLabel);
JTextField timeoutField = new JTextField(String.valueOf(Client.serverConfig.getPingTimeout()));
timeoutField.setBounds(x1, 140, 50, 25);
panel.add(timeoutField);
JLabel timeoutLabel = new JLabel("Úroveň timeout (s)");
timeoutLabel.setBounds(x2, 140, 300, 25);
panel.add(timeoutLabel);
JTextField pokusuNestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityAttempt()));
pokusuNestField.setBounds(x1, 180, 50, 25);
panel.add(pokusuNestField);
JLabel pokusuNestLabel = new JLabel("Počet pokusů před vyhodnocením nestability");
pokusuNestLabel.setBounds(x2, 180, 300, 25);
panel.add(pokusuNestLabel);
JTextField nestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityLimit()));
nestField.setBounds(x1, 220, 50, 25);
panel.add(nestField);
JLabel nestLabel = new JLabel("Úroveň nestability (s)");
nestLabel.setBounds(x2, 220, 300, 25);
panel.add(nestLabel);
JButton button = new JButton("Uložit");
button.setAlignmentX(Component.CENTER_ALIGNMENT);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Client.serverConfig.setPingRepeat(Integer.valueOf(repeateField.getText()));
Client.serverConfig.setPingAttempt(Integer.valueOf(pokusuField.getText()));
Client.serverConfig.setPingTimeout(Integer.valueOf(timeoutField.getText()));
Client.serverConfig.setInstabilityAttempt(Integer.valueOf(pokusuNestField.getText()));
Client.serverConfig.setInstabilityLimit(Integer.valueOf(nestField.getText()));
NettyClient.send(Message.SERVER_CONFIG, Client.serverConfig);
}
});
button.setBounds(x1, 300, 100, 40);
panel.add(button);
JButton buttonRestart = new JButton("Restartovat server");
//buttonRestart.setAlignmentX(Component.CENTER_ALIGNMENT);
buttonRestart.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int result = JOptionPane.showConfirmDialog(null,
"Opravdu chceš pokračovat?",
"Restart serveru",
JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
LogFile.printInfo("Odeslan pozadavek na restart serveru");
NettyClient.send(Message.RESTART, null);
}
}
});
buttonRestart.setBounds(x1+200, 300, 150, 40);
panel.add(buttonRestart);
return new JScrollPane(panel);
}
private JPanel tabZarizeni() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // Vertikální zarovnání
JTable table = new TableDeviceType();
JScrollPane scrollPane = new JScrollPane(table);
panel.add(new JScrollPane(scrollPane));
JButton button = new JButton("Přidat typ");
button.setAlignmentX(Component.CENTER_ALIGNMENT);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new AddDeviceTypeDialog().setVisible(true);
}
});
panel.add(button);
return panel;
}
private JPanel tabUsers() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // Vertikální zarovnání
JTable tableUsers = new TableUsers();
panel.add(new JScrollPane(tableUsers));
JButton button = new JButton("Přidat uživatele");
button.setAlignmentX(Component.CENTER_ALIGNMENT);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new UserDialog(null).setVisible(true);
}
});
panel.add(button);
return panel;
}
private Component tabSnmpProfile() {
JTable table = new JTable(new TableModelSnmpProfile());
return new JScrollPane(table);
}
private static class TableModelSnmpProfile extends DefaultTableModel {
public TableModelSnmpProfile() {
// sloupce
addColumn("Nazev");
addColumn("Verze");
addColumn("Community Read");
addColumn("Community Write");
addColumn("Port");
// radky
for (SnmpProfile sp : Client.snmpProfile) {
addRow(new Object[]{
sp.getName(),
sp.getVersion(),
sp.getCommunityRead(),
sp.getCommunityWrite(),
sp.getPort()});
}
}
}
private static class TableModelUsers extends DefaultTableModel {
public TableModelUsers() {
// sloupce
addColumn("Jméno");
addColumn("Nastaveni serveru");
addColumn("Přidat mapu");
addColumn("Odebrat mapu");
// radky
for (User sp : Client.users) {
addRow(new Object[]{
sp.getUsername(),
"",
"",
sp.isAddMap(), //sp.isSetServer(),
//sp.isAddMap(),
//sp.isRemoveMap()
});
}
}
}
}

View File

@ -0,0 +1,82 @@
package jnet.client.gui.serversettings;
import jnet.client.Client;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import jnet.lib.object.ObjectType;
public class TableDeviceType extends JTable {
private static final String[] COLUMN_NAMES = {
"Ikona",
"Název zařízení"};
public TableDeviceType() {
tableSetup();
}
@Override
public Class<?> getColumnClass(int column) {
if (column == 0) {
return ImageIcon.class;
} else {
return String.class;
}
}
private void tableSetup() {
DefaultTableModel model = new DefaultTableModel(COLUMN_NAMES, Client.objectType.size()) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
this.setModel(model);
DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer();
dtcr.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
this.setDefaultRenderer(String.class, dtcr);
int row = 0;
for (ObjectType obj : Client.objectType) {
try {
byte[] decodedBytes = Base64.getDecoder().decode(obj.getImgStr());
ByteArrayInputStream bis = new ByteArrayInputStream(decodedBytes);
ImageIcon icon = new ImageIcon(ImageIO.read(bis));
this.setValueAt(icon, row, 0);
this.setValueAt(obj.getName(), row, 1);
row++;
} catch (IOException ex) {
Logger.getLogger(TableDeviceType.class.getName()).log(Level.SEVERE, null, ex);
}
}
// nastavení vysky radku
for (int i = 0; i < Client.objectType.size(); i++) {
this.setRowHeight(i, this.getRowHeight(i) + 40);
}
// nastavení sirky sloupce
for (int i = 0; i < COLUMN_NAMES.length; i++) {
TableColumn column = this.getColumnModel().getColumn(i);
column.setPreferredWidth(column.getPreferredWidth() + 80);
}
this.setVisible(true);
}
}

View File

@ -0,0 +1,134 @@
package jnet.client.gui.serversettings;
import jnet.client.gui.serversettings.TableDeviceType;
import jnet.client.Client;
import jnet.client.gui.dialog.UserDialog;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import jnet.lib.object.User;
public class TableUsers extends JTable {
private static final String[] COLUMN_NAMES = {
"ID",
"Uživatel",
"Přidat mapu",
"Odebrat mapu",
"Upravit mapu",
"Přidat objekt",
"Odebrat objekt",
"Upravit objekt",
"Nastavit server"
};
public TableUsers() {
tableSetup();
}
private void tableSetup() {
DefaultTableModel model = new DefaultTableModel(COLUMN_NAMES, Client.users.size()) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex > 1) {
return ImageIcon.class;
}
return super.getColumnClass(columnIndex);
}
};
this.setModel(model);
this.setRowHeight(25);
this.getColumnModel().getColumn(1).setCellRenderer(new ImageRenderer());
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) { // Kontrola dvojitého kliku
int row = getSelectedRow(); // Získání vybraného řádku
if (row != -1) {
Object id = getValueAt(row, 0);
for (User user : Client.users) {
if (user.getId() == (int) id) {
new UserDialog(user).setVisible(true);
break;
}
}
}
}
}
});
int row = 0;
for (User u : Client.users) {
try {
ImageIcon ii_yes = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/img/yes.png")));
ImageIcon ii_no = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/img/no.png")));
this.setValueAt(u.getId(), row, 0);
this.setValueAt(u.getUsername(), row, 1);
this.setValueAt((u.isAddMap() ? ii_yes : ii_no), row, 2);
this.setValueAt((u.isRemoveMap() ? ii_yes : ii_no), row, 3);
this.setValueAt((u.isEditMap() ? ii_yes : ii_no), row, 4);
this.setValueAt((u.isAddObject()? ii_yes : ii_no), row, 5);
this.setValueAt((u.isEditObject()? ii_yes : ii_no), row, 6);
this.setValueAt((u.isRemoveObject()? ii_yes : ii_no), row, 7);
this.setValueAt((u.isEditServer() ? ii_yes : ii_no), row, 8);
row++;
} catch (IOException ex) {
Logger.getLogger(TableDeviceType.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
static class ImageRenderer extends JLabel implements TableCellRenderer {
public ImageRenderer() {
setHorizontalAlignment(CENTER); // Obrázky budou centrované
setOpaque(true); // Zajištění vykreslení pozadí
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setBackground(table.getSelectionBackground());
} else {
setBackground(table.getBackground());
}
if (value instanceof ImageIcon) {
setIcon((ImageIcon) value);
setText(null); // Zamezení zobrazení textu
} else {
setIcon(null);
setText(value != null ? value.toString() : "");
}
return this;
}
}
}

View File

@ -0,0 +1,142 @@
package jnet.client.network;
import io.netty.bootstrap.Bootstrap;
import jnet.client.Client;
import jnet.client.ClientMessageParser;
import jnet.client.gui.Tray;
import jnet.client.gui.Window;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;
import java.util.concurrent.TimeUnit;
import jnet.lib.LogFile;
import jnet.lib.Message;
public class NettyClient implements Runnable {
private final String host;
private final int port;
private final Bootstrap bootstrap;
private final EventLoopGroup group;
static private Channel channel;
private static boolean autoReconnectEnable;
public NettyClient(String host, int port) {
this.host = host;
this.port = port;
this.group = new NioEventLoopGroup();
this.bootstrap = new Bootstrap();
configureBootstrap();
}
private void configureBootstrap() {
bootstrap.group(group)
.channel(NioSocketChannel.class)
.option(ChannelOption.SO_KEEPALIVE, true)
.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
ch.pipeline().addLast("decoder", new ObjectDecoder(ClassResolvers.weakCachingConcurrentResolver(getClass().getClassLoader())));
ch.pipeline().addLast("encoder", new ObjectEncoder());
ch.pipeline().addLast("handler", new ClientHandler());
}
});
}
@Override
public void run() {
try {
connect();
} catch (Exception e) {
e.printStackTrace();
}
}
private void connect() {
autoReconnectEnable = true;
bootstrap.connect(host, port).addListener((ChannelFutureListener) future -> {
if (future.isSuccess()) {
channel = future.channel();
System.out.println("Pripojeno k serveru " + host + ":" + port);
Window.setConectionStatus("Připojeno");
} else {
LogFile.printErr("Pripojeni selhalo: " + future.cause().getMessage());
reconnect();
}
});
}
public void reconnect() {
if (autoReconnectEnable) {
group.schedule(() -> {
LogFile.printErr("Zkousim se znovu pripojit...");
Window.setConectionStatus("Připojování ...");
connect();
}, 5, TimeUnit.SECONDS);
}
}
public static void send(int type, Object obj) {
channel.writeAndFlush(new Message(type, obj));
LogFile.printDebug("<- Message type: " + type);
}
public static boolean isConnected() {
if (channel != null && channel.isActive()) {
return true;
}
return false;
}
public static void disconnect() {
// vypne automaticke pripojeni
autoReconnectEnable = false;
// odpojí
channel.disconnect();
channel.close();
// vypise do okna informaci
Window.setConectionStatus("Odpojeno");
// zmeni tray icon
Tray.setStatusDisconnected();
// zapíše do logu
LogFile.printInfo("User disconnect");
}
public void shutdown() {
group.shutdownGracefully();
}
public class ClientHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Message) {
Message m = (Message) msg;
ClientMessageParser.parse((Message) msg);
}
if (msg instanceof String) {
System.out.println("Server message: " + msg);
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
LogFile.printErr("Spojeni bylo ukonceno");
reconnect();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
System.err.println("Client error: " + cause);
ctx.close();
Client.connected = false;
}
}
}

View File

@ -1,137 +0,0 @@
package jnet.client;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import jnet.client.client.NettyClientManager;
import jnet.client.gui.Tray;
import jnet.client.gui.Window;
import jnet.lib.ApacheConfig;
import jnet.lib.BuilddDate;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.object.DeviceType;
import jnet.lib.object.Event;
import jnet.lib.object.OnlineClients;
import jnet.lib.object.ServerConfig;
import jnet.lib.object.Site;
import jnet.lib.object.SnmpProfile;
import jnet.lib.object.SnmpTemplate;
import jnet.lib.object.SnmpValueMap;
import jnet.lib.object.User;
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.ex.ConfigurationException;
public class Client {
// verze klienta
public static final int VERSION = 3;
// jméno aplikace
public static final String APP_NAME = "jNet client";
public static Configuration config;
public static ArrayList<OnlineClients> onlineClients = new ArrayList<>();
public static ArrayList<Site> site = new ArrayList<>();
public static ArrayList<DeviceType> deviceType = new ArrayList<>();
public static ArrayList<SnmpProfile> snmpProfile = new ArrayList<>();
public static ArrayList<User> users = new ArrayList<>();
public static ServerConfig serverConfig;
public static User user = new User();
public static List<Event> events = new ArrayList<>();
public static List<SnmpTemplate> snmpTemplate = new ArrayList<>();
public static List<SnmpValueMap> snmpValueMap = new ArrayList<>();
public static Window okno = Window.getInstance();
public static NettyClientManager nettyClient;
public static Tray trayIcon;
public static RemoteAdminTools remoteTools;
public static SoundManager soundManager;
public static void main(String[] args) {
LogFile.clear();
LogFile.setDebug(false);
LogFile.printInfo("---------------------------------------------");
LogFile.printInfo(" jNet Client ");
LogFile.printInfo(" Version: " + VERSION + " (" + BuilddDate.get() + ")");
LogFile.printInfo("---------------------------------------------");
LogFile.printInfo("");
// Nahrani konfigurace
LogFile.printInfo("Loading config ...");
try {
config = ApacheConfig.loadProperties();
LogFile.printInfo(" successfully");
} catch (ConfigurationException ex) {
LogFile.printInfo(" fail: " + ex.getMessage());
System.exit(1);
}
if (config.getBoolean("debug")) {
LogFile.setDebug(true);
LogFile.printInfo("Debug mode");
}
// ===== INICIALIZACE NÁSTROJŮ (VÝHRADNĚ ZE SLOŽKY app) =====
try {
remoteTools = new RemoteAdminTools();
} catch (RuntimeException e) {
LogFile.printErr("AdminTools selhal: " + e.getMessage());
// Můžeme pokračovat bez nástrojů (metody selžou)
}
///
/// sound manager
///
soundManager = new SoundManager();
///
/// tray icon
///
trayIcon = new Tray();
trayIcon.createAndShowTray();
///
/// okno
///
if (config.getBoolean("open_maximalized")) {
System.err.println("true");
okno.setExtendedState(JFrame.MAXIMIZED_BOTH);
} else {
System.err.println("false");
okno.setSize(1024, 800);
}
///
/// spustit minimalozovane ?
///
if (config.getBoolean("start_minimalized")) {
okno.setVisible(false);
} else {
okno.setVisible(true);
}
// Netty client vlákna
nettyClient = new NettyClientManager(config.getString("server", "localhost"), config.getInt("port", 1225));
nettyClient.start();
// ===== SHUTDOWN HOOK =====
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
LogFile.printInfo("Shutdown signal received...");
nettyClient.stop();
if (remoteTools != null) {
remoteTools.closeAll(); // ZAVŘE VŠECHNY SPUŠTĚNÉ PROCESY
}
}));
}
public static void sendMessage(Message msg) {
nettyClient.sendMessage(msg);
}
}

View File

@ -1,280 +0,0 @@
package jnet.client;
import jnet.lib.LogFile;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class RemoteAdminTools {
private final List<Process> runningProcesses = new ArrayList<>();
private final String puttyPath;
private final String winboxPath;
private final String browserPath;
private final String smsSdvPath;
private final String smsSdvIniPath;
private final String smsBthPath;
private final String smsBthIniPath;
private final String smsBtPath;
private final String smsBtIniPath;
/**
* Konstruktor – vždy hledá putty.exe a winbox.exe ve složce "app". Složka
* "app" se hledá: - vedle JAR souboru (pokud běžíme z JAR) - v aktuálním
* pracovním adresáři (pokud běžíme z IDE)
*/
public RemoteAdminTools() {
String appDir = findAppDirectory();
this.puttyPath = validateExecutable(appDir, "putty.exe");
this.winboxPath = validateExecutable(appDir, "winbox.exe");
this.browserPath = null; // prohlížeč necháme automaticky detekovat
this.smsSdvPath = validateExecutable(appDir, "smsc_sdv.exe");
this.smsSdvIniPath = appDir + File.separator + "smsc_sdv.INI";
this.smsBthPath = validateExecutable(appDir, "smsc_bth.exe");
this.smsBthIniPath = appDir + File.separator + "smsc_bth.INI";
this.smsBtPath = validateExecutable(appDir, "smsc_bt.exe");
this.smsBtIniPath = appDir + File.separator + "smsc_bt.INI";
LogFile.printInfo("RemoteAdminTools inicializovan, app dir: " + appDir);
}
/**
* Najde složku "app" – buď vedle JAR, nebo v aktuálním adresáři.
*/
private String findAppDirectory() {
// 1. Pokusíme se zjistit cestu k JAR
String jarDir = getJarDirectory();
if (jarDir != null) {
File appDir = new File(jarDir, "app");
if (appDir.exists() && appDir.isDirectory()) {
return appDir.getAbsolutePath();
}
}
// 2. Fallback – aktuální pracovní adresář (funguje v NetBeans)
File appDir = new File(System.getProperty("user.dir"), "app");
if (appDir.exists() && appDir.isDirectory()) {
return appDir.getAbsolutePath();
}
// 3. Ještě zkusíme src/main/resources/app (pro případ spuštění z IDE)
File srcAppDir = new File(System.getProperty("user.dir"), "src/main/resources/app");
if (srcAppDir.exists() && srcAppDir.isDirectory()) {
return srcAppDir.getAbsolutePath();
}
LogFile.printErr("Slozka 'app' nebyla nalezena!");
return System.getProperty("user.dir"); // vrátíme alespoň něco
}
/**
* Vrátí absolutní cestu ke složce, ve které se nachází spuštěný JAR. Pokud
* běžíme z IDE (classpath), vrátí null.
*/
private String getJarDirectory() {
try {
String path = RemoteAdminTools.class.getProtectionDomain()
.getCodeSource().getLocation().toURI().getPath();
File jarFile = new File(path);
if (jarFile.isFile()) {
return jarFile.getParent();
}
} catch (URISyntaxException e) {
LogFile.printErr("Nepodarilo se zjistit cestu k JAR: " + e.getMessage());
}
return null;
}
/**
* Ověří, že executable existuje ve složce app. Pokud ne, vyhodí chybu.
*/
private String validateExecutable(String appDir, String fileName) {
File exe = new File(appDir, fileName);
if (!exe.exists() || !exe.isFile()) {
LogFile.printErr("Soubor " + fileName + " nebyl nalezen v: " + exe.getAbsolutePath());
throw new RuntimeException("Chybi " + fileName + " ve slozce app!");
}
LogFile.printInfo("Nalezen " + fileName + " v: " + exe.getAbsolutePath());
return exe.getAbsolutePath();
}
private Process startProcess(List<String> command) throws IOException {
ProcessBuilder pb = new ProcessBuilder(command);
Process p = pb.start();
runningProcesses.add(p);
return p;
}
/**
* Otevře PuTTY v režimu SSH a automaticky se připojí.
*/
public void openPuttySSH(String host, String port, String username, String password) {
try {
List<String> cmd = new ArrayList<>();
cmd.add(puttyPath);
cmd.add("-ssh");
cmd.add("-P");
cmd.add(port);
if (username != null && !username.isEmpty()) {
cmd.add("-l");
cmd.add(username);
}
if (password != null && !password.isEmpty()) {
cmd.add("-pw");
cmd.add(password);
}
cmd.add(host);
startProcess(cmd);
LogFile.printInfo("PuTTY SSH spusten: " + host + ":" + port + " (uzivatel: " + username + ")");
} catch (IOException e) {
LogFile.printErr("Nepodarilo se spustit PuTTY SSH: " + e.getMessage());
}
}
/**
* Otevře PuTTY v režimu SSH (bez hesla).
*/
public void openPuttySSH(String host, String port, String username) {
openPuttySSH(host, port, username, null);
}
/**
* Otevře PuTTY v režimu Telnet.
*/
public void openPuttyTelnet(String host, String port) {
try {
List<String> cmd = new ArrayList<>();
cmd.add(puttyPath);
cmd.add("-telnet");
cmd.add("-P");
cmd.add(port);
cmd.add(host);
startProcess(cmd);
LogFile.printInfo("PuTTY Telnet spusten: " + host + ":" + port);
} catch (IOException e) {
LogFile.printErr("Nepodarilo se spustit PuTTY Telnet: " + e.getMessage());
}
}
/**
* Otevře Winbox a automaticky se připojí.
*/
public void openWinbox(String host, String username, String password) {
try {
List<String> cmd = new ArrayList<>();
cmd.add(winboxPath);
cmd.add(host);
if (username != null && !username.isEmpty()) {
//cmd.add("-u");
cmd.add(username);
}
if (password != null && !password.isEmpty()) {
//cmd.add("-p");
cmd.add(password);
}
System.err.println(cmd);
startProcess(cmd);
LogFile.printInfo("Winbox spusten pro: " + host + " (uzivatel: " + username + ")");
} catch (IOException e) {
LogFile.printErr("Nepodarilo se spustit Winbox: " + e.getMessage());
}
}
/**
* Otevře výchozí systémový prohlížeč s danou URL. POZOR: Tento proces nelze
* automaticky ukončit, protože Desktop.browse() nevrací objekt Process. Při
* ukončení hlavního programu se tedy prohlížeč nezavře – to je kompromis
* kvůli požadavku na "výchozí prohlížeč".
*/
public void openBrowser(String ip, String port, int version) {
StringBuilder sb = new StringBuilder();
switch (version) {
case 1: // HTTPS
sb.append("HTTPS://");
break;
default: // HTTP
sb.append("HTTP://");
}
sb.append(ip);
sb.append(":").append(port);
String url = sb.toString();
try {
URI uri = URI.create(url);
java.awt.Desktop.getDesktop().browse(uri);
LogFile.printInfo("Prohlizec otevren s URL: " + url);
} catch (Exception e) {
LogFile.printErr("Nepodarilo se otevrit prohlizec: " + e.getMessage());
}
}
public void openSMS(String host, String port, String password, int version) {
String smsPath = null;
String iniPath = null;
switch (version) {
case 0: //SDV
smsPath = smsSdvPath;
iniPath = smsSdvIniPath;
break;
case 1: // BTH
smsPath = smsBthPath;
iniPath = smsBthIniPath;
break;
case 2:
smsPath = smsBtPath;
iniPath = smsBtIniPath;
break;
}
if (!createSmsIni(iniPath, host, port, password)) {
LogFile.printErr("Nepodarilo se vytvorit konfiguracni soubor pro SMS");
return;
}
try {
List<String> cmd = new ArrayList<>();
cmd.add(smsPath);
startProcess(cmd);
LogFile.printInfo("SMS spustena pro " + host + ":" + port);
} catch (IOException e) {
LogFile.printErr("Nepodarilo se spustit SMS " + e.getMessage());
}
}
private boolean createSmsIni(String iniPath, String host, String port, String password) {
try (PrintWriter writer = new PrintWriter(new FileWriter(iniPath))) {
writer.println("[Form]");
writer.println("IPaddr=" + host + ":" + port);
writer.println("IPpassw=" + password);
writer.flush();
LogFile.printInfo("INI soubor vytvoren " + iniPath);
return true;
} catch (IOException e) {
LogFile.printErr("Chyba pri vytvoreni INI souboru " + e.getMessage());
return false;
}
}
/**
* Ukončí všechny dosud spuštěné procesy.
*/
public void closeAll() {
for (Process p : runningProcesses) {
if (p != null && p.isAlive()) {
p.destroyForcibly();
try {
// Oprava: waitFor(long, TimeUnit) místo waitFor(long)
p.waitFor(1, TimeUnit.SECONDS);
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
LogFile.printInfo("Proces ukončen.");
}
}
runningProcesses.clear();
}
}

View File

@ -1,44 +0,0 @@
package jnet.client;
import jnet.lib.object.NodeProbe;
import org.snmp4j.smi.SMIConstants;
public class SnmpResponseParser {
public static String parse(NodeProbe probe) {
if (probe.getValue() == null) {
return "error";
}
if (probe.getValue().toString().equals("noSuchObject")) {
return "error";
}
switch (probe.getDataType()) {
case SMIConstants.SYNTAX_INTEGER:
return parseInteger(probe).toString();
case SMIConstants.SYNTAX_OCTET_STRING:
return probe.getValue().toString();
}
return null;
}
private static Object parseInteger(NodeProbe probe) {
switch (probe.getConversionType()) {
case NodeProbe.CONVERSION_TYPE_DIVIDE:
double value = Integer.parseInt(probe.getValue().toString()) / probe.getConversionValue();
return value;
default:
throw new AssertionError();
}
}
public static class parse {
public parse(NodeProbe probe) {
}
}
}

View File

@ -1,203 +0,0 @@
package jnet.client;
import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jnet.lib.LogFile;
import jnet.lib.Status;
import jnet.lib.object.Node;
import jnet.lib.object.Site;
public class SoundManager {
private static final String KEY_OFFLINE_FIRST = "sound.offline.first";
private static final String KEY_OFFLINE_OTHER = "sound.offline.other";
private static final String KEY_ONLINE_ONE = "sound.online.one";
private static final String KEY_ONLINE_ALL = "sound.online.all";
private static final String KEY_VOLUME = "sound.volume";
// ✅ SPRÁVNÉ názvy souborů podle vaší struktury (přímo v resources)
private static final String DEFAULT_OFFLINE_FIRST = "first_offline.wav";
private static final String DEFAULT_OFFLINE_OTHER = "next_offline.wav";
private static final String DEFAULT_ONLINE_ONE = "one_online.wav";
private static final String DEFAULT_ONLINE_ALL = "all_online.wav";
private static final float DEFAULT_VOLUME = 0.8f;
private final Map<String, Clip> soundCache = new HashMap<>();
private float volume = DEFAULT_VOLUME;
private static final String SOUND_OFFLINE_FIRST = "offlineFirst";
private static final String SOUND_OFFLINE_OTHER = "offlineOther";
private static final String SOUND_ONLINE_ONE = "onlineOne";
private static final String SOUND_ONLINE_ALL = "onlineAll";
public SoundManager() {
loadConfigAndSounds();
}
public void loadConfigAndSounds() {
String pathOfflineFirst = Client.config.getString(KEY_OFFLINE_FIRST, DEFAULT_OFFLINE_FIRST);
String pathOfflineOther = Client.config.getString(KEY_OFFLINE_OTHER, DEFAULT_OFFLINE_OTHER);
String pathOnlineOne = Client.config.getString(KEY_ONLINE_ONE, DEFAULT_ONLINE_ONE);
String pathOnlineAll = Client.config.getString(KEY_ONLINE_ALL, DEFAULT_ONLINE_ALL);
float newVolume = Client.config.getFloat(KEY_VOLUME, DEFAULT_VOLUME);
setVolume(newVolume);
closeAll();
loadSound(SOUND_OFFLINE_FIRST, pathOfflineFirst);
loadSound(SOUND_OFFLINE_OTHER, pathOfflineOther);
loadSound(SOUND_ONLINE_ONE, pathOnlineOne);
loadSound(SOUND_ONLINE_ALL, pathOnlineAll);
}
private void loadSound(String cacheKey, String filePath) {
try {
URL url = null;
ClassLoader classLoader = getClass().getClassLoader();
// 1. ClassLoader.getResource() - hledá v classpath
url = classLoader.getResource(filePath);
// 2. getClass().getResource() s lomítkem
if (url == null) {
url = getClass().getResource("/" + filePath);
}
// 3. getClass().getResource() bez lomítka
if (url == null) {
url = getClass().getResource(filePath);
if (url != null) {
}
}
// 4. Jako soubor
if (url == null) {
File soundFile = new File(filePath);
if (soundFile.exists()) {
url = soundFile.toURI().toURL();
}
}
// 5. src/main/resources/
if (url == null) {
File srcResource = new File("src/main/resources/" + filePath);
if (srcResource.exists()) {
url = srcResource.toURI().toURL();
}
}
// 6. target/classes/
if (url == null) {
File targetResource = new File("target/classes/" + filePath);
if (targetResource.exists()) {
url = targetResource.toURI().toURL();
}
}
// 7. Extrahovat název (pokud cesta obsahuje složky)
if (url == null && filePath.contains("/")) {
String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
url = classLoader.getResource(fileName);
if (url == null) {
url = getClass().getResource("/" + fileName);
}
if (url == null) {
url = getClass().getResource(fileName);
}
}
if (url == null) {
System.err.println("❌ Zvukový soubor NENALEZEN: " + filePath);
return;
}
AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
Clip clip = AudioSystem.getClip();
clip.open(audioIn);
setClipVolume(clip, volume);
soundCache.put(cacheKey, clip);
} catch (Exception e) {
LogFile.printErr("❌ Chyba při načítání zvuku " + filePath + ": " + e.getMessage());
}
}
public void setVolume(float newVolume) {
this.volume = Math.max(0f, Math.min(1f, newVolume));
for (Clip clip : soundCache.values()) {
setClipVolume(clip, this.volume);
}
}
private void setClipVolume(Clip clip, float volume) {
if (clip == null) return;
if (clip.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
float min = gainControl.getMinimum();
float max = gainControl.getMaximum();
float range = max - min;
float gain = min + (range * volume);
gainControl.setValue(gain);
}
}
private void play(String cacheKey) {
Clip clip = soundCache.get(cacheKey);
if (clip != null) {
clip.setFramePosition(0);
clip.start();
System.out.println("🔊 Přehrávám zvuk: " + cacheKey);
} else {
System.err.println("❌ Zvuk '" + cacheKey + "' nebyl načten.");
}
}
public void evaluateAndPlay(List<Site> sites, boolean newOnline) {
int offlineCount = 0;
outer:
for (Site site : sites) {
for (Node node : site.getNode()) {
if (node.getStatus() == Status.OFFLINE) {
offlineCount++;
if (offlineCount > 1) {
break outer;
}
}
}
}
// System.out.println("📊 Offline zařízení: " + offlineCount + ", nový stav: " + (newOnline ? "ONLINE" : "OFFLINE"));
if (!newOnline) {
if (offlineCount > 1) {
play(SOUND_OFFLINE_OTHER);
} else {
play(SOUND_OFFLINE_FIRST);
}
} else {
if (offlineCount > 0) {
play(SOUND_ONLINE_ONE);
} else {
play(SOUND_ONLINE_ALL);
}
}
}
public void closeAll() {
for (Clip clip : soundCache.values()) {
if (clip != null) {
clip.close();
}
}
soundCache.clear();
}
public void reload() {
loadConfigAndSounds();
}
}

View File

@ -1,66 +0,0 @@
package jnet.client.client;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import jnet.client.Client;
import jnet.client.gui.Window;
import jnet.client.message.MessageRegister;
import jnet.client.message.Register;
import jnet.lib.LogFile;
import jnet.lib.Message;
@Sharable
public class ClientHandler extends SimpleChannelInboundHandler<Object> {
private NettyClientManager connectionThread;
private final MessageRegister messageRegistr = new MessageRegister();
public void setConnectionThread(NettyClientManager connectionThread) {
this.connectionThread = connectionThread;
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
LogFile.printInfo("Connected to server");
ctx.writeAndFlush(new Message(Message.CLIENT_TYPE, Client.VERSION));
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Message) {
Message message = (Message) msg;
LogFile.printDebug("Received message ID: "+ message.getType());
Register register = messageRegistr.getRegister(message.getType());
if (register != null) {
register.processing(ctx, message);
}
} else {
LogFile.printDebug("Unknown message received");
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
LogFile.printInfo("Connection inactive ..... reconnect initiated");
Window.setStatusBarMessage("Odpojeno");
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause instanceof java.net.SocketException && cause.getMessage().contains("Connection reset")) {
LogFile.printInfo("Connection reset by server");
Window.setStatusBarMessage("Odpojeno");
} else {
cause.printStackTrace();
}
ctx.close();
}
public void sendMessage(Message msg) {
if (connectionThread != null) {
connectionThread.sendMessage(msg);
}
}
}

View File

@ -1,30 +0,0 @@
package jnet.client.client;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;
import io.netty.handler.ssl.SslContext;
public class ClientInitializer extends ChannelInitializer<SocketChannel> {
private final SslContext sslCtx;
private final ClientHandler handler;
public ClientInitializer(SslContext sslCtx, ClientHandler handler) {
this.sslCtx = sslCtx;
this.handler = handler;
}
@Override
protected void initChannel(SocketChannel ch) {
ch.pipeline()
.addLast("ssl", sslCtx.newHandler(ch.alloc(), "localhost", 8443))
//.addLast("objectDecoder", new ObjectDecoder(ClassResolvers.cacheDisabled(null)))
//.addLast("objectEncoder", new ObjectEncoder())
.addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(null)))
.addLast(new ObjectEncoder())
.addLast("handler", handler);
}
}

View File

@ -1,167 +0,0 @@
package jnet.client.client;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.ssl.SslContext;
import jnet.client.Client;
import jnet.lib.Message;
public class NettyClientManager extends Thread {
private final String host;
private final int port;
private SslContext sslCtx = null;
private final ClientHandler handler;
private final EventLoopGroup group;
private static Channel channel;
private volatile boolean manualDisconnect = false;
private volatile boolean running = true;
private int reconnectAttempt = 0;
private static final int MAX_RECONNECT_DELAY = 15; // max doma za kterou se pokusí klient znovu připojit
public NettyClientManager(String host, int port) {
super("NettyClientManager"); // pojmenujeme vlákno
this.host = host;
this.port = port;
this.handler = new ClientHandler();
this.group = new NioEventLoopGroup();
// Propojíme handler s tímto vláknem (aby mohl posílat zprávy)
handler.setConnectionThread(this);
try {
this.sslCtx = SslUtil.createClientSslContext();
} catch (Exception ex) {
System.getLogger("Client SSL exception: " + ex.getMessage());
}
}
@Override
public void run() {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(group)
.channel(NioSocketChannel.class)
.option(ChannelOption.SO_KEEPALIVE, true)
.handler(new ClientInitializer(sslCtx, handler));
while (running) {
try {
System.out.println("Connecting to " + host + ":" + port + " (attempt " + (reconnectAttempt + 1) + ")");
ChannelFuture future = bootstrap.connect(host, port).sync();
channel = future.channel();
System.out.println("Connected successfully");
reconnectAttempt = 0;
channel.closeFuture().sync();
System.out.println("Connection lost");
// Pokud bylo provedeno manuální odpojení, přerušíme smyčku
if (manualDisconnect) {
System.out.println("Manual disconnect – stopping reconnect loop");
break;
}
if (!running) {
break;
}
int delay = Math.min(1 << reconnectAttempt, MAX_RECONNECT_DELAY);
reconnectAttempt++;
System.out.println("Reconnecting in " + delay + "s...");
Thread.sleep(delay * 1000L);
} catch (InterruptedException e) {
System.out.println("Connection thread interrupted");
// Pokud je to manuální odpojení, ukončíme smyčku
if (manualDisconnect) {
break;
}
Thread.currentThread().interrupt();
break;
} catch (Exception e) {
System.err.println("Connection error: " + e.getMessage());
if (running && !manualDisconnect) {
try {
Thread.sleep(3000);
} catch (InterruptedException ie) {
if (manualDisconnect) {
break;
}
Thread.currentThread().interrupt();
break;
}
} else {
break;
}
}
}
// Úklid po ukončení smyčky
shutdown();
}
/**
* Zastaví vlákno a uvolní zdroje
*/
public void stop() {
running = false;
if (channel != null) {
channel.close();
}
group.shutdownGracefully();
// Přerušíme vlákno, pokud čeká v sleep
this.interrupt();
}
private void shutdown() {
if (channel != null && channel.isActive()) {
channel.close();
}
group.shutdownGracefully();
System.out.println("Connection thread shut down");
}
public boolean isConnected() {
return channel != null && channel.isActive();
}
/**
* Odešle zprávu serveru (pokud je spojení aktivní)
*/
public static void sendMessage(Message msg) {
if (channel != null && channel.isActive()) {
channel.writeAndFlush(msg);
} else {
System.out.println("Cannot send message – not connected");
}
}
public static void sendMessage(int type, Object msg) {
if (channel != null && channel.isActive()) {
channel.writeAndFlush(new Message(type, msg));
} else {
System.out.println("Cannot send message – not connected");
}
}
public void disconnect() {
manualDisconnect = true;
if (channel != null) {
channel.close(); // zavře spojení – spustí channel.closeFuture().sync() v run()
}
this.interrupt(); // přeruší případné čekání
System.out.println("Manual disconnect initiated");
}
}

View File

@ -1,69 +0,0 @@
package jnet.client.client;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.EventLoopGroup;
import java.util.concurrent.TimeUnit;
public class ReconnectManager {
private final Bootstrap bootstrap;
private final EventLoopGroup group;
private final String host;
private final int port;
private final ClientHandler handler;
private int attempt = 0;
private static final int MAX_ATTEMPTS = Integer.MAX_VALUE;
private static final int BASE_DELAY_SECONDS = 1;
private static final int MAX_DELAY_SECONDS = 30;
public ReconnectManager(Bootstrap bootstrap, EventLoopGroup group,
String host, int port, ClientHandler handler) {
this.bootstrap = bootstrap;
this.group = group;
this.host = host;
this.port = port;
this.handler = handler;
}
public void scheduleReconnect() {
if (attempt >= MAX_ATTEMPTS) {
System.out.println("Max reconnect attempts reached, giving up.");
return;
}
int delay = Math.min(BASE_DELAY_SECONDS * (int) Math.pow(2, attempt), MAX_DELAY_SECONDS);
attempt++;
System.out.println("Reconnect attempt " + attempt + " in " + delay + "s");
group.schedule(() -> {
if (!Thread.currentThread().isInterrupted()) {
tryReconnect();
}
}, delay, TimeUnit.SECONDS);
}
private void tryReconnect() {
bootstrap.connect(host, port).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
System.out.println("Reconnect successful!");
attempt = 0;
} else {
System.out.println("Reconnect failed – will retry");
scheduleReconnect();
}
}
});
}
public void resetAttempts() {
attempt = 0;
System.out.println("Reconnect attempts reset");
}
}

View File

@ -1,19 +0,0 @@
package jnet.client.client;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.security.Security;
public class SslUtil {
static {
Security.addProvider(new BouncyCastleProvider());
}
public static SslContext createClientSslContext() throws Exception {
return SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE) // DŮLEŽITÉ!
.build();
}
}

View File

@ -1,77 +0,0 @@
package jnet.client.gui;
import jnet.client.Client;
import jnet.client.gui.dialog.DialogLogin;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.lib.LogFile;
import jnet.lib.ResourceLoader;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.IOException;
/**
* Horní lišta s ovládacími tlačítky.
*/
public class MenuPanel extends JPanel {
public MenuPanel() {
setPreferredSize(new Dimension(50, 50));
setLayout(new FlowLayout(FlowLayout.LEFT));
// Tlačítko Připojit / Odpojit
add(createIconButton("img/connect.png", "Připojit", e -> {
if (Client.nettyClient != null && Client.nettyClient.isConnected()) {
Client.nettyClient.disconnect();
}
// Otevře přihlašovací dialog
SwingUtilities.invokeLater(() -> new DialogLogin().setVisible(true));
}));
// Tlačítko Nastavení (klienta)
add(createIconButton("img/settings.png", "Nastavení", e
-> SwingUtilities.invokeLater(Window::showSettings)));
// Tlačítko Log (zatím prázdné)
add(createIconButton("img/log.png", "Log", e
-> SwingUtilities.invokeLater(Window::showLog)));
// Tlačítko Nastavení serveru
if (Client.user.isEditServer()) {
add(createIconButton("img/server_settings.png", "Nastavení serveru", e
-> SwingUtilities.invokeLater(() -> Window.showServerSettings(ServerSettingsPanel.TAB_DEFAULT))));
}
}
public void rebuild() {
removeAll();
// znovu přidáme tlačítka podle Client.user
// ...
revalidate();
repaint();
}
/**
* Pomocná metoda pro vytvoření tlačítka s ikonou.
*/
private JButton createIconButton(String resourcePath, String tooltip, ActionListener action) {
try {
var image = ImageIO.read(ResourceLoader.getFile(resourcePath));
JButton button = new JButton(new ImageIcon(image));
button.setFocusPainted(false);
button.setContentAreaFilled(false);
button.setToolTipText(tooltip);
button.addActionListener(action);
return button;
} catch (IOException ex) {
LogFile.printErr("Nepodařilo se načíst obrázek: " + resourcePath);
// Fallback – tlačítko s textem
JButton fallback = new JButton(tooltip);
fallback.addActionListener(action);
return fallback;
}
}
}

View File

@ -1,213 +0,0 @@
package jnet.client.gui;
import jnet.client.Client;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.filechooser.FileNameExtensionFilter;
import jnet.lib.ApacheConfig;
import jnet.lib.LogFile;
import org.apache.commons.configuration2.ex.ConfigurationException;
public class SettingsPanel extends JPanel {
public SettingsPanel() {
show();
}
public void show() {
this.setLayout(null);
this.setPreferredSize(new Dimension(300, 800));
// ===== NADPIS =====
JLabel nadpisLabel = new JLabel("Obecné nastavení");
nadpisLabel.setBounds(20, 20, 400, 25);
nadpisLabel.setFont(nadpisLabel.getFont().deriveFont(20f));
this.add(nadpisLabel);
// ===== CHECKBOX =====
JCheckBox runMinimalized = new JCheckBox("Spouštět minimalizovaně");
runMinimalized.setBounds(30, getNextY(nadpisLabel) + 20, 400, 25);
runMinimalized.setSelected(Client.config.getBoolean("start_minimalized"));
this.add(runMinimalized);
JCheckBox openMaxWindow = new JCheckBox("Otevírat maximalizované okno");
openMaxWindow.setBounds(30, getNextY(runMinimalized), 400, 25);
openMaxWindow.setSelected(Client.config.getBoolean("open_maximalized"));
this.add(openMaxWindow);
JCheckBox enableDebug = new JCheckBox("Debug režim");
enableDebug.setBounds(30, getNextY(openMaxWindow), 400, 25);
enableDebug.setSelected(Client.config.getBoolean("debug"));
this.add(enableDebug);
// ===== ZVUKY =====
JLabel nadpisSoundLabel = new JLabel("Zvuky");
nadpisSoundLabel.setBounds(20, getNextY(enableDebug) + 20, 400, 25);
nadpisSoundLabel.setFont(nadpisLabel.getFont().deriveFont(20f));
this.add(nadpisSoundLabel);
JCheckBox enableSounds = new JCheckBox("Povolit zvuky");
enableSounds.setBounds(30, getNextY(nadpisSoundLabel), 400, 25);
enableSounds.setSelected(Client.config.getBoolean("sound"));
this.add(enableSounds);
// ===== HLASITOST =====
JLabel hlasLabel = new JLabel("Hlasitost");
hlasLabel.setBounds(30, getNextY(enableSounds), 80, 25);
this.add(hlasLabel);
double volume = Client.config.getDouble("sound.volume", 0.75);
int volumePercent = (int) (volume * 100);
JSlider volumeSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 50);
volumeSlider.setBounds(110, getNextY(enableSounds), 200, 50);
volumeSlider.setValue(volumePercent);
volumeSlider.setPaintTrack(true);
volumeSlider.setPaintTicks(true);
volumeSlider.setPaintLabels(true);
volumeSlider.setMajorTickSpacing(50);
JLabel sliderValue = new JLabel(volumeSlider.getValue() + " %");
sliderValue.setBounds(350, getNextY(enableSounds), 50, 25);
this.add(sliderValue);
volumeSlider.addChangeListener(e -> sliderValue.setText(volumeSlider.getValue() + " %"));
this.add(volumeSlider);
// ===== VÝBĚR SOUBORŮ (POUŽÍVÁME SPRÁVNÉ KLÍČE) =====
// --- 1. Vše online ---
JLabel fileAllOkLabel = new JLabel("Zvuk vše online:");
fileAllOkLabel.setBounds(30, getNextY(volumeSlider), 150, 25);
this.add(fileAllOkLabel);
JTextField filePathFieldAllOk = new JTextField(25);
filePathFieldAllOk.setEditable(false);
filePathFieldAllOk.setBounds(200, getNextY(volumeSlider), 200, 25);
filePathFieldAllOk.setText(Client.config.getString("sound.online.all", ""));
this.add(filePathFieldAllOk);
JButton selectFileButtonAllOk = new JButton("Vyber soubor");
selectFileButtonAllOk.setBounds(420, getNextY(volumeSlider), 80, 25);
selectFileButtonAllOk.addActionListener(e -> {
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileNameExtensionFilter("Zvukové soubory WAV", "wav"));
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
filePathFieldAllOk.setText(fc.getSelectedFile().getAbsolutePath());
} else {
// při zrušení vrátíme původní hodnotu z konfigurace
filePathFieldAllOk.setText(Client.config.getString("sound.online.all", ""));
}
});
this.add(selectFileButtonAllOk);
// --- 2. Jeden online ---
JLabel fileOneOkLabel = new JLabel("Zvuk jeden online:");
fileOneOkLabel.setBounds(30, getNextY(filePathFieldAllOk), 150, 25);
this.add(fileOneOkLabel);
JTextField filePathFieldOneOk = new JTextField(25);
filePathFieldOneOk.setEditable(false);
filePathFieldOneOk.setBounds(200, getNextY(filePathFieldAllOk), 200, 25);
filePathFieldOneOk.setText(Client.config.getString("sound.online.one", ""));
this.add(filePathFieldOneOk);
JButton selectFileButtonOneOk = new JButton("Vyber soubor");
selectFileButtonOneOk.setBounds(420, getNextY(filePathFieldAllOk), 80, 25);
selectFileButtonOneOk.addActionListener(e -> {
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileNameExtensionFilter("Zvukové soubory WAV", "wav"));
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
filePathFieldOneOk.setText(fc.getSelectedFile().getAbsolutePath());
} else {
filePathFieldOneOk.setText(Client.config.getString("sound.online.one", ""));
}
});
this.add(selectFileButtonOneOk);
// --- 3. První offline ---
JLabel fileFirstKoLabel = new JLabel("Zvuk první offline:");
fileFirstKoLabel.setBounds(30, getNextY(filePathFieldOneOk), 150, 25);
this.add(fileFirstKoLabel);
JTextField filePathFieldFirstKo = new JTextField(25);
filePathFieldFirstKo.setEditable(false);
filePathFieldFirstKo.setBounds(200, getNextY(filePathFieldOneOk), 200, 25);
filePathFieldFirstKo.setText(Client.config.getString("sound.offline.first", ""));
this.add(filePathFieldFirstKo);
JButton selectFileButtonFirstKo = new JButton("Vyber soubor");
selectFileButtonFirstKo.setBounds(420, getNextY(filePathFieldOneOk), 80, 25);
selectFileButtonFirstKo.addActionListener(e -> {
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileNameExtensionFilter("Zvukové soubory WAV", "wav"));
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
filePathFieldFirstKo.setText(fc.getSelectedFile().getAbsolutePath());
} else {
filePathFieldFirstKo.setText(Client.config.getString("sound.offline.first", ""));
}
});
this.add(selectFileButtonFirstKo);
// --- 4. Další offline ---
JLabel fileNextKoLabel = new JLabel("Zvuk další offline:");
fileNextKoLabel.setBounds(30, getNextY(filePathFieldFirstKo), 150, 25);
this.add(fileNextKoLabel);
JTextField filePathFieldNextKo = new JTextField(25);
filePathFieldNextKo.setEditable(false);
filePathFieldNextKo.setBounds(200, getNextY(filePathFieldFirstKo), 200, 25);
filePathFieldNextKo.setText(Client.config.getString("sound.offline.other", ""));
this.add(filePathFieldNextKo);
JButton selectFileButtonNextKo = new JButton("Vyber soubor");
selectFileButtonNextKo.setBounds(420, getNextY(filePathFieldFirstKo), 80, 25);
selectFileButtonNextKo.addActionListener(e -> {
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileNameExtensionFilter("Zvukové soubory WAV", "wav"));
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
filePathFieldNextKo.setText(fc.getSelectedFile().getAbsolutePath());
} else {
filePathFieldNextKo.setText(Client.config.getString("sound.offline.other", ""));
}
});
this.add(selectFileButtonNextKo);
// ===== TLAČÍTKO ULOŽIT =====
JButton saveButton = new JButton("Uložit");
saveButton.setBounds(20, getNextY(filePathFieldNextKo) + 50, 100, 30);
saveButton.addActionListener(e -> {
// Uložíme všechny hodnoty z komponent do konfigurace
Client.config.setProperty("debug", enableDebug.isSelected());
Client.config.setProperty("start_minimalized", runMinimalized.isSelected());
Client.config.setProperty("open_maximalized", openMaxWindow.isSelected());
Client.config.setProperty("sound", enableSounds.isSelected());
Client.config.setProperty("sound.volume", volumeSlider.getValue() / 100.0);
// ===== ukládání cest =====
Client.config.setProperty("sound.online.all", filePathFieldAllOk.getText());
Client.config.setProperty("sound.online.one", filePathFieldOneOk.getText());
Client.config.setProperty("sound.offline.first", filePathFieldFirstKo.getText());
Client.config.setProperty("sound.offline.other", filePathFieldNextKo.getText());
try {
ApacheConfig.saveProperties(Client.config);
LogFile.printInfo("Nastavení uloženo.");
} catch (ConfigurationException ex) {
LogFile.printErr("Nastavení nebylo uloženo. " + ex.getMessage());
}
});
this.add(saveButton);
}
private int getNextY(Component p) {
return p.getY() + p.getHeight() + 30;
}
}

View File

@ -1,61 +0,0 @@
package jnet.client.gui;
import jnet.client.Client;
import jnet.lib.LogFile;
import jnet.lib.ResourceLoader;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import jnet.client.gui.dialog.DialogOnlineClients;
/**
* Spodní stavová lišta – zprávy a počet online klientů.
*/
public class StatusBar extends JPanel {
private final JLabel messageLabel = new JLabel();
private final JLabel onlineLabel = new JLabel();
public StatusBar() {
setPreferredSize(new Dimension(100, 35));
setBorder(BorderFactory.createEtchedBorder());
setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
messageLabel.setPreferredSize(new Dimension(200, 25));
add(messageLabel);
add(Box.createHorizontalGlue());
// tlacitko zobrazujici klienty
try {
var img = ImageIO.read(ResourceLoader.getFile("img/online_clients.png"));
JButton btnOnline = new JButton(new ImageIcon(img));
btnOnline.setFocusPainted(false);
btnOnline.setContentAreaFilled(false);
btnOnline.setBorderPainted(false);
btnOnline.setToolTipText("Online uživatelé");
btnOnline.addActionListener(e
-> new DialogOnlineClients());
add(btnOnline);
} catch (IOException ex) {
LogFile.printErr("Nepodařilo se načíst ikonu online_clients.png");
}
onlineLabel.setPreferredSize(new Dimension(150, 25));
add(onlineLabel);
}
public void setMessage(String text) {
SwingUtilities.invokeLater(() -> {
messageLabel.setText(text);
});
}
public void setOnlineCount() {
SwingUtilities.invokeLater(()
-> onlineLabel.setText("Klientů online: " + Client.onlineClients.size())
);
}
}

View File

@ -1,392 +0,0 @@
package jnet.client.gui;
import jnet.client.Client;
import jnet.client.gui.dialog.DialogSite;
import jnet.client.gui.maptree.MapTree;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.lib.LogFile;
import jnet.lib.ResourceLoader;
import jnet.lib.object.Site;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import jnet.client.gui.mapview.MapView;
import jnet.lib.object.Node;
/**
* Hlavní okno aplikace – implementováno jako singleton.
*/
public class Window extends JFrame {
private static Window instance;
private JSplitPane splitPane;
private StatusBar statusBar;
private MapTree mapTree;
private MenuPanel menuPanel;
private static ServerSettingsPanel currentServerSettingsPanel;
private static EventsPanel currentEventsPanel;
// Nové: reference na aktuální MapView a jeho scroll panel
private static MapView currentMapView;
private static JScrollPane currentMapViewScrollPane;
private Window() {
super(Client.APP_NAME);
setIcon();
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
handleClosing();
}
});
initComponents();
// pack();
// setLocationRelativeTo(null);
}
private void initComponents() {
setLayout(new BorderLayout());
menuPanel = new MenuPanel();
add(menuPanel, BorderLayout.NORTH);
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setDividerSize(5);
JPanel leftPanel = new JPanel(new BorderLayout());
leftPanel.setBackground(Color.WHITE);
leftPanel.setPreferredSize(new Dimension(200, 250));
mapTree = new MapTree();
leftPanel.add(mapTree, BorderLayout.CENTER);
if (Client.user != null && Client.user.isAddMap()) {
JButton addSiteButton = new JButton("Přidat mapu");
addSiteButton.addActionListener(e -> new DialogSite().setVisible(true));
leftPanel.add(addSiteButton, BorderLayout.SOUTH);
}
splitPane.add(leftPanel, JSplitPane.LEFT);
// Pravý panel – prázdný
splitPane.add(new JPanel(), JSplitPane.RIGHT);
add(splitPane, BorderLayout.CENTER);
if (statusBar == null) {
statusBar = new StatusBar();
}
add(statusBar, BorderLayout.SOUTH);
currentServerSettingsPanel = null;
currentEventsPanel = null;
}
public static Window getInstance() {
if (instance == null) {
instance = new Window();
}
return instance;
}
public void reloadWindow() {
getContentPane().removeAll();
initComponents();
revalidate();
repaint();
currentEventsPanel = null;
// Po znovunačtení okna zrušíme referenci na MapView, protože byl zničen
currentMapView = null;
currentMapViewScrollPane = null;
}
// ------------------------------------------------------------------------
// Soukromé pomocné metody
// ------------------------------------------------------------------------
private void setIcon() {
try {
var icon = ImageIO.read(ResourceLoader.getFile("img/app.png"));
setIconImage(icon);
} catch (IOException ex) {
LogFile.printErr("APP icon exception");
}
}
private void handleClosing() {
int n = JOptionPane.showOptionDialog(this,
"Ukončit nebo minimalizovat do lišty?",
"Ukončit",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
new Object[]{"Ukončit", "Minimalizovat"},
"Minimalizovat");
if (n == 0) {
LogFile.printInfo("Ukončit");
System.exit(0);
} else if (n == 1) {
// Skryjeme okno – zůstane pouze tray ikona
setVisible(false);
// Volitelně můžeme zobrazit bublinu s informací
Tray.showMessage("jNet client", "Aplikace byla minimalizována do lišty.");
}
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
if (b) {
// Pro jistotu zpozdíme maximalizaci, aby se provedla až po dokončení layoutu
SwingUtilities.invokeLater(() -> {
setExtendedState(JFrame.MAXIMIZED_BOTH);
toFront();
requestFocus();
});
}
}
// ------------------------------------------------------------------------
// Statické přístupové metody pro ostatní komponenty
// ------------------------------------------------------------------------
public static void setStatusBarMessage(String message) {
if (instance != null && instance.statusBar != null) {
instance.statusBar.setMessage(message);
}
}
public static void reloadOnlineClients() {
if (instance != null && instance.statusBar != null) {
instance.statusBar.setOnlineCount();
}
}
/**
* Nastaví nebo aktualizuje MapView pro daný Site. Odstraní starý pravý
* panel a vloží nový MapView.
*/
public static void setMapView(Site site) {
if (instance == null) {
return;
}
SwingUtilities.invokeLater(() -> {
// Odstraníme starý pravý panel (pokud existuje)
Component right = instance.splitPane.getRightComponent();
if (right != null) {
instance.splitPane.remove(right);
}
// Vytvoříme nový MapView
currentMapView = new MapView(site);
currentMapViewScrollPane = new JScrollPane(currentMapView);
instance.splitPane.add(currentMapViewScrollPane, JSplitPane.RIGHT);
instance.splitPane.revalidate();
instance.splitPane.repaint();
});
}
/**
* Aktualizuje stav uzlu v aktuálním MapView. Volá se z handleru po příchodu
* zprávy o změně stavu.
*/
public static void updateNodeStatusInMapView(int nodeId, int newStatus) {
if (currentMapView != null) {
currentMapView.updateNodeStatus(nodeId, newStatus);
}
}
/**
* Aktualizuje pozici uzlu v aktuálním MapView. Volá se z handleru po
* příchodu zprávy o změně stavu.
*/
public static void updateNodePositionInMapView(int nodeId, int x, int y) {
if (currentMapView != null) {
currentMapView.updateNodePosition(nodeId, x, y);
}
}
/**
* Aktualizuje pozici uzlu v aktuálním MapView. Volá se z handleru po
* příchodu zprávy o změně stavu.
*/
public static void addNodeInMapView(Node node) {
if (currentMapView != null) {
currentMapView.addNodeFromServer(node);
}
}
/**
* Kompletně obnoví MapView z nového Site objektu (např. po hromadné změně).
*/
public static void refreshMapView(Site site) {
if (currentMapView != null) {
currentMapView.refreshFromServer(site);
}
}
/**
* Obnoví aktuální zobrazení mapy podle dat ze serveru. Pokud není žádná
* mapa otevřena, nic neprovede.
*/
public static void refreshCurrentMapView() {
if (currentMapView == null) {
return;
}
SwingUtilities.invokeLater(() -> {
Site currentSite = currentMapView.getModel().getSite();
if (currentSite == null) {
return;
}
// Najdeme aktuální verzi site v Client.site
for (Site s : Client.site) {
if (s.getId() == currentSite.getId()) {
currentMapView.refreshFromServer(s);
break;
}
}
});
}
/**
* odebere node z mapview
*/
public static void removeNodeFromMapView(int nodeId) {
if (currentMapView != null) {
currentMapView.removeNodeFromServer(nodeId);
}
}
public static void showSettings() {
if (instance == null) {
return;
}
SwingUtilities.invokeLater(() -> {
JScrollPane panel = new JScrollPane(new SettingsPanel());
// Rychlejší posouvání šipkami a kolečkem
panel.getVerticalScrollBar().setUnitIncrement(20);
// Rychlejší posouvání Page Up / Page Down
panel.getVerticalScrollBar().setBlockIncrement(100);
// Povolení rychlejšího kolečka (volitelné)
panel.putClientProperty("JScrollBar.fastWheelScrolling", Boolean.TRUE);
instance.splitPane.add(panel, JSplitPane.RIGHT);
instance.splitPane.revalidate();
});
}
public static void showLog() {
if (instance == null) {
return;
}
SwingUtilities.invokeLater(() -> {
Component right = instance.splitPane.getRightComponent();
if (right != null) {
instance.splitPane.remove(right);
}
if (currentEventsPanel == null) {
currentEventsPanel = new EventsPanel();
} else {
currentEventsPanel.refresh();
}
instance.splitPane.add(currentEventsPanel, JSplitPane.RIGHT);
instance.splitPane.revalidate();
instance.splitPane.repaint();
});
}
public static void showServerSettings(int tab) {
if (instance == null) {
System.err.println("instance is null");
return;
}
SwingUtilities.invokeLater(() -> {
// if (currentServerSettingsPanel == null) {
currentServerSettingsPanel = new ServerSettingsPanel();
//JScrollPane scroll = new JScrollPane(currentServerSettingsPanel);
instance.splitPane.add(currentServerSettingsPanel, JSplitPane.RIGHT);
instance.splitPane.revalidate();
// }
currentServerSettingsPanel.setTable(tab);
switch (tab) {
case ServerSettingsPanel.TAB_DEVICE_TYPE:
currentServerSettingsPanel.refreshDeviceTypes();
break;
case ServerSettingsPanel.TAB_USERS:
currentServerSettingsPanel.refreshUsers();
break;
case ServerSettingsPanel.TAB_SNMP_PROFILE:
currentServerSettingsPanel.refreshSnmpProfiles();
break;
case ServerSettingsPanel.TAB_SNMP_TEMPLATE:
currentServerSettingsPanel.refreshSnmpTemplates();
break;
case ServerSettingsPanel.TAB_LOG:
//currentServerSettingsPanel.refreshL();
break;
default:
break;
}
});
}
public static void putServerLog(String[] log) {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.putLog(log);
}
}
public static void refreshDeviceTypes() {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.refreshDeviceTypes();
}
}
public static void refreshUsers() {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.refreshUsers();
}
}
public static void refreshSnmpProfiles() {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.refreshSnmpProfiles();
}
}
public static void refreshSnmpTemplates() {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.refreshSnmpTemplates();
}
}
public static void refreshValueMap() {
if (currentServerSettingsPanel != null) {
currentServerSettingsPanel.refreshValueMap();
}
}
public static void refreshMapTree() {
if (instance != null) {
instance.mapTree.refresh();
}
}
public static MapTree getMapTree() {
return instance != null ? instance.mapTree : null;
}
public static void refreshEventsIfVisible() {
if (currentEventsPanel != null && currentEventsPanel.isShowing()) {
currentEventsPanel.refresh();
}
}
}

View File

@ -1,144 +0,0 @@
package jnet.client.gui.dialog;
import jnet.client.gui.Window;
import jnet.client.gui.serversettings.ServerSettingsPanel;
import jnet.client.client.NettyClientManager;
import jnet.lib.Message;
import jnet.lib.object.DeviceType;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Base64;
import jnet.lib.LogFile;
public class DialogDeviceType extends JDialog {
private JLabel info = new JLabel("PNG obrázek o šířce 32px");
private JTextField nazevText = new JTextField(15);
private String imgStr = "";
public DialogDeviceType() {
setTitle("Přidat typ zařízení");
setModal(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
initComponents();
pack();
setLocationRelativeTo(null);
}
private void initComponents() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 10, 5, 10);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
int row = 0;
// Název
gbc.gridx = 0;
gbc.gridy = row;
panel.add(new JLabel("Název:"), gbc);
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(nazevText, gbc);
row++;
// Obrázek
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = row;
panel.add(new JLabel("Obrázek"), gbc);
JButton browseButton = new JButton("Browse");
browseButton.addActionListener(e -> browseImage());
gbc.gridx = 1;
panel.add(browseButton, gbc);
gbc.gridx = 2;
panel.add(info, gbc);
row++;
// Tlačítka
JButton addButton = new JButton("Přidat");
addButton.addActionListener(e -> addDeviceType());
JButton cancelButton = new JButton("Storno");
cancelButton.addActionListener(e -> dispose());
gbc.gridx = 0;
gbc.gridy = row;
gbc.gridwidth = 1;
panel.add(addButton, gbc);
gbc.gridx = 2;
panel.add(cancelButton, gbc);
add(panel);
}
private void browseImage() {
JFileChooser fc = new JFileChooser(".");
fc.setFileFilter(new FileNameExtensionFilter("PNG obrázky", "png"));
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
String mimeType = Files.probeContentType(file.toPath());
if (!"image/png".equals(mimeType)) {
info.setForeground(Color.RED);
info.setText("Chybný formát – vyberte PNG.");
return;
}
BufferedImage bimg = ImageIO.read(file);
if (bimg == null || bimg.getWidth() != 32) {
info.setForeground(Color.RED);
info.setText("Obrázek musí mít šířku 32px.");
return;
}
imgStr = encodeFileToBase64(file);
info.setForeground(Color.BLACK);
info.setText("Obrázek nahrán (" + file.getName() + ")");
} catch (IOException ex) {
LogFile.printErr("Chyba při načítání obrázku" + ex.getMessage());
info.setForeground(Color.RED);
info.setText("Chyba čtení souboru.");
}
}
}
private void addDeviceType() {
String name = nazevText.getText().trim();
if (name.length() < 3) {
info.setForeground(Color.RED);
info.setText("Název musí mít alespoň 3 znaky.");
return;
}
if (imgStr.isEmpty()) {
info.setForeground(Color.RED);
info.setText("Musíte vybrat obrázek.");
return;
}
NettyClientManager.sendMessage(new Message(Message.NODE_ICON_NEW, new DeviceType(name, imgStr)));
SwingUtilities.invokeLater(() -> {
Window.showServerSettings(ServerSettingsPanel.TAB_DEVICE_TYPE);
dispose();
});
}
private static String encodeFileToBase64(File file) throws IOException {
try (FileInputStream fis = new FileInputStream(file)) {
byte[] bytes = new byte[(int) file.length()];
int read = fis.read(bytes);
if (read != bytes.length) {
throw new IOException("Přečteno méně bajtů než očekáváno.");
}
return Base64.getEncoder().encodeToString(bytes);
}
}
}

View File

@ -1,162 +0,0 @@
package jnet.client.gui.dialog;
import jnet.client.Client;
import jnet.client.client.NettyClientManager;
import jnet.lib.ApacheConfig;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.ex.ConfigurationException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import static jnet.client.Client.nettyClient;
import jnet.lib.LogFile;
public class DialogLogin extends JDialog {
private static final Logger LOG = Logger.getLogger(DialogLogin.class.getName());
private JTextField serverText;
private JTextField portText;
private JTextField userText;
private JPasswordField passwordText;
public DialogLogin() {
setTitle("Přihlásit");
setSize(350, 250);
setLocationRelativeTo(null);
setResizable(false);
setModal(true);
initComponents();
}
private void initComponents() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 5, 5, 5);
gbc.fill = GridBagConstraints.HORIZONTAL;
// Načtení uložených hodnot (plain text)
String savedServer = Client.config.getString("server", "");
String savedPort = Client.config.getString("port", "");
String savedUser = Client.config.getString("user", "");
String savedPassword = Client.config.getString("password", "");
// Server
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
panel.add(new JLabel("Server:"), gbc);
serverText = new JTextField(savedServer, 15);
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(serverText, gbc);
// Port
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
panel.add(new JLabel("Port:"), gbc);
portText = new JTextField(savedPort, 5);
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(portText, gbc);
// Uživatel
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
panel.add(new JLabel("Uživatel:"), gbc);
userText = new JTextField(savedUser, 15);
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(userText, gbc);
// Heslo
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 1;
panel.add(new JLabel("Heslo:"), gbc);
passwordText = new JPasswordField(savedPassword, 15);
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(passwordText, gbc);
// Tlačítka
JButton loginButton = new JButton("Přihlásit");
loginButton.addActionListener(e -> performLogin());
JButton closeButton = new JButton("Storno");
closeButton.addActionListener(e -> dispose());
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.CENTER;
panel.add(loginButton, gbc);
gbc.gridx = 2;
panel.add(closeButton, gbc);
add(panel);
pack();
}
private void performLogin() {
String server = serverText.getText().trim();
String portStr = portText.getText().trim();
String user = userText.getText().trim();
String password = new String(passwordText.getPassword());
// Validace
if (server.isEmpty() || portStr.isEmpty() || user.isEmpty() || password.isEmpty()) {
JOptionPane.showMessageDialog(this,
"Všechna pole musí být vyplněna.",
"Chyba",
JOptionPane.ERROR_MESSAGE);
return;
}
int port;
try {
port = Integer.parseInt(portStr);
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(this,
"Port musí být číslo.",
"Chyba",
JOptionPane.ERROR_MESSAGE);
return;
}
// Uložení do konfigurace (bez hashování – zatím plain text)
try {
Client.config.setProperty("server", server);
Client.config.setProperty("port", portStr);
Client.config.setProperty("user", user);
Client.config.setProperty("password", password); // plain text
ApacheConfig.saveProperties( Client.config);
// Připojení klienta (mimo EDT – Netty)
Client.nettyClient = new NettyClientManager(server, port);
nettyClient.start();
// Zavření dialogu
dispose();
} catch (ConfigurationException ex) {
LogFile.printErr("Chyba při ukládání konfigurace");
JOptionPane.showMessageDialog(this,
"Chyba při ukládání nastavení: " + ex.getMessage(),
"Chyba",
JOptionPane.ERROR_MESSAGE);
}
}
}

View File

@ -1,117 +0,0 @@
package jnet.client.gui.dialog;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
import jnet.client.Client;
import jnet.client.gui.mapview.MapView;
import jnet.lib.object.Node;
import jnet.lib.object.Site;
public class DialogNodeChangeSite extends JDialog {
private final Node node;
private final MapView mapView; // může být null
// Původní konstruktor pro zachování kompatibility
public DialogNodeChangeSite(Node node) {
this(node, null);
}
// Nový konstruktor s MapView
public DialogNodeChangeSite(Node node, MapView mapView) {
this.node = node;
this.mapView = mapView;
setModal(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
init();
pack();
setLocationRelativeTo(null);
}
private void init() {
setTitle("Přesun na jinou mapu");
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 10, 5, 10);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
int row = 0;
JLabel labelMap = new JLabel("Nová mapa");
gbc.gridx = 0;
gbc.gridy = row;
panel.add(labelMap, gbc);
JComboBox<Site> comboBoxMap = new JComboBox<>();
DefaultComboBoxModel<Site> model = new DefaultComboBoxModel<>();
for (Site site : Client.site) {
model.addElement(site);
}
comboBoxMap.setModel(model);
comboBoxMap.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Site) {
setText(((Site) value).getName());
}
return this;
}
});
// Pouze informativní výpis – neměníme node!
comboBoxMap.addActionListener(e -> {
Site selected = (Site) comboBoxMap.getSelectedItem();
if (selected != null) {
System.out.println("Vybráno: " + selected.getName() + " (ID: " + selected.getId() + ")");
}
});
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(comboBoxMap, gbc);
row++;
JButton addButton = new JButton("Uložit");
JButton cancelButton = new JButton("Storno");
addButton.addActionListener(e -> {
Site selected = (Site) comboBoxMap.getSelectedItem();
if (selected != null && mapView != null) {
// Spustíme režim umístění na cílové mapě
mapView.startNodePlacement(node, selected.getId());
// Přepneme na cílovou mapu
mapView.switchToSite(selected.getId());
} else {
JOptionPane.showMessageDialog(this, "Nebyla vybrána cílová mapa nebo chybí MapView.");
}
dispose();
});
cancelButton.addActionListener(e -> dispose());
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = row;
panel.add(addButton, gbc);
gbc.gridx = 2;
panel.add(cancelButton, gbc);
add(panel);
}
}

View File

@ -1,127 +0,0 @@
package jnet.client.gui.dialog;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
import jnet.client.Client;
import jnet.client.client.NettyClientManager;
import jnet.lib.Message;
import jnet.lib.object.Node;
import jnet.lib.object.Site;
public class DialogNodeMapLink extends JDialog {
private Boolean newObject;
private Node node;
public DialogNodeMapLink(Node node, Boolean newObject) {
this.newObject = newObject;
this.node = node;
setModal(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
init();
pack();
setLocationRelativeTo(null);
}
private void init() {
if (newObject) {
setTitle("Nový statický object");
} else {
setTitle(node.getName());
}
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 10, 5, 10);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
int row = 0;
JLabel labelMap = new JLabel("Mapa");
gbc.gridx = 0;
gbc.gridy = row;
panel.add(labelMap, gbc);
JComboBox<Site> comboBoxMap = new JComboBox<>();
// Naplníme model
DefaultComboBoxModel<Site> model = new DefaultComboBoxModel<>();
for (Site site : Client.site) {
model.addElement(site);
}
comboBoxMap.setModel(model);
comboBoxMap.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof Site) {
Site s = (Site) value;
setText(s.getName()); // zobrazí jméno
}
return this;
}
});
comboBoxMap.addActionListener(e -> {
Site selected = (Site) comboBoxMap.getSelectedItem();
if (selected != null) {
int id = selected.getId();
String name = selected.getName();
node.setName(selected.getName());
node.setSiteLink(selected.getId());
}
});
gbc.gridx = 1;
gbc.gridwidth = 2;
panel.add(comboBoxMap, gbc);
row++;
JButton addButton = new JButton("Uložit");
JButton cancelButton = new JButton("Storno");
addButton.addActionListener(e -> {
node.setPing(false);
node.setType(Node.NODE_MAP);
node.setIcon(1);
if (newObject) {
NettyClientManager.sendMessage(new Message(Message.NODE_ADD, node));
dispose();
} else {
NettyClientManager.sendMessage(new Message(Message.NODE_CHANGE, node));
dispose();
}
dispose();
});
cancelButton.addActionListener(e -> dispose());
gbc.gridwidth = 1;
gbc.gridx = 0;
gbc.gridy = row;
panel.add(addButton, gbc);
gbc.gridx = 2;
panel.add(cancelButton, gbc);
add(panel);
}
}

Some files were not shown because too many files have changed in this diff Show More