Michal 2025-02-08 16:36:38 +01:00
commit 27f3734ab0
64 changed files with 6829 additions and 0 deletions

BIN
app/putty.exe Normal file

Binary file not shown.

BIN
app/winbox.exe Normal file

Binary file not shown.

73
build.xml Normal file
View File

@ -0,0 +1,73 @@
<?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.
-->
</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

BIN
img/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

BIN
img/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
img/browser.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/connect.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
img/flag_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

BIN
img/flag_green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

BIN
img/flag_orange.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
img/flag_red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

BIN
img/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

BIN
img/log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
img/no.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

BIN
img/online_clients.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
img/ping.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/platform_android.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/platform_pc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
img/server_connected.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
img/server_settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

BIN
img/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
img/ssh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

BIN
img/trash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

BIN
img/unlock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

BIN
img/winbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

BIN
img/yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

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

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>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

@ -0,0 +1,113 @@
package jnet.client;
import jnet.client.gui.Tray;
import jnet.client.gui.Window;
import jnet.client.network.NettyClient;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
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.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;
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 ArrayList<MapObject> mapObject = new ArrayList<>();
public static ArrayList<OnlineClients> onlineClients = new ArrayList<>();
public static ArrayList<ObjectType> objectType = new ArrayList<>();
public static ArrayList<SnmpProfile> snmpProfile = new ArrayList<>();
public static ArrayList<User> users = new ArrayList<>();
public static ArrayList<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");
}
///
/// okno
///
///
/// 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,219 @@
package jnet.client;
import jnet.client.gui.MapTree;
import jnet.client.gui.MapView;
import jnet.client.gui.Tray;
import jnet.client.network.NettyClient;
import java.util.ArrayList;
import jnet.lib.LogFile;
import jnet.lib.Message;
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;
public class ClientMessageParser {
public static void parse(Message msg) {
LogFile.printDebug("-> Message type: " + msg.getType());
switch (msg.getType()) {
case Message.CLIENT_VERSION:
NettyClient.send(Message.CLIENT_VERSION, Client.CLIENT_VERSION);
break;
case Message.UPDATE:
LogFile.printInfo("Received update request");
// String[] run = {"java", "-jar", "Updater.jar"};
// // TODO po přijetí pozadavku dialogove okno s informaci ze dojde k aktualizace a odpoctem k jejimu provedeni
// try {
// // odpoji se
// client.disconnect();
// // spusti updater
// Runtime.getRuntime().exec(run);
// // vypne program
// System.exit(0);
// } catch (IOException ex) {
// LogFile.printErr("Client update exception: " + ex.getMessage());
// }
break;
case Message.AUTH_REQUEST:
String[] userPass = {Client.config.getString("user"), Client.config.getString("password"), String.valueOf(OnlineClients.PLATFORM_PC)};
NettyClient.send(Message.AUTH, userPass);
break;
case Message.AUTH_SUCEFULL:
LogFile.printInfo("Log in to server");
Client.setConnected();
break;
case Message.AUTH_FAIL:
LogFile.printInfo("Authorization failed on server");
// TODO co dal ? když se nepřihlásí ? někam vypsat informaci nebo otevřít okno s informací ?
break;
case Message.ONLINE_CLIENTS:
Client.onlineClients = (ArrayList<OnlineClients>) msg.getMsg();
break;
case Message.OBJECT_TYPE:
Client.objectType.add((ObjectType) msg.getMsg());
break;
case Message.USER:
Client.users.add((User) msg.getMsg());
break;
case Message.USER_INFO:
Client.user = (User) msg.getMsg();
break;
case Message.MAP:
// pridani do arraylistu
Client.maps.add((Map) msg.getMsg());
// pridani do stromu map o refres se postara pri pridavani
MapTree.reload();
// aktualizace tray icon
Tray.refresh();
break;
case Message.OBJECT_LIST:
Client.mapObject = (ArrayList<MapObject>) msg.getMsg();
// pridani do stromu map o refres se postara pri pridavani
MapTree.reload();
// aktualizace tray icon
Tray.refresh();
break;
case Message.STATUS_UPDATE:
int[] o = (int[]) msg.getMsg();
int status = o[1];
int obj_id = o[0];
for (MapObject mapObject : Client.mapObject) {
if (mapObject.getId() == obj_id) {
// nastaveni statusu objektu
mapObject.setStatus(status);
// aktualizace pohledu map
MapView.updateMapView(mapObject.getId());
//aktualizace seznamu map
MapTree.reload();
// aktualizace tray icon
Tray.refresh();
break;
}
}
SoundManager.changeStatus(status);
break;
case Message.SET_MAP_LOCK:
int[] data_lock = (int[]) msg.getMsg();
for (Map map : Client.maps) {
if (map.getId() == data_lock[0]) {
map.setLock((data_lock[1] == 1));
break;
}
}
break;
case Message.SNMP_PROFILE:
Client.snmpProfile.add((SnmpProfile) msg.getMsg());
break;
case Message.EVENT_LIST:
Client.events = ((ArrayList<Event>) msg.getMsg());
break;
case Message.EVENT_NEW:
Client.events.add((Event) msg.getMsg());
break;
case Message.EVENT_UPDATE:
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;
}
}
break;
case Message.ADD_OBJECT:
MapObject new_mo = (MapObject) msg.getMsg();
// pridat do seznamu
Client.mapObject.add(new_mo);
break;
case Message.REMOVE_OBJECT:
for (MapObject mapObject : Client.mapObject) {
if (mapObject.getId() == (int) msg.getMsg()) {
// odebere ze seznamu
Client.mapObject.remove(mapObject);
// update map view
MapView.updateMapView(mapObject.getId());
break;
}
}
break;
case Message.UPDATE_OBJECT:
MapObject mo = (MapObject) msg.getMsg();
for (int i = 0; i < Client.mapObject.size(); i++) {
if (Client.mapObject.get(i).getId() == mo.getId()) {
Client.mapObject.set(i, mo);
break;
}
}
break;
case Message.MAP_REMOVE:
for (Map map : Client.maps) {
if (map.getId() == (int) msg.getMsg()) {
// odebere ze seznamu
Client.maps.remove(map);
// aktualizace seznamu map
MapTree.reload();
break;
}
}
break;
case Message.USER_EDIT:
User ue = (User) msg.getMsg();
// zmenit v seznamu
for (User user : Client.users) {
if (user.getId() == ue.getId()) {
Client.users.remove(user);
break;
}
}
break;
case Message.DELETE_LOG:
int objId = (int) msg.getMsg();
// vymaze logy v listu
for (Event event : Client.events) {
if (event.getObject() == objId) {
Client.events.remove(event);
break;
}
}
break;
case Message.SERVER_CONFIG:
Client.serverConfig = (ServerConfig) msg.getMsg();
break;
default:
LogFile.printErr("Neznamy typ zpravy");
}
}
}

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.MapObject;
public class SoundManager {
private static int count = 0;
public static void playOnline(){
int count = 0;
ListIterator<MapObject> iteratorMapObject = Client.mapObject.listIterator();
while (iteratorMapObject.hasNext()) {
MapObject obj = iteratorMapObject.next();
if (obj.getStatus() == Status.OFFLINE && count != 0) {
playNextOffline();
break;
} else if (obj.getStatus() == Status.OFFLINE) {
System.err.println(obj.getName());
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

@ -0,0 +1,83 @@
package jnet.client.gui;
import jnet.client.Client;
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.object.Map;
import jnet.lib.object.MapObject;
public class EventsPanel extends JPanel {
public EventsPanel() {
int limit = 50;
String column[] = {"Začátek", "Konec", "Stav", "Mapa", "Zařízení"};
DefaultTableModel tableModel = new DefaultTableModel(column, 0) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
Collections.sort(Client.events, new EventComparator());
Collections.reverse(Client.events);
if (limit > Client.events.size()){
limit = Client.events.size();
}
for (int i = 0; i < limit; i++) {
String[] info = getObjetInfo(Client.events.get(i).getObject());
Object[] d = {
getDate(Client.events.get(i).getStart()),
getDate(Client.events.get(i).getEnd()),
Client.events.get(i).getDescription(),
info[0],
info[1]};
tableModel.addRow(d);
}
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
}
private String getDate(long date) {
if (date != 0) {
SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
return ft.format(new Date(date));
}
return "";
}
private String[] getObjetInfo(int id) {
ListIterator<Map> iteratorMap = Client.maps.listIterator();
ListIterator<MapObject> iteratorMapObject = Client.mapObject.listIterator();
while (iteratorMap.hasNext()) {
Map map = iteratorMap.next();
while (iteratorMapObject.hasNext()) {
MapObject obj = iteratorMapObject.next();
if (obj.getId() == id) {
String[] data = {map.getName(), obj.getName()};
return data;
}
}
}
return null;
}
}

View File

@ -0,0 +1,143 @@
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.util.Collections;
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) {
JMenuItem mapAdd = new JMenuItem("Přidat mapu", new ImageIcon("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("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());
}
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() {
root.removeAllChildren();
Collections.sort(Client.maps, new MapComparator());
for (Map map : Client.maps) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(map);
root.add(node);
}
try {
model.reload();
expandAllNodes(tree, 0, tree.getRowCount());
} catch (Exception e) {
LogFile.printErr("Map tree error: " + e);
}
}
}

View File

@ -0,0 +1,85 @@
package jnet.client.gui;
import jnet.client.Client;
import java.awt.Component;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Iterator;
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;
import jnet.lib.object.MapObject;
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;
switch (getMapStatus(m.getId())) {
case Status.OK: // online
image = ImageIO.read(new File("img/flag_green.png"));
break;
case Status.WARNING: // warning
image = ImageIO.read(new File("img/flag_orange.png"));
break;
case Status.OFFLINE: // offline
image = ImageIO.read(new File("img/flag_red.png"));
break;
default: // other
image = ImageIO.read(new File("img/flag_gray.png"));
}
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;
}
private int getMapStatus(int mapId) {
int status = Status.NA;
Iterator<MapObject> iteratorMapObject = Client.mapObject.iterator();
while (iteratorMapObject.hasNext()) {
MapObject obj = iteratorMapObject.next();
if (obj.getMap() == mapId) {
switch (obj.getStatus()) {
case Status.OFFLINE:
return Status.OFFLINE;
case Status.WARNING:
status = Status.WARNING;
break;
default:
if (status != Status.WARNING) {
status = Status.OK;
}
}
}
}
return status;
}
}

View File

@ -0,0 +1,104 @@
package jnet.client.gui;
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.File;
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.Map;
import jnet.lib.object.MapObject;
public class MapView extends JPanel {
public static List<PaintObject> paintObjects = new ArrayList<>();
;
private static Map map;
public MapView(Map map) {
this.map = map;
LogFile.printDebug("View map: " + map.getName());
paintObjects.clear();
loadObject(map.getId());
this.addMouseMotionListener(new MapViewAction(map));
this.addMouseListener(new MapViewAction(map));
// 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
try {
BufferedImage image;
if (map.isLock()) {
image = ImageIO.read(new File("img/lock.png"));
} else {
image = ImageIO.read(new File("img/unlock.png"));
}
g.drawImage(image, 0, 0, this);
} catch (IOException ex) {
LogFile.printErr("File not found: " + ex);
}
// vykresleni objektu
for (PaintObject paintObject : paintObjects) {
paintObject.paint(g2);
}
}
public static void updateMapView(Map map) {
if (map.equals(MapView.map)) {
// obnoveni objektu
paintObjects.clear();
// nahrat objekty
loadObject(map.getId());
}
}
public static void updateMapView(int mapId) {
for (Map map : Client.maps) {
if (map.equals(MapView.map)) {
// obnoveni objektu
paintObjects.clear();
// nahrat objekty
loadObject(map.getId());
}
}
}
private static void loadObject(int mapId) {
for (MapObject obj : Client.mapObject) {
if (obj.getMap() == mapId) {
paintObjects.add(new PaintObject(obj));
}
}
}
}

View File

@ -0,0 +1,299 @@
package jnet.client.gui;
import jnet.client.gui.dialog.ObjectDialog;
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.util.Iterator;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
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;
}
for (PaintObject node : MapView.paintObjects) {
// zruseni vybrani na vsech objektech
node.setSelected(false);
if (node.contains(e.getPoint())) {
if (createConnection) { // vytvareni propojeni - startovni body
startConMapObject = node;
endConnPoint = e.getPoint();
} else {
selectedObject = node;
// nastaveni vybraneho objektu
offset = new Point(
(int) selectedObject.getBoxX() - e.getX(),
(int) selectedObject.getBoxY() - e.getY()
);
// zvyrazneni vybraneho objektu
selectedObject.setSelected(true);
}
}
}
}
@Override
public void mouseReleased(MouseEvent e) { // vola se pri uvolneni tlacitka
if (selectedObject != null) {
// presouvani objektu
if (!map.isLock()) {// povoli upravy jen kdyz neni mapa zamcena
// odeslani nove pozice objektu
// TODO doresit kontrolu souradnic aby se zbytecne neodesilala zmena kdyz k ni nedojde
// zkontrolovat zda došlo ke zmene pozice
int[] data = {
selectedObject.getId(),
(int) selectedObject.getX(),
(int) selectedObject.getY()
};
NettyClient.send(Message.OBJECT_MOVE, data);
}
// dvojklik na objekt
if (e.getClickCount() == 2) {
doubleClickOnObject(selectedObject);
}
// prave kliknuti na objekt
if (e.getButton() == MouseEvent.BUTTON3) {
rightClickOnObject(e, selectedObject);
}
} else {
// prave kliknuti do volneho mista v mape
if (e.getButton() == MouseEvent.BUTTON3) {
rigthClick(e);
}
}
selectedObject = null;
offset = null;
if (createConnection) {
for (PaintObject node : MapView.paintObjects) {
if (node.contains(e.getPoint())) {
endConMapObject = node;
if (startConMapObject.getId() != endConMapObject.getId()) {
//new ObjectConnectionDialog(startConMapObject.getId(), endConMapObject.getId());
}
}
}
// zrusi vytvareni propojeni
createConnection = false;
}
}
@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) {
//jen pokud neni mapa zamcena
if (!map.isLock() && Client.user.isEditMap()) {
// vytvareni propojeni
if (createConnection) {
for (PaintObject node : MapView.paintObjects) {
if (node.contains(e.getPoint())) {
endConnPoint = node.getPoint();
break;
} else {
endConnPoint = e.getPoint();
}
}
} else {
// presunovani objektu
if (this.selectedObject != null && this.offset != null) {
// ziskani novych souradnic
Point to = e.getPoint();
to.x += offset.x;
to.y += offset.y;
//nastaveni nove pozice
selectedObject.setPosition(to);
}
}
}
}
@Override
public void mouseMoved(MouseEvent e) {
}
private void doubleClickOnObject(PaintObject selectedObject) {
int id = selectedObject.getId();
Iterator<MapObject> iteratorMapObject = Client.mapObject.iterator();
while (iteratorMapObject.hasNext()) {
MapObject obj = iteratorMapObject.next();
if (obj.getId() == id) {
new ObjectDialog(map.getId(), obj, false);
break;
}
}
}
private void rigthClick(MouseEvent me) {
JPopupMenu menu = new JPopupMenu();
// zamek mapy
JMenuItem itemLock;
if (map.isLock()) {
itemLock = new JMenuItem("Odemknout mapu", new ImageIcon("img/unlock.png"));
} else {
itemLock = new JMenuItem("Zamknout mapu", new ImageIcon("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 = new JMenuItem("Přidat objekt", new ImageIcon("img/add.png"));
itemAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MapObject mo = new MapObject();
mo.setX(me.getX());
mo.setY(me.getY());
new ObjectDialog(map.getId(), mo, true);
}
});
itemAdd.setEnabled(!map.isLock());
menu.add(itemAdd);
}
// polozka pridani propojeni
/*
JMenuItem itemPropoj = new JMenuItem("Přidat propojení", new ImageIcon("img/arrow.png"));
itemPropoj.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
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 = new JMenuItem("Winbox", new ImageIcon("img/winbox.png"));
itemWinbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//AppLauncher.winbox(obj.getObject().getIp(), obj.getObject().getService().getPortWinbox(), obj.getObject().getUser(), obj.getObject().getPassword());
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 = new JMenuItem("Otevřít v prohlížeči", new ImageIcon("img/browser.png"));
itemWeb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new ExtAppManager().runWeb(obj.getObject().getWebVerze(), obj.getObject().getIp(), obj.getObject().getWebPort());
}
});
menu.add(itemWeb);
}
if (obj.getObject().isSsh()) {
JMenuItem itemSsh = new JMenuItem("SSH", new ImageIcon("img/ssh.png"));
itemSsh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new ExtAppManager().runSshPutty(obj.getObject().getIp(), obj.getObject().getUser(), obj.getObject().getPassword(), Integer.parseInt(obj.getObject().getSshPort()));
//AppLauncher.ssh(obj.getObject().getIp(), obj.getObject().getUser(), obj.getObject().getPassword(), Integer.parseInt(obj.getObject().getService().getPortSsh()));
}
});
menu.add(itemSsh);
}
// ping na objekt
JMenuItem itemPingRemote = new JMenuItem("Ping", new ImageIcon("img/ping.png"));
itemPingRemote.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
});
menu.add(itemPingRemote);
// ping na objekt
JMenuItem itemPingLocal = new JMenuItem("Ping (lokální)", new ImageIcon("img/ping.png"));
itemPingLocal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
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 = new JMenuItem("Odebrat", new ImageIcon("img/trash.png"));
itemRemove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
NettyClient.send(Message.REMOVE_OBJECT, obj.getId());
}
});
itemRemove.setEnabled(!map.isLock());
menu.add(itemRemove);
}
// zobrazeni menu
menu.show(e.getComponent(), e.getX(), e.getY());
}
}

View File

@ -0,0 +1,101 @@
package jnet.client.gui;
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.File;
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(new File("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(new File("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(new File("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(new File("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,253 @@
package jnet.client.gui;
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,212 @@
package jnet.client.gui;
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.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.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 pokusuField = new JTextField(String.valueOf(Client.serverConfig.getPingAttempt()));
pokusuField.setBounds(x1, 60, 50, 25);
panel.add(pokusuField);
JLabel pokusuLabel = new JLabel("Počet pokusů před vyhodnocenim offline");
pokusuLabel.setBounds(x2, 60, 300, 25);
panel.add(pokusuLabel);
JTextField timeoutField = new JTextField(String.valueOf(Client.serverConfig.getPingTimeout()));
timeoutField.setBounds(x1, 100, 50, 25);
panel.add(timeoutField);
JLabel timeoutLabel = new JLabel("Úroveň timeout (ms)");
timeoutLabel.setBounds(x2, 100, 300, 25);
panel.add(timeoutLabel);
JTextField pokusuNestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityAttempt()));
pokusuNestField.setBounds(x1, 140, 50, 25);
panel.add(pokusuNestField);
JLabel pokusuNestLabel = new JLabel("Počet pokusů před vyhodnocením nestability");
pokusuNestLabel.setBounds(x2, 140, 300, 25);
panel.add(pokusuNestLabel);
JTextField nestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityLimit()));
nestField.setBounds(x1, 180, 50, 25);
panel.add(nestField);
JLabel nestLabel = new JLabel("Úroveň nestability (ms)");
nestLabel.setBounds(x2, 180, 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.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, 220, 100, 40);
panel.add(button);
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,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(new File("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

@ -0,0 +1,82 @@
package jnet.client.gui;
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,133 @@
package jnet.client.gui;
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(new File("img/yes.png")));
ImageIcon ii_no = new ImageIcon(ImageIO.read(new File("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,114 @@
package jnet.client.gui;
import jnet.client.Client;
import java.awt.AWTException;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import javax.imageio.ImageIO;
import jnet.lib.LogFile;
import jnet.lib.Status;
import jnet.lib.object.MapObject;
public class Tray {
private SystemTray tray = SystemTray.getSystemTray();
private static TrayIcon trayIcon;
private static PopupMenu menu = new PopupMenu();
public void createAndShowTray() {
try {
//Check the SystemTray is supported
if (!SystemTray.isSupported()) {
LogFile.printErr("SystemTray is not supported");
return;
}
// tray menu
MenuItem exitItem = new MenuItem("Ukončit");
exitItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
LogFile.printInfo("Exit appliaction from tray icon");
System.exit(0);
}
});
menu.add(exitItem);
trayIcon = new TrayIcon(ImageIO.read(new File("img/flag_gray.png")), Client.APP_NAME, menu);
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed( ActionEvent e ) {
//Double click - obnovit/minimalizovat
if (Client.okno.isVisible()) {
Client.okno.setVisible(false);
} else {
Client.okno.setVisible(true);
}
}}
);
tray = SystemTray.getSystemTray();
tray.add(trayIcon);
} catch (IOException ex) {
LogFile.printErr("TrayIcon error: " + ex.getMessage());
} catch (AWTException ex) {
LogFile.printErr("TrayIcon error: " + ex.getMessage());
}
}
public static void setIcon(String icon) {
try {
BufferedImage image = ImageIO.read(new File("img/"+icon));
trayIcon.setImage(image);
} catch (IOException ex) {
LogFile.printErr("TrayIcon error: " + ex.getMessage());
}
}
public static void setStatusOffline() {
setIcon("flag_red.png");
}
public static void setStatusOnline() {
setIcon("flag_green.png");
}
public static void setStatusWarning() {
setIcon("flag_orange.png");
}
public static void setStatusDisconnected() {
setIcon("flag_gray.png");
}
public static void refresh() {
Iterator<MapObject> iteratorMapObject = Client.mapObject.iterator();
while (iteratorMapObject.hasNext()) {
MapObject obj = iteratorMapObject.next();
switch (obj.getStatus()) {
case Status.OFFLINE:
setStatusOffline();
case Status.WARNING:
setStatusWarning();
break;
default:
setStatusOnline();
}
}
}
}

View File

@ -0,0 +1,152 @@
package jnet.client.gui;
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
Dimension d = new Dimension(1024, 800);
this.setPreferredSize(d);
this.setSize(d);
this.setLocationRelativeTo(null);
try {
this.setIconImage(ImageIO.read(new File("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.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

@ -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

@ -0,0 +1,607 @@
package jnet.client.gui.dialog;
import jnet.client.Client;
import jnet.client.network.NettyClient;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
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.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import jnet.lib.EventComparator;
import jnet.lib.LogFile;
import jnet.lib.Message;
import jnet.lib.Status;
import jnet.lib.object.Event;
import jnet.lib.object.MapObject;
import jnet.lib.object.ObjectType;
import jnet.lib.object.SnmpProfile;
public class ObjectDialog extends JDialog {
private MapObject obj;
private int mapId;
private Boolean newObject;
private JTextField nazevText = new JTextField();
private JLabel nazevWarning = new JLabel("Název musi mit min. 3 znaky");
private JTextField ipText = new JTextField();
private JLabel ipWarning = new JLabel("Neplatná IP adresa");
private JComboBox<String> typeComboBox = new JComboBox<String>();
private JTextField userText = new JTextField();
private JPasswordField hesloText = new JPasswordField();
private DefaultComboBoxModel<String> snmpmodel = new DefaultComboBoxModel<String>();
private JCheckBox disableCheBox = new JCheckBox();
private JTextField locationText = new JTextField();
private JTextArea descriptionText = new JTextArea();
private JCheckBox winboxBox = new JCheckBox("Winbox");
private JTextField portWinbox = new JTextField("8291");
private JCheckBox sshBox = new JCheckBox("SSH");
private JTextField portSsh = new JTextField("22");
private JCheckBox wwwBox = new JCheckBox("Web");
private JTextField portWww = new JTextField("80");
private JComboBox<String> wwwVerzeComboBox = new JComboBox<String>();
private JCheckBox telnetBox = new JCheckBox("Telnet");
private JTextField portTelnet = new JTextField("23");
private JCheckBox smstBox = new JCheckBox("Summit SMS");
private JTextField portSms = new JTextField("5020");
private JComboBox<String> smsVerzeComboBox = new JComboBox<String>();
private JComboBox<String> snmpProfileComboBox = new JComboBox<String>();
public ObjectDialog(int mapId, MapObject obj, boolean newObject) {
this.obj = obj;
this.mapId = mapId;
this.newObject = newObject;
if (newObject) {
setTitle("Nový objekt");
} else {
setTitle("Vlastnosti objektu");
}
setSize(600, 520);
setLocationRelativeTo(null);
setVisible(true);
setAlwaysOnTop(false);
setResizable(false);
setLayout(new BorderLayout());
JTabbedPane tabbedPane = new JTabbedPane();
JScrollPane tabNastaveni = new JScrollPane(tabNastaveni(),
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
tabbedPane.addTab("Informace", tabInfo());
tabbedPane.addTab("Nastaveni", tabNastaveni);
tabbedPane.addTab("Služby", tabSluzby());
tabbedPane.addTab("Události", tabUdalosti());
//tabbedPane.addTab("Sondy", tabSondy());
// pokud se jedna o novy objekt
if (newObject) {
tabbedPane.setSelectedIndex(1); // prepne na kartu nastaveni
tabbedPane.setEnabledAt(0, false); // vypne kartu informace
tabbedPane.setEnabledAt(3, false); // vypne kartu udalosti
}
add(tabbedPane, BorderLayout.CENTER);
JPanel pane = new JPanel();
JButton save = new JButton("Ulozit");
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// kontrola chyb
if (nazevText.getText().length() < 3) {
nazevWarning.setVisible(true);
return;
}
nazevWarning.setVisible(false);
if (!validateIp(ipText.getText())) {
ipWarning.setVisible(true);
return;
}
ipWarning.setVisible(false);
// ulozeni do objektu
obj.setMap(mapId);
obj.setName(nazevText.getText());
obj.setIp(ipText.getText());
obj.setUser(userText.getText());
obj.setPassword(new String(hesloText.getPassword()));
for (int i = 0; i < Client.objectType.size(); i++) {
if (typeComboBox.getSelectedIndex() == i) {
obj.setObjectType(Client.objectType.get(i).getId());
}
}
obj.setSnmpProfile(Client.snmpProfile.get(snmpProfileComboBox.getSelectedIndex()).getId());
obj.setActive(disableCheBox.isSelected());
obj.setDescription(descriptionText.getText());
obj.setLocation(locationText.getText());
obj.setWinbox(winboxBox.isSelected());
obj.setWinboxPort(portWinbox.getText());
obj.setSsh(sshBox.isSelected());
obj.setSshPort(portSsh.getText());
obj.setWeb(wwwBox.isSelected());
obj.setWebPort(portWww.getText());
obj.setWebVerze(wwwVerzeComboBox.getSelectedIndex());
obj.setTelnet(telnetBox.isSelected());
obj.setTelnetPort(portTelnet.getText());
obj.setSms(smstBox.isSelected());
obj.setSmsPort(portSms.getText());
obj.setSmsVerze(smsVerzeComboBox.getSelectedIndex());
if (!obj.isActive() || newObject) {
obj.setStatus(Status.NA);
}
// ArrayList<SnmpProbe> probe = new ArrayList<>();
// if (!newObject) {
// probe.addAll(obj.getSnmpProbe());
// }
// obj.setSnmpProbe(probe);
if (newObject) {
NettyClient.send(Message.ADD_OBJECT, obj);
} else {
NettyClient.send(Message.UPDATE_OBJECT, obj);
}
// zavreni dialogu
dispose();
}
});
pane.add(save);
JButton cancel = new JButton("Zrusit");
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
pane.add(cancel);
add(pane, BorderLayout.PAGE_END);
// nacteni snmp profilu
for (SnmpProfile sp : Client.snmpProfile) {
snmpmodel.addElement(sp.getName());
}
// doplneni poli dialogu podle vybraneho objektu
if (!newObject) {
nazevText.setText(obj.getName());
ipText.setText(obj.getIp());
userText.setText(obj.getUser());
hesloText.setText(obj.getPassword());
for (int i = 0; i < Client.objectType.size() - 1; i++) {
if (obj.getObjectType() == Client.objectType.get(i).getId()) {
typeComboBox.setSelectedIndex(i);
}
}
for (int i = 0; i < Client.snmpProfile.size(); i++) {
if (Client.snmpProfile.get(i).getId() == obj.getSnmpProfile()) {
snmpProfileComboBox.setSelectedIndex(i);
}
}
disableCheBox.setSelected(obj.isActive());
descriptionText.setText(obj.getDescription());
locationText.setText(obj.getLocation());
winboxBox.setSelected(obj.isWinbox());
portWinbox.setText(obj.getWinboxPort());
sshBox.setSelected(obj.isSsh());
portSsh.setText(obj.getSshPort());
wwwBox.setSelected(obj.isWeb());
portWww.setText(obj.getWebPort());
wwwVerzeComboBox.setSelectedIndex(obj.getWebVerze());
telnetBox.setSelected(obj.isTelnet());
portTelnet.setText(obj.getTelnetPort());
smstBox.setSelected(obj.isSms());
portSms.setText(obj.getSmsPort());
smsVerzeComboBox.setSelectedIndex(obj.getSmsVerze());
} else {
disableCheBox.setSelected(true);
}
show();
}
private JPanel tabInfo() {
JPanel p = new JPanel(null);
/*
Map<String, String> label = new HashMap<String, String>();
label.put("Popis", "1.3.6.1.2.1.1.1.0");
label.put("Uptime", "1.3.6.1.2.1.1.3.0");
label.put("Contact", "1.3.6.1.2.1.1.4.0");
label.put("Name", "1.3.6.1.2.1.1.5.0");
if(!newObject){ /// TODO u objektu u kterych neni snmp protokol povolen vraci system err null
Thread ti = new Thread() {
@Override
public void run() {
super.run();
// nacteni snmp profilu
String port = "161";
String community = "public";
int version = SNMPManager.version1;
for (SnmpProfile sp : Client.serverSettings.getSnmp()) {
if (obj.getSnmpProfile() == sp.getId()) {
port = sp.getPort();
community = sp.getCommunity();
version = sp.getVersion();
break;
}
}
SNMPManager mngr = new SNMPManager(obj.getIp(), port, community, version);
try {
mngr.start();
} catch (Exception e) {
}
int y = 30;
for (Entry<String, String> entry : label.entrySet()) {
try {
JLabel label = new JLabel(entry.getKey());
label.setBounds(20, y, 90, 25);
JLabel value = new JLabel(mngr.getAsString(new OID(entry.getValue())));
value.setBounds(100, y, 200, 25);
p.add(label);
p.add(value);
y += 30;
p.revalidate();
p.repaint();
} catch (Exception e) {
LogFile.printErr("Object dialog - SNMP error: " + e);
}
}
}
};
ti.start();
}
*/
return p;
}
private JPanel tabNastaveni() {
JPanel p = new JPanel();
p.setLayout(null);
JLabel nazevLabel = new JLabel("Název");
nazevLabel.setBounds(20, 30, 80, 25);
p.add(nazevLabel);
nazevText.setBounds(110, 30, 160, 25);
p.add(nazevText);
nazevWarning.setForeground(Color.red);
nazevWarning.setBounds(110, 55, 160, 25);
nazevWarning.setVisible(false);
p.add(nazevWarning);
JLabel ipLabel = new JLabel("IP adresa");
ipLabel.setBounds(300, 30, 80, 25);
p.add(ipLabel);
ipText.setBounds(390, 30, 160, 25);
p.add(ipText);
ipWarning.setForeground(Color.red);
ipWarning.setBounds(390, 55, 160, 25);
ipWarning.setVisible(false);
p.add(ipWarning);
JLabel typLabel = new JLabel("Typ");
typLabel.setBounds(20, 130, 80, 25);
p.add(typLabel);
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
for (ObjectType obj : Client.objectType) {
model.addElement(obj.getName());
}
typeComboBox.setModel(model);
typeComboBox.setBounds(110, 130, 160, 25);
p.add(typeComboBox);
JLabel userLabel = new JLabel("Uživatel");
userLabel.setBounds(20, 80, 80, 25);
p.add(userLabel);
userText.setBounds(110, 80, 160, 25);
p.add(userText);
JLabel hesloLabel = new JLabel("Heslo");
hesloLabel.setBounds(300, 80, 80, 25);
p.add(hesloLabel);
hesloText.setBounds(390, 80, 160, 25);
p.add(hesloText);
JLabel snmpLabel = new JLabel("SNMP profil");
snmpLabel.setBounds(300, 130, 80, 25);
p.add(snmpLabel);
snmpProfileComboBox.setModel(snmpmodel);
snmpProfileComboBox.setBounds(390, 130, 160, 25);
p.add(snmpProfileComboBox);
JLabel disableLabel = new JLabel("Aktivní");
disableLabel.setBounds(20, 180, 80, 25);
p.add(disableLabel);
disableCheBox.setBounds(110, 180, 160, 25);
p.add(disableCheBox);
JButton snmpTest = new JButton("Test SNMP");
snmpTest.setBounds(390, 180, 160, 25);
snmpTest.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
/* TODO idealne at test provede server (ten bude osesilat informace o snmp pozadavky!!!!
Thread testSnmp = new Thread() {
@Override
public void run() {
try {
// nacteni snmp profilu
String port = "161";
String community = "public";
int version = SNMPManager.version1;
for (int i = 0; i < Client.serverSettings.getSnmp().size(); i++) {
if (snmpProfileComboBox.getSelectedIndex() == i) {
port = Client.serverSettings.getSnmp().get(i).getPort();
community = Client.serverSettings.getSnmp().get(i).getCommunity();
version = Client.serverSettings.getSnmp().get(i).getVersion();
break;
}
}
SNMPManager mngr = new SNMPManager(ipText.getText(), port, community, version);
mngr.start();
String desc = mngr.getSysDescr();
JOptionPane.showMessageDialog(ObjectDialog.this, "Odpoved: " + desc, "SNMP test", JOptionPane.INFORMATION_MESSAGE);
} catch (Exception ex) {
JOptionPane.showMessageDialog(ObjectDialog.this, "SNMP se nepodařilo načíst", "SNMP test", JOptionPane.ERROR_MESSAGE);
System.err.println("SNMP test error: " + ex.getMessage());
}
}
};
testSnmp.start();
*/
}
});
p.add(snmpTest);
JLabel locLabel = new JLabel("Umístění");
locLabel.setBounds(20, 230, 80, 25);
p.add(locLabel);
locationText.setBounds(110, 230, 440, 25);
p.add(locationText);
JLabel descLabel = new JLabel("Poznámka");
descLabel.setBounds(20, 280, 80, 25);
p.add(descLabel);
descriptionText.setBounds(110, 280, 440, 100);
descriptionText.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(10, 10, 10, 10)));
p.add(descriptionText);
return p;
}
private JPanel tabSluzby() {
JPanel p = new JPanel();
p.setLayout(null);
winboxBox.setBounds(20, 30, 80, 25);
p.add(winboxBox);
JLabel winbox_port = new JLabel("port:");
winbox_port.setBounds(130, 30, 60, 25);
p.add(winbox_port);
portWinbox.setBounds(180, 30, 60, 25);
p.add(portWinbox);
sshBox.setBounds(20, 60, 80, 25);
p.add(sshBox);
JLabel ssh_port = new JLabel("port:");
ssh_port.setBounds(130, 60, 60, 25);
p.add(ssh_port);
portSsh.setBounds(180, 60, 60, 25);
p.add(portSsh);
wwwBox.setBounds(20, 90, 80, 25);
p.add(wwwBox);
JLabel www_port = new JLabel("port:");
www_port.setBounds(130, 90, 60, 25);
p.add(www_port);
portWww.setBounds(180, 90, 60, 25);
p.add(portWww);
JLabel www_verze = new JLabel("verze:");
www_verze.setBounds(260, 90, 60, 25);
p.add(www_verze);
wwwVerzeComboBox.setModel(new DefaultComboBoxModel(new String[]{"HTTP", "HTTPS"}));
wwwVerzeComboBox.setBounds(320, 90, 80, 25);
p.add(wwwVerzeComboBox);
telnetBox.setBounds(20, 120, 80, 25);
p.add(telnetBox);
JLabel telnet_port = new JLabel("port:");
telnet_port.setBounds(130, 120, 60, 25);
p.add(telnet_port);
portTelnet.setBounds(180, 120, 60, 25);
p.add(portTelnet);
smstBox.setBounds(20, 150, 80, 25);
p.add(smstBox);
JLabel sms_port = new JLabel("port:");
sms_port.setBounds(130, 150, 60, 25);
p.add(sms_port);
portSms.setBounds(180, 150, 60, 25);
p.add(portSms);
JLabel sms_verze = new JLabel("verze:");
sms_verze.setBounds(260, 150, 60, 25);
p.add(sms_verze);
smsVerzeComboBox.setModel(new DefaultComboBoxModel(new String[]{"SDV", "BT"}));
smsVerzeComboBox.setBounds(320, 150, 80, 25);
p.add(smsVerzeComboBox);
return p;
}
private JPanel tabUdalosti() {
String column[] = {"Začátek", "Konec", "Stav"};
DefaultTableModel tableModel = new DefaultTableModel(column, 0) {
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
try {
// TODO pri vytvareni noveho objektu to vyhodi chybu
Collections.sort(Client.events, new EventComparator());
Collections.reverse(Client.events);
if (!newObject) {
for (Event e : Client.events) {
if (e.getObject() == obj.getId()) {
Object[] d = {
getDate(e.getStart()),
getDate(e.getEnd()),
e.getDescription()};
tableModel.addRow(d);
}
}
}
} catch (Exception e) {
LogFile.printErr("Object log error: " + e.getMessage());
}
JTable table = new JTable(tableModel);
table.setPreferredScrollableViewportSize(new Dimension(500, 350)); // Šířka 500, výška 300
JButton btn = new JButton("Smazat události");
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tableModel.setRowCount(0);
NettyClient.send(Message.DELETE_LOG, obj.getId());
}
});
JPanel panel = new JPanel();
panel.add(new JScrollPane(table));
panel.add(btn);
return panel;
}
private JPanel tabSondy() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
String column[] = {"Popis", "OID", "Aktivni", "Zobrazit"};
DefaultTableModel tableModel = new DefaultTableModel(column, 0);
if (!newObject) {
// try {
// for (SnmpProbe p : obj.getSnmpProbe()) {
// Object[] d = {p.getName(), p.getOid(), "", ""};
// tableModel.addRow(d);
// }
// } catch (Exception e) {
// LogFile.printErr("Probe list " + e.getMessage());
// }
}
JScrollPane table = new JScrollPane();
table.add(new JTable(tableModel));
panel.add(new JTable(tableModel), BorderLayout.CENTER);
JPanel jp = new JPanel();
jp.add(new JLabel("Přidat: "));
panel.add(jp, BorderLayout.PAGE_END);
return panel;
}
private boolean validateIp(String ip) {
Pattern pattern = Pattern.compile("^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
Matcher matcher = pattern.matcher(ip);
return matcher.matches();
}
private boolean validatePort(String port) {
try {
int pNum = Integer.parseInt(port);
if ((pNum > 0) && (pNum < 65536)) {
return true;
}
} catch (NumberFormatException e) {
}
return false;
}
private String getDate(long date) {
if (date != 0) {
SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
return ft.format(new Date(date));
}
return "";
}
private String getStatus(int status) {
switch (status) {
case Status.OK: // online
return "online";
case Status.WARNING: // warning
return "varování";
case Status.OFFLINE: // offline
return "offline";
default: // other
return "n/a";
}
}
}

View File

@ -0,0 +1,59 @@
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;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import jnet.lib.LogFile;
import jnet.lib.object.OnlineClients;
public class OnlineClientsDialog extends JDialog {
public OnlineClientsDialog() {
setTitle("Online klienti");
setLocationRelativeTo(null);
setAlwaysOnTop(true);
setLayout(new FlowLayout(FlowLayout.CENTER));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.setBorder(new EmptyBorder(10, 25, 10, 25));
panel.add(Box.createRigidArea(new Dimension(5, 10)));
for (OnlineClients oc : Client.onlineClients) {
try {
JLabel line = new JLabel(" " + oc.getUsername() + " (" + oc.getIp() + ")");
switch (oc.getPlatform()) {
case OnlineClients.PLATFORM_MOBILE:
line.setIcon(new ImageIcon(ImageIO.read(new File("img/platform_android.png"))));
break;
case OnlineClients.PLATFORM_PC:
line.setIcon(new ImageIcon(ImageIO.read(new File("img/platform_pc.png"))));
break;
}
panel.add(line);
panel.add(Box.createRigidArea(new Dimension(5, 10)));
} catch (IOException ex) {
LogFile.printErr("Online Clients dialog exception: " + ex.getMessage());
}
panel.add(Box.createRigidArea(new Dimension(5, 20)));
}
add(panel);
pack();
setVisible(true);
}
}

View File

@ -0,0 +1,157 @@
package jnet.client.gui.dialog;
import jnet.client.gui.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

@ -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;
}
}
}