From 67511b8aad6c1162bbd8ba01e1d4cd9a0bb1e107 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 14 Jul 2014 20:58:42 +0200 Subject: mavenization on its way... --- Dozentenmodul/bin/Image_zu_Veranstaltung_HDD.png | Bin 34300 -> 0 bytes Dozentenmodul/bin/Logo_bwLehrpool.png | Bin 29052 -> 0 bytes Dozentenmodul/bin/auth/Authentification.class | Bin 449 -> 0 bytes Dozentenmodul/bin/config/config_file.class | Bin 1692 -> 0 bytes Dozentenmodul/bin/ftp/DownloadTask.class | Bin 3851 -> 0 bytes Dozentenmodul/bin/ftp/FTPException.class | Bin 336 -> 0 bytes Dozentenmodul/bin/ftp/FTPUtility.class | Bin 4632 -> 0 bytes Dozentenmodul/bin/ftp/UploadTask.class | Bin 3496 -> 0 bytes .../bin/gui/image/CreateImageAllgemein_GUI.class | Bin 8279 -> 0 bytes .../bin/gui/image/CreateImageTechnisch_GUI.class | Bin 8531 -> 0 bytes Dozentenmodul/bin/gui/image/DeleteImage_GUI.class | Bin 12376 -> 0 bytes .../bin/gui/image/EditImageAllgemein_GUI.class | Bin 10015 -> 0 bytes .../bin/gui/image/EditImageTechnisch_GUI.class | Bin 8509 -> 0 bytes .../bin/gui/image/FTPCreateUploader_GUI.class | Bin 13025 -> 0 bytes .../bin/gui/image/FTPDownloader_GUI.class | Bin 11126 -> 0 bytes .../bin/gui/image/FTPEditUploader_GUI.class | Bin 12738 -> 0 bytes .../bin/gui/image/SearchEditImage_GUI.class | Bin 12507 -> 0 bytes Dozentenmodul/bin/gui/image/SearchImage_GUI.class | Bin 12262 -> 0 bytes .../bin/gui/intro/BillOfRights_GUI$1.class | Bin 710 -> 0 bytes .../bin/gui/intro/BillOfRights_GUI$2.class | Bin 2231 -> 0 bytes .../bin/gui/intro/BillOfRights_GUI$3.class | Bin 959 -> 0 bytes Dozentenmodul/bin/gui/intro/BillOfRights_GUI.class | Bin 10743 -> 0 bytes Dozentenmodul/bin/gui/intro/Login_GUI.class | Bin 9418 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$1.class | Bin 692 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$10.class | Bin 2247 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$2.class | Bin 1088 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$3.class | Bin 1006 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$4.class | Bin 977 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$5.class | Bin 1068 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$6.class | Bin 1083 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$7.class | Bin 974 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$8.class | Bin 996 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI$9.class | Bin 1096 -> 0 bytes Dozentenmodul/bin/gui/intro/MainMenue_GUI.class | Bin 10342 -> 0 bytes Dozentenmodul/bin/gui/intro/VmWareLink_GUI$1.class | Bin 695 -> 0 bytes Dozentenmodul/bin/gui/intro/VmWareLink_GUI.class | Bin 4931 -> 0 bytes .../gui/lecture/CreateLectureAllgemein_GUI.class | Bin 10580 -> 0 bytes .../bin/gui/lecture/EditLectureAllgemein_GUI.class | Bin 9792 -> 0 bytes .../lecture/ExtendedSearchForImages_GUI$1.class | Bin 937 -> 0 bytes .../lecture/ExtendedSearchForImages_GUI$2.class | Bin 931 -> 0 bytes .../lecture/ExtendedSearchForImages_GUI$3.class | Bin 1225 -> 0 bytes .../gui/lecture/ExtendedSearchForImages_GUI.class | Bin 6193 -> 0 bytes Dozentenmodul/bin/models/SessionData.class | Bin 1041 -> 0 bytes Dozentenmodul/bin/models/user.class | Bin 718 -> 0 bytes Dozentenmodul/bin/org.eclipse.core.resources.prefs | 2 - Dozentenmodul/bin/org.eclipse.jdt.core.prefs | 11 - .../org/eclipse/wb/swt/SWTResourceManager.class | Bin 11070 -> 0 bytes Dozentenmodul/bin/thrift/AuthenticationError.class | Bin 1583 -> 0 bytes ...ion$AuthenticationExceptionStandardScheme.class | Bin 2988 -> 0 bytes ...henticationExceptionStandardSchemeFactory.class | Bin 1157 -> 0 bytes ...eption$AuthenticationExceptionTupleScheme.class | Bin 2442 -> 0 bytes ...AuthenticationExceptionTupleSchemeFactory.class | Bin 1133 -> 0 bytes .../thrift/AuthenticationException$_Fields.class | Bin 3046 -> 0 bytes .../bin/thrift/AuthenticationException.class | Bin 11125 -> 0 bytes Dozentenmodul/bin/thrift/AuthorizationError.class | Bin 1494 -> 0 bytes ...tion$AuthorizationExceptionStandardScheme.class | Bin 2973 -> 0 bytes ...thorizationExceptionStandardSchemeFactory.class | Bin 1141 -> 0 bytes ...ception$AuthorizationExceptionTupleScheme.class | Bin 2427 -> 0 bytes ...$AuthorizationExceptionTupleSchemeFactory.class | Bin 1117 -> 0 bytes .../thrift/AuthorizationException$_Fields.class | Bin 3036 -> 0 bytes .../bin/thrift/AuthorizationException.class | Bin 11081 -> 0 bytes .../thrift/ImageServer$AsyncClient$Factory.class | Bin 1477 -> 0 bytes ...ImageServer$AsyncClient$authenticate_call.class | Bin 3336 -> 0 bytes ...eServer$AsyncClient$getUserFromToken_call.class | Bin 3257 -> 0 bytes .../thrift/ImageServer$AsyncClient$ping_call.class | Bin 2925 -> 0 bytes .../bin/thrift/ImageServer$AsyncClient.class | Bin 3081 -> 0 bytes .../bin/thrift/ImageServer$AsyncIface.class | Bin 538 -> 0 bytes ...ImageServer$AsyncProcessor$authenticate$1.class | Bin 3150 -> 0 bytes .../ImageServer$AsyncProcessor$authenticate.class | Bin 3247 -> 0 bytes ...eServer$AsyncProcessor$getUserFromToken$1.class | Bin 3170 -> 0 bytes ...ageServer$AsyncProcessor$getUserFromToken.class | Bin 3241 -> 0 bytes .../thrift/ImageServer$AsyncProcessor$ping$1.class | Bin 2953 -> 0 bytes .../thrift/ImageServer$AsyncProcessor$ping.class | Bin 3032 -> 0 bytes .../bin/thrift/ImageServer$AsyncProcessor.class | Bin 2446 -> 0 bytes .../bin/thrift/ImageServer$Client$Factory.class | Bin 1451 -> 0 bytes Dozentenmodul/bin/thrift/ImageServer$Client.class | Bin 3970 -> 0 bytes Dozentenmodul/bin/thrift/ImageServer$Iface.class | Bin 502 -> 0 bytes .../ImageServer$Processor$authenticate.class | Bin 2329 -> 0 bytes .../ImageServer$Processor$getUserFromToken.class | Bin 2337 -> 0 bytes .../bin/thrift/ImageServer$Processor$ping.class | Bin 1919 -> 0 bytes .../bin/thrift/ImageServer$Processor.class | Bin 2324 -> 0 bytes .../ImageServer$authenticate_args$_Fields.class | Bin 3142 -> 0 bytes ...cate_args$authenticate_argsStandardScheme.class | Bin 2850 -> 0 bytes ...gs$authenticate_argsStandardSchemeFactory.class | Bin 1191 -> 0 bytes ...nticate_args$authenticate_argsTupleScheme.class | Bin 2314 -> 0 bytes ..._args$authenticate_argsTupleSchemeFactory.class | Bin 1167 -> 0 bytes .../bin/thrift/ImageServer$authenticate_args.class | Bin 10868 -> 0 bytes .../ImageServer$authenticate_result$_Fields.class | Bin 3158 -> 0 bytes ..._result$authenticate_resultStandardScheme.class | Bin 2987 -> 0 bytes ...$authenticate_resultStandardSchemeFactory.class | Bin 1223 -> 0 bytes ...ate_result$authenticate_resultTupleScheme.class | Bin 2449 -> 0 bytes ...ult$authenticate_resultTupleSchemeFactory.class | Bin 1199 -> 0 bytes .../thrift/ImageServer$authenticate_result.class | Bin 11542 -> 0 bytes ...ImageServer$getUserFromToken_args$_Fields.class | Bin 3091 -> 0 bytes ..._args$getUserFromToken_argsStandardScheme.class | Bin 2711 -> 0 bytes ...etUserFromToken_argsStandardSchemeFactory.class | Bin 1255 -> 0 bytes ...ken_args$getUserFromToken_argsTupleScheme.class | Bin 2196 -> 0 bytes ...s$getUserFromToken_argsTupleSchemeFactory.class | Bin 1231 -> 0 bytes .../thrift/ImageServer$getUserFromToken_args.class | Bin 9748 -> 0 bytes ...ageServer$getUserFromToken_result$_Fields.class | Bin 3198 -> 0 bytes ...ult$getUserFromToken_resultStandardScheme.class | Bin 3025 -> 0 bytes ...UserFromToken_resultStandardSchemeFactory.class | Bin 1287 -> 0 bytes ...result$getUserFromToken_resultTupleScheme.class | Bin 2487 -> 0 bytes ...getUserFromToken_resultTupleSchemeFactory.class | Bin 1263 -> 0 bytes .../ImageServer$getUserFromToken_result.class | Bin 11659 -> 0 bytes .../bin/thrift/ImageServer$ping_args$_Fields.class | Bin 2863 -> 0 bytes ...eServer$ping_args$ping_argsStandardScheme.class | Bin 2150 -> 0 bytes ...$ping_args$ping_argsStandardSchemeFactory.class | Bin 1063 -> 0 bytes ...mageServer$ping_args$ping_argsTupleScheme.class | Bin 1460 -> 0 bytes ...ver$ping_args$ping_argsTupleSchemeFactory.class | Bin 1039 -> 0 bytes .../bin/thrift/ImageServer$ping_args.class | Bin 7314 -> 0 bytes .../thrift/ImageServer$ping_result$_Fields.class | Bin 2995 -> 0 bytes ...ver$ping_result$ping_resultStandardScheme.class | Bin 2557 -> 0 bytes ...g_result$ping_resultStandardSchemeFactory.class | Bin 1095 -> 0 bytes ...Server$ping_result$ping_resultTupleScheme.class | Bin 2014 -> 0 bytes ...ping_result$ping_resultTupleSchemeFactory.class | Bin 1071 -> 0 bytes .../bin/thrift/ImageServer$ping_result.class | Bin 9526 -> 0 bytes Dozentenmodul/bin/thrift/ImageServer.class | Bin 1037 -> 0 bytes ...ption$InvalidTokenExceptionStandardScheme.class | Bin 2164 -> 0 bytes ...nvalidTokenExceptionStandardSchemeFactory.class | Bin 1125 -> 0 bytes ...xception$InvalidTokenExceptionTupleScheme.class | Bin 1474 -> 0 bytes ...n$InvalidTokenExceptionTupleSchemeFactory.class | Bin 1101 -> 0 bytes .../bin/thrift/InvalidTokenException$_Fields.class | Bin 2829 -> 0 bytes .../bin/thrift/InvalidTokenException.class | Bin 7448 -> 0 bytes .../bin/thrift/MasterThriftConnection.class | Bin 2125 -> 0 bytes .../SessionData$SessionDataStandardScheme.class | Bin 2843 -> 0 bytes ...sionData$SessionDataStandardSchemeFactory.class | Bin 965 -> 0 bytes .../SessionData$SessionDataTupleScheme.class | Bin 2290 -> 0 bytes ...SessionData$SessionDataTupleSchemeFactory.class | Bin 941 -> 0 bytes Dozentenmodul/bin/thrift/SessionData$_Fields.class | Bin 3030 -> 0 bytes Dozentenmodul/bin/thrift/SessionData.class | Bin 12076 -> 0 bytes Dozentenmodul/bin/thrift/ThriftConnection.class | Bin 2326 -> 0 bytes .../thrift/UserInfo$UserInfoStandardScheme.class | Bin 2967 -> 0 bytes .../UserInfo$UserInfoStandardSchemeFactory.class | Bin 917 -> 0 bytes .../bin/thrift/UserInfo$UserInfoTupleScheme.class | Bin 2378 -> 0 bytes .../UserInfo$UserInfoTupleSchemeFactory.class | Bin 893 -> 0 bytes Dozentenmodul/bin/thrift/UserInfo$_Fields.class | Bin 3064 -> 0 bytes Dozentenmodul/bin/thrift/UserInfo.class | Bin 12630 -> 0 bytes Dozentenmodul/pom.xml | 183 ++ Dozentenmodul/src/auth/Authentification.java | 12 - Dozentenmodul/src/config/config_file.java | 66 - Dozentenmodul/src/ftp/DownloadTask.java | 112 - Dozentenmodul/src/ftp/FTPException.java | 8 - Dozentenmodul/src/ftp/FTPUtility.java | 201 -- Dozentenmodul/src/ftp/UploadTask.java | 98 - .../src/gui/image/CreateImageAllgemein_GUI.java | 355 --- .../src/gui/image/CreateImageFreigabe_GUI.java | 264 -- .../src/gui/image/CreateImageTechnisch_GUI.java | 405 --- Dozentenmodul/src/gui/image/DeleteImage_GUI.java | 633 ----- .../src/gui/image/EditImageAllgemein_GUI.java | 424 --- .../src/gui/image/EditImageFreigabe_GUI.java | 262 -- .../src/gui/image/EditImageTechnisch_GUI.java | 403 --- .../src/gui/image/FTPCreateUploader_GUI.java | 547 ---- Dozentenmodul/src/gui/image/FTPDownloader_GUI.java | 484 ---- .../src/gui/image/FTPEditUploader_GUI.java | 538 ---- .../src/gui/image/SearchEditImage_GUI.java | 596 ---- Dozentenmodul/src/gui/image/SearchImage_GUI.java | 529 ---- .../src/gui/image/SearchMethodLecture_GUI.java | 290 -- Dozentenmodul/src/gui/intro/About_GUI.java | 95 - Dozentenmodul/src/gui/intro/BillOfRights_GUI.java | 241 -- Dozentenmodul/src/gui/intro/Login_GUI.java | 336 --- Dozentenmodul/src/gui/intro/MainMenue_GUI.java | 462 ---- Dozentenmodul/src/gui/intro/VmWareLink_GUI.java | 292 -- .../gui/lecture/CreateLectureAllgemein_GUI.java | 545 ---- .../src/gui/lecture/CreateLectureLink_GUI.java | 540 ---- .../src/gui/lecture/DeleteLecture_GUI.java | 495 ---- .../src/gui/lecture/EditLectureAllgemein_GUI.java | 454 ---- .../src/gui/lecture/EditLectureLink_GUI.java | 532 ---- .../src/gui/lecture/EditLectureSearch_GUI.java | 563 ---- .../gui/lecture/ExtendedSearchForImages_GUI.java | 269 -- .../src/gui/lecture/SearchLecture_GUI.java | 453 --- .../src/main/java/auth/Authentification.java | 12 + .../src/main/java/config/config_file.java | 66 + Dozentenmodul/src/main/java/ftp/DownloadTask.java | 112 + Dozentenmodul/src/main/java/ftp/FTPException.java | 8 + Dozentenmodul/src/main/java/ftp/FTPUtility.java | 201 ++ Dozentenmodul/src/main/java/ftp/UploadTask.java | 98 + .../java/gui/image/CreateImageAllgemein_GUI.java | 355 +++ .../java/gui/image/CreateImageFreigabe_GUI.java | 264 ++ .../java/gui/image/CreateImageTechnisch_GUI.java | 405 +++ .../src/main/java/gui/image/DeleteImage_GUI.java | 633 +++++ .../java/gui/image/EditImageAllgemein_GUI.java | 424 +++ .../main/java/gui/image/EditImageFreigabe_GUI.java | 262 ++ .../java/gui/image/EditImageTechnisch_GUI.java | 403 +++ .../main/java/gui/image/FTPCreateUploader_GUI.java | 547 ++++ .../src/main/java/gui/image/FTPDownloader_GUI.java | 484 ++++ .../main/java/gui/image/FTPEditUploader_GUI.java | 538 ++++ .../main/java/gui/image/SearchEditImage_GUI.java | 596 ++++ .../src/main/java/gui/image/SearchImage_GUI.java | 529 ++++ .../java/gui/image/SearchMethodLecture_GUI.java | 290 ++ .../src/main/java/gui/intro/About_GUI.java | 95 + .../src/main/java/gui/intro/BillOfRights_GUI.java | 241 ++ .../src/main/java/gui/intro/Login_GUI.java | 336 +++ .../src/main/java/gui/intro/MainMenue_GUI.java | 462 ++++ .../src/main/java/gui/intro/VmWareLink_GUI.java | 292 ++ .../gui/lecture/CreateLectureAllgemein_GUI.java | 545 ++++ .../java/gui/lecture/CreateLectureLink_GUI.java | 540 ++++ .../main/java/gui/lecture/DeleteLecture_GUI.java | 495 ++++ .../java/gui/lecture/EditLectureAllgemein_GUI.java | 454 ++++ .../main/java/gui/lecture/EditLectureLink_GUI.java | 532 ++++ .../java/gui/lecture/EditLectureSearch_GUI.java | 563 ++++ .../gui/lecture/ExtendedSearchForImages_GUI.java | 269 ++ .../main/java/gui/lecture/SearchLecture_GUI.java | 453 +++ Dozentenmodul/src/main/java/models/Client.java | 18 + Dozentenmodul/src/main/java/models/Image.java | 172 ++ Dozentenmodul/src/main/java/models/Lecture.java | 141 + Dozentenmodul/src/main/java/models/Links.java | 161 ++ .../src/main/java/models/SessionData.java | 30 + Dozentenmodul/src/main/java/models/person.java | 121 + Dozentenmodul/src/main/java/models/user.java | 23 + .../org/eclipse/wb/swt/SWTResourceManager.java | 447 +++ .../main/java/thrift/MasterThriftConnection.java | 46 + .../src/main/java/thrift/ThriftConnection.java | 53 + Dozentenmodul/src/main/java/util/GuiOrganizer.java | 26 + Dozentenmodul/src/main/java/util/OpenLinks.java | 20 + Dozentenmodul/src/models/Client.java | 18 - Dozentenmodul/src/models/Image.java | 172 -- Dozentenmodul/src/models/Lecture.java | 141 - Dozentenmodul/src/models/Links.java | 161 -- Dozentenmodul/src/models/SessionData.java | 30 - Dozentenmodul/src/models/person.java | 121 - Dozentenmodul/src/models/user.java | 23 - .../src/org/eclipse/wb/swt/SWTResourceManager.java | 447 --- .../src/test/java/bwlehrpool/AppTest.java | 38 + Dozentenmodul/src/thrift/AuthenticationError.java | 51 - .../src/thrift/AuthenticationException.java | 504 ---- Dozentenmodul/src/thrift/AuthorizationError.java | 48 - .../src/thrift/AuthorizationException.java | 504 ---- Dozentenmodul/src/thrift/ImageServer.java | 2871 -------------------- .../src/thrift/InvalidTokenException.java | 280 -- .../src/thrift/MasterThriftConnection.java | 46 - Dozentenmodul/src/thrift/SessionData.java | 597 ---- Dozentenmodul/src/thrift/ThriftConnection.java | 53 - Dozentenmodul/src/thrift/UserInfo.java | 688 ----- Dozentenmodul/src/util/GuiOrganizer.java | 26 - Dozentenmodul/src/util/OpenLinks.java | 20 - 236 files changed, 12983 insertions(+), 18318 deletions(-) delete mode 100644 Dozentenmodul/bin/Image_zu_Veranstaltung_HDD.png delete mode 100644 Dozentenmodul/bin/Logo_bwLehrpool.png delete mode 100644 Dozentenmodul/bin/auth/Authentification.class delete mode 100644 Dozentenmodul/bin/config/config_file.class delete mode 100644 Dozentenmodul/bin/ftp/DownloadTask.class delete mode 100644 Dozentenmodul/bin/ftp/FTPException.class delete mode 100644 Dozentenmodul/bin/ftp/FTPUtility.class delete mode 100644 Dozentenmodul/bin/ftp/UploadTask.class delete mode 100644 Dozentenmodul/bin/gui/image/CreateImageAllgemein_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/DeleteImage_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/EditImageAllgemein_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPDownloader_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/SearchImage_GUI.class delete mode 100644 Dozentenmodul/bin/gui/intro/BillOfRights_GUI$1.class delete mode 100644 Dozentenmodul/bin/gui/intro/BillOfRights_GUI$2.class delete mode 100644 Dozentenmodul/bin/gui/intro/BillOfRights_GUI$3.class delete mode 100644 Dozentenmodul/bin/gui/intro/BillOfRights_GUI.class delete mode 100644 Dozentenmodul/bin/gui/intro/Login_GUI.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$1.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$10.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$2.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$3.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$4.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$5.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$6.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$7.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$8.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI$9.class delete mode 100644 Dozentenmodul/bin/gui/intro/MainMenue_GUI.class delete mode 100644 Dozentenmodul/bin/gui/intro/VmWareLink_GUI$1.class delete mode 100644 Dozentenmodul/bin/gui/intro/VmWareLink_GUI.class delete mode 100644 Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class delete mode 100644 Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class delete mode 100644 Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$1.class delete mode 100644 Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$2.class delete mode 100644 Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class delete mode 100644 Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI.class delete mode 100644 Dozentenmodul/bin/models/SessionData.class delete mode 100644 Dozentenmodul/bin/models/user.class delete mode 100644 Dozentenmodul/bin/org.eclipse.core.resources.prefs delete mode 100644 Dozentenmodul/bin/org.eclipse.jdt.core.prefs delete mode 100644 Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationError.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/AuthenticationException.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationError.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/AuthorizationException.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncClient$Factory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncClient$authenticate_call.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncClient$getUserFromToken_call.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncClient$ping_call.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncClient.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncIface.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate$1.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken$1.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping$1.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Client$Factory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Client.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Iface.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Processor$authenticate.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Processor$getUserFromToken.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Processor$ping.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$Processor.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_args.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$authenticate_result.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_args.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer$ping_result.class delete mode 100644 Dozentenmodul/bin/thrift/ImageServer.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/InvalidTokenException.class delete mode 100644 Dozentenmodul/bin/thrift/MasterThriftConnection.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData$SessionDataStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData$SessionDataStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData$SessionDataTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData$SessionDataTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/SessionData.class delete mode 100644 Dozentenmodul/bin/thrift/ThriftConnection.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardScheme.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleScheme.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleSchemeFactory.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo$_Fields.class delete mode 100644 Dozentenmodul/bin/thrift/UserInfo.class create mode 100644 Dozentenmodul/pom.xml delete mode 100644 Dozentenmodul/src/auth/Authentification.java delete mode 100644 Dozentenmodul/src/config/config_file.java delete mode 100644 Dozentenmodul/src/ftp/DownloadTask.java delete mode 100644 Dozentenmodul/src/ftp/FTPException.java delete mode 100644 Dozentenmodul/src/ftp/FTPUtility.java delete mode 100644 Dozentenmodul/src/ftp/UploadTask.java delete mode 100644 Dozentenmodul/src/gui/image/CreateImageAllgemein_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/CreateImageFreigabe_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/DeleteImage_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/EditImageFreigabe_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/EditImageTechnisch_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/FTPDownloader_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/SearchEditImage_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/SearchImage_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/SearchMethodLecture_GUI.java delete mode 100644 Dozentenmodul/src/gui/intro/About_GUI.java delete mode 100644 Dozentenmodul/src/gui/intro/BillOfRights_GUI.java delete mode 100644 Dozentenmodul/src/gui/intro/Login_GUI.java delete mode 100644 Dozentenmodul/src/gui/intro/MainMenue_GUI.java delete mode 100644 Dozentenmodul/src/gui/intro/VmWareLink_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java delete mode 100644 Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java create mode 100644 Dozentenmodul/src/main/java/auth/Authentification.java create mode 100644 Dozentenmodul/src/main/java/config/config_file.java create mode 100644 Dozentenmodul/src/main/java/ftp/DownloadTask.java create mode 100644 Dozentenmodul/src/main/java/ftp/FTPException.java create mode 100644 Dozentenmodul/src/main/java/ftp/FTPUtility.java create mode 100644 Dozentenmodul/src/main/java/ftp/UploadTask.java create mode 100644 Dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/CreateImageFreigabe_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/EditImageFreigabe_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/FTPDownloader_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/image/SearchMethodLecture_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/intro/About_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/intro/BillOfRights_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/intro/Login_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/intro/VmWareLink_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/ExtendedSearchForImages_GUI.java create mode 100644 Dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java create mode 100644 Dozentenmodul/src/main/java/models/Client.java create mode 100644 Dozentenmodul/src/main/java/models/Image.java create mode 100644 Dozentenmodul/src/main/java/models/Lecture.java create mode 100644 Dozentenmodul/src/main/java/models/Links.java create mode 100644 Dozentenmodul/src/main/java/models/SessionData.java create mode 100644 Dozentenmodul/src/main/java/models/person.java create mode 100644 Dozentenmodul/src/main/java/models/user.java create mode 100644 Dozentenmodul/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java create mode 100644 Dozentenmodul/src/main/java/thrift/MasterThriftConnection.java create mode 100644 Dozentenmodul/src/main/java/thrift/ThriftConnection.java create mode 100644 Dozentenmodul/src/main/java/util/GuiOrganizer.java create mode 100644 Dozentenmodul/src/main/java/util/OpenLinks.java delete mode 100644 Dozentenmodul/src/models/Client.java delete mode 100644 Dozentenmodul/src/models/Image.java delete mode 100644 Dozentenmodul/src/models/Lecture.java delete mode 100644 Dozentenmodul/src/models/Links.java delete mode 100644 Dozentenmodul/src/models/SessionData.java delete mode 100644 Dozentenmodul/src/models/person.java delete mode 100644 Dozentenmodul/src/models/user.java delete mode 100644 Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java create mode 100644 Dozentenmodul/src/test/java/bwlehrpool/AppTest.java delete mode 100644 Dozentenmodul/src/thrift/AuthenticationError.java delete mode 100644 Dozentenmodul/src/thrift/AuthenticationException.java delete mode 100644 Dozentenmodul/src/thrift/AuthorizationError.java delete mode 100644 Dozentenmodul/src/thrift/AuthorizationException.java delete mode 100644 Dozentenmodul/src/thrift/ImageServer.java delete mode 100644 Dozentenmodul/src/thrift/InvalidTokenException.java delete mode 100644 Dozentenmodul/src/thrift/MasterThriftConnection.java delete mode 100644 Dozentenmodul/src/thrift/SessionData.java delete mode 100644 Dozentenmodul/src/thrift/ThriftConnection.java delete mode 100644 Dozentenmodul/src/thrift/UserInfo.java delete mode 100644 Dozentenmodul/src/util/GuiOrganizer.java delete mode 100644 Dozentenmodul/src/util/OpenLinks.java (limited to 'Dozentenmodul') diff --git a/Dozentenmodul/bin/Image_zu_Veranstaltung_HDD.png b/Dozentenmodul/bin/Image_zu_Veranstaltung_HDD.png deleted file mode 100644 index 39b3bac6..00000000 Binary files a/Dozentenmodul/bin/Image_zu_Veranstaltung_HDD.png and /dev/null differ diff --git a/Dozentenmodul/bin/Logo_bwLehrpool.png b/Dozentenmodul/bin/Logo_bwLehrpool.png deleted file mode 100644 index b897d9f1..00000000 Binary files a/Dozentenmodul/bin/Logo_bwLehrpool.png and /dev/null differ diff --git a/Dozentenmodul/bin/auth/Authentification.class b/Dozentenmodul/bin/auth/Authentification.class deleted file mode 100644 index 0d9b3144..00000000 Binary files a/Dozentenmodul/bin/auth/Authentification.class and /dev/null differ diff --git a/Dozentenmodul/bin/config/config_file.class b/Dozentenmodul/bin/config/config_file.class deleted file mode 100644 index 9e074954..00000000 Binary files a/Dozentenmodul/bin/config/config_file.class and /dev/null differ diff --git a/Dozentenmodul/bin/ftp/DownloadTask.class b/Dozentenmodul/bin/ftp/DownloadTask.class deleted file mode 100644 index 447a8eb4..00000000 Binary files a/Dozentenmodul/bin/ftp/DownloadTask.class and /dev/null differ diff --git a/Dozentenmodul/bin/ftp/FTPException.class b/Dozentenmodul/bin/ftp/FTPException.class deleted file mode 100644 index aa1d8638..00000000 Binary files a/Dozentenmodul/bin/ftp/FTPException.class and /dev/null differ diff --git a/Dozentenmodul/bin/ftp/FTPUtility.class b/Dozentenmodul/bin/ftp/FTPUtility.class deleted file mode 100644 index 95655233..00000000 Binary files a/Dozentenmodul/bin/ftp/FTPUtility.class and /dev/null differ diff --git a/Dozentenmodul/bin/ftp/UploadTask.class b/Dozentenmodul/bin/ftp/UploadTask.class deleted file mode 100644 index 101ff93b..00000000 Binary files a/Dozentenmodul/bin/ftp/UploadTask.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/CreateImageAllgemein_GUI.class b/Dozentenmodul/bin/gui/image/CreateImageAllgemein_GUI.class deleted file mode 100644 index 9e28bfa1..00000000 Binary files a/Dozentenmodul/bin/gui/image/CreateImageAllgemein_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI.class b/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI.class deleted file mode 100644 index d03e7bba..00000000 Binary files a/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class deleted file mode 100644 index 810a0bde..00000000 Binary files a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/EditImageAllgemein_GUI.class b/Dozentenmodul/bin/gui/image/EditImageAllgemein_GUI.class deleted file mode 100644 index bb3de645..00000000 Binary files a/Dozentenmodul/bin/gui/image/EditImageAllgemein_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class deleted file mode 100644 index 45e33268..00000000 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class deleted file mode 100644 index f37a90df..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPDownloader_GUI.class b/Dozentenmodul/bin/gui/image/FTPDownloader_GUI.class deleted file mode 100644 index 2cc03f7b..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPDownloader_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class deleted file mode 100644 index 5f5bd3c0..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class deleted file mode 100644 index c74231f4..00000000 Binary files a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI.class deleted file mode 100644 index 76bf7853..00000000 Binary files a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$1.class b/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$1.class deleted file mode 100644 index 2b4bf693..00000000 Binary files a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$2.class b/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$2.class deleted file mode 100644 index 72c79ffe..00000000 Binary files a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$2.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$3.class b/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$3.class deleted file mode 100644 index 32770f91..00000000 Binary files a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI$3.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI.class b/Dozentenmodul/bin/gui/intro/BillOfRights_GUI.class deleted file mode 100644 index 7118cb01..00000000 Binary files a/Dozentenmodul/bin/gui/intro/BillOfRights_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/Login_GUI.class b/Dozentenmodul/bin/gui/intro/Login_GUI.class deleted file mode 100644 index aaa9ada0..00000000 Binary files a/Dozentenmodul/bin/gui/intro/Login_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$1.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$1.class deleted file mode 100644 index 8f2c2337..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$10.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$10.class deleted file mode 100644 index 55965fd2..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$10.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$2.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$2.class deleted file mode 100644 index d88ea420..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$2.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$3.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$3.class deleted file mode 100644 index bb811f7a..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$3.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$4.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$4.class deleted file mode 100644 index 1cf17778..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$4.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$5.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$5.class deleted file mode 100644 index e4c4e858..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$5.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$6.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$6.class deleted file mode 100644 index 715c30d8..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$6.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$7.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$7.class deleted file mode 100644 index 10cac7e7..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$7.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$8.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$8.class deleted file mode 100644 index c742cf3c..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$8.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$9.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI$9.class deleted file mode 100644 index 193a25de..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI$9.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class b/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class deleted file mode 100644 index 1f61a168..00000000 Binary files a/Dozentenmodul/bin/gui/intro/MainMenue_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/VmWareLink_GUI$1.class b/Dozentenmodul/bin/gui/intro/VmWareLink_GUI$1.class deleted file mode 100644 index 091931f8..00000000 Binary files a/Dozentenmodul/bin/gui/intro/VmWareLink_GUI$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/intro/VmWareLink_GUI.class b/Dozentenmodul/bin/gui/intro/VmWareLink_GUI.class deleted file mode 100644 index 27406089..00000000 Binary files a/Dozentenmodul/bin/gui/intro/VmWareLink_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class b/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class deleted file mode 100644 index 45526d36..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/CreateLectureAllgemein_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class b/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class deleted file mode 100644 index 1ff0d787..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/EditLectureAllgemein_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$1.class b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$1.class deleted file mode 100644 index 962df75f..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$2.class b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$2.class deleted file mode 100644 index 07e7e8cf..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$2.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class deleted file mode 100644 index 173ab342..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI.class b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI.class deleted file mode 100644 index ed5b0b25..00000000 Binary files a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/models/SessionData.class b/Dozentenmodul/bin/models/SessionData.class deleted file mode 100644 index 0718956c..00000000 Binary files a/Dozentenmodul/bin/models/SessionData.class and /dev/null differ diff --git a/Dozentenmodul/bin/models/user.class b/Dozentenmodul/bin/models/user.class deleted file mode 100644 index cd274e48..00000000 Binary files a/Dozentenmodul/bin/models/user.class and /dev/null differ diff --git a/Dozentenmodul/bin/org.eclipse.core.resources.prefs b/Dozentenmodul/bin/org.eclipse.core.resources.prefs deleted file mode 100644 index 61583c81..00000000 --- a/Dozentenmodul/bin/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/gui/lecture/EditLectureAllgemein_GUI.java=UTF-8 diff --git a/Dozentenmodul/bin/org.eclipse.jdt.core.prefs b/Dozentenmodul/bin/org.eclipse.jdt.core.prefs deleted file mode 100644 index 838bd9d6..00000000 --- a/Dozentenmodul/bin/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class b/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class deleted file mode 100644 index 32758ea9..00000000 Binary files a/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationError.class b/Dozentenmodul/bin/thrift/AuthenticationError.class deleted file mode 100644 index 8f12237d..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationError.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardScheme.class b/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardScheme.class deleted file mode 100644 index 6108caf6..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardSchemeFactory.class deleted file mode 100644 index ed3b0b62..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleScheme.class b/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleScheme.class deleted file mode 100644 index 2ae1e4f8..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleSchemeFactory.class deleted file mode 100644 index 662f2f37..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException$AuthenticationExceptionTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException$_Fields.class b/Dozentenmodul/bin/thrift/AuthenticationException$_Fields.class deleted file mode 100644 index 21b0acfc..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthenticationException.class b/Dozentenmodul/bin/thrift/AuthenticationException.class deleted file mode 100644 index de2ec118..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthenticationException.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationError.class b/Dozentenmodul/bin/thrift/AuthorizationError.class deleted file mode 100644 index b05d13c5..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationError.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardScheme.class b/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardScheme.class deleted file mode 100644 index 978243e1..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardSchemeFactory.class deleted file mode 100644 index 9186486d..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleScheme.class b/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleScheme.class deleted file mode 100644 index 7b0fcbe6..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleSchemeFactory.class deleted file mode 100644 index 40ca68dc..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException$AuthorizationExceptionTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException$_Fields.class b/Dozentenmodul/bin/thrift/AuthorizationException$_Fields.class deleted file mode 100644 index ff62ea72..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/AuthorizationException.class b/Dozentenmodul/bin/thrift/AuthorizationException.class deleted file mode 100644 index 9ec46927..00000000 Binary files a/Dozentenmodul/bin/thrift/AuthorizationException.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$Factory.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$Factory.class deleted file mode 100644 index c7f71131..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$Factory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$authenticate_call.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$authenticate_call.class deleted file mode 100644 index fb117af1..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$authenticate_call.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$getUserFromToken_call.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$getUserFromToken_call.class deleted file mode 100644 index 43a434ad..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$getUserFromToken_call.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$ping_call.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$ping_call.class deleted file mode 100644 index 6ebc2ea3..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient$ping_call.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncClient.class deleted file mode 100644 index 1d34c1e2..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncClient.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncIface.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncIface.class deleted file mode 100644 index e28e8f90..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncIface.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate$1.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate$1.class deleted file mode 100644 index 3dadf0b7..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate.class deleted file mode 100644 index a02237d2..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$authenticate.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken$1.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken$1.class deleted file mode 100644 index 8bd8bacf..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken.class deleted file mode 100644 index 2b4fe03d..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$getUserFromToken.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping$1.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping$1.class deleted file mode 100644 index 9dc81f2a..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping.class deleted file mode 100644 index 4b4e0afe..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor$ping.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor.class b/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor.class deleted file mode 100644 index 9bd05794..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$AsyncProcessor.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Client$Factory.class b/Dozentenmodul/bin/thrift/ImageServer$Client$Factory.class deleted file mode 100644 index 215621f5..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Client$Factory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Client.class b/Dozentenmodul/bin/thrift/ImageServer$Client.class deleted file mode 100644 index d8ecb8b8..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Client.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Iface.class b/Dozentenmodul/bin/thrift/ImageServer$Iface.class deleted file mode 100644 index 18aec242..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Iface.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Processor$authenticate.class b/Dozentenmodul/bin/thrift/ImageServer$Processor$authenticate.class deleted file mode 100644 index 1a1f939e..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Processor$authenticate.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Processor$getUserFromToken.class b/Dozentenmodul/bin/thrift/ImageServer$Processor$getUserFromToken.class deleted file mode 100644 index eba9943e..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Processor$getUserFromToken.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Processor$ping.class b/Dozentenmodul/bin/thrift/ImageServer$Processor$ping.class deleted file mode 100644 index a3dd6c8f..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Processor$ping.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$Processor.class b/Dozentenmodul/bin/thrift/ImageServer$Processor.class deleted file mode 100644 index 26f96272..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$Processor.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$_Fields.class deleted file mode 100644 index a8cd4f66..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardScheme.class deleted file mode 100644 index 29e03256..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardSchemeFactory.class deleted file mode 100644 index d20ee8b2..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleScheme.class deleted file mode 100644 index 58d1374e..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleSchemeFactory.class deleted file mode 100644 index 4429e284..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args$authenticate_argsTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_args.class deleted file mode 100644 index a92fb3e9..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_args.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$_Fields.class deleted file mode 100644 index 9fcb0a6e..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardScheme.class deleted file mode 100644 index b1243414..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardSchemeFactory.class deleted file mode 100644 index 1c507ea2..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleScheme.class deleted file mode 100644 index 4a3edda6..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleSchemeFactory.class deleted file mode 100644 index c82d6354..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result$authenticate_resultTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result.class b/Dozentenmodul/bin/thrift/ImageServer$authenticate_result.class deleted file mode 100644 index db12a9f8..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$authenticate_result.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$_Fields.class deleted file mode 100644 index ad982267..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardScheme.class deleted file mode 100644 index 9b24fe8f..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardSchemeFactory.class deleted file mode 100644 index 8bac7772..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleScheme.class deleted file mode 100644 index 94eb7a5d..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleSchemeFactory.class deleted file mode 100644 index 13e77c2b..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args$getUserFromToken_argsTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args.class deleted file mode 100644 index 90aa2fa1..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_args.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$_Fields.class deleted file mode 100644 index f306cf9d..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardScheme.class deleted file mode 100644 index 8ce44766..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardSchemeFactory.class deleted file mode 100644 index 9cb117e7..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleScheme.class deleted file mode 100644 index e9186710..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleSchemeFactory.class deleted file mode 100644 index 1ba83391..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result$getUserFromToken_resultTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result.class b/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result.class deleted file mode 100644 index bc1a176b..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$getUserFromToken_result.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args$_Fields.class deleted file mode 100644 index af0bbe88..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardScheme.class deleted file mode 100644 index 2c2f59cf..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardSchemeFactory.class deleted file mode 100644 index 6fc626ef..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleScheme.class deleted file mode 100644 index 822afb2c..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleSchemeFactory.class deleted file mode 100644 index 7b2dc61c..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args$ping_argsTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_args.class b/Dozentenmodul/bin/thrift/ImageServer$ping_args.class deleted file mode 100644 index 72a484fb..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_args.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result$_Fields.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result$_Fields.class deleted file mode 100644 index 6af85a25..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardScheme.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardScheme.class deleted file mode 100644 index 311b5c76..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardSchemeFactory.class deleted file mode 100644 index 77ed53ce..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleScheme.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleScheme.class deleted file mode 100644 index eb11e143..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleSchemeFactory.class deleted file mode 100644 index 95803bc3..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result$ping_resultTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer$ping_result.class b/Dozentenmodul/bin/thrift/ImageServer$ping_result.class deleted file mode 100644 index eb20bac5..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer$ping_result.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ImageServer.class b/Dozentenmodul/bin/thrift/ImageServer.class deleted file mode 100644 index 414f9a34..00000000 Binary files a/Dozentenmodul/bin/thrift/ImageServer.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardScheme.class b/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardScheme.class deleted file mode 100644 index 8336b756..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardSchemeFactory.class deleted file mode 100644 index 603e663a..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleScheme.class b/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleScheme.class deleted file mode 100644 index cbce816c..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleSchemeFactory.class deleted file mode 100644 index 0286db6c..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException$InvalidTokenExceptionTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException$_Fields.class b/Dozentenmodul/bin/thrift/InvalidTokenException$_Fields.class deleted file mode 100644 index a93a93a8..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/InvalidTokenException.class b/Dozentenmodul/bin/thrift/InvalidTokenException.class deleted file mode 100644 index 317b760c..00000000 Binary files a/Dozentenmodul/bin/thrift/InvalidTokenException.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/MasterThriftConnection.class b/Dozentenmodul/bin/thrift/MasterThriftConnection.class deleted file mode 100644 index 8229138f..00000000 Binary files a/Dozentenmodul/bin/thrift/MasterThriftConnection.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardScheme.class b/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardScheme.class deleted file mode 100644 index 06cd5a25..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardSchemeFactory.class deleted file mode 100644 index d41ac16a..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData$SessionDataStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleScheme.class b/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleScheme.class deleted file mode 100644 index f17400c1..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleSchemeFactory.class deleted file mode 100644 index f4f8424d..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData$SessionDataTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData$_Fields.class b/Dozentenmodul/bin/thrift/SessionData$_Fields.class deleted file mode 100644 index 56fd12f4..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/SessionData.class b/Dozentenmodul/bin/thrift/SessionData.class deleted file mode 100644 index c1156dff..00000000 Binary files a/Dozentenmodul/bin/thrift/SessionData.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/ThriftConnection.class b/Dozentenmodul/bin/thrift/ThriftConnection.class deleted file mode 100644 index 290acaad..00000000 Binary files a/Dozentenmodul/bin/thrift/ThriftConnection.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardScheme.class b/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardScheme.class deleted file mode 100644 index c4a055f7..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardSchemeFactory.class b/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardSchemeFactory.class deleted file mode 100644 index ff60ded1..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo$UserInfoStandardSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleScheme.class b/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleScheme.class deleted file mode 100644 index 1d717010..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleScheme.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleSchemeFactory.class b/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleSchemeFactory.class deleted file mode 100644 index adf2a51e..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo$UserInfoTupleSchemeFactory.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo$_Fields.class b/Dozentenmodul/bin/thrift/UserInfo$_Fields.class deleted file mode 100644 index 3bff9fe0..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo$_Fields.class and /dev/null differ diff --git a/Dozentenmodul/bin/thrift/UserInfo.class b/Dozentenmodul/bin/thrift/UserInfo.class deleted file mode 100644 index ed7e6f12..00000000 Binary files a/Dozentenmodul/bin/thrift/UserInfo.class and /dev/null differ diff --git a/Dozentenmodul/pom.xml b/Dozentenmodul/pom.xml new file mode 100644 index 00000000..02ab3756 --- /dev/null +++ b/Dozentenmodul/pom.xml @@ -0,0 +1,183 @@ + + 4.0.0 + + bwlehrpool + dmc + 1.0-SNAPSHOT + jar + + DozMod-Client + http://maven.apache.org + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + maven-assembly-plugin + + + package + + single + + + + + + + gui.intro.Login_GUI + + + + jar-with-dependencies + + + + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + true + + + + + + + + + + mac + + + mac os x + + + + org.eclipse.swt.carbon + macosx + + + + windows + + + windows + + + + org.eclipse.swt.win32.win32 + x86 + + + + linux_64 + + + linux + amd64 + + + + org.eclipse.swt.org.eclipse.swt.gtk.linux.x86_64.4.3.swt + org.eclipse.swt.gtk.linux.x86_64 + + + + + + + + org.apache.thrift + libthrift + 0.9.1 + compile + + + commons-io + commons-io + 2.4 + compile + + + commons-net + commons-net + 3.3 + compile + + + com.toedter + jcalendar + 1.4 + compile + + + net.sourceforge.jdatepicker + jdatepicker + 1.3.2 + compile + + + ${swt.groupId} + ${swt.artifactId} + 4.3 + + + + log4j + log4j + 1.2.17 + compile + + + org.ini4j + ini4j + 0.5.2 + compile + + + org.slf4j + slf4j-log4j12 + 1.5.8 + compile + + + org.openslx.bwlp + master-sync-shared + 1.0-SNAPSHOT + compile + + + bwlehrpool + dms + 1.0-SNAPSHOT + + + junit + junit + 3.8.1 + test + + + + diff --git a/Dozentenmodul/src/auth/Authentification.java b/Dozentenmodul/src/auth/Authentification.java deleted file mode 100644 index 41f69502..00000000 --- a/Dozentenmodul/src/auth/Authentification.java +++ /dev/null @@ -1,12 +0,0 @@ -package auth; - -import thrift.UserInfo; - -public class Authentification { - - public boolean auth(String username, String pass) - { - return false; - - } -} diff --git a/Dozentenmodul/src/config/config_file.java b/Dozentenmodul/src/config/config_file.java deleted file mode 100644 index 5d59e22a..00000000 --- a/Dozentenmodul/src/config/config_file.java +++ /dev/null @@ -1,66 +0,0 @@ -package config; - -import java.io.File; -import java.io.IOException; - -import org.ini4j.Wini; -public class config_file { - - public boolean createConfig() throws IOException{ - - - String config_file="C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite"; - //File fuer den Ordner erzeugen - File config=new File(config_file); - String file=config_file+"\\config.ini"; - //ini File erzeugen - File conf=new File(file); - Wini ini; - - //Pruefen ob Ordner schon existiert - if(config.exists()==false) - { - //Wenn nicht erzeuge Ordner - config.mkdir(); - - //Erzeuge eine neue Datei - conf.createNewFile(); - ini=new Wini(conf); - - //Wenn in die Datei geschrieben werden kann - if(conf.canWrite()==true) - { - //Schreibe Config - ini.put("main", "BillOfRights",false); - ini.put("main", "vmware", false); - ini.store(); - - return true; - } - - } - else - { - //Wenn Ordner schon existiert, pruefe ob Datei existiert - if(conf.exists()==false) - { - //Wenn nicht, erzeuge diese - conf.createNewFile(); - ini=new Wini(conf); - - if(conf.canWrite()==true) - { - //Schreibe Konfig in File - ini.put("main", "BillOfRights",false); - ini.put("main", "vmware", false); - ini.store(); - - return true; - } - } - } - return true; - - } - -} diff --git a/Dozentenmodul/src/ftp/DownloadTask.java b/Dozentenmodul/src/ftp/DownloadTask.java deleted file mode 100644 index 83ad2c15..00000000 --- a/Dozentenmodul/src/ftp/DownloadTask.java +++ /dev/null @@ -1,112 +0,0 @@ -package ftp; - -import gui.image.FTPDownloader_GUI; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; - -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; - -/** - * Execute file download in a background thread and update the progress. - * @author www.codejava.net - * - */ -public class DownloadTask extends SwingWorker { - - private static final int BUFFER_SIZE = 4096; - - private String host; - private int port; - private String username; - private String password; - - private String downloadPath; - private String saveDir; - - @SuppressWarnings("unused") - private FTPDownloader_GUI gui; - - public DownloadTask(String host, int port, String username, - String password, String downloadPath, String saveDir, - FTPDownloader_GUI gui) { - this.host = host; - this.port = port; - this.username = username; - this.password = password; - this.downloadPath = downloadPath; - this.saveDir = saveDir; - this.gui = gui; - - } - - /** - * Executed in background thread - */ - @Override - protected Void doInBackground() throws Exception { - FTPUtility util = new FTPUtility(host, port, username, password); - try { - util.connect(); - - byte[] buffer = new byte[BUFFER_SIZE]; - int bytesRead = -1; - long totalBytesRead = 0; - int percentCompleted = 0; - long start=System.nanoTime(); - final double NANOS_PER_SECOND = 1000000000.0; - final double BYTES_PER_MIB = 1024*1024; - long fileSize = util.getFileSize(downloadPath); - //gui.setFileSize(fileSize); - - String fileName = new File(downloadPath).getName(); - - File downloadFile = new File(saveDir + File.separator + fileName); - FileOutputStream outputStream = new FileOutputStream(downloadFile); - - util.downloadFile(downloadPath); - InputStream inputStream = util.getInputStream(); - - while ((bytesRead = inputStream.read(buffer)) != -1 && isCancelled()==false) { - outputStream.write(buffer, 0, bytesRead); - totalBytesRead += bytesRead; - //System.out.println(totalBytesRead); - double speed = NANOS_PER_SECOND / BYTES_PER_MIB * totalBytesRead / (System.nanoTime() - start + 1); - percentCompleted = (int) (totalBytesRead * 100 / fileSize); - setProgress(percentCompleted); - firePropertyChange("speed", 0, speed); - firePropertyChange("filesize", 0,fileSize); - firePropertyChange("bytesread", 0,totalBytesRead); - - } - - outputStream.close(); - - util.finish(); - } catch (FTPException ex) { - JOptionPane.showMessageDialog(null, "Error downloading file: " + ex.getMessage(), - "Error", JOptionPane.ERROR_MESSAGE); - ex.printStackTrace(); - setProgress(0); - cancel(true); - } finally { - util.disconnect(); - } - - return null; - } - - /** - * Executed in Swing's event dispatching thread - */ - @Override - protected void done() { - if (!isCancelled()) { - JOptionPane.showMessageDialog(null, - "File has been downloaded successfully!", "Message", - JOptionPane.INFORMATION_MESSAGE); - } - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/ftp/FTPException.java b/Dozentenmodul/src/ftp/FTPException.java deleted file mode 100644 index bc3193e0..00000000 --- a/Dozentenmodul/src/ftp/FTPException.java +++ /dev/null @@ -1,8 +0,0 @@ -package ftp; - -@SuppressWarnings("serial") -public class FTPException extends Exception { - public FTPException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/ftp/FTPUtility.java b/Dozentenmodul/src/ftp/FTPUtility.java deleted file mode 100644 index f2c51dfc..00000000 --- a/Dozentenmodul/src/ftp/FTPUtility.java +++ /dev/null @@ -1,201 +0,0 @@ -package ftp; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.SocketException; -import java.security.NoSuchAlgorithmException; - -import javax.swing.JOptionPane; - -import models.Image; - -import org.apache.commons.net.ftp.FTP; -import org.apache.commons.net.ftp.FTPFile; -import org.apache.commons.net.ftp.FTPReply; -import org.apache.commons.net.ftp.FTPSClient; - - -/** - * A utility class that provides functionality for downloading files from a FTP - * server. - * - * @author www.codejava.net - * - */ -public class FTPUtility { - - // FTP server information - private String host; - private int port; - private String username; - private String password; - - private FTPSClient ftpClient = new FTPSClient(); - private int replyCode; - - private InputStream inputStream; - private OutputStream outputStream; - - public FTPUtility(String host, int port, String user, String pass) { - this.host = host; - this.port = port; - this.username = user; - this.password = pass; - } - - /** - * Connect and login to the server. - * - * @throws FTPException - * @throws NoSuchAlgorithmException - */ - public void connect() throws FTPException, NoSuchAlgorithmException { - try { - ftpClient.connect(host, port); - replyCode = ftpClient.getReplyCode(); - if (!FTPReply.isPositiveCompletion(replyCode)) { - throw new FTPException("FTP serve refused connection."); - } - - - boolean logged = ftpClient.login(username, password); - if (!logged) { - // failed to login - ftpClient.execPROT("P"); - ftpClient.disconnect(); - throw new FTPException("Could not login to the server."); - } - - ftpClient.enterLocalPassiveMode(); - - } catch (IOException ex) { - throw new FTPException("I/O error: " + ex.getMessage()); - } - } - - /** - * Gets size (in bytes) of the file on the server. - * - * @param filePath - * Path of the file on server - * @return file size in bytes - * @throws FTPException - */ - public long getFileSize(String filePath) throws FTPException { - try { - FTPFile file = ftpClient.mlistFile(filePath); - if (file == null) { - throw new FTPException("The file may not exist on the server!"); - } - return file.getSize(); - } catch (IOException ex) { - throw new FTPException("Could not determine size of the file: " - + ex.getMessage()); - } - } - - /** - * Start downloading a file from the server - * - * @param downloadPath - * Full path of the file on the server - * @throws FTPException - * if client-server communication error occurred - */ - public void downloadFile(String downloadPath) throws FTPException { - try { - - boolean success = ftpClient.setFileType(FTP.BINARY_FILE_TYPE); - if (!success) { - throw new FTPException("Could not set binary file type."); - } - - inputStream = ftpClient.retrieveFileStream(downloadPath); - - if (inputStream == null) { - throw new FTPException( - "Could not open input stream. The file may not exist on the server."); - } - } catch (IOException ex) { - throw new FTPException("Error downloading file: " + ex.getMessage()); - } - } - - - /** - * Start uploading a file to the server - * @param uploadFile the file to be uploaded - * @param destDir destination directory on the server - * where the file is stored - * @throws FTPException if client-server communication error occurred - */ - public void uploadFile(File uploadFile, String destDir) throws FTPException { - try { - boolean success = ftpClient.changeWorkingDirectory(destDir); - if (!success) { - throw new FTPException("Could not change working directory to " - + destDir + ". The directory may not exist."); - } - - success = ftpClient.setFileType(FTP.BINARY_FILE_TYPE); - if (!success) { - throw new FTPException("Could not set binary file type."); - } - - outputStream = ftpClient.storeFileStream(Image.image.getNewName()); - - //ftpClient.rename(uploadFile.getName(), ); - } catch (IOException ex) { - throw new FTPException("Error uploading file: " + ex.getMessage()); - } - } - - /** - * Write an array of bytes to the output stream. - */ - public void writeFileBytes(byte[] bytes, int offset, int length) - throws IOException { - outputStream.write(bytes, offset, length); - } - - /** - * Complete the download operation. - */ - public void finish() throws IOException { - inputStream.close(); - ftpClient.completePendingCommand(); - } - - /** - * Log out and disconnect from the server - */ - public void disconnect() throws FTPException { - if (ftpClient.isConnected()) { - try { - if (!ftpClient.logout()) { - throw new FTPException("Could not log out from the server"); - } - ftpClient.disconnect(); - } catch (IOException ex) { - throw new FTPException("Error disconnect from the server: " - + ex.getMessage()); - } - } - } - - /** - * Return InputStream of the remote file on the server. - */ - public InputStream getInputStream() { - return inputStream; - } - - public OutputStream getOutputStream() { - return outputStream; - } - - - -} \ No newline at end of file diff --git a/Dozentenmodul/src/ftp/UploadTask.java b/Dozentenmodul/src/ftp/UploadTask.java deleted file mode 100644 index 06d76dc8..00000000 --- a/Dozentenmodul/src/ftp/UploadTask.java +++ /dev/null @@ -1,98 +0,0 @@ -package ftp; - -import java.io.File; -import java.io.FileInputStream; - -import javax.swing.JOptionPane; -import javax.swing.SwingWorker; - -import models.Image; - -/** - * Executes the file upload in a background thread and updates progress to - * listeners that implement the java.beans.PropertyChangeListener interface. - * @author www.codejava.net - * - */ -public class UploadTask extends SwingWorker { - private static final int BUFFER_SIZE = 4096; - - private String host; - private int port; - private String username; - private String password; - - private String destDir; - private File uploadFile; - - public UploadTask(String host, int port, String username, String password, - String destDir, File uploadFile) { - this.host = host; - this.port = port; - this.username = username; - this.password = password; - this.destDir = destDir; - this.uploadFile = uploadFile; - - } - - /** - * Executed in background thread - */ - @Override - protected Void doInBackground() throws Exception { - FTPUtility util = new FTPUtility(host, port, username, password); - try { - util.connect(); - util.uploadFile(uploadFile, destDir); - - FileInputStream inputStream = new FileInputStream(uploadFile); - byte[] buffer = new byte[BUFFER_SIZE]; - int bytesRead = -1; - int i=0; - long totalBytesRead = 0; - int percentCompleted = 0; - long fileSize = uploadFile.length(); - Image.image.setFilesize(fileSize); - long start=System.nanoTime(); - final double NANOS_PER_SECOND = 1000000000.0; - final double BYTES_PER_MIB = 1024*1024; - while ((bytesRead = inputStream.read(buffer)) != -1 && isCancelled()==false) { - util.writeFileBytes(buffer, 0, bytesRead); - totalBytesRead += bytesRead; - percentCompleted = (int) (totalBytesRead * 100 / fileSize); - double speed = NANOS_PER_SECOND / BYTES_PER_MIB * totalBytesRead / (System.nanoTime() - start + 1); - setProgress(percentCompleted); - firePropertyChange("speed", 0, speed); - firePropertyChange("filesize", 0,fileSize); - firePropertyChange("bytesread", 0,totalBytesRead); - } - - inputStream.close(); - - util.finish(); - } catch (FTPException ex) { - JOptionPane.showMessageDialog(null, "Error uploading file: " + ex.getMessage(), - "Error", JOptionPane.ERROR_MESSAGE); - ex.printStackTrace(); - setProgress(0); - cancel(true); - } finally { - util.disconnect(); - } - - return null; - } - - /** - * Executed in Swing's event dispatching thread - */ - @Override - protected void done() { - if (!isCancelled()) { - JOptionPane.showMessageDialog(null, - "File has been uploaded successfully!", "Message", - JOptionPane.INFORMATION_MESSAGE); - } - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/image/CreateImageAllgemein_GUI.java b/Dozentenmodul/src/gui/image/CreateImageAllgemein_GUI.java deleted file mode 100644 index 6231c6f2..00000000 --- a/Dozentenmodul/src/gui/image/CreateImageAllgemein_GUI.java +++ /dev/null @@ -1,355 +0,0 @@ -package gui.image; - - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Links; -import models.person; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class CreateImageAllgemein_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private JTextField Vorname; - private JTextField Nachname; - private JTextField Hochschule; - private JTextField EMail; - private JTextField imagename; - - /** - * Create the dialog. - */ - public CreateImageAllgemein_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - //Beendet das Fenster auf X - System.exit(0); - } - @Override - public void windowOpened(WindowEvent arg0) { - imagename.requestFocusInWindow(); - } - }); - //Verhindert das Vergroessern des Fensters - setResizable(false); - - try { - //setzt das Look & Feel - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - //Setzt den Titel - setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); - //Zentriert das Fenster - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 66, 557, 369); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel label = new JLabel("Vorname: *"); - label.setBackground(SystemColor.menu); - label.setBounds(10, 245, 125, 20); - panel_1.add(label); - - Vorname = new JTextField(); - Vorname.setEnabled(false); - Vorname.setEditable(false); - Vorname.setBackground(Color.WHITE); - Vorname.setText(person.verantwortlicher.getVorname()); - Vorname.setColumns(10); - Vorname.setBounds(145, 245, 350, 20); - panel_1.add(Vorname); - - JLabel label_7 = new JLabel("Nachname: *"); - label_7.setBackground(SystemColor.menu); - label_7.setBounds(10, 276, 125, 20); - panel_1.add(label_7); - - Nachname = new JTextField(); - Nachname.setEnabled(false); - Nachname.setEditable(false); - Nachname.setBackground(Color.WHITE); - Nachname.setText(person.verantwortlicher.getName()); - Nachname.setColumns(10); - Nachname.setBounds(145, 276, 350, 20); - panel_1.add(Nachname); - - JLabel label_8 = new JLabel("Hochschule: *"); - label_8.setBackground(SystemColor.menu); - label_8.setBounds(10, 307, 125, 20); - panel_1.add(label_8); - - Hochschule = new JTextField(); - Hochschule.setEnabled(false); - Hochschule.setEditable(false); - Hochschule.setBackground(Color.WHITE); - Hochschule.setText(person.verantwortlicher.getHochschule()); - Hochschule.setColumns(10); - Hochschule.setBounds(145, 307, 350, 20); - panel_1.add(Hochschule); - - JLabel label_9 = new JLabel("E-Mail: *"); - label_9.setBackground(SystemColor.menu); - label_9.setBounds(10, 338, 125, 20); - panel_1.add(label_9); - - EMail = new JTextField(); - EMail.setEnabled(false); - EMail.setEditable(false); - EMail.setBackground(Color.WHITE); - EMail.setText(person.verantwortlicher.getEMail()); - EMail.setColumns(10); - EMail.setBounds(145, 338, 350, 20); - panel_1.add(EMail); - - JLabel lblImagename = new JLabel("Imagename: *"); - lblImagename.setBackground(SystemColor.menu); - lblImagename.setBounds(10, 31, 125, 20); - panel_1.add(lblImagename); - - - imagename = new JTextField(); - imagename.setBackground(Color.WHITE); - imagename.setText((String) null); - imagename.setColumns(10); - imagename.setBounds(145, 31, 350, 20); - imagename.setText(Image.image.getImagename()); //null am Anfang, aber speichert die Eingabe, wenn man zurueck kommt zur Seite - panel_1.add(imagename); - - JTextArea txtrGebenSieBitte = new JTextArea(); - txtrGebenSieBitte.setEditable(false); - txtrGebenSieBitte.setBackground(SystemColor.menu); - txtrGebenSieBitte.setLineWrap(true); - txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); - txtrGebenSieBitte.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); - txtrGebenSieBitte.setBounds(145, 62, 350, 110); - panel_1.add(txtrGebenSieBitte); - - JPanel panel = new JPanel(); - panel.setBounds(10, 402, 577, 33); - contentPanel.add(panel); - panel.setLayout(null); - panel.setBorder(new EmptyBorder(5, 5, 5, 5)); - panel.setBackground(SystemColor.menu); - - JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); - lblPflichtfelder.setBounds(10, 442, 136, 14); - contentPanel.add(lblPflichtfelder); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - //oeffnet das Hauptmenue - CreateImageAllgemein_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton backButton = new JButton("Zur\u00FCck"); - backButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Image.image.setImagename(imagename.getText()); - MainMenue_GUI sr=new MainMenue_GUI(); - sr.setVisible(true); - dispose(); - } - }); - backButton.setActionCommand("Cancel"); - buttonPane.add(backButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - //Prueft die Eingabe - if(imagename.getText().isEmpty()==false && Vorname.getText().isEmpty()==false && Nachname.getText().isEmpty()==false && Hochschule.getText().isEmpty()==false&&EMail.getText().isEmpty()==false) - { - //Schreibt die Daten in das Model - Image.image.setImagename(imagename.getText()); - CreateImageTechnisch_GUI ea=new CreateImageTechnisch_GUI(); - ea.setVisible(true); - dispose(); - } - else{ - JOptionPane.showMessageDialog(null, "Bitte geben Sie alle notwendigen Daten an!", - "Daten unvollst\u00e4ndig", JOptionPane.INFORMATION_MESSAGE); - } - } - }); - continueButton.setActionCommand("OK"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem menuItem = new JMenuItem("About"); - menuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(menuItem); - - }//end main -} diff --git a/Dozentenmodul/src/gui/image/CreateImageFreigabe_GUI.java b/Dozentenmodul/src/gui/image/CreateImageFreigabe_GUI.java deleted file mode 100644 index ec50440f..00000000 --- a/Dozentenmodul/src/gui/image/CreateImageFreigabe_GUI.java +++ /dev/null @@ -1,264 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Links; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class CreateImageFreigabe_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private final ButtonGroup buttonGrouplicense = new ButtonGroup(); - private final ButtonGroup buttonGroupInternet = new ButtonGroup(); - JComboBox comboBox; - - /** - * Create the dialog. - */ - public CreateImageFreigabe_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Image Freigabe"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("W\u00E4hlen Sie bitte hier die von Ihnen gew\u00FCnschte Freigabe f\u00FCr Ihr Image aus."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Freigabe", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 51, 557, 124); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Freigabemodus:"); - lblNewLabel_2.setBounds(10, 55, 250, 20); - panel_1.add(lblNewLabel_2); - - comboBox = new JComboBox(); - comboBox.setModel(new DefaultComboBoxModel(new String[] { - "Lokal (Eigene Hochschule)", - "\u00D6ffentlich (Alle Hochschulen)" })); - comboBox.setSelectedIndex(0); - comboBox.setBounds(270, 55, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - CreateImageFreigabe_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Zur\u00FCck"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - Image.image.setShareMode(comboBox.getSelectedIndex()); - CreateImageTechnisch_GUI sr = new CreateImageTechnisch_GUI(); - sr.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("OK"); - buttonPane.add(cancelButton); - // getRootPane().setDefaultButton(cancelButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Image.image.setShareMode(comboBox.getSelectedIndex()); - FTPCreateUploader_GUI ea = new FTPCreateUploader_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - continueButton.setActionCommand("Cancel"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - JMenuItem menuItem = new JMenuItem("About"); - menuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(menuItem); - - } -} diff --git a/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java b/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java deleted file mode 100644 index 34594f3d..00000000 --- a/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java +++ /dev/null @@ -1,405 +0,0 @@ -package gui.image; - - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JSpinner; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.SpinnerNumberModel; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Links; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class CreateImageTechnisch_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JSpinner spinnerCPU; - JSpinner spinnerRam; - JRadioButton rdbtnlicenseJa; - JRadioButton rdbtnlicenseNein; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - private final ButtonGroup buttonGrouplicense = new ButtonGroup(); - private final ButtonGroup buttonGroupInternet = new ButtonGroup(); - - - /** - * Create the dialog. - */ - public CreateImageTechnisch_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Eingabe technischer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Geben Sie hier bitte einige technische Daten ein"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Image", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 66, 557, 124); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - rdbtnlicenseNein = new JRadioButton("Nein"); - buttonGrouplicense.add(rdbtnlicenseNein); - rdbtnlicenseNein.setBounds(377, 29, 46, 23); - panel_1.add(rdbtnlicenseNein); - - rdbtnInternetNein = new JRadioButton("Nein"); - rdbtnInternetNein.setSelected(true); - buttonGroupInternet.add(rdbtnInternetNein); - rdbtnInternetNein.setBounds(377, 57, 46, 23); - panel_1.add(rdbtnInternetNein); - - JLabel lblInternetIstInnerhalb = new JLabel("Internet ist f\u00FCr dieses Image gesperrt:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - JButton btnInternetSettings = new JButton("Einstellungen..."); - btnInternetSettings.setEnabled(false); - btnInternetSettings.setBounds(439, 57, 108, 23); - panel_1.add(btnInternetSettings); - - rdbtnInternetJa = new JRadioButton("Ja"); - - buttonGroupInternet.add(rdbtnInternetJa); - rdbtnInternetJa.setBounds(266, 57, 41, 23); - panel_1.add(rdbtnInternetJa); - - rdbtnlicenseJa = new JRadioButton("Ja"); - rdbtnlicenseJa.setSelected(true); - buttonGrouplicense.add(rdbtnlicenseJa); - rdbtnlicenseJa.setBounds(266, 29, 41, 23); - panel_1.add(rdbtnlicenseJa); - - JLabel lblNewLabel_2 = new JLabel("Image enth\u00E4lt lizenzpflichtige Software:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblLizenzserverEintragen = new JLabel("Lizenzserver eintragen:"); - lblLizenzserverEintragen.setBounds(10, 85, 250, 20); - panel_1.add(lblLizenzserverEintragen); - - JButton btnLicenseServer = new JButton("Server-Adresse..."); - btnLicenseServer.setEnabled(false); - btnLicenseServer.setBounds(266, 84, 157, 23); - panel_1.add(btnLicenseServer); - - JPanel panel_2 = new JPanel(); - panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Empfehlung bez\u00fcglich Ressourcen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(11, 196, 557, 338); - contentPanel.add(panel_2); - - JLabel lblGbyte = new JLabel("GByte"); - lblGbyte.setBounds(424, 91, 46, 20); - panel_2.add(lblGbyte); - - spinnerCPU = new JSpinner(); - spinnerCPU.setModel(new SpinnerNumberModel(1, 1, 4, 1)); - spinnerCPU.setBounds(385, 188, 29, 20); - panel_2.add(spinnerCPU); - - JTextArea txtrBeispielWindows = new JTextArea(); - txtrBeispielWindows.setText("Beispiel:\r\nWindows 7 32/64 Bit: 2 GByte\r\nLinux/Unix 32/64 Bit: 1 GByte"); - txtrBeispielWindows.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrBeispielWindows.setBackground(SystemColor.menu); - txtrBeispielWindows.setBounds(10, 122, 280, 55); - panel_2.add(txtrBeispielWindows); - - - - JLabel lblKerne = new JLabel("Kerne"); - lblKerne.setBounds(424, 191, 46, 20); - panel_2.add(lblKerne); - - JLabel lblWieVieleCpus = new JLabel("Wie viele CPUs empfehlen Sie f\u00FCr das Image:"); - lblWieVieleCpus.setBounds(10, 191, 280, 20); - panel_2.add(lblWieVieleCpus); - - spinnerRam = new JSpinner(); - spinnerRam.setModel(new SpinnerNumberModel(1, 1, 8, 1)); - spinnerRam.setBounds(385, 88, 29, 20); - panel_2.add(spinnerRam); - - JLabel label_3 = new JLabel("mindestens"); - label_3.setBounds(315, 191, 60, 20); - panel_2.add(label_3); - - JLabel lblMindestens = new JLabel("mindestens"); - lblMindestens.setBounds(315, 91, 60, 20); - panel_2.add(lblMindestens); - - JTextArea txtrBeispielWindows_1 = new JTextArea(); - txtrBeispielWindows_1.setText("Beispiel:\r\nWindows 7 32/64 Bit: 1 Kern\r\nLinux/Unix 32/64 Bit: 1 Kern"); - txtrBeispielWindows_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrBeispielWindows_1.setBackground(SystemColor.menu); - txtrBeispielWindows_1.setBounds(10, 222, 280, 55); - panel_2.add(txtrBeispielWindows_1); - - JLabel lblNewLabel_3 = new JLabel("Wie viel Arbeitsspeicher empfehlen Sie f\u00FCr das Image:"); - lblNewLabel_3.setBounds(10, 91, 280, 20); - panel_2.add(lblNewLabel_3); - - JTextArea txtrHinweisSolltenSie = new JTextArea(); - txtrHinweisSolltenSie.setBackground(SystemColor.menu); - txtrHinweisSolltenSie.setFont(new Font("Tahoma", Font.PLAIN, 13)); - txtrHinweisSolltenSie.setText("Hinweis: Sollten Sie keine Software einsetzen, die viele Ressourcen ben\u00F6tigt,\r\nk\u00F6nnen Sie sich an den Beispielwerten orientieren."); - txtrHinweisSolltenSie.setBounds(10, 25, 537, 55); - panel_2.add(txtrHinweisSolltenSie); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - CreateImageTechnisch_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Zur\u00FCck"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - if(rdbtnInternetJa.isSelected()==true) - { - Image.image.setInternet(true); - } - else - { - Image.image.setInternet(false); - } - - if(rdbtnlicenseJa.isSelected()==true) - { - Image.image.setLicensed(true); - } - else - { - Image.image.setLicensed(false); - } - Image.image.setCpu(Integer.valueOf(spinnerCPU.getValue().toString()).intValue()); - Image.image.setRam(Integer.valueOf(spinnerRam.getValue().toString()).intValue()); - - CreateImageAllgemein_GUI sr=new CreateImageAllgemein_GUI(); - sr.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("OK"); - buttonPane.add(cancelButton); - //getRootPane().setDefaultButton(cancelButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(rdbtnInternetJa.isSelected()==true) - { - Image.image.setInternet(true); - } - else - { - Image.image.setInternet(false); - } - - if(rdbtnlicenseJa.isSelected()==true) - { - Image.image.setLicensed(true); - } - else - { - Image.image.setLicensed(false); - } - Image.image.setCpu(Integer.valueOf(spinnerCPU.getValue().toString()).intValue()); - Image.image.setRam(Integer.valueOf(spinnerRam.getValue().toString()).intValue()); - CreateImageFreigabe_GUI ea=new CreateImageFreigabe_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - continueButton.setActionCommand("Cancel"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem menuItem = new JMenuItem("About"); - menuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(menuItem); - - } -} diff --git a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java b/Dozentenmodul/src/gui/image/DeleteImage_GUI.java deleted file mode 100644 index 67084a75..00000000 --- a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java +++ /dev/null @@ -1,633 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.HeadlessException; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.ListSelectionModel; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class DeleteImage_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox comboBox; - JTable tableAllImages; - JTable tablemyImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; - ThriftConnection con=new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final DefaultTableModel modelMyImages = new DefaultTableModel(titles,0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyImages = new TableRowSorter( - modelMyImages); - - /** - * Create the dialog. - */ - public DeleteImage_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Image l\u00F6schen"); - // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel( - "Zu l\u00F6schendes Image w\u00E4hlen"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("W\u00E4hlen Sie bitte aus der unten stehenden Liste das zu l\u00F6schende Image aus."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche*Folgt noch...*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - // oeffnet das Fenster Extended GUI - con.closeThriftConnection(); - - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(332, 106, 188, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox(); - try { - // Holt sich eine Liste aller verf\u00FCgbaren Betriebssysteme vom Server - List list = client.getAllOS(); - // Leeres Item hinzufuegen - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - // Hinzufuegen der verfuegbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - JOptionPane.showMessageDialog(null, - e2.getCause()+"\n"+e2.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - // Registriert Auswahlaenderungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // Prueft das die Auswahl nicht leer ist - if (comboBox.getSelectedItem().toString() != "") { - // Filtert nach dem ausgewaehlten Betriebssystem - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox - .getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - comboBox.getSelectedItem().toString(), 2)); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - // oeffnet das Hauuetmenue - con.closeThriftConnection(); - - // oeffnet das Hauuetmenue - - DeleteImage_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); - if (tabbedPane.getSelectedIndex() == 0) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - // String username="Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - } else if (tabbedPane.getSelectedIndex() == 1) { - - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - initTableModel(modelMyImages); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages = new JTable(); - tableAllImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages = new JTable(); - tablemyImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tablemyImages.setEnabled(true); - - tablemyImages.setModel(modelMyImages); - - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyImages.setRowSorter(rowSorterMyImages); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages = new JTable(); - tableCoopImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages = new JTable(); - tablePublicImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen = new JTable(); - tablePublicVorlagen - .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - JButton btnDelete = new JButton("L\u00F6schen"); - btnDelete.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - String imageid=""; - String imageversion=""; - int eingabe; - - if (tablemyImages.getSelectedRowCount() != 0) { - - // frage, soll das selektierte Daten geloescht werden? - eingabe = JOptionPane.showConfirmDialog(null, - "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - - imageid = modelMyImages.getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 7) - .toString(); - - imageversion = modelMyImages.getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 8) - .toString(); - - // TODO - // Image darf nur geloescht werden, wenn keine - // Veranstaltung mehr auf das Image verweist. - // Unbdingt abfragen! - - try { - if (!client.connectedToLecture(imageid, - imageversion)) { - System.out.println(imageid); - System.out.println(imageversion); - try { - client.deleteImageServer(imageid, imageversion); - if (client.deleteImageData(imageid, - imageversion)) { - // if (client.deleteImageServer(imageid - // ,imageversion)) { - - - - - DeleteImage_GUI di = new DeleteImage_GUI(); - di.setVisible(true); - dispose(); - - - /* - * } else { - * - * JOptionPane.showConfirmDialog(null, - * "Loeschen vom Server hat leider nicht geklappt!!" - * , imageversion, - * JOptionPane.OK_CANCEL_OPTION); } - */ - - } else { - - JOptionPane - .showConfirmDialog( - null, - "L\u00f6schen von der DB hat leider nicht geklappt!!", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (HeadlessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - } else { - - JOptionPane.showMessageDialog(null, - "Image kann nicht gel\u00f6scht werden, da mindestens eine Veranstaltung mit diesem Image verlinkt ist.", - "Verlinkung vorhanden", JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - - } else { - - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein eigenes Image aus", - "Message", JOptionPane.INFORMATION_MESSAGE); - } - - } - }); - btnDelete.setBounds(449, 508, 118, 23); - contentPanel.add(btnDelete); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // oeffnet das Hauptmen\u00FC - con.closeThriftConnection(); - - // oeffnet das Hauptmenue - - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem menuItem = new JMenuItem("About"); - menuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(menuItem); - - } - - // Initiale Beff\u00FClung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List images; - try { - // Hole eine Liste der Images - images = client.getImageList(); - - Iterator i = images.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte f\u00FCr die Tabelle - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime(), "", images.get(x).id, - images.get(x).getVersion() }; - // System.out.println("id:"+images.get(x).getId()); - // F\u00FCge diese Objekte der Tabelle hinzu - - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java b/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java deleted file mode 100644 index 47837c22..00000000 --- a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java +++ /dev/null @@ -1,424 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class EditImageAllgemein_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private JTextField Vorname; - private JTextField Nachname; - private JTextField Hochschule; - private JTextField EMail; - private JTextField imagename; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - private JPanel panel_2; - private JLabel lblNewLabel; - private JTextPane txtpnBitteWhlenSie; - private JPanel buttonPane; - private JButton backButton; - private JButton okButton; - - /** - * Create the dialog. - */ - public EditImageAllgemein_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung bei einem Klick auf das X - con.closeThriftConnection(); - System.exit(0); - } - }); - // Verhindert das vergroessern des Fensters - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); - - // Zentriert das Fenster in der Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - initData(); - getContentPane().setLayout(null); - { - panel_2 = new JPanel(); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(10, 11, 577, 57); - getContentPane().add(panel_2); - panel_2.setLayout(null); - { - lblNewLabel = new JLabel("Bearbeiten Ihrer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel_2.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel_2.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 66, 557, 369); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel label = new JLabel("Vorname: *"); - label.setBackground(SystemColor.menu); - label.setBounds(10, 245, 125, 20); - panel_1.add(label); - - Vorname = new JTextField(); - Vorname.setEditable(false); - Vorname.setEnabled(false); - Vorname.setBackground(Color.WHITE); - Vorname.setText(person.verantwortlicher.getVorname()); - Vorname.setColumns(10); - Vorname.setBounds(145, 245, 350, 20); - panel_1.add(Vorname); - - JLabel label_7 = new JLabel("Nachname: *"); - label_7.setBackground(SystemColor.menu); - label_7.setBounds(10, 276, 125, 20); - panel_1.add(label_7); - - Nachname = new JTextField(); - Nachname.setEnabled(false); - Nachname.setEditable(false); - Nachname.setBackground(Color.WHITE); - Nachname.setText(person.verantwortlicher.getName()); - Nachname.setColumns(10); - Nachname.setBounds(145, 276, 350, 20); - panel_1.add(Nachname); - - JLabel label_8 = new JLabel("Hochschule: *"); - label_8.setBackground(SystemColor.menu); - label_8.setBounds(10, 307, 125, 20); - panel_1.add(label_8); - - Hochschule = new JTextField(); - Hochschule.setEnabled(false); - Hochschule.setEditable(false); - Hochschule.setBackground(Color.WHITE); - Hochschule.setText(person.verantwortlicher.getHochschule()); - Hochschule.setColumns(10); - Hochschule.setBounds(145, 307, 350, 20); - panel_1.add(Hochschule); - - JLabel label_9 = new JLabel("E-Mail: *"); - label_9.setBackground(SystemColor.menu); - label_9.setBounds(10, 338, 125, 20); - panel_1.add(label_9); - - EMail = new JTextField(); - EMail.setEnabled(false); - EMail.setEditable(false); - EMail.setBackground(Color.WHITE); - EMail.setText(person.verantwortlicher.getEMail()); - EMail.setColumns(10); - EMail.setBounds(145, 338, 350, 20); - panel_1.add(EMail); - - JLabel lblImagename = new JLabel("Imagename: *"); - lblImagename.setBackground(SystemColor.menu); - lblImagename.setBounds(10, 31, 125, 20); - panel_1.add(lblImagename); - - imagename = new JTextField(); - imagename - .setToolTipText("Bitte geben Sie hier den Namen des Image ein, z.B. \"Programmieren\"."); - imagename.setBackground(Color.WHITE); - imagename.setText(Image.image.getImagename()); - imagename.setColumns(10); - imagename.setBounds(145, 31, 350, 20); - panel_1.add(imagename); - - JTextArea txtrGebenSieBitte = new JTextArea(); - txtrGebenSieBitte.setBackground(SystemColor.menu); - txtrGebenSieBitte.setLineWrap(true); - txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); - txtrGebenSieBitte - .setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); - txtrGebenSieBitte.setBounds(145, 62, 350, 110); - panel_1.add(txtrGebenSieBitte); - - JPanel panel = new JPanel(); - panel.setBounds(10, 402, 577, 33); - contentPanel.add(panel); - panel.setLayout(null); - panel.setBorder(new EmptyBorder(5, 5, 5, 5)); - panel.setBackground(SystemColor.menu); - - JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); - lblPflichtfelder.setBounds(10, 442, 136, 14); - contentPanel.add(lblPflichtfelder); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // Durch den Klick auf Button Hauptmenpue wird dieses Fenster - // unsichtbar und das Hauptmenue sichtbar - - EditImageAllgemein_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Bearbeiten"); - lblNewLabel_1.setBounds(146, 11, 71, 14); - contentPanel.add(lblNewLabel_1); - { - buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - backButton = new JButton("Zur\u00FCck"); - backButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // Setzen der Eingabe im Model, dadurch bleiben die - // Daten bei einem erneuten Aufruf verfuegbar - // Image.image.setImagename(imagename.getText()); - - SearchEditImage_GUI se = new SearchEditImage_GUI(); - se.setVisible(true); - dispose(); - } - }); - backButton.setActionCommand("CANCEL"); - buttonPane.add(backButton); - - } - { - okButton = new JButton("Weiter"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // check is textfield is empty - if (imagename.getText().length() <= 0) { - JOptionPane.showMessageDialog(null, - "Bitte geben Sie einen Labornamen ein.", - "Daten nicht vollst\u00e4ndig", - JOptionPane.INFORMATION_MESSAGE); - - } else { - - // setze Namen, egal ob alt oder nicht - Image.image.setImagename(imagename.getText()); - System.out.println("Changing name to:" + imagename.getText()+ "\nNewName is: "+Image.image.getNewName()); - - - EditImageTechnisch_GUI ea = new EditImageTechnisch_GUI(); - ea.setVisible(true); - dispose(); - }// end else - } - }); - - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem menuItem = new JMenuItem("About"); - menuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(menuItem); - // setFocusTraversalPolicy(new FocusTraversalOnArray(new - // Component[]{getContentPane(), panel_2, lblNewLabel, - // txtpnBitteWhlenSie, contentPanel, panel_1, label, Vorname, label_7, - // Nachname, label_8, Hochschule, label_9, EMail, lblImagename, - // imagename, txtrGebenSieBitte, panel, lblPflichtfelder, lblHauptmen, - // label_1, lblVlimage, label_2, lblNewLabel_1, buttonPane, backButton, - // okButton, separator, separator_1, menuBar, mnNewMenu_1, mntmFaq, - // mntmOtrs})); - - } - - public void initData() { - try { - - Map map = client.getImageData( - Image.image.getImageId(), Image.image.getVersion()); - if (map.get("internet").equals("0")) { - Image.image.setInternet(false); - } else { - Image.image.setInternet(true); - } - if (map.get("license").equals("0")) { - Image.image.setLicensed(false); - } else { - Image.image.setLicensed(true); - } - Image.image.setImagename(map.get("name")); - Image.image.setRam(Integer.parseInt(map.get("ram"))); - Image.image.setCpu(Integer.parseInt(map.get("cpu"))); - Image.image.setImagepath(map.get("path")); - Image.image.setFilesize(Long.parseLong(map.get("filesize"))); - int mode=0; - if(map.get("shareMode").equals("only_local")){ - mode=0; - } - else - { - mode=1; - } - Image.image.setShareMode(mode); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getMessage(), "Debug-Message", - JOptionPane.ERROR_MESSAGE); - } - } - -} diff --git a/Dozentenmodul/src/gui/image/EditImageFreigabe_GUI.java b/Dozentenmodul/src/gui/image/EditImageFreigabe_GUI.java deleted file mode 100644 index e28b774b..00000000 --- a/Dozentenmodul/src/gui/image/EditImageFreigabe_GUI.java +++ /dev/null @@ -1,262 +0,0 @@ -package gui.image; - - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Links; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class EditImageFreigabe_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private final ButtonGroup buttonGrouplicense = new ButtonGroup(); - private final ButtonGroup buttonGroupInternet = new ButtonGroup(); - JComboBox comboBox; - - /** - * Create the dialog. - */ - public EditImageFreigabe_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Image Freigabe"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("W\u00E4hlen Sie bitte hier die von Ihnen gew\u00FCnschte Freigabe f\u00FCr Ihr Image aus."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Freigabe", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 51, 557, 124); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Freigabemodus:"); - lblNewLabel_2.setBounds(10, 55, 250, 20); - panel_1.add(lblNewLabel_2); - - comboBox = new JComboBox(); - comboBox.setModel(new DefaultComboBoxModel(new String[] {"Lokal (Eigene Hochschule)", "\u00D6ffentlich (Alle Hochschulen)"})); - comboBox.setSelectedIndex(Image.image.getShareMode()); - comboBox.setBounds(270, 55, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - EditImageFreigabe_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Zur\u00FCck"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - Image.image.setShareMode(comboBox.getSelectedIndex()); - EditImageTechnisch_GUI sr=new EditImageTechnisch_GUI(); - sr.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("OK"); - buttonPane.add(cancelButton); - //getRootPane().setDefaultButton(cancelButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Image.image.setShareMode(comboBox.getSelectedIndex()); - FTPEditUploader_GUI ea=new FTPEditUploader_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - continueButton.setActionCommand("Cancel"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } -} diff --git a/Dozentenmodul/src/gui/image/EditImageTechnisch_GUI.java b/Dozentenmodul/src/gui/image/EditImageTechnisch_GUI.java deleted file mode 100644 index 825292c2..00000000 --- a/Dozentenmodul/src/gui/image/EditImageTechnisch_GUI.java +++ /dev/null @@ -1,403 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JSpinner; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.SpinnerNumberModel; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import util.GuiOrganizer; -import util.OpenLinks; -import models.Image; -import models.Links; - -@SuppressWarnings("serial") -public class EditImageTechnisch_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JSpinner spinnerCPU; - JSpinner spinnerRam; - JRadioButton rdbtnlicenseJa; - JRadioButton rdbtnlicenseNein; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - private final ButtonGroup buttonGrouplicense = new ButtonGroup(); - private final ButtonGroup buttonGroupInternet = new ButtonGroup(); - - /** - * Create the dialog. - */ - public EditImageTechnisch_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung bei Klick auf das X - - System.exit(0); - } - - }); - // Verhindert das Vergroe�ern des Fensters - setResizable(false); - - try { - // setzt das Look & Feel - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Titel des Fensters - setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); - // Zentriert das Fenster - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Eingabe technischer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Geben Sie hier bitte einige technische Daten ein."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Image", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 66, 557, 95); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel( - "Image enth\u00E4lt lizenzpflichtige Software:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - rdbtnlicenseJa = new JRadioButton("Ja"); - rdbtnlicenseJa.setSelected(true); - buttonGrouplicense.add(rdbtnlicenseJa); - rdbtnlicenseJa.setBounds(266, 29, 109, 23); - panel_1.add(rdbtnlicenseJa); - - rdbtnlicenseNein = new JRadioButton("Nein"); - buttonGrouplicense.add(rdbtnlicenseNein); - rdbtnlicenseNein.setBounds(377, 29, 109, 23); - panel_1.add(rdbtnlicenseNein); - if (Image.image.isLicensed() == true) { - rdbtnlicenseJa.setSelected(true); - } else { - rdbtnlicenseNein.setSelected(true); - } - - JLabel lblInternetIstInnerhalb = new JLabel( - "Internet ist innerhalb des Image gesperrt:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - rdbtnInternetJa = new JRadioButton("Ja"); - buttonGroupInternet.add(rdbtnInternetJa); - rdbtnInternetJa.setBounds(266, 57, 109, 23); - panel_1.add(rdbtnInternetJa); - - rdbtnInternetNein = new JRadioButton("Nein"); - rdbtnInternetNein.setSelected(true); - buttonGroupInternet.add(rdbtnInternetNein); - rdbtnInternetNein.setBounds(377, 57, 109, 23); - panel_1.add(rdbtnInternetNein); - if (Image.image.isInternet() == true) { - rdbtnInternetJa.setSelected(true); - } else { - rdbtnInternetNein.setSelected(true); - } - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // Macht dieses Fenster unsichtbar und das vorhergehende Fenster - // sichtbar - EditImageTechnisch_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - - JPanel panel_2 = new JPanel(); - panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, - "Empfehlung bez\u00fcglich Ressourcen", TitledBorder.LEADING, - TitledBorder.TOP, null, null)); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(10, 172, 557, 338); - contentPanel.add(panel_2); - - JTextArea txtrHinweisSolltenSie = new JTextArea(); - txtrHinweisSolltenSie.setBackground(SystemColor.menu); - txtrHinweisSolltenSie.setFont(new Font("Tahoma", Font.PLAIN, 13)); - txtrHinweisSolltenSie - .setText("Hinweis: Sollten Sie keine Software einsetzen, die viele Ressourcen ben\u00F6tigt,\r\nk\u00F6nnen Sie sich an den Beispielwerten orientieren."); - txtrHinweisSolltenSie.setBounds(10, 25, 537, 55); - panel_2.add(txtrHinweisSolltenSie); - - JLabel lblNewLabel_3 = new JLabel( - "Wie viel Arbeitsspeicher empfehlen Sie f\u00FCr das Image:"); - lblNewLabel_3.setBounds(10, 91, 280, 20); - panel_2.add(lblNewLabel_3); - - JLabel lblMindestens = new JLabel("mindestens"); - lblMindestens.setBounds(315, 91, 60, 20); - panel_2.add(lblMindestens); - - spinnerRam = new JSpinner(); - spinnerRam.setModel(new SpinnerNumberModel(1, 1, 8, 1)); - spinnerRam.setBounds(385, 88, 29, 20); - spinnerRam.setValue(Image.image.getRam()); - panel_2.add(spinnerRam); - - JLabel lblGbyte = new JLabel("GByte"); - lblGbyte.setBounds(424, 91, 46, 20); - panel_2.add(lblGbyte); - - JTextArea txtrBeispielWindows = new JTextArea(); - txtrBeispielWindows - .setText("Beispiel:\r\nWindows 7 32/64 Bit: 2 GByte\r\nLinux/Unix 32/64 Bit: 1 GByte"); - txtrBeispielWindows.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrBeispielWindows.setBackground(SystemColor.menu); - txtrBeispielWindows.setBounds(20, 111, 280, 55); - panel_2.add(txtrBeispielWindows); - - JTextArea txtrBeispielWindows_1 = new JTextArea(); - txtrBeispielWindows_1 - .setText("Beispiel:\r\nWindows 7 32/64 Bit: 1 Kern\r\nLinux/Unix 32/64 Bit: 1 Kern"); - txtrBeispielWindows_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrBeispielWindows_1.setBackground(SystemColor.menu); - txtrBeispielWindows_1.setBounds(20, 226, 280, 55); - panel_2.add(txtrBeispielWindows_1); - - JLabel lblWieVieleCpus = new JLabel( - "Wie viele CPUs empfehlen Sie f\u00FCr das Image:"); - lblWieVieleCpus.setBounds(10, 201, 280, 20); - panel_2.add(lblWieVieleCpus); - - JLabel label_3 = new JLabel("mindestens"); - label_3.setBounds(315, 201, 60, 20); - panel_2.add(label_3); - - spinnerCPU = new JSpinner(); - spinnerCPU.setModel(new SpinnerNumberModel(1, 1, 4, 1)); - spinnerCPU.setBounds(385, 198, 29, 20); - spinnerCPU.setValue(Image.image.getCpu()); - panel_2.add(spinnerCPU); - - JLabel lblKerne = new JLabel("Kerne"); - lblKerne.setBounds(424, 201, 46, 20); - panel_2.add(lblKerne); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // Setzt die Imagewerte in das Model - Image.image.setCpu(Integer.valueOf( - spinnerCPU.getValue().toString()).intValue()); - Image.image.setRam(Integer.valueOf( - spinnerRam.getValue().toString()).intValue()); - if (rdbtnInternetJa.isSelected() == true) { - Image.image.setInternet(true); - } else { - Image.image.setInternet(false); - } - - if (rdbtnlicenseJa.isSelected() == true) { - Image.image.setLicensed(true); - } else { - Image.image.setLicensed(false); - } - // oeffnet das vorherige Fenster - EditImageAllgemein_GUI ei = new EditImageAllgemein_GUI(); - ei.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Image.image.setCpu(Integer.valueOf( - spinnerCPU.getValue().toString()).intValue()); - Image.image.setRam(Integer.valueOf( - spinnerRam.getValue().toString()).intValue()); - if (rdbtnInternetJa.isSelected() == true) { - Image.image.setInternet(true); - } else { - Image.image.setInternet(false); - } - - if (rdbtnlicenseJa.isSelected() == true) { - Image.image.setLicensed(true); - } else { - Image.image.setLicensed(false); - } - // oeffnet das naechste Fenster - EditImageFreigabe_GUI ea=new EditImageFreigabe_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } -} diff --git a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java deleted file mode 100644 index b850ccb2..00000000 --- a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java +++ /dev/null @@ -1,547 +0,0 @@ -package gui.image; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; - -import models.Image; -import models.Links; -import models.SessionData; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; -import ftp.UploadTask; -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -@SuppressWarnings("serial") -public class FTPCreateUploader_GUI extends JFrame implements - PropertyChangeListener { - - @SuppressWarnings("unused") - private JPanel contentPane; - private final JPanel contentPanel = new JPanel(); - JLabel lblPath; - JProgressBar progressBar; - String host = SessionData.session.getServerAdress(); - int port = 21; - server.User user; - String filename = ""; - File uploadFile; - static String arg = ""; - UploadTask task; - JLabel UpSpeed; - JLabel labelfertig; - JLabel labelfilesize; - JLabel labelZeit; - JLabel labelverbleibend; - long filesize; - double speed; - long bytesread; - boolean taskrun = false; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - JButton finishButton = new JButton("Fertigstellen"); - JButton btnUploadStarten = new JButton("Upload auf Server starten"); - JButton btnZurck = new JButton("Zur\u00FCck"); - int progress = 0; // progress of upload - - - /** - * Create the frame. - */ - public FTPCreateUploader_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - task.cancel(true); - } - con.closeThriftConnection(); - System.exit(0); - }// end window closing - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - // filename=name; - setBackground(Color.WHITE); - setTitle("Dozentenmodul *Prototyp* - Image erzeugen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(new BorderLayout()); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel, BorderLayout.CENTER); - contentPanel.setLayout(null); - { - JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); - btnSpeicherortAuswhlen.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.FILES_ONLY); - - fc.showOpenDialog(getParent()); - File file = fc.getSelectedFile(); - // check if a file is selected and exists - if (file != null) { - // file selected - uploadFile = file; - filename = uploadFile.getName(); - lblPath.setText(file.getAbsolutePath()); - } else { - // no file selected - lblPath.setText(""); - }// end if - } - }); - - btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); - btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); - contentPanel.add(btnSpeicherortAuswhlen); - } - - lblPath = new JLabel(""); - lblPath.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent arg0) { - if (lblPath.getText().isEmpty()) { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(false); - btnUploadStarten.setText("Bitte warten"); - } else { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(true); - btnUploadStarten.setText("Upload auf Server starten"); - } - } - }); - lblPath.setHorizontalAlignment(SwingConstants.LEFT); - lblPath.setBounds(102, 158, 485, 23); - contentPanel.add(lblPath); - - btnUploadStarten.setEnabled(false); - btnUploadStarten.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - buttonUploadActionPerformed(arg0); - - } - }); - - btnUploadStarten.setBounds(102, 200, 173, 23); - contentPanel.add(btnUploadStarten); - - progressBar = new JProgressBar(0, 100); - progressBar.setStringPainted(true); - - progressBar.setBounds(102, 234, 485, 30); - contentPanel.add(progressBar); - - JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); - lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); - contentPanel.add(lblUploadgeschwindigkeit); - - JLabel label_1 = new JLabel("Fertig:"); - label_1.setBounds(102, 325, 46, 14); - contentPanel.add(label_1); - - labelfertig = new JLabel("0"); - labelfertig.setHorizontalAlignment(SwingConstants.LEFT); - labelfertig.setBounds(183, 325, 108, 14); - contentPanel.add(labelfertig); - - UpSpeed = new JLabel("0"); - UpSpeed.setHorizontalAlignment(SwingConstants.LEFT); - UpSpeed.setBounds(374, 275, 117, 14); - contentPanel.add(UpSpeed); - - JLabel label_4 = new JLabel("von:"); - label_4.setBounds(318, 325, 46, 14); - contentPanel.add(label_4); - - labelfilesize = new JLabel("0"); - labelfilesize.setHorizontalAlignment(SwingConstants.LEFT); - labelfilesize.setBounds(374, 325, 117, 14); - contentPanel.add(labelfilesize); - - JLabel label_6 = new JLabel("Verbleibend:"); - label_6.setBounds(102, 350, 71, 14); - contentPanel.add(label_6); - - JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); - label_7.setBounds(102, 300, 150, 14); - contentPanel.add(label_7); - - labelZeit = new JLabel("0"); - labelZeit.setHorizontalAlignment(SwingConstants.LEFT); - labelZeit.setBounds(374, 300, 117, 14); - contentPanel.add(labelZeit); - - labelverbleibend = new JLabel("0"); - labelverbleibend.setHorizontalAlignment(SwingConstants.LEFT); - labelverbleibend.setBounds(183, 350, 108, 14); - contentPanel.add(labelverbleibend); - - JPanel panel = new JPanel(); - panel.setLayout(null); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - contentPanel.add(panel); - - JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); - lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); - lblUploadIhresImage.setBounds(10, 11, 509, 22); - panel.add(lblUploadIhresImage); - - JTextPane txtpnFhreSieBitte = new JTextPane(); - txtpnFhreSieBitte - .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); - txtpnFhreSieBitte.setEditable(false); - txtpnFhreSieBitte.setBackground(SystemColor.menu); - txtpnFhreSieBitte.setBounds(10, 36, 509, 32); - panel.add(txtpnFhreSieBitte); - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 79, 597, 2); - contentPanel.add(separator); - - JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); - lblNewLabel_1.setForeground(Color.BLUE); - lblNewLabel_1.setBounds(20, 88, 61, 20); - contentPanel.add(lblNewLabel_1); - - JLabel label_3 = new JLabel(">"); - label_3.setBounds(80, 91, 14, 14); - contentPanel.add(label_3); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(91, 88, 46, 20); - contentPanel.add(lblVlimage); - - JLabel label_5 = new JLabel(">"); - label_5.setBounds(139, 91, 14, 14); - contentPanel.add(label_5); - - JLabel lblNeubearbeiten = new JLabel("Neu"); - lblNeubearbeiten.setBounds(149, 91, 108, 14); - contentPanel.add(lblNeubearbeiten); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - contentPanel.add(separator_1); - - JLabel lblSchritt_1 = new JLabel("Schritt 1:"); - lblSchritt_1.setBounds(24, 128, 57, 14); - contentPanel.add(lblSchritt_1); - - JLabel lblSchritt_2 = new JLabel("Schritt 2:"); - lblSchritt_2.setBounds(24, 204, 57, 14); - contentPanel.add(lblSchritt_2); - - JLabel lblSchritt_3 = new JLabel("Schritt 3:"); - lblSchritt_3.setBounds(20, 423, 57, 14); - contentPanel.add(lblSchritt_3); - - JLabel lblKlickenSieAuf = new JLabel( - "Klicken Sie auf \"Fertigstellen\"."); - lblKlickenSieAuf.setBounds(98, 423, 241, 14); - contentPanel.add(lblKlickenSieAuf); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBackground(UIManager.getColor("Button.background")); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane, BorderLayout.SOUTH); - { - finishButton.setEnabled(false); - finishButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - writeData(); - dispose(); - MainMenue_GUI m = new MainMenue_GUI(); - m.setVisible(true); - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - task.cancel(true); - } - - } - }); - - btnZurck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - dispose(); - - CreateImageTechnisch_GUI m = new CreateImageTechnisch_GUI(); - m.setVisible(true); - } - }); - btnZurck.setActionCommand("Cancel"); - buttonPane.add(btnZurck); - finishButton.setActionCommand("Cancel"); - buttonPane.add(finishButton); - } - } - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu menu = new JMenu("Hilfe"); - menuBar.add(menu); - - JMenuItem menuItem = new JMenuItem("FAQ"); - menuItem.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - menu.add(menuItem); - - JMenuItem menuItem_1 = new JMenuItem("OTRS"); - menuItem_1.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - menu.add(menuItem_1); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - menu.add(mntmAbout); - setVisible(true); - - } - - private void buttonUploadActionPerformed(ActionEvent event) { - - progressBar.setValue(0); - btnUploadStarten.setEnabled(false); // verhindert einen weiteren klick - btnUploadStarten.setText("Bitte warten"); - - try { - System.out.println("Test"); - user = client.getFtpUser(); - System.out.println("FTP name" + user.userName); - System.out.println("FTP path" + user.path); - System.out.println("FTP pass" + user.password); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); - - System.out.println(formatter.format(new Date()) + "_" - + person.verantwortlicher.getHochschule() + "_" - + person.verantwortlicher.getUsername() + "_" - + Image.image.getImagename() + ".vmdk"); - Image.image.setNewName(formatter.format(new Date()) + "_" - + person.verantwortlicher.getHochschule() + "_" - + person.verantwortlicher.getUsername() + "_" - + Image.image.getImagename() + ".vmdk"); - System.out.println("Uploading to host: "+host); - - task = new UploadTask(host, port, user.userName, user.password, - user.path+"temp/", uploadFile); - - task.addPropertyChangeListener(this); - task.execute(); - taskrun = true; - - } - - public void propertyChange(PropertyChangeEvent arg0) { - progress = 0; - if ("progress" == arg0.getPropertyName()) { - progress = (Integer) arg0.getNewValue(); - progressBar.setValue(progress); - - // Button zum Fertigstellen freischalten, wenn 100% erreicht sind - if (progress == 0 || progress == 100) { - // not uploading currently - btnZurck.setEnabled(true); - } else { - // currently uploading, don't let user interact - btnZurck.setEnabled(false); - } - - // Fertigstellen erlauben wenn upload abgeschlossen - if (progress == 100) { - finishButton.setEnabled(true); - - } else { - finishButton.setEnabled(false); - - } - - } - - - - if ("speed" == arg0.getPropertyName()) { - speed = (double) arg0.getNewValue(); - // if(speed<=1){ - - UpSpeed.setText(String.valueOf(speed).substring(0, - String.valueOf(speed).lastIndexOf(".") + 3) - + " MB/s"); - - } - if ("bytesread" == arg0.getPropertyName()) { - bytesread = (long) arg0.getNewValue(); - labelfertig.setText((bytesread / 1024 / 1024) + " MB"); - labelverbleibend - .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) - + " MB"); - - labelZeit - .setText(String - .valueOf( - ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) - .substring( - 0, - String.valueOf( - (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) - .lastIndexOf(".")) - + " Minuten"); - - } - if ("filesize" == arg0.getPropertyName()) { - filesize = (long) arg0.getNewValue(); - labelfilesize.setText((filesize / 1024 / 1024) + " MB"); - - } - - } - - public boolean writeData() { - - try { - - client.writeVLdata(Image.image.getImagename(), - person.verantwortlicher.getUsername(), - person.verantwortlicher.getVorname(), - person.verantwortlicher.getName(), - person.verantwortlicher.getHochschule(), - person.verantwortlicher.getEMail(), - person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet(), - Image.image.isLicensed(), Image.image.isInternet(), - Image.image.getRam(), Image.image.getCpu(), - "temp/" + Image.image.getNewName(),false,Image.image.getFilesize(),Image.image.getShareMode()); - client.startFileCopy(Image.image.getNewName()); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - return false; - } - return true; - - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java b/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java deleted file mode 100644 index d21da67e..00000000 --- a/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java +++ /dev/null @@ -1,484 +0,0 @@ -package gui.image; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; - -import models.Image; -import models.Links; -import models.SessionData; - -import org.apache.thrift.TException; - -import server.Server.Client; -import server.User; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; -import ftp.DownloadTask; -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -@SuppressWarnings("serial") -public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener { - - @SuppressWarnings("unused") - private JPanel contentPane; - private final JPanel contentPanel = new JPanel(); - JLabel lblPath; - JLabel downspeed; - User user; - JProgressBar progressBar; - String host = SessionData.session.getServerAdress(); - int port = 21; - String downloadFile = ""; - static String arg = ""; - DownloadTask task; - JLabel lblBytesread; - JLabel lblNewLabel_3; - JLabel labelVerbleibend; - long filesize; - double speed; - int progress = 0; // progress of download - long bytesread; - JLabel labelZeit; - boolean taskrun = false; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - JButton btnZurck = new JButton("Zur\u00FCck"); - JButton btnDownloadStarten = new JButton("Download starten"); - JButton btnMainMenu = new JButton("Hauptmen\u00FC"); - - - /** - * Create the frame. - */ - public FTPDownloader_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - con.closeThriftConnection(); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - task.cancel(true); - } - //dispose(); - System.exit(0); - }//end window closing - }); - setResizable(false); - // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - setBackground(Color.WHITE); - setTitle("Dozentenmodul *Prototyp* - Image herunterladen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(new BorderLayout()); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel, BorderLayout.CENTER); - contentPanel.setLayout(null); - { - JButton btnSpeicherortAuswhlen = new JButton( - "Speicherort ausw\u00E4hlen"); - btnSpeicherortAuswhlen.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - fc.showOpenDialog(getParent()); - File dir = fc.getSelectedFile(); - // check if directory is selected - if (dir != null) { - // is selected - lblPath.setText(dir.getAbsolutePath()); - } else { - // no directory selected - lblPath.setText(""); - }// end if - } - }); - - btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); - btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); - contentPanel.add(btnSpeicherortAuswhlen); - } - - lblPath = new JLabel(""); - lblPath.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent arg0) { - if (lblPath.getText().isEmpty()) { - // wenn leer, dann upload button nicht freigeben - btnDownloadStarten.setEnabled(false); - btnDownloadStarten.setText("Bitte warten"); - } else { - // wenn leer, dann upload button nicht freigeben - btnDownloadStarten.setEnabled(true); - btnDownloadStarten.setText("Download starten"); - } - } - }); - lblPath.setBounds(102, 158, 485, 23); - contentPanel.add(lblPath); - - btnDownloadStarten.setEnabled(false); - btnDownloadStarten.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - buttonDownloadActionPerformed(arg0); - } - }); - - btnDownloadStarten.setBounds(102, 200, 173, 23); - contentPanel.add(btnDownloadStarten); - - progressBar = new JProgressBar(0, 100); - progressBar.setStringPainted(true); - - progressBar.setBounds(102, 234, 485, 30); - contentPanel.add(progressBar); - - JLabel lblDownloadgeschwindigkeit = new JLabel( - "Downloadgeschwindigkeit:"); - lblDownloadgeschwindigkeit.setBounds(102, 275, 141, 14); - contentPanel.add(lblDownloadgeschwindigkeit); - - downspeed = new JLabel("0"); - downspeed.setBounds(374, 275, 117, 14); - contentPanel.add(downspeed); - - JLabel lblFertig = new JLabel("Fertig:"); - lblFertig.setBounds(102, 325, 46, 14); - contentPanel.add(lblFertig); - - lblBytesread = new JLabel("0"); - lblBytesread.setBounds(183, 325, 108, 14); - contentPanel.add(lblBytesread); - - JLabel lblVon = new JLabel("von:"); - lblVon.setBounds(318, 325, 46, 14); - contentPanel.add(lblVon); - - lblNewLabel_3 = new JLabel("0"); - lblNewLabel_3.setBounds(374, 325, 117, 14); - contentPanel.add(lblNewLabel_3); - - JLabel lblMbVerbleibend = new JLabel("Verbleibend:"); - lblMbVerbleibend.setBounds(102, 350, 71, 14); - contentPanel.add(lblMbVerbleibend); - - labelVerbleibend = new JLabel("0"); - labelVerbleibend.setBounds(183, 350, 108, 14); - contentPanel.add(labelVerbleibend); - - JLabel lblGeschtzteVerbleibendeZeit = new JLabel( - "Gesch\u00E4tzte Verbleibende Zeit:"); - lblGeschtzteVerbleibendeZeit.setBounds(102, 300, 150, 14); - contentPanel.add(lblGeschtzteVerbleibendeZeit); - - labelZeit = new JLabel("0"); - labelZeit.setBounds(374, 300, 117, 14); - contentPanel.add(labelZeit); - - JPanel panel = new JPanel(); - panel.setLayout(null); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 24, 577, 57); - contentPanel.add(panel); - - JLabel lblImageDownloader = new JLabel("Image Downloader"); - lblImageDownloader.setFont(new Font("Tahoma", Font.BOLD, 18)); - lblImageDownloader.setBounds(10, 11, 509, 22); - panel.add(lblImageDownloader); - - JTextPane txtpnWhlenSieEinen = new JTextPane(); - txtpnWhlenSieEinen.setText("W\u00E4hlen Sie einen Ort aus, um das von Ihnen gw\u00E4hlte Image erunter zu laden."); - txtpnWhlenSieEinen.setEditable(false); - txtpnWhlenSieEinen.setBackground(SystemColor.menu); - txtpnWhlenSieEinen.setBounds(10, 36, 509, 32); - panel.add(txtpnWhlenSieEinen); - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 88, 597, 2); - contentPanel.add(separator); - - JLabel label_1 = new JLabel("Hauptmen\u00FC"); - label_1.setForeground(Color.BLUE); - label_1.setBounds(20, 92, 61, 20); - contentPanel.add(label_1); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(80, 95, 14, 14); - contentPanel.add(label_2); - - JLabel label_3 = new JLabel("VL-Image"); - label_3.setForeground(Color.BLUE); - label_3.setBounds(91, 92, 46, 20); - contentPanel.add(label_3); - - JLabel label_4 = new JLabel(">"); - label_4.setBounds(139, 95, 14, 14); - contentPanel.add(label_4); - - JLabel label_5 = new JLabel("Neu/Bearbeiten"); - label_5.setBounds(149, 95, 108, 14); - contentPanel.add(label_5); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(-10, 648, 597, 2); - contentPanel.add(separator_1); - - JLabel lblSchritt = new JLabel("Schritt 1:"); - lblSchritt.setBounds(24, 128, 57, 14); - contentPanel.add(lblSchritt); - - JLabel lblSchritt_1 = new JLabel("Schritt 2:"); - lblSchritt_1.setBounds(24, 204, 57, 14); - contentPanel.add(lblSchritt_1); - - JLabel lblSchritt_3 = new JLabel("Schritt 3:"); - lblSchritt_3.setBounds(20, 423, 57, 14); - contentPanel.add(lblSchritt_3); - - JLabel lblKlickenSieAuf = new JLabel( - "Klicken Sie auf \"Fertigstellen\"."); - lblKlickenSieAuf.setBounds(98, 423, 241, 14); - contentPanel.add(lblKlickenSieAuf); - - JMenuBar menuBar = new JMenuBar(); - menuBar.setBounds(0, 0, 597, 21); - contentPanel.add(menuBar); - - JMenu menu = new JMenu("Hilfe"); - menuBar.add(menu); - - JMenuItem menuItem = new JMenuItem("FAQ"); - menuItem.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - menu.add(menuItem); - - JMenuItem menuItem_1 = new JMenuItem("OTRS"); - menuItem_1.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - menu.add(menuItem_1); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - menu.add(mntmAbout); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBackground(UIManager.getColor("Button.background")); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane, BorderLayout.SOUTH); - { - btnZurck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (taskrun == true) { - task.cancel(true); - try { - client.DeleteFtpUser(user.userName); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - - SearchEditImage_GUI se = new SearchEditImage_GUI(); - se.setVisible(true); - dispose(); - } - }); - btnZurck.setActionCommand("Cancel"); - buttonPane.add(btnZurck); - } - - - btnMainMenu.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - - MainMenue_GUI mm = new MainMenue_GUI(); - mm.setVisible(true); - dispose(); - } - }); - btnMainMenu.setActionCommand("Cancel"); - buttonPane.add(btnMainMenu); - } - setVisible(true); - - } - - private void buttonDownloadActionPerformed(ActionEvent event) { - - progressBar.setValue(0); - btnDownloadStarten.setEnabled(false); // verhindert schnellen zweiten - // Klick - btnDownloadStarten.setText("Bitte warten"); - try { - user = client.getFtpUser(); - - downloadFile = user.path+"/"+client.getPathOfImage(Image.image.getImageId(), - Image.image.getVersion()); - - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - task = new DownloadTask(host, port, user.userName, user.password, - downloadFile, lblPath.getText(), this); - task.addPropertyChangeListener(this); - task.execute(); - taskrun = true; - - } - - public void propertyChange(PropertyChangeEvent arg0) { - - progress = 0; - if ("progress" == arg0.getPropertyName()) { - progress = (Integer) arg0.getNewValue(); - progressBar.setValue(progress); - - // Button zum Fertigstellen freischalten, wenn 100% erreicht sind - if (progress == 0 || progress == 100) { - // not uploading currently - btnZurck.setEnabled(true); - btnMainMenu.setEnabled(true); - } else { - // currently uploading, don't let user interact - btnZurck.setEnabled(false); - btnMainMenu.setEnabled(false); - } - } - - if ("speed" == arg0.getPropertyName()) { - speed = (double) arg0.getNewValue(); - // if(speed<=1){ - - downspeed.setText(String.valueOf(speed).substring(0, - String.valueOf(speed).lastIndexOf(".") + 3) - + " MB/s"); - - } - if ("bytesread" == arg0.getPropertyName()) { - bytesread = (long) arg0.getNewValue(); - lblBytesread.setText((bytesread / 1024 / 1024) + " MB"); - labelVerbleibend - .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) - + " MB"); - - labelZeit - .setText(String - .valueOf( - ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) - .substring( - 0, - String.valueOf( - (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) - .lastIndexOf(".")) - + " Minuten"); - - } - if ("filesize" == arg0.getPropertyName()) { - filesize = (long) arg0.getNewValue(); - lblNewLabel_3.setText((filesize / 1024 / 1024) + " MB"); - - } - - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java deleted file mode 100644 index a2123712..00000000 --- a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java +++ /dev/null @@ -1,538 +0,0 @@ -package gui.image; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; - -import models.Image; -import models.Links; -import models.SessionData; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; -import ftp.UploadTask; -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -@SuppressWarnings("serial") -public class FTPEditUploader_GUI extends JFrame implements - PropertyChangeListener { - - @SuppressWarnings("unused") - private JPanel contentPane; - private final JPanel contentPanel = new JPanel(); - JLabel lblPath; - JProgressBar progressBar; - String host = SessionData.session.getServerAdress(); - int port = 21; - server.User user; - String filename = ""; - File uploadFile; - static String arg = ""; - UploadTask task; - JLabel UpSpeed; - JLabel labelfertig; - JLabel labelfilesize; - JLabel labelZeit; - JLabel labelverbleibend; - long filesize; - double speed; - long bytesread; - boolean taskrun = false; - int progress = 0; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - JButton btnUploadStarten = new JButton("Upload auf Server starten"); - JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); - JButton finishButton = new JButton("Fertigstellen"); - JButton btnZurck = new JButton("Zur\u00FCck"); - - - /** - * Create the frame. - */ - public FTPEditUploader_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - if (taskrun == true) { - try { - - client.DeleteFtpUser(user.userName); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - task.cancel(true); - } - con.closeThriftConnection(); - System.exit(0); - }// end window closing - }); - setResizable(false); - // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - // filename=name; - setBackground(Color.WHITE); - setTitle("Dozentenmodul *Prototyp* - Image bearbeiten"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(new BorderLayout()); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel, BorderLayout.CENTER); - contentPanel.setLayout(null); - { - - btnSpeicherortAuswhlen.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.FILES_ONLY); - - fc.showOpenDialog(getParent()); - File file = fc.getSelectedFile(); - // check if a file is selected and exists - if (file != null) { - // file exists - uploadFile = file; - filename = uploadFile.getName(); - lblPath.setText(file.getAbsolutePath()); - } else { - // no file selected - lblPath.setText(""); - }// end if - } - }); - - btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); - btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); - contentPanel.add(btnSpeicherortAuswhlen); - } - - lblPath = new JLabel(""); - lblPath.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent arg0) { - if (lblPath.getText().isEmpty()) { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(false); - btnUploadStarten.setText("Bitte warten"); - } else { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(true); - btnUploadStarten.setText("Upload auf Server starten"); - } - } - }); - lblPath.setBounds(102, 158, 485, 23); - contentPanel.add(lblPath); - - btnUploadStarten.setEnabled(false); - btnUploadStarten.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - buttonUploadActionPerformed(arg0); - - } - }); - - btnUploadStarten.setBounds(102, 200, 173, 23); - contentPanel.add(btnUploadStarten); - - progressBar = new JProgressBar(0, 100); - progressBar.setStringPainted(true); - - progressBar.setBounds(102, 234, 485, 30); - contentPanel.add(progressBar); - - JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); - lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); - contentPanel.add(lblUploadgeschwindigkeit); - - JLabel label_1 = new JLabel("Fertig:"); - label_1.setBounds(102, 325, 46, 14); - contentPanel.add(label_1); - - labelfertig = new JLabel("0"); - labelfertig.setBounds(183, 325, 108, 14); - contentPanel.add(labelfertig); - - UpSpeed = new JLabel("0"); - UpSpeed.setBounds(374, 275, 117, 14); - contentPanel.add(UpSpeed); - - JLabel label_4 = new JLabel("von:"); - label_4.setBounds(318, 325, 46, 14); - contentPanel.add(label_4); - - labelfilesize = new JLabel("0"); - labelfilesize.setBounds(374, 325, 117, 14); - contentPanel.add(labelfilesize); - - JLabel label_6 = new JLabel("Verbleibend:"); - label_6.setBounds(102, 350, 71, 14); - contentPanel.add(label_6); - - JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); - label_7.setBounds(102, 300, 150, 14); - contentPanel.add(label_7); - - labelZeit = new JLabel("0"); - labelZeit.setBounds(374, 300, 117, 14); - contentPanel.add(labelZeit); - - labelverbleibend = new JLabel("0"); - labelverbleibend.setBounds(183, 350, 108, 14); - contentPanel.add(labelverbleibend); - - JPanel panel = new JPanel(); - panel.setLayout(null); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - contentPanel.add(panel); - - JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); - lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); - lblUploadIhresImage.setBounds(10, 11, 509, 22); - panel.add(lblUploadIhresImage); - - JTextPane txtpnFhreSieBitte = new JTextPane(); - txtpnFhreSieBitte - .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); - txtpnFhreSieBitte.setEditable(false); - txtpnFhreSieBitte.setBackground(SystemColor.menu); - txtpnFhreSieBitte.setBounds(10, 36, 509, 32); - panel.add(txtpnFhreSieBitte); - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 79, 597, 2); - contentPanel.add(separator); - - JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); - lblNewLabel_1.setForeground(Color.BLUE); - lblNewLabel_1.setBounds(20, 88, 61, 20); - contentPanel.add(lblNewLabel_1); - - JLabel label_3 = new JLabel(">"); - label_3.setBounds(80, 91, 14, 14); - contentPanel.add(label_3); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(91, 88, 46, 20); - contentPanel.add(lblVlimage); - - JLabel label_5 = new JLabel(">"); - label_5.setBounds(139, 91, 14, 14); - contentPanel.add(label_5); - - JLabel lblNeubearbeiten = new JLabel("Bearbeiten"); - lblNeubearbeiten.setBounds(149, 91, 108, 14); - contentPanel.add(lblNeubearbeiten); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - contentPanel.add(separator_1); - - JLabel lblSchritt_1 = new JLabel("Schritt 1:"); - lblSchritt_1.setBounds(24, 128, 57, 14); - contentPanel.add(lblSchritt_1); - - JLabel lblSchritt_2 = new JLabel("Schritt 2:"); - lblSchritt_2.setBounds(24, 204, 57, 14); - contentPanel.add(lblSchritt_2); - - JLabel label = new JLabel("Schritt 3:"); - label.setBounds(20, 423, 57, 14); - contentPanel.add(label); - - JLabel label_2 = new JLabel("Klicken Sie auf \"Fertigstellen\"."); - label_2.setBounds(98, 423, 241, 14); - contentPanel.add(label_2); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBackground(UIManager.getColor("Button.background")); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane, BorderLayout.SOUTH); - { - - //finishButton.setEnabled(false); - finishButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - updateData(); - dispose(); - MainMenue_GUI m = new MainMenue_GUI(); - m.setVisible(true); - - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - task.cancel(true); - } - - } - }); - btnZurck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - dispose(); - EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI(); - ei.setVisible(true); - } - }); - - btnZurck.setActionCommand("Cancel"); - buttonPane.add(btnZurck); - finishButton.setActionCommand("Cancel"); - buttonPane.add(finishButton); - } - } - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu menu = new JMenu("Hilfe"); - menuBar.add(menu); - - JMenuItem menuItem = new JMenuItem("FAQ"); - menuItem.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - }); - - menu.add(menuItem); - - JMenuItem menuItem_1 = new JMenuItem("OTRS"); - menuItem_1.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - }); - - menu.add(menuItem_1); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - menu.add(mntmAbout); - setVisible(true); - - } - - private void buttonUploadActionPerformed(ActionEvent event) { - - progressBar.setValue(0); - btnUploadStarten.setEnabled(false); // verhindert einen weiteren klick - btnUploadStarten.setText("Bitte warten"); - - try { - user = client.getFtpUser(); - System.out.println("FTP name" + user.userName); - System.out.println("FTP path" + user.path); - System.out.println("FTP pass" + user.password); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); - - Image.image.setNewName(formatter.format(new Date()) + "_" - + person.verantwortlicher.getHochschule() + "_" - + person.verantwortlicher.getUsername() + "_" - + Image.image.getImagename()+ ".vmdk"); - task = new UploadTask(host, port, user.userName, user.password, - user.path+"temp/", uploadFile); - - task.addPropertyChangeListener(this); - task.execute(); - taskrun = true; - - } - - public void propertyChange(PropertyChangeEvent arg0) { - if ("progress" == arg0.getPropertyName()) { - progress = (Integer) arg0.getNewValue(); - progressBar.setValue(progress); - - // Button zum Fertigstellen freischalten, wenn 100% erreicht sind - if (progress == 100) { - // not uploading currently - btnZurck.setEnabled(true); - } else { - // currently uploading, don't let user interact - btnZurck.setEnabled(false); - } - - // Fertigstellen erlauben wenn upload abgeschlossen - if (progress == 100) { - finishButton.setEnabled(true); - } else { - finishButton.setEnabled(false); - } - } - - - - if ("speed" == arg0.getPropertyName()) { - speed = (double) arg0.getNewValue(); - // if(speed<=1){ - - UpSpeed.setText(String.valueOf(speed).substring(0, - String.valueOf(speed).lastIndexOf(".") + 3) - + " MB/s"); - - } - if ("bytesread" == arg0.getPropertyName()) { - bytesread = (long) arg0.getNewValue(); - labelfertig.setText((bytesread / 1024 / 1024) + " MB"); - labelverbleibend - .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) - + " MB"); - - labelZeit - .setText(String - .valueOf( - ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) - .substring( - 0, - String.valueOf( - (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) - .lastIndexOf(".")) - + " Minuten"); - - } - if ("filesize" == arg0.getPropertyName()) { - filesize = (long) arg0.getNewValue(); - labelfilesize.setText((filesize / 1024 / 1024) + " MB"); - - } - - } - - public boolean updateData() { - - try { - System.out.println("NewName="+Image.image.getNewName()); - System.out.println("OldName="+Image.image.getImagename()); - if(Image.image.getNewName().isEmpty()){ - client.updateImageData(Image.image.getImagename(), - Image.image.getImagename(),Image.image.getImagepath(), Image.image.isLicensed(), - Image.image.isInternet(), Image.image.getRam(), - Image.image.getCpu(), Image.image.getImageId(), - Image.image.getVersion(), false,Image.image.getFilesize(),Image.image.getShareMode()); - client.startFileCopy(Image.image.getNewName()); - } - else{ - - - client.updateImageData(Image.image.getImagename(), - Image.image.getImagename(),"temp/" + Image.image.getNewName(), Image.image.isLicensed(), - Image.image.isInternet(), Image.image.getRam(), - Image.image.getCpu(), Image.image.getImageId(), - Image.image.getVersion(), false,Image.image.getFilesize(),Image.image.getShareMode()); - client.startFileCopy(Image.image.getNewName()); - } - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - return false; - } - return true; - - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java b/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java deleted file mode 100644 index 58fba9e7..00000000 --- a/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java +++ /dev/null @@ -1,596 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Image; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -//import models.person; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class SearchEditImage_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox comboBox; - JTable tableAllImages; - JTable tablemyImages; - boolean activeSearch=false; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyImages = new TableRowSorter( - modelMyImages); - - - /** - * Create the dialog. - */ - public SearchEditImage_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - - @Override - public void windowOpened(WindowEvent arg0) { - initTableModel(modelMyImages); - initTableModel(modelAll); - textFieldName.requestFocusInWindow(); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); - // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext.isEmpty()==false) { - activeSearch=true; - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - } - else{ - activeSearch=false; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - rowSorterAll.setRowFilter(null); - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche *Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(365, 106, 155, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox(); - try { - // Holt sich eine Liste aller verfuegbaren Betriebssysteme vom Server - List list = client.getAllOS(); - // Leeres Item hinzufuegen - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - // Hinzufuegen der verfuegbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - JOptionPane.showMessageDialog(null, - e2.getCause()+"\n"+e2.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - // Registriert Auswahlaenderungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // Prueft das die Auswahl nicht leer ist - if (comboBox.getSelectedItem().toString().isEmpty()==false) { - // Filtert nach dem ausgewaehlten Betriebssystem - activeSearch=true; - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox - .getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - comboBox.getSelectedItem().toString(), 2)); - } - else{ - activeSearch=false; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - - rowSorterAll.setRowFilter(null); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Hauuetmenue - - SearchEditImage_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0 && activeSearch==false) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - // String username="Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - } else if(tabbedPane.getSelectedIndex()==1 && activeSearch==false){ - rowSorterAll.setRowFilter(null); - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages = new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages = new JTable(); - tablemyImages.setModel(modelMyImages); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyImages.setRowSorter(rowSorterMyImages); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - JButton btnDownload = new JButton("Download"); - btnDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // oeffnet den Downloader - - if (tablemyImages.getSelectedRow() != -1) { - String imageid = modelMyImages.getValueAt( - tablemyImages.convertRowIndexToModel(tablemyImages - .getSelectedRow()), 7).toString(); - - Image.image.setImageId(imageid); - String imageversion = modelMyImages.getValueAt( - tablemyImages.convertRowIndexToModel(tablemyImages - .getSelectedRow()), 8).toString(); - - Image.image.setVersion(imageversion); - SearchEditImage_GUI.this.setVisible(false); - FTPDownloader_GUI down = new FTPDownloader_GUI(); - down.setVisible(true); - - - } else { - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein Image f\u00fcr den Download aus", - "Message", JOptionPane.INFORMATION_MESSAGE); - } - } - }); - btnDownload.setBounds(449, 508, 118, 23); - contentPanel.add(btnDownload); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // oeffnet das Hauptmenue - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - // check if user is in correct tab - if (tabbedPane.getSelectedIndex() == 0) { - //check if a row is selected - if (tablemyImages.getSelectedRow() != -1) { - String imageid = modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), - 7).toString(); - - Image.image.setImageId(imageid); - String imageversion = modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), - 8).toString(); - - Image.image.setVersion(imageversion); - - EditImageAllgemein_GUI ea = new EditImageAllgemein_GUI(); - ea.setVisible(true); - dispose(); - } else { - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein Image aus.", - "Image Auswahl", JOptionPane.INFORMATION_MESSAGE); - }// end check if row is selected - } else { - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein eigenes Image aus.", - "Image Auswahl", JOptionPane.INFORMATION_MESSAGE); - }//end check if correct tab is selected - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List images; - try { - // Hole eine Liste der Images - images = client.getImageList(); - - Iterator i = images.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime(), "", images.get(x).id, - images.get(x).getVersion() }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/image/SearchImage_GUI.java b/Dozentenmodul/src/gui/image/SearchImage_GUI.java deleted file mode 100644 index ef8b75bb..00000000 --- a/Dozentenmodul/src/gui/image/SearchImage_GUI.java +++ /dev/null @@ -1,529 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Image; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class SearchImage_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox comboBox; - JTable tableAllImages; - JTable tablemyImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyImages = new TableRowSorter( - modelMyImages); - - - /** - * Create the dialog. - */ - public SearchImage_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - - @Override - public void windowOpened(WindowEvent arg0) { - textFieldName.requestFocusInWindow(); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Suche VL-Image"); - // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche *Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(360, 106, 160, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox(); - try { - // Holt sich eine Liste aller verfuegbaren Betriebssysteme vom Server - List list = client.getAllOS(); - // Leeres Item hinzufuegen - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - // Hinzufuegen der verfuegbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - JOptionPane.showMessageDialog(null, - e2.getCause()+"\n"+e2.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - // Registriert Auswahlaenderungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // Prueft das die Auswahl nicht leer ist - if (comboBox.getSelectedItem().toString() != "") { - // Filtert nach dem ausgewaehlten Betriebssystem - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox - .getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - comboBox.getSelectedItem().toString(), 2)); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Hauuetmenue - - SearchImage_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - // String username="Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - } else if (tabbedPane.getSelectedIndex() == 1) { - - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - initTableModel(modelMyImages); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages = new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages = new JTable(); - tablemyImages.setModel(modelMyImages); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyImages.setRowSorter(rowSorterMyImages); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - JButton btnDownload = new JButton("Download"); - btnDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // oeffnet den Downloader - - if (tablemyImages.getSelectedRow() != -1) { - String imageid = modelMyImages.getValueAt( - tablemyImages.convertRowIndexToModel(tablemyImages - .getSelectedRow()), 7).toString(); - - Image.image.setImageId(imageid); - String imageversion = modelMyImages.getValueAt( - tablemyImages.convertRowIndexToModel(tablemyImages - .getSelectedRow()), 8).toString(); - - Image.image.setVersion(imageversion); - SearchImage_GUI.this.setVisible(false); - FTPDownloader_GUI down = new FTPDownloader_GUI(); - down.setVisible(true); - - - } else { - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein Image f\u00fcr den Download aus", - "Message", JOptionPane.INFORMATION_MESSAGE); - } - } - }); - btnDownload.setBounds(449, 508, 118, 23); - contentPanel.add(btnDownload); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // oeffnet das Hauptmenue - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List images; - try { - // Hole eine Liste der Images - images = client.getImageList(); - - Iterator i = images.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime(), "", images.get(x).id, - images.get(x).getVersion() }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/image/SearchMethodLecture_GUI.java b/Dozentenmodul/src/gui/image/SearchMethodLecture_GUI.java deleted file mode 100644 index 4eda36f0..00000000 --- a/Dozentenmodul/src/gui/image/SearchMethodLecture_GUI.java +++ /dev/null @@ -1,290 +0,0 @@ -package gui.image; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Links; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class SearchMethodLecture_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnSearchByImage; - JRadioButton rdbtnSearchByLecture; - private final ButtonGroup buttonGroup = new ButtonGroup(); - - - - /** - * Create the dialog. - */ - public SearchMethodLecture_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Suchmethode w\u00E4hlen"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suchmethode ausw\u00E4hlen"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Geben Sie bitte an, nach welchem Kriterium Sie suchen m\u00F6chten."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, - "W\u00e4hlen Sie bitte die Suchmethode Ihrer Suche", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 36, 557, 369); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - rdbtnSearchByImage = new JRadioButton( - "Nach einem VL-Image oder Vorlagen suchen"); - buttonGroup.add(rdbtnSearchByImage); - rdbtnSearchByImage.setBounds(6, 38, 545, 23); - panel_1.add(rdbtnSearchByImage); - - JTextArea txtrHierKlickenWenn = new JTextArea(); - txtrHierKlickenWenn.setBackground(SystemColor.menu); - txtrHierKlickenWenn.setLineWrap(true); - txtrHierKlickenWenn.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrHierKlickenWenn - .setText("Hier klicken, wenn Sie nach einem konkreten Image suchen, von dem Sie exakte Daten kennen. Hierzu geh\u00F6ren z.B. das Betriebssystem oder die installierte Software.\r\nEs werden zudem alle Vorlagen aufgelistet."); - txtrHierKlickenWenn.setBounds(25, 68, 518, 80); - panel_1.add(txtrHierKlickenWenn); - - JTextArea txtrHierKlickenWenn_1 = new JTextArea(); - txtrHierKlickenWenn_1 - .setText("Hier klicken, wenn Sie nur wissen f\u00FCr welche Veranstaltung das gesuchte Image verwendet wird. Hierzu geh\u00F6ren z.B. der Name des Dozenten oder der Name der Veranstaltung."); - txtrHierKlickenWenn_1.setLineWrap(true); - txtrHierKlickenWenn_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtrHierKlickenWenn_1.setBackground(SystemColor.menu); - txtrHierKlickenWenn_1.setBounds(25, 210, 518, 80); - panel_1.add(txtrHierKlickenWenn_1); - - rdbtnSearchByLecture = new JRadioButton( - "Nach einer Veranstaltung suchen"); - buttonGroup.add(rdbtnSearchByLecture); - rdbtnSearchByLecture.setBounds(6, 180, 545, 23); - panel_1.add(rdbtnSearchByLecture); - - JPanel panel = new JPanel(); - panel.setBounds(10, 402, 577, 33); - contentPanel.add(panel); - panel.setLayout(null); - panel.setBorder(new EmptyBorder(5, 5, 5, 5)); - panel.setBackground(SystemColor.menu); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - SearchMethodLecture_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Suchmethode"); - lblNewLabel_1.setBounds(146, 11, 82, 14); - contentPanel.add(lblNewLabel_1); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton backButton = new JButton("Zur\u00FCck"); - backButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - MainMenue_GUI sr = new MainMenue_GUI(); - sr.setVisible(true); - dispose(); - } - }); - backButton.setActionCommand("CANCEL"); - buttonPane.add(backButton); - getRootPane().setDefaultButton(backButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - if (rdbtnSearchByImage.isSelected() == true) { - SearchImage_GUI si = new SearchImage_GUI(); - si.setVisible(true); - dispose(); - } - } - - }); - continueButton.setActionCommand("OK"); - buttonPane.add(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } -} diff --git a/Dozentenmodul/src/gui/intro/About_GUI.java b/Dozentenmodul/src/gui/intro/About_GUI.java deleted file mode 100644 index 447f18ee..00000000 --- a/Dozentenmodul/src/gui/intro/About_GUI.java +++ /dev/null @@ -1,95 +0,0 @@ -package gui.intro; - -import java.awt.Image; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; - -import util.GuiOrganizer; - -@SuppressWarnings("serial") -public class About_GUI extends JFrame { - - private JPanel contentPane; - private JTextPane txtpnVersionVBuilddate; - - /** - * Create the frame. - */ - public About_GUI() { - // Fenster darf nicht vergroessert werden - setResizable(false); - - try { - // Setzt das Look and Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getMessage(), "Debug-Message", - JOptionPane.ERROR_MESSAGE); - } - // Titel des Fensters setzen - setTitle("Dozentenmodul *Prototyp* - About"); - // Aktion die beim Schliessen durchgefuehrt werden soll - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - // Groesse des Fensters definieren - setBounds(0, 0, 355, 309); - GuiOrganizer.centerGUI(this); - // Erzeugen eines Panels - contentPane = new JPanel(); - // Hintergrund Farbe des Panels setzen - contentPane.setBackground(SystemColor.menu); - // Rahmen des Fensters setzen - contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); - setContentPane(contentPane); - // Layout setzen - contentPane.setLayout(null); - // Label fuer das Logo erzeugen - JLabel imgLabel = new JLabel(); - // Groesse und Position des Logos festelegen - imgLabel.setBounds(30, 18, 294, 80); - // Pfadangabe des Logos - - ImageIcon icon = new ImageIcon(getClass().getResource( - "/Logo_bwLehrpool.png"), "Logo"); - // Skalierung des Logos - Image scaled = icon.getImage().getScaledInstance(270, 64, 0); - imgLabel.setIcon(new ImageIcon(scaled)); - // Hinzufuegen des Logos in das Fenster - contentPane.add(imgLabel); - - // Erzeugen, Hinzufuegen und definierung der Aktion des Buttons - JButton BtnClose = new JButton("Close"); - BtnClose.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - dispose(); - - }// end actionPerformed - }); - - BtnClose.setBounds(62, 226, 237, 23); - contentPane.add(BtnClose); - - txtpnVersionVBuilddate = new JTextPane(); - txtpnVersionVBuilddate - .setText("Version: v0.1\r\nBuild-Date: 03.06.2014\r\n\r\nContact: michael.wilson@hs-offenburg.de\r\nWebsite: http://bwlehrpool.hs-offenburg.de/"); - txtpnVersionVBuilddate.setEditable(false); - txtpnVersionVBuilddate.setBackground(SystemColor.menu); - txtpnVersionVBuilddate.setBounds(62, 95, 224, 90); - contentPane.add(txtpnVersionVBuilddate); - }// end LoginGUI() -}// end class diff --git a/Dozentenmodul/src/gui/intro/BillOfRights_GUI.java b/Dozentenmodul/src/gui/intro/BillOfRights_GUI.java deleted file mode 100644 index 21d15d40..00000000 --- a/Dozentenmodul/src/gui/intro/BillOfRights_GUI.java +++ /dev/null @@ -1,241 +0,0 @@ -package gui.intro; - - -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import models.Links; - -import org.ini4j.InvalidFileFormatException; -import org.ini4j.Wini; - -import util.GuiOrganizer; -import util.OpenLinks; - - - -@SuppressWarnings("serial") -public class BillOfRights_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JButton fwdButton; - JCheckBox chckbxAkzeptieren; - - /** - * Create the dialog. - */ - public BillOfRights_GUI() { - setResizable(false); - - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - //Beendet das Programm beim Klick auf das X - System.exit(0); - } - }); - try { - //Setzt das Look & Feel auf das System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp*"); - - //Zentiert das Fenster in der Bildschirmmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 567, 60); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Hinweis"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Bitte lesen und best\u00E4tigen Sie folgende rechtliche Hinweise"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 22); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 95, 567, 485); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JTextArea txtrLoremIpsumDolor = new JTextArea(); - txtrLoremIpsumDolor.setWrapStyleWord(true); - txtrLoremIpsumDolor.setLineWrap(true); - txtrLoremIpsumDolor.setEditable(false); - JScrollPane scr=new JScrollPane(txtrLoremIpsumDolor); - scr.setBounds(0, 0, 567, 477); - txtrLoremIpsumDolor.setBounds(0, 0, 567, 477); - txtrLoremIpsumDolor.setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \r\n\r\nUt wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. \r\n\r\nNam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis. \r\n\r\nAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat. \r\n\r\nConsetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus. \r\n\r\nLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \r\n\r\nUt wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. \r\n\r\nNam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo"); - - contentPanel.add(scr); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 630, 587, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - fwdButton = new JButton("Weiter"); - fwdButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - try { - Wini ini=new Wini(new File("C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); - ini.put("main", "BillOfRights",true); - ini.store(); - } catch (InvalidFileFormatException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - VmWareLink_GUI ac=new VmWareLink_GUI(); - ac.setVisible(true); - dispose(); - } - }); - fwdButton.setEnabled(false); - - buttonPane.add(fwdButton); - } - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 617, 587, 2); - getContentPane().add(separator); - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 82, 587, 2); - getContentPane().add(separator); - } - - chckbxAkzeptieren = new JCheckBox("Ja, ich akzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen."); - chckbxAkzeptieren.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - //Beim Akzeptieren der Bestaetigung wird der Weiter-Button verfuegbar gemacht - if(chckbxAkzeptieren.isSelected()==true) - { - - fwdButton.setEnabled(true); - - } - else - { - - } - } - }); - chckbxAkzeptieren.setBackground(SystemColor.menu); - chckbxAkzeptieren.setBounds(10, 587, 567, 23); - getContentPane().add(chckbxAkzeptieren); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - mnNewMenu_1.setHorizontalAlignment(SwingConstants.CENTER); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - } -} diff --git a/Dozentenmodul/src/gui/intro/Login_GUI.java b/Dozentenmodul/src/gui/intro/Login_GUI.java deleted file mode 100644 index 06a87307..00000000 --- a/Dozentenmodul/src/gui/intro/Login_GUI.java +++ /dev/null @@ -1,336 +0,0 @@ -package gui.intro; - -import java.awt.Color; -import java.awt.EventQueue; -import java.awt.Image; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.io.IOException; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; - -import models.SessionData; -import models.person; - -import org.apache.thrift.TException; -import org.ini4j.Wini; - -import thrift.ImageServer.Client; -import thrift.MasterThriftConnection; -import thrift.ThriftConnection; -import thrift.UserInfo; -import util.GuiOrganizer; -import config.config_file; - -@SuppressWarnings("serial") -public class Login_GUI extends JFrame { - - private JPanel contentPane; - private JTextField lblusername; - private JPasswordField lblpass; - JLabel lblConnectionInfo = new JLabel(""); - boolean isClientReturnedCorrectly = false; - boolean login; - String masterServerIP = MasterThriftConnection.MASTERSERVERIP; - MasterThriftConnection thrift; - Client client; - String token; - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - // Pruefe und Erzeuge gegebenfalls Config - config_file cf = new config_file(); - boolean conf = cf.createConfig(); - if (conf == true) { - // Aufruf und Anzeige des Login Fensters - Login_GUI frame = new Login_GUI(); - frame.setVisible(true); - } else { - JOptionPane.showMessageDialog(null, - "Fehler beim erzeugen der Konfigurationsfile", - "Message", JOptionPane.ERROR_MESSAGE); - } - - } catch (Exception e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(null, e.getStackTrace(), - "Message", JOptionPane.ERROR_MESSAGE); - } - } - }); - } - - /** - * Create the frame. - */ - public Login_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - - // Fenster darf nicht vergroessert werden - setResizable(false); - - try { - // Setzt das Look and Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getMessage(), "Debug-Message", - JOptionPane.ERROR_MESSAGE); - } - // Titel des Fensters setzen - setTitle("Dozentenmodul *Prototyp*"); - // Aktion die beim Schliessen durchgefuehrt werden soll - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - //Größe setzen und mittig ausrichten - setBounds(0, 0, 603, 400); - GuiOrganizer.centerGUI(this); - - // Erzeugen eines Panels - contentPane = new JPanel(); - // Hintergrund Farbe des Panels setzen - contentPane.setBackground(SystemColor.menu); - // Rahmen des Fensters setzen - contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); - setContentPane(contentPane); - // Layout setzen - contentPane.setLayout(null); - // Label fuer das Logo erzeugen - JLabel imgLabel = new JLabel(); - // Groesse und Position des Logos festelegen - imgLabel.setBounds(150, 11, 350, 142); - // Pfadangabe des Logos - - ImageIcon icon = new ImageIcon(getClass().getResource( - "/Logo_bwLehrpool.png"), "Logo"); - // Skalierung des Logos - Image scaled = icon.getImage().getScaledInstance(270, 64, 0); - imgLabel.setIcon(new ImageIcon(scaled)); - // Hinzufuegen des Logos in das Fenster - contentPane.add(imgLabel); - - // Erzeugen und Hinzufuegen des Labels - JLabel LabelUser = new JLabel("bwIDM-Benutzername:"); - LabelUser.setBounds(111, 164, 134, 20); - contentPane.add(LabelUser); - - // Erzeugen und Hinzufuegen des Textfeldes - lblusername = new JTextField(); - lblusername - .setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein."); - lblusername.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - performLogin(); - } - }); - lblusername.setBounds(292, 164, 237, 20); - contentPane.add(lblusername); - lblusername.setColumns(10); - - // Erzeugen und Hinzufuegen des Labels - JLabel LabelPass = new JLabel("bwIDM-Passwort:"); - LabelPass.setBounds(111, 195, 134, 20); - contentPane.add(LabelPass); - - // Erzeugen, Hinzufuegen und definierung der Aktion des Buttons - JButton BtnLogin = new JButton("Login"); - BtnLogin.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - performLogin(); - }// end actionPerformed - }); - - BtnLogin.setBounds(292, 244, 237, 23); - contentPane.add(BtnLogin); - - // Erzeugen und Hinzufuegen des Passwortfeldes - lblpass = new JPasswordField(); - lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein."); - lblpass.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - performLogin(); - } - }); - lblpass.setBounds(292, 195, 237, 20); - contentPane.add(lblpass); - - lblConnectionInfo.setHorizontalAlignment(SwingConstants.LEFT); - lblConnectionInfo.setBounds(292, 290, 237, 20); - contentPane.add(lblConnectionInfo); - //GuiOrganizer.centerGUI(this); - }// end LoginGUI() - - // Versuche den Benutzer einzuloggen - public void performLogin() { - - login = false; - thrift = new MasterThriftConnection(); - client = thrift.getMasterThriftConnection(); - token = null; - thrift.SessionData result = null; - - try { - login = true; - String passText = new String(lblpass.getPassword()); - // check if client has received a connection with information or a - // null package - if (checkClientPackage() == true) { - // package has information - result = client.authenticate(lblusername.getText(), passText); - SessionData.session.setAuthToken(result.authToken); - SessionData.session.setSessionID(result.sessionId); - SessionData.session.setServerAdress(result.serverAddress); - - // set connection to bwLehrpoolSuiteServer - ThriftConnection bwthrift = new ThriftConnection(); - server.Server.Client bwClient = bwthrift.getThriftConnection(); - models.Client.clientcon.setClient(bwClient); - - System.out.println("Session-ID: " + result.sessionId - + "\nToken: " + result.authToken); - - if (login == true) { - //Daten speichern - if (SessionData.session.getAuthToken() == null) { - System.out.println("Token ist null"); - JOptionPane.showMessageDialog(null, - "Error: Token ist null", "Token defekt", - JOptionPane.ERROR_MESSAGE); - } - System.out.println("Hole jetzt Infos aus SessionData..."); - UserInfo user = client.getUserFromToken(SessionData.session - .getAuthToken()); - - String hochschule = user.eMail.substring(user.eMail - .indexOf("@") + 1); - - person.verantwortlicher.setUsername(lblusername.getText() - .substring(0, lblusername.getText().indexOf("@"))); - person.verantwortlicher.setName(user.lastName); - person.verantwortlicher.setVorname(user.firstName); - person.verantwortlicher.setEMail(user.eMail); - person.verantwortlicher.setHochschule(hochschule); - - try { - // Lege config File an und entscheide welches Fenster - // als naechstes geoeffnet wird - Wini ini = new Wini( - new File( - "C:\\Users\\" - + System.getProperty("user.name") - + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); - // Pruefe ob Bills Of Rights schon akzeptiert wurden, - // wenn - // nicht zeige diese an - if (ini.get("main", "BillOfRights", boolean.class) == false) { - // Erstellen einer Instanz der Aktionsauswahl - BillOfRights_GUI re = new BillOfRights_GUI(); - re.setVisible(true); - // Schliessen des Fensters nach erfolgreichen Login - setVisible(false); - } else { - // Pruefe ob die Links zu vmware angezeigt werden - // sollen - if (ini.get("main", "vmware", boolean.class) == false) { - VmWareLink_GUI vm = new VmWareLink_GUI(); - vm.setVisible(true); - setVisible(false); - } else { - - // oeffne das Hauptmenue - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - setVisible(false); - } - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, e.getCause() + "\n" - + e.getMessage(), "Debug-Message", - JOptionPane.ERROR_MESSAGE); - } - - } else { - JOptionPane.showMessageDialog(null, "Login denied!", - "Message", JOptionPane.INFORMATION_MESSAGE); - } - - } else { - // package from server is null - login = false; - lblConnectionInfo.setForeground(Color.red); - lblConnectionInfo - .setText("Fehler: Client nicht mit Server verbunden."); - - } - - } catch (thrift.AuthenticationException e) { - System.out - .println("Authentifizierung fehlgeschlagen: " + e.message); - JOptionPane - .showMessageDialog( - null, - "Benutzeranmeldung fehlgeschlagen: Bitte Benutzername und Passwort \u00fcberpr\u00fcfen.", - "Anmeldung fehlgeschlagen", - JOptionPane.ERROR_MESSAGE); - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getMessage(), "Message", - JOptionPane.ERROR_MESSAGE); - return; - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getMessage(), "Debug-Message", - JOptionPane.ERROR_MESSAGE); - return; - } - }// end performLogin - - public boolean checkClientPackage() { - // check if client is null or has been returned with information - if (client != null) { - // client contains information - isClientReturnedCorrectly = true; - System.out.println("Verbindungsinformationen erhalten"); - } else { - // client has returned with error - isClientReturnedCorrectly = false; - System.out - .println("Fehler: Keine korrekten Verbindungsdaten erhalten."); - } - - return isClientReturnedCorrectly; - }// end checkServerConnection() - -}// end class diff --git a/Dozentenmodul/src/gui/intro/MainMenue_GUI.java b/Dozentenmodul/src/gui/intro/MainMenue_GUI.java deleted file mode 100644 index 2954ca3b..00000000 --- a/Dozentenmodul/src/gui/intro/MainMenue_GUI.java +++ /dev/null @@ -1,462 +0,0 @@ -package gui.intro; - -import gui.image.CreateImageAllgemein_GUI; -import gui.image.DeleteImage_GUI; -import gui.image.SearchEditImage_GUI; -import gui.image.SearchImage_GUI; -import gui.lecture.CreateLectureAllgemein_GUI; -import gui.lecture.DeleteLecture_GUI; -import gui.lecture.EditLectureSearch_GUI; -import gui.lecture.SearchLecture_GUI; - -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.ScrollPane; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.ToolTipManager; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Links; -import models.SessionData; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class MainMenue_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - String descNewImage, descEditImage, descDeleteImage, descSearchImage, - descNewLecture, descEditLecture, descDeleteLecture, - descSearchLecture = ""; - JRadioButton rdbtnImageNew; - JRadioButton rdbtnImageEdit; - JRadioButton rdbtnImageSearchDownload; - JRadioButton rdbtnLectureNew; - JRadioButton rdbtnImageDelete; - JRadioButton rdbtnLectureEdit; - JRadioButton rdbtnLectureDelete; - JRadioButton rdbtnLectureSearch; - private final ButtonGroup buttonGroup = new ButtonGroup(); - private JMenuItem mntmAbout; - - - /** - * Create the dialog. - */ - public MainMenue_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Connected Server: "+SessionData.session.getServerAdress()); - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 567, 69); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Hauptmen\u00FC"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Bitte w\u00E4hlen Sie ihre gew\u00FCnschte Aktion."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 22); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 104, 567, 502); - contentPanel.setBackground(SystemColor.menu); - - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panelImage = new JPanel(); - panelImage.setBackground(SystemColor.menu); - panelImage.setBorder(new TitledBorder(null, "VL-Image", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panelImage.setBounds(10, 146, 270, 170); - contentPanel.add(panelImage); - panelImage.setLayout(null); - - rdbtnImageNew = new JRadioButton("Neu"); - rdbtnImageNew - .setToolTipText("Hier k\u00F6nnen Sie eine standard Laborvorlage downloaden"); - rdbtnImageNew.setBounds(6, 22, 159, 23); - panelImage.add(rdbtnImageNew); - rdbtnImageNew.setSelected(true); - buttonGroup.add(rdbtnImageNew); - rdbtnImageNew.setBackground(SystemColor.menu); - - rdbtnImageEdit = new JRadioButton("Bearbeiten"); - rdbtnImageEdit - .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); - rdbtnImageEdit.setBounds(6, 48, 185, 23); - panelImage.add(rdbtnImageEdit); - buttonGroup.add(rdbtnImageEdit); - rdbtnImageEdit.setHorizontalAlignment(SwingConstants.LEFT); - rdbtnImageEdit.setBackground(SystemColor.menu); - - rdbtnImageDelete = new JRadioButton("L\u00F6schen"); - rdbtnImageDelete.setEnabled(true); - buttonGroup.add(rdbtnImageDelete); - rdbtnImageDelete - .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); - rdbtnImageDelete.setHorizontalAlignment(SwingConstants.LEFT); - rdbtnImageDelete.setBackground(SystemColor.menu); - rdbtnImageDelete.setBounds(6, 74, 185, 23); - panelImage.add(rdbtnImageDelete); - - rdbtnImageSearchDownload = new JRadioButton("Suche und Download"); - buttonGroup.add(rdbtnImageSearchDownload); - rdbtnImageSearchDownload - .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); - rdbtnImageSearchDownload.setHorizontalAlignment(SwingConstants.LEFT); - rdbtnImageSearchDownload.setBackground(SystemColor.menu); - rdbtnImageSearchDownload.setBounds(6, 100, 185, 23); - panelImage.add(rdbtnImageSearchDownload); - - JPanel panelDesc = new JPanel(); - panelDesc.setLayout(null); - panelDesc.setBorder(new TitledBorder(UIManager - .getBorder("TitledBorder.border"), "Erkl\u00e4rung", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panelDesc.setBackground(SystemColor.menu); - panelDesc.setBounds(290, 146, 270, 170); - contentPanel.add(panelDesc); - - ScrollPane scrollPaneDesc = new ScrollPane(); - scrollPaneDesc.setBounds(10, 15, 250, 145); - final JTextArea txtDesc = new JTextArea(); - txtDesc.setLineWrap(true); - txtDesc.setWrapStyleWord(true); - txtDesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtDesc.setBackground(SystemColor.menu); - scrollPaneDesc.add(txtDesc); - // Pro AUswahl - txtDesc.setText("Legen Sie ein neues Image an und laden Sie anschlie\u00dfend die passende .vmdk-Datei hoch. Ein Image (wenn auch von einem anderen Dozenten) ist die Voraussetzung f\u00fcr eine Veranstaltung."); - panelDesc.add(scrollPaneDesc); - - JPanel panelVeranstaltung = new JPanel(); - panelVeranstaltung.setLayout(null); - panelVeranstaltung.setBorder(new TitledBorder(UIManager - .getBorder("TitledBorder.border"), "Veranstaltung (VMChooser)", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panelVeranstaltung.setBackground(SystemColor.menu); - panelVeranstaltung.setBounds(10, 327, 270, 170); - contentPanel.add(panelVeranstaltung); - - rdbtnLectureNew = new JRadioButton("Neu"); - buttonGroup.add(rdbtnLectureNew); - rdbtnLectureNew - .setToolTipText("Hier k\u00F6nnen Sie Ihre Labordaten eingeben"); - rdbtnLectureNew.setBounds(6, 24, 185, 23); - panelVeranstaltung.add(rdbtnLectureNew); - rdbtnLectureNew.setBackground(SystemColor.menu); - - rdbtnLectureEdit = new JRadioButton("Bearbeiten"); - rdbtnLectureEdit - .setToolTipText("Hier k\u00F6nnen Sie einen Link auf ein bestehendes Labor erzeugen"); - rdbtnLectureEdit.setBounds(6, 50, 230, 23); - panelVeranstaltung.add(rdbtnLectureEdit); - buttonGroup.add(rdbtnLectureEdit); - rdbtnLectureEdit.setBackground(SystemColor.menu); - - rdbtnLectureDelete = new JRadioButton("L\u00F6schen"); - rdbtnLectureDelete - .setToolTipText("Hier k\u00F6nnen Sie ein Labor l\u00F6schen"); - rdbtnLectureDelete.setBounds(6, 76, 175, 23); - panelVeranstaltung.add(rdbtnLectureDelete); - buttonGroup.add(rdbtnLectureDelete); - rdbtnLectureDelete.setBackground(SystemColor.menu); - - rdbtnLectureSearch = new JRadioButton("Suche"); - buttonGroup.add(rdbtnLectureSearch); - rdbtnLectureSearch - .setToolTipText("Hier k\u00F6nnen Sie ein Labor l\u00F6schen"); - rdbtnLectureSearch.setBackground(SystemColor.menu); - rdbtnLectureSearch.setBounds(6, 102, 175, 23); - panelVeranstaltung.add(rdbtnLectureSearch); - - JPanel panelNews = new JPanel(); - panelNews.setLayout(null); - panelNews.setBorder(new TitledBorder(UIManager - .getBorder("TitledBorder.border"), "News", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panelNews.setBackground(SystemColor.menu); - panelNews.setBounds(290, 327, 270, 170); - contentPanel.add(panelNews); - - ScrollPane scrollPaneNews = new ScrollPane(); - // scrollPaneDesc.setBounds(10, 15, 250, 145); - scrollPaneNews.setBounds(10, 15, 250, 145); - JTextArea txtNews = new JTextArea(); - txtNews.setFont(new Font("Tahoma", Font.PLAIN, 11)); - txtNews.setBackground(SystemColor.menu); - txtNews.setWrapStyleWord(true); - txtNews.setLineWrap(true); - txtNews.setText("Hier werden mal die Neuigkeiten stehen. Diese kommen direkt vom Satelliten, sind als HS-spezifisch :)"); - scrollPaneNews.add(txtNews); - panelNews.add(scrollPaneNews); - - /* - * Funktion Texte f\u00fcr das Klicken der RadioButtons - */ - rdbtnImageNew.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - descNewImage = "Legen Sie ein neues Image an und laden Sie anschlie\u00dfend die passende .vmdk-Datei hoch. Ein Image (wenn auch von einem anderen Dozenten) ist die Voraussetzung f\u00fcr eine Veranstaltung."; - txtDesc.setText(descNewImage); - } - }); - rdbtnImageEdit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descEditImage = "Bearbeiten Sie die hinterlegten Informationen zu einem Image oder laden Sie eine neue .vmdk-Datei hoch."; - txtDesc.setText(descEditImage); - } - }); - rdbtnImageDelete.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descDeleteImage = "Suchen Sie alte und nicht mehr ben\u00f6tigte Images und l\u00f6schen Sie diese."; - txtDesc.setText(descDeleteImage); - } - }); - rdbtnImageSearchDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descSearchImage = "Suchen Sie nach bestimmten Images oder verschaffen Sie sich einen \u00fcberblick \u00fcber alle verf\u00fcgbaren Images. Sie k\u00f6nnen gew\u00fcnschte Images umgehend herunterladen."; - txtDesc.setText(descSearchImage); - } - }); - rdbtnLectureNew.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descNewLecture = "Legen Sie eine neue Veranstaltung an und verkn\u00fcpfen Sie diese mit einem bereits vorhandenem Image. Ihre neue Veranstaltung kann auch auf dem Image eines anderen Dozenten beruhen."; - txtDesc.setText(descNewLecture); - } - }); - rdbtnLectureEdit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descEditLecture = "Bearbeiten Sie die hinterlegten Informationen zu einer Veranstaltung."; - txtDesc.setText(descEditLecture); - } - }); - rdbtnLectureDelete.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descDeleteLecture = "Suchen und l\u00f6schen Sie eine Veranstaltung. Das hiermit verbundene Image bleibt erhalten."; - txtDesc.setText(descDeleteLecture); - } - }); - rdbtnLectureSearch.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - descSearchLecture = "Suchen Sie nach bestimmten Veranstaltungen oder verschaffen Sie sich einen \u00fcberblick \u00fcber alle verf\u00fcgbaren Veranstaltungen. Eventuell gibt es bereits etwas passendes f\u00fcr Ihre Vorlesung."; - txtDesc.setText(descSearchLecture); - } - }); - /* - * Ende der Radiobuttons - */ - - JLabel lblGrafik = new JLabel(""); - // ToolTipp fuer Grafik - lblGrafik - .setToolTipText("" - + "Ein virtuelles Labor besteht immer aus den beiden Komponenten
" - + "Image und Veranstaltung. Ein Image ist dabei die Grundlage f\u00FCr
" - + "mehrere Veranstaltungen. Somit kann eine neue Veranstaltung
" - + "erstellt werden, ohne ein neues Image hochladen zu m\u00FCssen.


" - + "Image: Das Image enth\u00E4lt die ben\u00F6tigte Software, die im
" - + "virtuellen Labor ben\u00F6tigt wird. Es wird von genau einem Dozenten
" - + "angelegt und besitzt einen allgemeinen Namen, z.B. \"Programmieren\".
" - + "Bei einem Image handelt es sich um eine Datei vom Typ VMDK.


" - + "Veranstaltung: Es k\u00F6nnen nun, basierend auf einem Image,
" - + " beliebig viele Veranstaltungen von unterschiedlichen Dozenten erstellt
" - + "werden. Diese k\u00F6nnten z.B. konkret \"Web-Entwicklung\" oder \"K\u00FCnstliche
" - + "Intelligenz\" lauten und referenzieren dabei auf das allgemeine Image
" - + "\"Programmieren\"."); - lblGrafik.setIcon(new ImageIcon(MainMenue_GUI.class - .getResource("/Image_zu_Veranstaltung_HDD.png"))); - // ToolTipp lange anzeigen - 60sec - ToolTipManager.sharedInstance().setDismissDelay(60000); - ToolTipManager.sharedInstance().registerComponent(lblGrafik); - lblGrafik.setBounds(82, 3, 391, 110); - contentPanel.add(lblGrafik); - - JTextPane txtpnUmDetaillierteInformationen = new JTextPane(); - txtpnUmDetaillierteInformationen - .setText("Um detaillierte Informationen zu erhalten, fahren Sie bitte mit der Maus \u00FCber die Grafik."); - txtpnUmDetaillierteInformationen.setEditable(false); - txtpnUmDetaillierteInformationen.setBackground(SystemColor.menu); - txtpnUmDetaillierteInformationen.setBounds(10, 113, 509, 22); - contentPanel.add(txtpnUmDetaillierteInformationen); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 630, 587, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton continueButton = new JButton("Weiter"); - - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // Images - if (rdbtnImageNew.isSelected() == true) { - CreateImageAllgemein_GUI sr = new CreateImageAllgemein_GUI(); - sr.setVisible(true); - dispose(); - } else if (rdbtnImageEdit.isSelected() == true) { - SearchEditImage_GUI si = new SearchEditImage_GUI(); - si.setVisible(true); - dispose(); - } else if (rdbtnImageDelete.isSelected() == true) { - DeleteImage_GUI di = new DeleteImage_GUI(); - di.setVisible(true); - dispose(); - } else if (rdbtnImageSearchDownload.isSelected() == true) { - // SearchMethodLecture_GUI sm = new - // SearchMethodLecture_GUI(); - SearchImage_GUI si = new SearchImage_GUI(); - si.setVisible(true); - dispose(); - // Lectures - } else if (rdbtnLectureNew.isSelected() == true) { - CreateLectureAllgemein_GUI av = new CreateLectureAllgemein_GUI(); - av.setVisible(true); - dispose(); - } else if (rdbtnLectureEdit.isSelected() == true) { - EditLectureSearch_GUI el = new EditLectureSearch_GUI(); - el.setVisible(true); - dispose(); - } else if (rdbtnLectureDelete.isSelected() == true) { - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else if (rdbtnLectureSearch.isSelected() == true) { - SearchLecture_GUI sl = new SearchLecture_GUI(); - sl.setVisible(true); - dispose(); - } - } - }); - continueButton.setActionCommand("OK"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 617, 587, 2); - getContentPane().add(separator); - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 91, 587, 2); - getContentPane().add(separator); - } - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - }// end main -}// end class diff --git a/Dozentenmodul/src/gui/intro/VmWareLink_GUI.java b/Dozentenmodul/src/gui/intro/VmWareLink_GUI.java deleted file mode 100644 index 87c6b2a2..00000000 --- a/Dozentenmodul/src/gui/intro/VmWareLink_GUI.java +++ /dev/null @@ -1,292 +0,0 @@ -package gui.intro; - - -import java.awt.Desktop; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import models.Links; - -import org.ini4j.InvalidFileFormatException; -import org.ini4j.Wini; - -import util.GuiOrganizer; -import util.OpenLinks; - - -@SuppressWarnings("serial") -public class VmWareLink_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JCheckBox chckbxNewCheckBox; - private JButton btnWindows; - - - /** - * Create the dialog. - */ - public VmWareLink_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - System.exit(0); - } - }); - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("Dozentenmodul *Prototyp*"); - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBounds(0, 0, 577, 80); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Hinweis VMWare Player"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 42); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 104, 567, 502); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JTextPane txtpnUmIhreVmdk = new JTextPane(); - txtpnUmIhreVmdk.setBackground(SystemColor.menu); - txtpnUmIhreVmdk.setEditable(false); - txtpnUmIhreVmdk.setText("F\u00FCr die Arbeit mit der bwLehrpool Suite wird zwingend ein VMWare Player ben\u00F6tigt. Diesen k\u00F6nnen Sie sich unter folgendem Link kostenfrei downloaden."); - txtpnUmIhreVmdk.setBounds(10, 16, 499, 66); - contentPanel.add(txtpnUmIhreVmdk); - - JLabel lblNewLabel_1 = new JLabel("Windows: "); - lblNewLabel_1.addMouseListener(new MouseAdapter() { - @Override - public void mouseReleased(MouseEvent arg0) { - URI url; - try { - url = new URI("https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"); - Desktop.getDesktop().browse(url); - } catch (URISyntaxException | IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - } - }); - - lblNewLabel_1.setBounds(10, 93, 499, 14); - contentPanel.add(lblNewLabel_1); - - chckbxNewCheckBox = new JCheckBox("Diese Benachrichtigung nicht mehr anzeigen."); - chckbxNewCheckBox.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if(chckbxNewCheckBox.isSelected()==true) - { - try { - Wini ini=new Wini(new File("C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); - ini.put("main", "vmware",true); - ini.store(); - } catch (InvalidFileFormatException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - } - }); - chckbxNewCheckBox.setBounds(6, 472, 555, 23); - contentPanel.add(chckbxNewCheckBox); - - JLabel lbllinuxvmwarePlayer = new JLabel("Linux: "); - lbllinuxvmwarePlayer.setBounds(10, 178, 499, 14); - contentPanel.add(lbllinuxvmwarePlayer); - - btnWindows = new JButton("VMware Player herunterladen"); - btnWindows.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - try { - - OpenLinks open = new OpenLinks(); - - URI windows= new URI(Links.getUriWindows()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - btnWindows.setBounds(10, 119, 186, 23); - contentPanel.add(btnWindows); - - JButton btnLinux = new JButton("VMware Player herunterladen"); - btnLinux.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - try { - OpenLinks open = new OpenLinks(); - - URI linux= new URI(Links.getUriLinux()); - - open.openWebpage(linux); - - } catch (URISyntaxException f) { - // TODO Auto-generated catch block - f.printStackTrace(); - } - } - }); - btnLinux.setBounds(10, 203, 186, 23); - contentPanel.add(btnLinux); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 630, 587, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - MainMenue_GUI ea=new MainMenue_GUI(); - ea.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 617, 587, 2); - getContentPane().add(separator); - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 91, 587, 2); - getContentPane().add(separator); - } - { - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - { - JMenu mnHilfe = new JMenu("Hilfe"); - menuBar.add(mnHilfe); - { - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - mnHilfe.add(mntmFaq); - } - { - JMenuItem mntmOTRS = new JMenuItem("OTRS"); - mntmOTRS.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - mnHilfe.add(mntmOTRS); - } - } - } - - - - }//end constructor - - - -}// end class diff --git a/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java b/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java deleted file mode 100644 index 44e8bd50..00000000 --- a/Dozentenmodul/src/gui/lecture/CreateLectureAllgemein_GUI.java +++ /dev/null @@ -1,545 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.ScrollPane; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Calendar; -import java.util.Date; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Lecture; -import models.Links; -import models.person; -import util.GuiOrganizer; -import util.OpenLinks; - -import com.toedter.calendar.JDateChooser; - -@SuppressWarnings("serial") -public class CreateLectureAllgemein_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private JTextField Vorname; - private JTextField Nachname; - private JTextField Hochschule; - private JTextField EMail; - private JTextField txtFldVeranstaltungsname; - JTextArea description; - JRadioButton radioButtonyes; - JRadioButton radioButtonno; - JDateChooser dateChooserend; - JDateChooser dateChooserstart; - Date startDate = new Date(); - Date endDate; - int maxLifeTime = 180; // Anzahl Tage, die eine Veranstaltung in der Zukunft - // aktiv sein darf - boolean isDateOrderCorrect, isDateMaxLifeTimeCorrect, - isAllInformationReady = false; - - - /** - * Create the dialog. - */ - public CreateLectureAllgemein_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - - @Override - public void windowOpened(WindowEvent arg0) { - txtFldVeranstaltungsname.requestFocusInWindow(); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung erzeugen"); - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 21); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 331, 557, 162); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel label = new JLabel("Vorname: *"); - label.setBackground(SystemColor.menu); - label.setBounds(10, 33, 125, 20); - panel_1.add(label); - - Vorname = new JTextField(); - Vorname.setEditable(false); - Vorname.setEnabled(false); - Vorname.setText(person.verantwortlicher.getVorname()); - Vorname.setBackground(Color.WHITE); - Vorname.setColumns(10); - Vorname.setBounds(145, 33, 350, 20); - panel_1.add(Vorname); - - JLabel label_7 = new JLabel("Nachname: *"); - label_7.setBackground(SystemColor.menu); - label_7.setBounds(10, 64, 125, 20); - panel_1.add(label_7); - - Nachname = new JTextField(); - Nachname.setEnabled(false); - Nachname.setEditable(false); - Nachname.setText(person.verantwortlicher.getName()); - Nachname.setBackground(Color.WHITE); - Nachname.setColumns(10); - Nachname.setBounds(145, 64, 350, 20); - panel_1.add(Nachname); - - JLabel label_8 = new JLabel("Hochschule: *"); - label_8.setBackground(SystemColor.menu); - label_8.setBounds(10, 95, 125, 20); - panel_1.add(label_8); - - Hochschule = new JTextField(); - Hochschule.setEnabled(false); - Hochschule.setEditable(false); - Hochschule.setText(person.verantwortlicher.getHochschule()); - Hochschule.setBackground(Color.WHITE); - Hochschule.setColumns(10); - Hochschule.setBounds(145, 95, 350, 20); - panel_1.add(Hochschule); - - JLabel label_9 = new JLabel("E-Mail: *"); - label_9.setBackground(SystemColor.menu); - label_9.setBounds(10, 126, 125, 20); - panel_1.add(label_9); - - EMail = new JTextField(); - EMail.setEnabled(false); - EMail.setEditable(false); - EMail.setText(person.verantwortlicher.getEMail()); - EMail.setBackground(Color.WHITE); - EMail.setColumns(10); - EMail.setBounds(145, 126, 350, 20); - panel_1.add(EMail); - - JPanel panel = new JPanel(); - panel.setBounds(10, 402, 577, 33); - contentPanel.add(panel); - panel.setLayout(null); - panel.setBorder(new EmptyBorder(5, 5, 5, 5)); - panel.setBackground(SystemColor.menu); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - CreateLectureAllgemein_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - - JPanel panel_2 = new JPanel(); - panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Veranstaltungsdaten", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(10, 36, 557, 284); - contentPanel.add(panel_2); - - JLabel label_3 = new JLabel("Laborname (Anzeigename): *"); - label_3.setBounds(10, 25, 180, 14); - panel_2.add(label_3); - - txtFldVeranstaltungsname = new JTextField(); - txtFldVeranstaltungsname.setColumns(10); - txtFldVeranstaltungsname.setBounds(200, 22, 347, 20); - txtFldVeranstaltungsname.setText(Lecture.lecture.getName()); - panel_2.add(txtFldVeranstaltungsname); - - JTextArea textArea = new JTextArea(); - textArea.setEditable(false); - textArea.setWrapStyleWord(true); - textArea.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an. Dieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); - textArea.setLineWrap(true); - textArea.setFont(new Font("Tahoma", Font.PLAIN, 12)); - textArea.setBackground(SystemColor.menu); - textArea.setBounds(10, 49, 537, 49); - panel_2.add(textArea); - - JLabel lblDesc = new JLabel("Beschreibung: *"); - lblDesc.setBounds(10, 111, 180, 14); - panel_2.add(lblDesc); - - ScrollPane scrollPane = new ScrollPane(); - scrollPane.setBounds(200, 104, 347, 78); - panel_2.add(scrollPane); - description = new JTextArea(); - description.setFont(new Font("Tahoma", Font.PLAIN, 11)); - description.setLineWrap(true); - description.setText(Lecture.lecture.getDesc()); - scrollPane.add(description); - description.setBounds(0, 0, 4, 22); - scrollPane.add(description); - - dateChooserend = new JDateChooser(); - endDate = addDays(new Date(), maxLifeTime); // Datum darf weiter als 6 - // Monate in der Zukunft - // liegen - dateChooserend.setDate(endDate); - if (Lecture.lecture.getEnddate() == null) { - // is not defined yet - dateChooserend.setDate(endDate); - } else { - // already defined from last visit on this page - dateChooserend.setDate(Lecture.lecture.getEnddate()); - } - dateChooserend.setDateFormatString("yyyy-MM-dd hh:mm:ss"); - dateChooserend.setBounds(404, 188, 143, 20); - panel_2.add(dateChooserend); - - JLabel lblBis = new JLabel("bis:"); - lblBis.setBounds(378, 188, 21, 20); - panel_2.add(lblBis); - - dateChooserstart = new JDateChooser(); - if (Lecture.lecture.getStartdate() == null) { - // is not defined yet - dateChooserstart.setDate(startDate); - } else { - // already defined from last visit on this page - dateChooserstart.setDate(Lecture.lecture.getStartdate()); - } - dateChooserstart.setDateFormatString("yyyy-MM-dd hh:mm:ss"); - dateChooserstart.setBounds(226, 188, 143, 20); - panel_2.add(dateChooserstart); - - JLabel label_6 = new JLabel("von:"); - label_6.setBounds(200, 188, 30, 20); - panel_2.add(label_6); - - JLabel label_10 = new JLabel("G\u00FCltigkeitsdatum: *"); - label_10.setBounds(10, 194, 127, 14); - panel_2.add(label_10); - - JLabel label_11 = new JLabel("Aktiv:"); - label_11.setBounds(10, 229, 127, 14); - panel_2.add(label_11); - - radioButtonyes = new JRadioButton("Ja"); - radioButtonyes.setSelected(true); - radioButtonyes.setBounds(200, 225, 73, 23); - panel_2.add(radioButtonyes); - - radioButtonno = new JRadioButton("Nein"); - radioButtonyes.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - radioButtonyes.setSelected(true); - radioButtonno.setSelected(false); - } - }); - radioButtonno.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - radioButtonno.setSelected(true); - radioButtonyes.setSelected(false); - } - }); - radioButtonno.setBounds(296, 225, 73, 23); - panel_2.add(radioButtonno); - - JLabel lblimVmchooserSichtbar = new JLabel("(im VMChooser sichtbar)"); - lblimVmchooserSichtbar.setBounds(10, 245, 127, 14); - panel_2.add(lblimVmchooserSichtbar); - - JLabel lblmaxMonate = new JLabel("(max. 6 Monate)"); - lblmaxMonate.setBounds(10, 208, 127, 14); - panel_2.add(lblmaxMonate); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton backButton = new JButton("Zur\u00FCck"); - backButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (radioButtonyes.isSelected() == true) { - Lecture.lecture.setActive(true); - } else { - Lecture.lecture.setActive(false); - } - - Lecture.lecture.setName(txtFldVeranstaltungsname - .getText()); - Lecture.lecture.setDesc(description.getText()); - Lecture.lecture.setEnddate(dateChooserend.getDate()); - Lecture.lecture.setStartdate(dateChooserstart.getDate()); - Image.image.setImagename(txtFldVeranstaltungsname - .getText()); - - MainMenue_GUI sr = new MainMenue_GUI(); - sr.setVisible(true); - dispose(); - } - }); - backButton.setActionCommand("Cancel"); - buttonPane.add(backButton); - getRootPane().setDefaultButton(backButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // liegt das End-Datum vor dem Start-Datum? - if (dateChooserend.getDate().before( - dateChooserstart.getDate())) { - // datum ist falsch rum - isDateOrderCorrect = false; - JOptionPane - .showMessageDialog( - null, - "Das End-Datum liegt vor dem Start-Datum. Bitte \u00e4ndern.", - "Datum fehlerhaft", - JOptionPane.INFORMATION_MESSAGE); - } else { - // bereit - isDateOrderCorrect = true; - } - // liegt das eingegebene Datum nach dem erlaubten - // End-Datum? - if (dateChooserend.getDate().after(endDate)) { - // Datum zu weit weg - isDateMaxLifeTimeCorrect = false; - JOptionPane.showMessageDialog(null, - "Das End-Datum liegt zu weit in der Zukunft. Erlaubt ist maximal:\n" - + endDate, "Datum fehlerhaft", - JOptionPane.INFORMATION_MESSAGE); - dateChooserend.setDate(endDate); //setze Datum auf maximum - } else { - // bereit - isDateMaxLifeTimeCorrect = true; - } - // Pruefen ob alles eingegeben wurde - if (txtFldVeranstaltungsname.getText().isEmpty() == true - || description.getText().isEmpty() == true) { - // mind 1 Textfeld ist leer - isAllInformationReady = false; - JOptionPane - .showMessageDialog( - null, - "Bitte geben Sie einen Veranstaltungsnamen und eine Beschreibung ein.", - "Datum fehlerhaft", - JOptionPane.INFORMATION_MESSAGE); - } else { - // Textfelder bereit - isAllInformationReady = true; - } - - // welcher Radiobutton ist geklickt? - if (radioButtonyes.isSelected() == true) { - Lecture.lecture.setActive(true); - } else { - Lecture.lecture.setActive(false); - } - // Pruefe ob alle Eingaben korrekt sind, dann mache - // weiter - if (isAllInformationReady == true - && isDateMaxLifeTimeCorrect == true - && isDateOrderCorrect == true) { - // everything is ok, proceed - Lecture.lecture.setName(txtFldVeranstaltungsname - .getText()); - Lecture.lecture.setDesc(description.getText()); - Lecture.lecture.setEnddate(dateChooserend.getDate()); - Lecture.lecture.setStartdate(dateChooserstart - .getDate()); - Image.image.setImagename(txtFldVeranstaltungsname - .getText()); - - CreateLectureLink_GUI ev = new CreateLectureLink_GUI(); - ev.setVisible(true); - dispose(); - } - - } - }); - continueButton.setActionCommand("OK"); - buttonPane.add(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); - lblPflichtfelder.setBounds(32, 602, 136, 14); - getContentPane().add(lblPflichtfelder); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mnmtAbout = new JMenuItem("About"); - mnmtAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mnmtAbout); - - } - - public Date addDays(Date date, int days) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.DATE, days); // minus number would decrement the days - return cal.getTime(); - } -} diff --git a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java deleted file mode 100644 index 0a00e781..00000000 --- a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java +++ /dev/null @@ -1,540 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.table.DefaultTableModel; - -import models.Lecture; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class CreateLectureLink_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox comboBox; - JTable tableAllImages = new JTable(); - JTable tablemyImages = new JTable(); - JTable tableCoopImages = new JTable(); - JTable tablePublicImages = new JTable(); - JTable tablePublicVorlagen = new JTable(); - private JTextField textFieldName; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - - - /** - * Create the dialog. - */ - public CreateLectureLink_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - con.closeThriftConnection(); - System.exit(0); - } - - @Override - public void windowOpened(WindowEvent arg0) { - textFieldName.requestFocusInWindow(); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung erzeugen"); - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Image verlinken"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("W\u00E4hlen Sie bitte ein Image aus, auf dem Ihre Versanstaltung basiert."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - String stext = textFieldName.getText(); - modelAll.setRowCount(0); - initTableModel(modelAll); - - if (stext != "") - for (int i = 0; i < modelAll.getRowCount(); i++) { - - if (modelAll.getValueAt(i, 0).toString() - .startsWith(stext)) { - - } else { - modelAll.removeRow(i); - } - } - - } - - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(431, 106, 89, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox(); - try { - List list = client.getAllOS(); - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - comboBox.addItem(list.get(i)); - } - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - modelAll.setRowCount(0); - initTableModel(modelAll); - String selItem = comboBox.getSelectedItem().toString(); - if (selItem != "") { - for (int i = 0; i < modelAll.getRowCount(); i++) { - - if (modelAll.getValueAt(i, 2).equals(selItem)) { - - } else { - modelAll.removeRow(i); - } - } - - } - } - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - CreateLectureLink_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("Veranstaltung"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 76, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(151, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(164, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - - tablemyImages.setModel(model); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages = new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - initTableModel(modelAll); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Zur\u00FCck"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - CreateLectureAllgemein_GUI eVAG = new CreateLectureAllgemein_GUI(); - eVAG.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("CANCEL"); - buttonPane.add(cancelButton); - getRootPane().setDefaultButton(cancelButton); - } - { - JButton doLinkButton = new JButton( - "Veranstaltung erzeugen und abschlie\u00DFen"); - doLinkButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // check if a row is selected - if ((tableAllImages.getSelectedRow() != -1) - || (tablemyImages.getSelectedRow() != -1) - || (tableCoopImages.getSelectedRow() != -1) - || (tablePublicImages.getSelectedRow() != -1) - || (tablePublicVorlagen.getSelectedRow() != -1)) { - - // a row is selected, do operations - String imagename = tableAllImages.getValueAt( - tableAllImages.getSelectedRow(), 0) - .toString(); - try { - DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); - client.writeLecturedata( - Lecture.lecture.getName(), - Lecture.lecture.getShortDesc(), - Lecture.lecture.getDesc(), - formatter.format( - Lecture.lecture.getStartdate()) - .toString(), - formatter.format( - Lecture.lecture.getEnddate()) - .toString(), - Lecture.lecture.isActive(), - imagename, - person.verantwortlicher.getUsername(), - person.verantwortlicher.getVorname(), - person.verantwortlicher.getName(), - person.verantwortlicher.getHochschule(), - person.verantwortlicher.getEMail(), - person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet()); - JOptionPane - .showMessageDialog( - null, - "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", - "Veranstaltung angelegt", - JOptionPane.INFORMATION_MESSAGE); - // zurueck zum Menue - MainMenue_GUI m = new MainMenue_GUI(); - m.setVisible(true); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane - .showMessageDialog( - null, - "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten.", - "Error", - JOptionPane.ERROR_MESSAGE); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - dispose(); - - } else { - // nothing selected - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein Image aus.", - "Image Auswahl", - JOptionPane.INFORMATION_MESSAGE); - } - - } - }); - doLinkButton.setActionCommand("OK"); - buttonPane.add(doLinkButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - public DefaultTableModel initTableModel(DefaultTableModel model) { - List images; - try { - images = client.getImageList(); - Iterator i = images.iterator(); - List ListObj = new ArrayList(); - int x = 0; - - while (i.hasNext()) { - - i.next(); - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime() - }; - ListObj.add(obj); - model.addRow(ListObj.get(x)); - x++; - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java b/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java deleted file mode 100644 index c638e440..00000000 --- a/Dozentenmodul/src/gui/lecture/DeleteLecture_GUI.java +++ /dev/null @@ -1,495 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class DeleteLecture_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JTable tableAllLectures; - JTable tablemyLectures; - JTable tableCoopImages; - JTable tablePublicVorlagen; - JTable tablePublicImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Veranstaltungsname", "Beschreibung", - "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", - "Verantwortlicher", "Image", "Schlagwort", "ID" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); - final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0); - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyLectures = new TableRowSorter( - modelMyLectures); - private JButton button; - - - /** - * Create the dialog. - */ - public DeleteLecture_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung l\u00F6schen"); - // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel( - "Zu l\u00F6schende Veranstaltung w\u00E4hlen"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("W\u00E4hlen Sie bitte aus der unten stehenden Liste die zu l\u00F6schende Veranstaltung aus."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche*Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(336, 106, 184, 14); - panel_1.add(lblErweiterteSuche); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Hauptmenue - - DeleteLecture_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("Veranstaltung"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 75, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(152, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); - lblNewLabel_1.setBounds(166, 11, 128, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - username, 5)); - } else if (tabbedPane.getSelectedIndex() == 1) { - - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - initTableModel(modelMyLectures); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllLectures = new JTable(); - tableAllLectures.setModel(modelAll); - tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyLectures = new JTable(); - tablemyLectures.setModel(modelMyLectures); - - tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyLectures.setRowSorter(rowSorterMyLectures); - - scrollPaneMyImage.setViewportView(tablemyLectures); - tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, - null); - tableAllLectures.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllLectures); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Veranstaltungen", null, - scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - button = new JButton("L\u00F6schen"); - button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - String lectureID=""; - int eingabe; - - //check if a row is selected - if (tablemyLectures.getSelectedRowCount() !=0){ - //a row is selected - //ask for confirmation - eingabe = JOptionPane.showConfirmDialog(null, - "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - //user has confirmed deletion, now get the ID of the selected lecture - lectureID = modelMyLectures.getValueAt(tablemyLectures.convertColumnIndexToModel(tablemyLectures.getSelectedRow()), 8).toString(); - System.out.println("L\u00f6sche Lecture "+lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - System.out.println("L\u00f6schen erfolgreich"); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - JOptionPane - .showMessageDialog( - null, - "L\u00f6schen aus Datenbank fehlgeschlagen.", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - }//end check if a row is selected - - } - }); - button.setBounds(459, 508, 118, 23); - contentPanel.add(button); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton btnBack = new JButton("Zur\u00FCck"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // oeffnet das Hauptmenue - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - btnBack.setActionCommand("OK"); - buttonPane.add(btnBack); - getRootPane().setDefaultButton(btnBack); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List lectures; - try { - // Hole eine Liste der Images - lectures = client.getLectureList(); - Iterator i = lectures.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { - lectures.get(x).lecturename, - lectures.get(x).desc, - lectures.get(x).starttime + " " - + lectures.get(x).endtime, - lectures.get(x).isActive, lectures.get(x).lastused, - lectures.get(x).username, " ", - lectures.get(x).imagename, lectures.get(x).id }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } -} diff --git a/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java deleted file mode 100644 index b72efce9..00000000 --- a/Dozentenmodul/src/gui/lecture/EditLectureAllgemein_GUI.java +++ /dev/null @@ -1,454 +0,0 @@ -package gui.lecture; - - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.ScrollPane; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Image; -import models.Lecture; -import models.Links; -import models.person; -import util.GuiOrganizer; -import util.OpenLinks; - -import com.toedter.calendar.JDateChooser; - - -@SuppressWarnings("serial") -public class EditLectureAllgemein_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private JTextField Vorname; - private JTextField Nachname; - private JTextField Hochschule; - private JTextField EMail; - private JTextField textFieldLaborname; - JTextArea description; - JRadioButton radioButtonyes; - JDateChooser dateChooserend; - JDateChooser dateChooserstart; - JRadioButton radioButtonno; - private final ButtonGroup buttonGroup = new ButtonGroup(); - - - /** - * Create the dialog. - */ - public EditLectureAllgemein_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten");; - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 21); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 331, 557, 162); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel label = new JLabel("Vorname: *"); - label.setBackground(SystemColor.menu); - label.setBounds(10, 33, 125, 20); - panel_1.add(label); - - Vorname = new JTextField(); - Vorname.setEditable(false); - Vorname.setEnabled(false); - Vorname.setText(person.verantwortlicher.getVorname()); - Vorname.setBackground(Color.WHITE); - Vorname.setColumns(10); - Vorname.setBounds(145, 33, 350, 20); - panel_1.add(Vorname); - - JLabel label_7 = new JLabel("Nachname: *"); - label_7.setBackground(SystemColor.menu); - label_7.setBounds(10, 64, 125, 20); - panel_1.add(label_7); - - Nachname = new JTextField(); - Nachname.setEnabled(false); - Nachname.setEditable(false); - Nachname.setText(person.verantwortlicher.getName()); - Nachname.setBackground(Color.WHITE); - Nachname.setColumns(10); - Nachname.setBounds(145, 64, 350, 20); - panel_1.add(Nachname); - - JLabel label_8 = new JLabel("Hochschule: *"); - label_8.setBackground(SystemColor.menu); - label_8.setBounds(10, 95, 125, 20); - panel_1.add(label_8); - - Hochschule = new JTextField(); - Hochschule.setEnabled(false); - Hochschule.setEditable(false); - Hochschule.setText(person.verantwortlicher.getHochschule()); - Hochschule.setBackground(Color.WHITE); - Hochschule.setColumns(10); - Hochschule.setBounds(145, 95, 350, 20); - panel_1.add(Hochschule); - - JLabel label_9 = new JLabel("E-Mail: *"); - label_9.setBackground(SystemColor.menu); - label_9.setBounds(10, 126, 125, 20); - panel_1.add(label_9); - - EMail = new JTextField(); - EMail.setEnabled(false); - EMail.setEditable(false); - EMail.setText(person.verantwortlicher.getEMail()); - EMail.setBackground(Color.WHITE); - EMail.setColumns(10); - EMail.setBounds(145, 126, 350, 20); - panel_1.add(EMail); - - JPanel panel = new JPanel(); - panel.setBounds(10, 402, 577, 33); - contentPanel.add(panel); - panel.setLayout(null); - panel.setBorder(new EmptyBorder(5, 5, 5, 5)); - panel.setBackground(SystemColor.menu); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - EditLectureAllgemein_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Neu"); - lblNewLabel_1.setBounds(146, 11, 46, 14); - contentPanel.add(lblNewLabel_1); - - JPanel panel_2 = new JPanel(); - panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Veranstaltungsdaten", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(10, 36, 557, 284); - contentPanel.add(panel_2); - - JLabel label_3 = new JLabel("Laborname (Anzeigename): *"); - label_3.setBounds(10, 25, 180, 14); - panel_2.add(label_3); - - textFieldLaborname = new JTextField(); - textFieldLaborname.setText(Lecture.lecture.getName()); - textFieldLaborname.setColumns(10); - textFieldLaborname.setBounds(200, 22, 347, 20); - panel_2.add(textFieldLaborname); - - JTextArea textArea = new JTextArea(); - textArea.setEditable(false); - textArea.setWrapStyleWord(true); - textArea.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an. Dieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); - textArea.setLineWrap(true); - textArea.setFont(new Font("Tahoma", Font.PLAIN, 12)); - textArea.setBackground(SystemColor.menu); - textArea.setBounds(10, 49, 537, 49); - panel_2.add(textArea); - - JLabel label_4 = new JLabel("Beschreibung: *"); - label_4.setBounds(10, 111, 180, 14); - panel_2.add(label_4); - - ScrollPane scrollPane = new ScrollPane(); - scrollPane.setBounds(200, 104, 347, 78); - panel_2.add(scrollPane); - description = new JTextArea(); - description.setFont(new Font("Tahoma", Font.PLAIN, 11)); - description.setText(Lecture.lecture.getDesc()); - description.setLineWrap(true); - scrollPane.add(description); - description.setBounds(0, 0, 4, 22); - scrollPane.add(description); - - dateChooserend = new JDateChooser(); - dateChooserend.setDateFormatString("dd-MM-yyyy hh:mm:ss"); - dateChooserend.setDate(Lecture.lecture.getEnddate()); - dateChooserend.setBounds(385, 188, 100, 20); - panel_2.add(dateChooserend); - - JLabel label_5 = new JLabel("bis"); - label_5.setBounds(351, 188, 24, 20); - panel_2.add(label_5); - - dateChooserstart = new JDateChooser(); - dateChooserstart.setDateFormatString("yyyy-MM-dd hh:mm:ss"); - dateChooserstart.setDate(Lecture.lecture.getStartdate()); - dateChooserstart.setBounds(240, 188, 101, 20); - panel_2.add(dateChooserstart); - - JLabel label_6 = new JLabel("von:"); - label_6.setBounds(200, 188, 30, 20); - panel_2.add(label_6); - - JLabel label_10 = new JLabel("G\u00FCltigkeitsdatum: *"); - label_10.setBounds(10, 188, 250, 14); - panel_2.add(label_10); - - JLabel label_11 = new JLabel("Aktiv:"); - label_11.setBounds(10, 229, 250, 14); - panel_2.add(label_11); - - radioButtonyes = new JRadioButton("Ja"); - buttonGroup.add(radioButtonyes); - if(Lecture.lecture.isActive()==true) - { - radioButtonyes.setSelected(true); - }else - { - radioButtonno.setSelected(true); - } - - radioButtonyes.setBounds(240, 225, 109, 23); - panel_2.add(radioButtonyes); - - radioButtonno = new JRadioButton("Nein"); - buttonGroup.add(radioButtonno); - radioButtonno.setBounds(385, 225, 109, 23); - panel_2.add(radioButtonno); - - JLabel label_12 = new JLabel("(Im VMChooser sichtbar)"); - label_12.setBounds(10, 254, 250, 14); - panel_2.add(label_12); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(radioButtonyes.isSelected()==true) - { - Lecture.lecture.setActive(true); - } - else - { - Lecture.lecture.setActive(false); - } - - Lecture.lecture.setName(textFieldLaborname.getText()); - Lecture.lecture.setDesc(description.getText()); - Lecture.lecture.setEnddate(dateChooserend.getDate()); - Lecture.lecture.setStartdate(dateChooserstart.getDate()); - Image.image.setImagename(textFieldLaborname.getText()); - - MainMenue_GUI sr=new MainMenue_GUI(); - sr.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if(radioButtonyes.isSelected()==true) - { - Lecture.lecture.setActive(true); - } - else - { - Lecture.lecture.setActive(false); - } - - Lecture.lecture.setName(textFieldLaborname.getText()); - Lecture.lecture.setNewName(textFieldLaborname.getText()); - Lecture.lecture.setDesc(description.getText()); - Lecture.lecture.setEnddate(dateChooserend.getDate()); - Lecture.lecture.setStartdate(dateChooserstart.getDate()); - Image.image.setImagename(textFieldLaborname.getText()); - - - EditLectureLink_GUI ev=new EditLectureLink_GUI(); - ev.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); - lblPflichtfelder.setBounds(32, 602, 136, 14); - getContentPane().add(lblPflichtfelder); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java deleted file mode 100644 index f7b38b06..00000000 --- a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java +++ /dev/null @@ -1,532 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.table.DefaultTableModel; - -import models.Lecture; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class EditLectureLink_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox comboBox; - JTable tableAllImages = new JTable(); - JTable tablemyImages = new JTable(); - JTable tableCoopImages = new JTable(); - JTable tablePublicImages = new JTable(); - JTable tablePublicVorlagen = new JTable(); - private JTextField textFieldName; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - - /** - * Create the dialog. - */ - public EditLectureLink_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - con.closeThriftConnection(); - System.exit(0); - } - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); - - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Image verlinken"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("W\u00E4hlen Sie bitte ein Image aus, auf dem Ihre Versanstaltung basiert."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - String stext = textFieldName.getText(); - modelAll.setRowCount(0); - initTableModel(modelAll); - - if (stext != "") - for (int i = 0; i < modelAll.getRowCount(); i++) { - - if (modelAll.getValueAt(i, 0).toString() - .startsWith(stext)) { - - } else { - modelAll.removeRow(i); - } - } - - } - - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche *Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // ExtendedSearchForImages_GUI es = new - // ExtendedSearchForImages_GUI(); - // es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(317, 106, 203, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox(); - try { - List list = client.getAllOS(); - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - modelAll.setRowCount(0); - initTableModel(modelAll); - String selItem = comboBox.getSelectedItem().toString(); - if (selItem != "") { - for (int i = 0; i < modelAll.getRowCount(); i++) { - - if (modelAll.getValueAt(i, 2).equals(selItem)) { - - } else { - modelAll.removeRow(i); - } - } - - } - } - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - - EditLectureLink_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("Veranstaltung"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 76, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(151, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Veranstaltung verlinken"); - lblNewLabel_1.setBounds(164, 11, 113, 14); - contentPanel.add(lblNewLabel_1); - - JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - - tablemyImages.setModel(model); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - JButton btnLinkLschen = new JButton("Link l\u00F6schen"); - btnLinkLschen.setEnabled(false); - btnLinkLschen.setBounds(478, 508, 89, 23); - contentPanel.add(btnLinkLschen); - - initTableModel(modelAll); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); - el.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton( - "Veranstaltung \u00e4ndern und abschlie\u00DFen"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - // check if a row is selected - if ((tableAllImages.getSelectedRow() != -1) - || (tablemyImages.getSelectedRow() != -1) - || (tableCoopImages.getSelectedRow() != -1) - || (tablePublicImages.getSelectedRow() != -1) - || (tablePublicVorlagen.getSelectedRow() != -1)) { - - // a row is selected, do operations - String imagename = tableAllImages.getValueAt( - tableAllImages.getSelectedRow(), 0) - .toString(); - - try { - - DateFormat formatter = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); - client.updateLecturedata( - Lecture.lecture.getName(), - Lecture.lecture.getNewName(), - Lecture.lecture.getShortDesc(), - Lecture.lecture.getDesc(), - formatter.format( - Lecture.lecture.getStartdate()) - .toString(), - formatter.format( - Lecture.lecture.getEnddate()) - .toString(), - Lecture.lecture.isActive(), - imagename, - person.verantwortlicher.getVorname(), - person.verantwortlicher.getName(), - person.verantwortlicher.getHochschule(), - person.verantwortlicher.getEMail(), - person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultaet(), - Lecture.lecture.getid()); - - JOptionPane - .showMessageDialog( - null, - "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", - "Veranstaltung angelegt", - JOptionPane.INFORMATION_MESSAGE); - - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - } else { - // nothing selected - JOptionPane.showMessageDialog(null, - "Bitte w\u00e4hlen Sie ein Image aus.", - "Image Auswahl", - JOptionPane.INFORMATION_MESSAGE); - - } - - MainMenue_GUI m = new MainMenue_GUI(); - m.setVisible(true); - dispose(); - - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - public DefaultTableModel initTableModel(DefaultTableModel model) { - List images; - try { - images = client.getImageList(); - Iterator i = images.iterator(); - List ListObj = new ArrayList(); - int x = 0; - - while (i.hasNext()) { - - i.next(); - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime(), "", images.get(x).id, - images.get(x).getVersion() }; - ListObj.add(obj); - model.addRow(ListObj.get(x)); - x++; - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } -} diff --git a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java deleted file mode 100644 index 58329ae2..00000000 --- a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java +++ /dev/null @@ -1,563 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Lecture; -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class EditLectureSearch_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JTable tableAllLectures; - JTable tablemyLectures; - JTable tableCoopImages; - JTable tablePublicVorlagen; - JTable tablePublicImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Veranstaltungsname", "Beschreibung", - "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", - "Verantwortlicher", "Image", "Schlagwort", "ID" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyLectures = new TableRowSorter( - modelMyLectures); - - - /** - * Create the dialog. - */ - public EditLectureSearch_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); - // Zentriert das Fenster in die Bildmitte - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach Veranstaltung"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche *Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(326, 106, 194, 14); - panel_1.add(lblErweiterteSuche); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Hauptmenue - - EditLectureSearch_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("Veranstaltung"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 75, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(152, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); - lblNewLabel_1.setBounds(166, 11, 128, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - username, 5)); - } else if (tabbedPane.getSelectedIndex() == 1) { - - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 323); - contentPanel.add(tabbedPane); - initTableModel(modelMyLectures); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllLectures = new JTable(); - tableAllLectures.setModel(modelAll); - tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyLectures = new JTable(); - tablemyLectures.setModel(modelMyLectures); - - tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyLectures.setRowSorter(rowSorterMyLectures); - - scrollPaneMyImage.setViewportView(tablemyLectures); - tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, - null); - tableAllLectures.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllLectures); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Veranstaltungen", null, - scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton btnBack = new JButton("Zur\u00FCck"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // oeffnet das Hauptmenue - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - btnBack.setActionCommand("OK"); - buttonPane.add(btnBack); - getRootPane().setDefaultButton(btnBack); - } - { - JButton btnContinue = new JButton("Weiter"); - btnContinue.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // check if a row is selected - if ((tableAllLectures.getSelectedRow() != -1) - || (tablemyLectures.getSelectedRow() != -1) - || (tableCoopImages.getSelectedRow() != -1) - || (tablePublicImages.getSelectedRow() != -1) - || (tablePublicVorlagen.getSelectedRow() != -1)) { - - // a row is selected, do operations - - if (tabbedPane.getSelectedIndex() == 0) { - - Lecture.lecture.setid(modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 8).toString()); - Lecture.lecture.setName(modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 0).toString()); - Lecture.lecture.setDesc(modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 1).toString()); - String date = modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 2).toString(); - - Lecture.lecture.setLinkedImagename(modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 6).toString()); - - int zweitesLeerzeichen = date.indexOf(" ", - date.indexOf(" ") + 1); - - String startdate = date.substring(0, - zweitesLeerzeichen); - String enddate = date - .substring(zweitesLeerzeichen); - DateFormat df = new SimpleDateFormat( - "yyyy-MM-dd hh:mm:ss"); - - try { - // Format has to be "yyyy-MM-dd hh:mm:ss" - Lecture.lecture.setEnddate(df - .parse(enddate)); - Lecture.lecture.setStartdate(df - .parse(startdate)); - } catch (ParseException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - if (modelMyLectures - .getValueAt( - tablemyLectures - .convertRowIndexToModel(tablemyLectures - .getSelectedRow()), - 3).toString().equals("1")) { - Lecture.lecture.setActive(true); - } else { - Lecture.lecture.setActive(false); - } - - - // EditImageAllgemein_GUI ea=new - // EditImageAllgemein_GUI(); - EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); - el.setVisible(true); - dispose(); - } else { - JOptionPane - .showMessageDialog( - null, - "Bitte w\u00f4hlen Sie ein eigenes Image aus", - "Message", - JOptionPane.INFORMATION_MESSAGE); - } - } else { - // nothing selected - JOptionPane.showMessageDialog(null, - "Bitte w\u00f4hlen Sie ein Image aus.", - "Image Auswahl", - JOptionPane.INFORMATION_MESSAGE); - }// end check if a row is selected - - } - }); - btnContinue.setActionCommand("Cancel"); - buttonPane.add(btnContinue); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List lectures; - try { - // Hole eine Liste der Images - lectures = client.getLectureList(); - Iterator i = lectures.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { - lectures.get(x).lecturename, - lectures.get(x).desc, - lectures.get(x).starttime + " " - + lectures.get(x).endtime, - lectures.get(x).isActive, lectures.get(x).lastused, - lectures.get(x).username, " ", - lectures.get(x).imagename, lectures.get(x).id }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java b/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java deleted file mode 100644 index 579ea3bd..00000000 --- a/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java +++ /dev/null @@ -1,269 +0,0 @@ -package gui.lecture; - - -import gui.image.CreateImageAllgemein_GUI; -import gui.image.FTPCreateUploader_GUI; -import gui.intro.About_GUI; - -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JSeparator; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.Links; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class ExtendedSearchForImages_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - private JTextField textField; - private JTextField textField_1; - - - /** - * Create the dialog. - */ - public ExtendedSearchForImages_GUI() { - - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite *Prototyp* - Erweiterte Suche"); - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Weitere Suchoptionen"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("beschreibung"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 493); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Image-Typ", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 11, 557, 95); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Image-Typ"); - lblNewLabel_2.setBounds(10, 39, 176, 20); - panel_1.add(lblNewLabel_2); - - JCheckBox chckbxBestehendesImage = new JCheckBox("Bestehendes Image"); - chckbxBestehendesImage.setSelected(true); - chckbxBestehendesImage.setBounds(192, 38, 138, 23); - panel_1.add(chckbxBestehendesImage); - - JCheckBox chckbxRohling = new JCheckBox("Rohling"); - chckbxRohling.setSelected(true); - chckbxRohling.setBounds(332, 38, 97, 23); - panel_1.add(chckbxRohling); - - JPanel panel = new JPanel(); - panel.setLayout(null); - panel.setBorder(new TitledBorder(null, "Image-Inhalt", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 117, 557, 95); - contentPanel.add(panel); - - JLabel lblEnthalteneSoftware = new JLabel("Enthaltene Software"); - lblEnthalteneSoftware.setBounds(10, 39, 176, 20); - panel.add(lblEnthalteneSoftware); - - textField = new JTextField(); - textField.setBounds(196, 39, 351, 20); - panel.add(textField); - textField.setColumns(10); - - JLabel lblNewLabel_1 = new JLabel("Bitte mit ; getrennt angeben"); - lblNewLabel_1.setBounds(196, 70, 351, 14); - panel.add(lblNewLabel_1); - - JPanel panel_2 = new JPanel(); - panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Informationen zum Ersteller", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_2.setBackground(SystemColor.menu); - panel_2.setBounds(10, 223, 557, 123); - contentPanel.add(panel_2); - - JLabel lblNachnameDesErstellers = new JLabel("Nachname des Erstellers"); - lblNachnameDesErstellers.setBounds(10, 39, 176, 20); - panel_2.add(lblNachnameDesErstellers); - - textField_1 = new JTextField(); - textField_1.setColumns(10); - textField_1.setBounds(196, 39, 351, 20); - panel_2.add(textField_1); - - JLabel lblHochschuleuniversitt = new JLabel("Hochschule/Universit\u00E4t"); - lblHochschuleuniversitt.setBounds(10, 70, 176, 20); - panel_2.add(lblHochschuleuniversitt); - - JComboBox comboBox = new JComboBox(); - comboBox.setBounds(196, 70, 351, 20); - panel_2.add(comboBox); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - CreateImageAllgemein_GUI sr=new CreateImageAllgemein_GUI(); - sr.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("\u00DCbernehmen"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - FTPCreateUploader_GUI ea=new FTPCreateUploader_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu = new JMenu("Suchen"); - menuBar.add(mnNewMenu); - - JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); - mnNewMenu.add(mntmVlSuche); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } -} diff --git a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java b/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java deleted file mode 100644 index 6035ebf5..00000000 --- a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java +++ /dev/null @@ -1,453 +0,0 @@ -package gui.lecture; - -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; - -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import models.Links; -import models.person; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; -import util.GuiOrganizer; -import util.OpenLinks; - -@SuppressWarnings("serial") -public class SearchLecture_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JTable tableAllLectures; - JTable tablemyLectures; - JTable tableCoopImages; - JTable tablePublicVorlagen; - JTable tablePublicImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Veranstaltungsname", "Beschreibung", - "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", - "Verantwortlicher", "Image", "Schlagwort", "ID" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } - }; - final TableRowSorter rowSorterAll = new TableRowSorter( - modelAll); - final TableRowSorter rowSorterMyLectures = new TableRowSorter( - modelMyLectures); - - - /** - * Create the dialog. - */ - public SearchLecture_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - con.closeThriftConnection(); - System.exit(0); - } - }); - // Verhindert das Vergroessern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung suchen"); - // Zentriert das Fenster in die Bildmitte 2; - setBounds(0, 0, 603, 722); - GuiOrganizer.centerGUI(this); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach Veranstaltung"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "Erweiterte Suche *Folgt noch*"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Fenster Extended GUI - - //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - //es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(315, 106, 205, 14); - panel_1.add(lblErweiterteSuche); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // oeffnet das Hauptmenue - - SearchLecture_GUI.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("Veranstaltung"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 75, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(152, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); - lblNewLabel_1.setBounds(166, 11, 128, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0) { - - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( - username, 5)); - } else if (tabbedPane.getSelectedIndex() == 1) { - - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 323); - contentPanel.add(tabbedPane); - initTableModel(modelMyLectures); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllLectures = new JTable(); - tableAllLectures.setModel(modelAll); - tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyLectures = new JTable(); - tablemyLectures.setModel(modelMyLectures); - - tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyLectures.setRowSorter(rowSorterMyLectures); - - scrollPaneMyImage.setViewportView(tablemyLectures); - tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, - null); - tableAllLectures.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllLectures); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Veranstaltungen", null, - scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton btnBack = new JButton("Zur\u00FCck"); - btnBack.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // oeffnet das Hauptmenue - - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - btnBack.setActionCommand("OK"); - buttonPane.add(btnBack); - getRootPane().setDefaultButton(btnBack); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getFAQ()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - - URI windows; - try { - windows = new URI(Links.getOTRS()); - - open.openWebpage(windows); - - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - mnNewMenu_1.add(mntmOtrs); - - JMenuItem mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - } - - // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List lectures; - try { - // Hole eine Liste der Images - lectures = client.getLectureList(); - Iterator i = lectures.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { - lectures.get(x).lecturename, - lectures.get(x).desc, - lectures.get(x).starttime + " " - + lectures.get(x).endtime, - lectures.get(x).isActive, lectures.get(x).lastused, - lectures.get(x).username, " ", - lectures.get(x).imagename, lectures.get(x).id }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - -} diff --git a/Dozentenmodul/src/main/java/auth/Authentification.java b/Dozentenmodul/src/main/java/auth/Authentification.java new file mode 100644 index 00000000..41f69502 --- /dev/null +++ b/Dozentenmodul/src/main/java/auth/Authentification.java @@ -0,0 +1,12 @@ +package auth; + +import thrift.UserInfo; + +public class Authentification { + + public boolean auth(String username, String pass) + { + return false; + + } +} diff --git a/Dozentenmodul/src/main/java/config/config_file.java b/Dozentenmodul/src/main/java/config/config_file.java new file mode 100644 index 00000000..5d59e22a --- /dev/null +++ b/Dozentenmodul/src/main/java/config/config_file.java @@ -0,0 +1,66 @@ +package config; + +import java.io.File; +import java.io.IOException; + +import org.ini4j.Wini; +public class config_file { + + public boolean createConfig() throws IOException{ + + + String config_file="C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite"; + //File fuer den Ordner erzeugen + File config=new File(config_file); + String file=config_file+"\\config.ini"; + //ini File erzeugen + File conf=new File(file); + Wini ini; + + //Pruefen ob Ordner schon existiert + if(config.exists()==false) + { + //Wenn nicht erzeuge Ordner + config.mkdir(); + + //Erzeuge eine neue Datei + conf.createNewFile(); + ini=new Wini(conf); + + //Wenn in die Datei geschrieben werden kann + if(conf.canWrite()==true) + { + //Schreibe Config + ini.put("main", "BillOfRights",false); + ini.put("main", "vmware", false); + ini.store(); + + return true; + } + + } + else + { + //Wenn Ordner schon existiert, pruefe ob Datei existiert + if(conf.exists()==false) + { + //Wenn nicht, erzeuge diese + conf.createNewFile(); + ini=new Wini(conf); + + if(conf.canWrite()==true) + { + //Schreibe Konfig in File + ini.put("main", "BillOfRights",false); + ini.put("main", "vmware", false); + ini.store(); + + return true; + } + } + } + return true; + + } + +} diff --git a/Dozentenmodul/src/main/java/ftp/DownloadTask.java b/Dozentenmodul/src/main/java/ftp/DownloadTask.java new file mode 100644 index 00000000..83ad2c15 --- /dev/null +++ b/Dozentenmodul/src/main/java/ftp/DownloadTask.java @@ -0,0 +1,112 @@ +package ftp; + +import gui.image.FTPDownloader_GUI; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; + +/** + * Execute file download in a background thread and update the progress. + * @author www.codejava.net + * + */ +public class DownloadTask extends SwingWorker { + + private static final int BUFFER_SIZE = 4096; + + private String host; + private int port; + private String username; + private String password; + + private String downloadPath; + private String saveDir; + + @SuppressWarnings("unused") + private FTPDownloader_GUI gui; + + public DownloadTask(String host, int port, String username, + String password, String downloadPath, String saveDir, + FTPDownloader_GUI gui) { + this.host = host; + this.port = port; + this.username = username; + this.password = password; + this.downloadPath = downloadPath; + this.saveDir = saveDir; + this.gui = gui; + + } + + /** + * Executed in background thread + */ + @Override + protected Void doInBackground() throws Exception { + FTPUtility util = new FTPUtility(host, port, username, password); + try { + util.connect(); + + byte[] buffer = new byte[BUFFER_SIZE]; + int bytesRead = -1; + long totalBytesRead = 0; + int percentCompleted = 0; + long start=System.nanoTime(); + final double NANOS_PER_SECOND = 1000000000.0; + final double BYTES_PER_MIB = 1024*1024; + long fileSize = util.getFileSize(downloadPath); + //gui.setFileSize(fileSize); + + String fileName = new File(downloadPath).getName(); + + File downloadFile = new File(saveDir + File.separator + fileName); + FileOutputStream outputStream = new FileOutputStream(downloadFile); + + util.downloadFile(downloadPath); + InputStream inputStream = util.getInputStream(); + + while ((bytesRead = inputStream.read(buffer)) != -1 && isCancelled()==false) { + outputStream.write(buffer, 0, bytesRead); + totalBytesRead += bytesRead; + //System.out.println(totalBytesRead); + double speed = NANOS_PER_SECOND / BYTES_PER_MIB * totalBytesRead / (System.nanoTime() - start + 1); + percentCompleted = (int) (totalBytesRead * 100 / fileSize); + setProgress(percentCompleted); + firePropertyChange("speed", 0, speed); + firePropertyChange("filesize", 0,fileSize); + firePropertyChange("bytesread", 0,totalBytesRead); + + } + + outputStream.close(); + + util.finish(); + } catch (FTPException ex) { + JOptionPane.showMessageDialog(null, "Error downloading file: " + ex.getMessage(), + "Error", JOptionPane.ERROR_MESSAGE); + ex.printStackTrace(); + setProgress(0); + cancel(true); + } finally { + util.disconnect(); + } + + return null; + } + + /** + * Executed in Swing's event dispatching thread + */ + @Override + protected void done() { + if (!isCancelled()) { + JOptionPane.showMessageDialog(null, + "File has been downloaded successfully!", "Message", + JOptionPane.INFORMATION_MESSAGE); + } + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/ftp/FTPException.java b/Dozentenmodul/src/main/java/ftp/FTPException.java new file mode 100644 index 00000000..bc3193e0 --- /dev/null +++ b/Dozentenmodul/src/main/java/ftp/FTPException.java @@ -0,0 +1,8 @@ +package ftp; + +@SuppressWarnings("serial") +public class FTPException extends Exception { + public FTPException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/ftp/FTPUtility.java b/Dozentenmodul/src/main/java/ftp/FTPUtility.java new file mode 100644 index 00000000..f2c51dfc --- /dev/null +++ b/Dozentenmodul/src/main/java/ftp/FTPUtility.java @@ -0,0 +1,201 @@ +package ftp; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.SocketException; +import java.security.NoSuchAlgorithmException; + +import javax.swing.JOptionPane; + +import models.Image; + +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPFile; +import org.apache.commons.net.ftp.FTPReply; +import org.apache.commons.net.ftp.FTPSClient; + + +/** + * A utility class that provides functionality for downloading files from a FTP + * server. + * + * @author www.codejava.net + * + */ +public class FTPUtility { + + // FTP server information + private String host; + private int port; + private String username; + private String password; + + private FTPSClient ftpClient = new FTPSClient(); + private int replyCode; + + private InputStream inputStream; + private OutputStream outputStream; + + public FTPUtility(String host, int port, String user, String pass) { + this.host = host; + this.port = port; + this.username = user; + this.password = pass; + } + + /** + * Connect and login to the server. + * + * @throws FTPException + * @throws NoSuchAlgorithmException + */ + public void connect() throws FTPException, NoSuchAlgorithmException { + try { + ftpClient.connect(host, port); + replyCode = ftpClient.getReplyCode(); + if (!FTPReply.isPositiveCompletion(replyCode)) { + throw new FTPException("FTP serve refused connection."); + } + + + boolean logged = ftpClient.login(username, password); + if (!logged) { + // failed to login + ftpClient.execPROT("P"); + ftpClient.disconnect(); + throw new FTPException("Could not login to the server."); + } + + ftpClient.enterLocalPassiveMode(); + + } catch (IOException ex) { + throw new FTPException("I/O error: " + ex.getMessage()); + } + } + + /** + * Gets size (in bytes) of the file on the server. + * + * @param filePath + * Path of the file on server + * @return file size in bytes + * @throws FTPException + */ + public long getFileSize(String filePath) throws FTPException { + try { + FTPFile file = ftpClient.mlistFile(filePath); + if (file == null) { + throw new FTPException("The file may not exist on the server!"); + } + return file.getSize(); + } catch (IOException ex) { + throw new FTPException("Could not determine size of the file: " + + ex.getMessage()); + } + } + + /** + * Start downloading a file from the server + * + * @param downloadPath + * Full path of the file on the server + * @throws FTPException + * if client-server communication error occurred + */ + public void downloadFile(String downloadPath) throws FTPException { + try { + + boolean success = ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + if (!success) { + throw new FTPException("Could not set binary file type."); + } + + inputStream = ftpClient.retrieveFileStream(downloadPath); + + if (inputStream == null) { + throw new FTPException( + "Could not open input stream. The file may not exist on the server."); + } + } catch (IOException ex) { + throw new FTPException("Error downloading file: " + ex.getMessage()); + } + } + + + /** + * Start uploading a file to the server + * @param uploadFile the file to be uploaded + * @param destDir destination directory on the server + * where the file is stored + * @throws FTPException if client-server communication error occurred + */ + public void uploadFile(File uploadFile, String destDir) throws FTPException { + try { + boolean success = ftpClient.changeWorkingDirectory(destDir); + if (!success) { + throw new FTPException("Could not change working directory to " + + destDir + ". The directory may not exist."); + } + + success = ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + if (!success) { + throw new FTPException("Could not set binary file type."); + } + + outputStream = ftpClient.storeFileStream(Image.image.getNewName()); + + //ftpClient.rename(uploadFile.getName(), ); + } catch (IOException ex) { + throw new FTPException("Error uploading file: " + ex.getMessage()); + } + } + + /** + * Write an array of bytes to the output stream. + */ + public void writeFileBytes(byte[] bytes, int offset, int length) + throws IOException { + outputStream.write(bytes, offset, length); + } + + /** + * Complete the download operation. + */ + public void finish() throws IOException { + inputStream.close(); + ftpClient.completePendingCommand(); + } + + /** + * Log out and disconnect from the server + */ + public void disconnect() throws FTPException { + if (ftpClient.isConnected()) { + try { + if (!ftpClient.logout()) { + throw new FTPException("Could not log out from the server"); + } + ftpClient.disconnect(); + } catch (IOException ex) { + throw new FTPException("Error disconnect from the server: " + + ex.getMessage()); + } + } + } + + /** + * Return InputStream of the remote file on the server. + */ + public InputStream getInputStream() { + return inputStream; + } + + public OutputStream getOutputStream() { + return outputStream; + } + + + +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/ftp/UploadTask.java b/Dozentenmodul/src/main/java/ftp/UploadTask.java new file mode 100644 index 00000000..06d76dc8 --- /dev/null +++ b/Dozentenmodul/src/main/java/ftp/UploadTask.java @@ -0,0 +1,98 @@ +package ftp; + +import java.io.File; +import java.io.FileInputStream; + +import javax.swing.JOptionPane; +import javax.swing.SwingWorker; + +import models.Image; + +/** + * Executes the file upload in a background thread and updates progress to + * listeners that implement the java.beans.PropertyChangeListener interface. + * @author www.codejava.net + * + */ +public class UploadTask extends SwingWorker { + private static final int BUFFER_SIZE = 4096; + + private String host; + private int port; + private String username; + private String password; + + private String destDir; + private File uploadFile; + + public UploadTask(String host, int port, String username, String password, + String destDir, File uploadFile) { + this.host = host; + this.port = port; + this.username = username; + this.password = password; + this.destDir = destDir; + this.uploadFile = uploadFile; + + } + + /** + * Executed in background thread + */ + @Override + protected Void doInBackground() throws Exception { + FTPUtility util = new FTPUtility(host, port, username, password); + try { + util.connect(); + util.uploadFile(uploadFile, destDir); + + FileInputStream inputStream = new FileInputStream(uploadFile); + byte[] buffer = new byte[BUFFER_SIZE]; + int bytesRead = -1; + int i=0; + long totalBytesRead = 0; + int percentCompleted = 0; + long fileSize = uploadFile.length(); + Image.image.setFilesize(fileSize); + long start=System.nanoTime(); + final double NANOS_PER_SECOND = 1000000000.0; + final double BYTES_PER_MIB = 1024*1024; + while ((bytesRead = inputStream.read(buffer)) != -1 && isCancelled()==false) { + util.writeFileBytes(buffer, 0, bytesRead); + totalBytesRead += bytesRead; + percentCompleted = (int) (totalBytesRead * 100 / fileSize); + double speed = NANOS_PER_SECOND / BYTES_PER_MIB * totalBytesRead / (System.nanoTime() - start + 1); + setProgress(percentCompleted); + firePropertyChange("speed", 0, speed); + firePropertyChange("filesize", 0,fileSize); + firePropertyChange("bytesread", 0,totalBytesRead); + } + + inputStream.close(); + + util.finish(); + } catch (FTPException ex) { + JOptionPane.showMessageDialog(null, "Error uploading file: " + ex.getMessage(), + "Error", JOptionPane.ERROR_MESSAGE); + ex.printStackTrace(); + setProgress(0); + cancel(true); + } finally { + util.disconnect(); + } + + return null; + } + + /** + * Executed in Swing's event dispatching thread + */ + @Override + protected void done() { + if (!isCancelled()) { + JOptionPane.showMessageDialog(null, + "File has been uploaded successfully!", "Message", + JOptionPane.INFORMATION_MESSAGE); + } + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java b/Dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java new file mode 100644 index 00000000..6231c6f2 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/CreateImageAllgemein_GUI.java @@ -0,0 +1,355 @@ +package gui.image; + + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Links; +import models.person; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class CreateImageAllgemein_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private JTextField Vorname; + private JTextField Nachname; + private JTextField Hochschule; + private JTextField EMail; + private JTextField imagename; + + /** + * Create the dialog. + */ + public CreateImageAllgemein_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + //Beendet das Fenster auf X + System.exit(0); + } + @Override + public void windowOpened(WindowEvent arg0) { + imagename.requestFocusInWindow(); + } + }); + //Verhindert das Vergroessern des Fensters + setResizable(false); + + try { + //setzt das Look & Feel + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + //Setzt den Titel + setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); + //Zentriert das Fenster + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 66, 557, 369); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel label = new JLabel("Vorname: *"); + label.setBackground(SystemColor.menu); + label.setBounds(10, 245, 125, 20); + panel_1.add(label); + + Vorname = new JTextField(); + Vorname.setEnabled(false); + Vorname.setEditable(false); + Vorname.setBackground(Color.WHITE); + Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setColumns(10); + Vorname.setBounds(145, 245, 350, 20); + panel_1.add(Vorname); + + JLabel label_7 = new JLabel("Nachname: *"); + label_7.setBackground(SystemColor.menu); + label_7.setBounds(10, 276, 125, 20); + panel_1.add(label_7); + + Nachname = new JTextField(); + Nachname.setEnabled(false); + Nachname.setEditable(false); + Nachname.setBackground(Color.WHITE); + Nachname.setText(person.verantwortlicher.getName()); + Nachname.setColumns(10); + Nachname.setBounds(145, 276, 350, 20); + panel_1.add(Nachname); + + JLabel label_8 = new JLabel("Hochschule: *"); + label_8.setBackground(SystemColor.menu); + label_8.setBounds(10, 307, 125, 20); + panel_1.add(label_8); + + Hochschule = new JTextField(); + Hochschule.setEnabled(false); + Hochschule.setEditable(false); + Hochschule.setBackground(Color.WHITE); + Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setColumns(10); + Hochschule.setBounds(145, 307, 350, 20); + panel_1.add(Hochschule); + + JLabel label_9 = new JLabel("E-Mail: *"); + label_9.setBackground(SystemColor.menu); + label_9.setBounds(10, 338, 125, 20); + panel_1.add(label_9); + + EMail = new JTextField(); + EMail.setEnabled(false); + EMail.setEditable(false); + EMail.setBackground(Color.WHITE); + EMail.setText(person.verantwortlicher.getEMail()); + EMail.setColumns(10); + EMail.setBounds(145, 338, 350, 20); + panel_1.add(EMail); + + JLabel lblImagename = new JLabel("Imagename: *"); + lblImagename.setBackground(SystemColor.menu); + lblImagename.setBounds(10, 31, 125, 20); + panel_1.add(lblImagename); + + + imagename = new JTextField(); + imagename.setBackground(Color.WHITE); + imagename.setText((String) null); + imagename.setColumns(10); + imagename.setBounds(145, 31, 350, 20); + imagename.setText(Image.image.getImagename()); //null am Anfang, aber speichert die Eingabe, wenn man zurueck kommt zur Seite + panel_1.add(imagename); + + JTextArea txtrGebenSieBitte = new JTextArea(); + txtrGebenSieBitte.setEditable(false); + txtrGebenSieBitte.setBackground(SystemColor.menu); + txtrGebenSieBitte.setLineWrap(true); + txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); + txtrGebenSieBitte.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + txtrGebenSieBitte.setBounds(145, 62, 350, 110); + panel_1.add(txtrGebenSieBitte); + + JPanel panel = new JPanel(); + panel.setBounds(10, 402, 577, 33); + contentPanel.add(panel); + panel.setLayout(null); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); + panel.setBackground(SystemColor.menu); + + JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); + lblPflichtfelder.setBounds(10, 442, 136, 14); + contentPanel.add(lblPflichtfelder); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + //oeffnet das Hauptmenue + CreateImageAllgemein_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton backButton = new JButton("Zur\u00FCck"); + backButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Image.image.setImagename(imagename.getText()); + MainMenue_GUI sr=new MainMenue_GUI(); + sr.setVisible(true); + dispose(); + } + }); + backButton.setActionCommand("Cancel"); + buttonPane.add(backButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //Prueft die Eingabe + if(imagename.getText().isEmpty()==false && Vorname.getText().isEmpty()==false && Nachname.getText().isEmpty()==false && Hochschule.getText().isEmpty()==false&&EMail.getText().isEmpty()==false) + { + //Schreibt die Daten in das Model + Image.image.setImagename(imagename.getText()); + CreateImageTechnisch_GUI ea=new CreateImageTechnisch_GUI(); + ea.setVisible(true); + dispose(); + } + else{ + JOptionPane.showMessageDialog(null, "Bitte geben Sie alle notwendigen Daten an!", + "Daten unvollst\u00e4ndig", JOptionPane.INFORMATION_MESSAGE); + } + } + }); + continueButton.setActionCommand("OK"); + buttonPane.add(continueButton); + getRootPane().setDefaultButton(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem menuItem = new JMenuItem("About"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(menuItem); + + }//end main +} diff --git a/Dozentenmodul/src/main/java/gui/image/CreateImageFreigabe_GUI.java b/Dozentenmodul/src/main/java/gui/image/CreateImageFreigabe_GUI.java new file mode 100644 index 00000000..ec50440f --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/CreateImageFreigabe_GUI.java @@ -0,0 +1,264 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Links; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class CreateImageFreigabe_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private final ButtonGroup buttonGrouplicense = new ButtonGroup(); + private final ButtonGroup buttonGroupInternet = new ButtonGroup(); + JComboBox comboBox; + + /** + * Create the dialog. + */ + public CreateImageFreigabe_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Image Freigabe"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("W\u00E4hlen Sie bitte hier die von Ihnen gew\u00FCnschte Freigabe f\u00FCr Ihr Image aus."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Freigabe", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 51, 557, 124); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Freigabemodus:"); + lblNewLabel_2.setBounds(10, 55, 250, 20); + panel_1.add(lblNewLabel_2); + + comboBox = new JComboBox(); + comboBox.setModel(new DefaultComboBoxModel(new String[] { + "Lokal (Eigene Hochschule)", + "\u00D6ffentlich (Alle Hochschulen)" })); + comboBox.setSelectedIndex(0); + comboBox.setBounds(270, 55, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + CreateImageFreigabe_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton cancelButton = new JButton("Zur\u00FCck"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + Image.image.setShareMode(comboBox.getSelectedIndex()); + CreateImageTechnisch_GUI sr = new CreateImageTechnisch_GUI(); + sr.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("OK"); + buttonPane.add(cancelButton); + // getRootPane().setDefaultButton(cancelButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Image.image.setShareMode(comboBox.getSelectedIndex()); + FTPCreateUploader_GUI ea = new FTPCreateUploader_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + continueButton.setActionCommand("Cancel"); + buttonPane.add(continueButton); + getRootPane().setDefaultButton(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + JMenuItem menuItem = new JMenuItem("About"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(menuItem); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java b/Dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java new file mode 100644 index 00000000..34594f3d --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/CreateImageTechnisch_GUI.java @@ -0,0 +1,405 @@ +package gui.image; + + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.SpinnerNumberModel; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Links; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class CreateImageTechnisch_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JSpinner spinnerCPU; + JSpinner spinnerRam; + JRadioButton rdbtnlicenseJa; + JRadioButton rdbtnlicenseNein; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + private final ButtonGroup buttonGrouplicense = new ButtonGroup(); + private final ButtonGroup buttonGroupInternet = new ButtonGroup(); + + + /** + * Create the dialog. + */ + public CreateImageTechnisch_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe technischer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("Geben Sie hier bitte einige technische Daten ein"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Image", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 66, 557, 124); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + rdbtnlicenseNein = new JRadioButton("Nein"); + buttonGrouplicense.add(rdbtnlicenseNein); + rdbtnlicenseNein.setBounds(377, 29, 46, 23); + panel_1.add(rdbtnlicenseNein); + + rdbtnInternetNein = new JRadioButton("Nein"); + rdbtnInternetNein.setSelected(true); + buttonGroupInternet.add(rdbtnInternetNein); + rdbtnInternetNein.setBounds(377, 57, 46, 23); + panel_1.add(rdbtnInternetNein); + + JLabel lblInternetIstInnerhalb = new JLabel("Internet ist f\u00FCr dieses Image gesperrt:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + JButton btnInternetSettings = new JButton("Einstellungen..."); + btnInternetSettings.setEnabled(false); + btnInternetSettings.setBounds(439, 57, 108, 23); + panel_1.add(btnInternetSettings); + + rdbtnInternetJa = new JRadioButton("Ja"); + + buttonGroupInternet.add(rdbtnInternetJa); + rdbtnInternetJa.setBounds(266, 57, 41, 23); + panel_1.add(rdbtnInternetJa); + + rdbtnlicenseJa = new JRadioButton("Ja"); + rdbtnlicenseJa.setSelected(true); + buttonGrouplicense.add(rdbtnlicenseJa); + rdbtnlicenseJa.setBounds(266, 29, 41, 23); + panel_1.add(rdbtnlicenseJa); + + JLabel lblNewLabel_2 = new JLabel("Image enth\u00E4lt lizenzpflichtige Software:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblLizenzserverEintragen = new JLabel("Lizenzserver eintragen:"); + lblLizenzserverEintragen.setBounds(10, 85, 250, 20); + panel_1.add(lblLizenzserverEintragen); + + JButton btnLicenseServer = new JButton("Server-Adresse..."); + btnLicenseServer.setEnabled(false); + btnLicenseServer.setBounds(266, 84, 157, 23); + panel_1.add(btnLicenseServer); + + JPanel panel_2 = new JPanel(); + panel_2.setLayout(null); + panel_2.setBorder(new TitledBorder(null, "Empfehlung bez\u00fcglich Ressourcen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(11, 196, 557, 338); + contentPanel.add(panel_2); + + JLabel lblGbyte = new JLabel("GByte"); + lblGbyte.setBounds(424, 91, 46, 20); + panel_2.add(lblGbyte); + + spinnerCPU = new JSpinner(); + spinnerCPU.setModel(new SpinnerNumberModel(1, 1, 4, 1)); + spinnerCPU.setBounds(385, 188, 29, 20); + panel_2.add(spinnerCPU); + + JTextArea txtrBeispielWindows = new JTextArea(); + txtrBeispielWindows.setText("Beispiel:\r\nWindows 7 32/64 Bit: 2 GByte\r\nLinux/Unix 32/64 Bit: 1 GByte"); + txtrBeispielWindows.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrBeispielWindows.setBackground(SystemColor.menu); + txtrBeispielWindows.setBounds(10, 122, 280, 55); + panel_2.add(txtrBeispielWindows); + + + + JLabel lblKerne = new JLabel("Kerne"); + lblKerne.setBounds(424, 191, 46, 20); + panel_2.add(lblKerne); + + JLabel lblWieVieleCpus = new JLabel("Wie viele CPUs empfehlen Sie f\u00FCr das Image:"); + lblWieVieleCpus.setBounds(10, 191, 280, 20); + panel_2.add(lblWieVieleCpus); + + spinnerRam = new JSpinner(); + spinnerRam.setModel(new SpinnerNumberModel(1, 1, 8, 1)); + spinnerRam.setBounds(385, 88, 29, 20); + panel_2.add(spinnerRam); + + JLabel label_3 = new JLabel("mindestens"); + label_3.setBounds(315, 191, 60, 20); + panel_2.add(label_3); + + JLabel lblMindestens = new JLabel("mindestens"); + lblMindestens.setBounds(315, 91, 60, 20); + panel_2.add(lblMindestens); + + JTextArea txtrBeispielWindows_1 = new JTextArea(); + txtrBeispielWindows_1.setText("Beispiel:\r\nWindows 7 32/64 Bit: 1 Kern\r\nLinux/Unix 32/64 Bit: 1 Kern"); + txtrBeispielWindows_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrBeispielWindows_1.setBackground(SystemColor.menu); + txtrBeispielWindows_1.setBounds(10, 222, 280, 55); + panel_2.add(txtrBeispielWindows_1); + + JLabel lblNewLabel_3 = new JLabel("Wie viel Arbeitsspeicher empfehlen Sie f\u00FCr das Image:"); + lblNewLabel_3.setBounds(10, 91, 280, 20); + panel_2.add(lblNewLabel_3); + + JTextArea txtrHinweisSolltenSie = new JTextArea(); + txtrHinweisSolltenSie.setBackground(SystemColor.menu); + txtrHinweisSolltenSie.setFont(new Font("Tahoma", Font.PLAIN, 13)); + txtrHinweisSolltenSie.setText("Hinweis: Sollten Sie keine Software einsetzen, die viele Ressourcen ben\u00F6tigt,\r\nk\u00F6nnen Sie sich an den Beispielwerten orientieren."); + txtrHinweisSolltenSie.setBounds(10, 25, 537, 55); + panel_2.add(txtrHinweisSolltenSie); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + CreateImageTechnisch_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton cancelButton = new JButton("Zur\u00FCck"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if(rdbtnInternetJa.isSelected()==true) + { + Image.image.setInternet(true); + } + else + { + Image.image.setInternet(false); + } + + if(rdbtnlicenseJa.isSelected()==true) + { + Image.image.setLicensed(true); + } + else + { + Image.image.setLicensed(false); + } + Image.image.setCpu(Integer.valueOf(spinnerCPU.getValue().toString()).intValue()); + Image.image.setRam(Integer.valueOf(spinnerRam.getValue().toString()).intValue()); + + CreateImageAllgemein_GUI sr=new CreateImageAllgemein_GUI(); + sr.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("OK"); + buttonPane.add(cancelButton); + //getRootPane().setDefaultButton(cancelButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(rdbtnInternetJa.isSelected()==true) + { + Image.image.setInternet(true); + } + else + { + Image.image.setInternet(false); + } + + if(rdbtnlicenseJa.isSelected()==true) + { + Image.image.setLicensed(true); + } + else + { + Image.image.setLicensed(false); + } + Image.image.setCpu(Integer.valueOf(spinnerCPU.getValue().toString()).intValue()); + Image.image.setRam(Integer.valueOf(spinnerRam.getValue().toString()).intValue()); + CreateImageFreigabe_GUI ea=new CreateImageFreigabe_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + continueButton.setActionCommand("Cancel"); + buttonPane.add(continueButton); + getRootPane().setDefaultButton(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem menuItem = new JMenuItem("About"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(menuItem); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java b/Dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java new file mode 100644 index 00000000..67084a75 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java @@ -0,0 +1,633 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.HeadlessException; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.ListSelectionModel; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class DeleteImage_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox comboBox; + JTable tableAllImages; + JTable tablemyImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", + "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; + ThriftConnection con=new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final DefaultTableModel modelMyImages = new DefaultTableModel(titles,0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyImages = new TableRowSorter( + modelMyImages); + + /** + * Create the dialog. + */ + public DeleteImage_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Image l\u00F6schen"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel( + "Zu l\u00F6schendes Image w\u00E4hlen"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("W\u00E4hlen Sie bitte aus der unten stehenden Liste das zu l\u00F6schende Image aus."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext != "") { + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + + + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche*Folgt noch...*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + // oeffnet das Fenster Extended GUI + con.closeThriftConnection(); + + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(332, 106, 188, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox(); + try { + // Holt sich eine Liste aller verf\u00FCgbaren Betriebssysteme vom Server + List list = client.getAllOS(); + // Leeres Item hinzufuegen + comboBox.addItem(""); + for (int i = 0; i < list.size(); i++) { + // Hinzufuegen der verfuegbaren Betriebssysteme + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + JOptionPane.showMessageDialog(null, + e2.getCause()+"\n"+e2.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + // Registriert Auswahlaenderungen der Box + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // Prueft das die Auswahl nicht leer ist + if (comboBox.getSelectedItem().toString() != "") { + // Filtert nach dem ausgewaehlten Betriebssystem + rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox + .getSelectedItem().toString(), 2)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + comboBox.getSelectedItem().toString(), 2)); + } + } + + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + // oeffnet das Hauuetmenue + con.closeThriftConnection(); + + // oeffnet das Hauuetmenue + + DeleteImage_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(146, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + System.out.println(tabbedPane.getSelectedIndex()); + if (tabbedPane.getSelectedIndex() == 0) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + // String username="Spitzer Tobias"; + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + username, 4)); + } else if (tabbedPane.getSelectedIndex() == 1) { + + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + initTableModel(modelMyImages); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages = new JTable(); + tableAllImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages = new JTable(); + tablemyImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tablemyImages.setEnabled(true); + + tablemyImages.setModel(modelMyImages); + + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyImages.setRowSorter(rowSorterMyImages); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + tableAllImages.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + JTable tableCoopImages = new JTable(); + tableCoopImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + JTable tablePublicImages = new JTable(); + tablePublicImages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + JTable tablePublicVorlagen = new JTable(); + tablePublicVorlagen + .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + JButton btnDelete = new JButton("L\u00F6schen"); + btnDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + String imageid=""; + String imageversion=""; + int eingabe; + + if (tablemyImages.getSelectedRowCount() != 0) { + + // frage, soll das selektierte Daten geloescht werden? + eingabe = JOptionPane.showConfirmDialog(null, + "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", + JOptionPane.YES_NO_OPTION); + + if (eingabe == JOptionPane.YES_OPTION) { + + imageid = modelMyImages.getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7) + .toString(); + + imageversion = modelMyImages.getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 8) + .toString(); + + // TODO + // Image darf nur geloescht werden, wenn keine + // Veranstaltung mehr auf das Image verweist. + // Unbdingt abfragen! + + try { + if (!client.connectedToLecture(imageid, + imageversion)) { + System.out.println(imageid); + System.out.println(imageversion); + try { + client.deleteImageServer(imageid, imageversion); + if (client.deleteImageData(imageid, + imageversion)) { + // if (client.deleteImageServer(imageid + // ,imageversion)) { + + + + + DeleteImage_GUI di = new DeleteImage_GUI(); + di.setVisible(true); + dispose(); + + + /* + * } else { + * + * JOptionPane.showConfirmDialog(null, + * "Loeschen vom Server hat leider nicht geklappt!!" + * , imageversion, + * JOptionPane.OK_CANCEL_OPTION); } + */ + + } else { + + JOptionPane + .showConfirmDialog( + null, + "L\u00f6schen von der DB hat leider nicht geklappt!!", + "Fehler", + JOptionPane.INFORMATION_MESSAGE); + } + } catch (HeadlessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + + } else { + + JOptionPane.showMessageDialog(null, + "Image kann nicht gel\u00f6scht werden, da mindestens eine Veranstaltung mit diesem Image verlinkt ist.", + "Verlinkung vorhanden", JOptionPane.INFORMATION_MESSAGE); + } + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + } + + } else { + + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein eigenes Image aus", + "Message", JOptionPane.INFORMATION_MESSAGE); + } + + } + }); + btnDelete.setBounds(449, 508, 118, 23); + contentPanel.add(btnDelete); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // oeffnet das Hauptmen\u00FC + con.closeThriftConnection(); + + // oeffnet das Hauptmenue + + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem menuItem = new JMenuItem("About"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(menuItem); + + } + + // Initiale Beff\u00FClung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List images; + try { + // Hole eine Liste der Images + images = client.getImageList(); + + Iterator i = images.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte f\u00FCr die Tabelle + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), + images.get(x).getLectureName(), + images.get(x).getUserData(), + images.get(x).getUpdateTime(), "", images.get(x).id, + images.get(x).getVersion() }; + // System.out.println("id:"+images.get(x).getId()); + // F\u00FCge diese Objekte der Tabelle hinzu + + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java b/Dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java new file mode 100644 index 00000000..47837c22 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java @@ -0,0 +1,424 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class EditImageAllgemein_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private JTextField Vorname; + private JTextField Nachname; + private JTextField Hochschule; + private JTextField EMail; + private JTextField imagename; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + private JPanel panel_2; + private JLabel lblNewLabel; + private JTextPane txtpnBitteWhlenSie; + private JPanel buttonPane; + private JButton backButton; + private JButton okButton; + + /** + * Create the dialog. + */ + public EditImageAllgemein_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung bei einem Klick auf das X + con.closeThriftConnection(); + System.exit(0); + } + }); + // Verhindert das vergroessern des Fensters + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); + + // Zentriert das Fenster in der Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + initData(); + getContentPane().setLayout(null); + { + panel_2 = new JPanel(); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(10, 11, 577, 57); + getContentPane().add(panel_2); + panel_2.setLayout(null); + { + lblNewLabel = new JLabel("Bearbeiten Ihrer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel_2.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel_2.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 66, 557, 369); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel label = new JLabel("Vorname: *"); + label.setBackground(SystemColor.menu); + label.setBounds(10, 245, 125, 20); + panel_1.add(label); + + Vorname = new JTextField(); + Vorname.setEditable(false); + Vorname.setEnabled(false); + Vorname.setBackground(Color.WHITE); + Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setColumns(10); + Vorname.setBounds(145, 245, 350, 20); + panel_1.add(Vorname); + + JLabel label_7 = new JLabel("Nachname: *"); + label_7.setBackground(SystemColor.menu); + label_7.setBounds(10, 276, 125, 20); + panel_1.add(label_7); + + Nachname = new JTextField(); + Nachname.setEnabled(false); + Nachname.setEditable(false); + Nachname.setBackground(Color.WHITE); + Nachname.setText(person.verantwortlicher.getName()); + Nachname.setColumns(10); + Nachname.setBounds(145, 276, 350, 20); + panel_1.add(Nachname); + + JLabel label_8 = new JLabel("Hochschule: *"); + label_8.setBackground(SystemColor.menu); + label_8.setBounds(10, 307, 125, 20); + panel_1.add(label_8); + + Hochschule = new JTextField(); + Hochschule.setEnabled(false); + Hochschule.setEditable(false); + Hochschule.setBackground(Color.WHITE); + Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setColumns(10); + Hochschule.setBounds(145, 307, 350, 20); + panel_1.add(Hochschule); + + JLabel label_9 = new JLabel("E-Mail: *"); + label_9.setBackground(SystemColor.menu); + label_9.setBounds(10, 338, 125, 20); + panel_1.add(label_9); + + EMail = new JTextField(); + EMail.setEnabled(false); + EMail.setEditable(false); + EMail.setBackground(Color.WHITE); + EMail.setText(person.verantwortlicher.getEMail()); + EMail.setColumns(10); + EMail.setBounds(145, 338, 350, 20); + panel_1.add(EMail); + + JLabel lblImagename = new JLabel("Imagename: *"); + lblImagename.setBackground(SystemColor.menu); + lblImagename.setBounds(10, 31, 125, 20); + panel_1.add(lblImagename); + + imagename = new JTextField(); + imagename + .setToolTipText("Bitte geben Sie hier den Namen des Image ein, z.B. \"Programmieren\"."); + imagename.setBackground(Color.WHITE); + imagename.setText(Image.image.getImagename()); + imagename.setColumns(10); + imagename.setBounds(145, 31, 350, 20); + panel_1.add(imagename); + + JTextArea txtrGebenSieBitte = new JTextArea(); + txtrGebenSieBitte.setBackground(SystemColor.menu); + txtrGebenSieBitte.setLineWrap(true); + txtrGebenSieBitte.setFont(new Font("Tahoma", Font.PLAIN, 12)); + txtrGebenSieBitte + .setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an.\r\nDieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + txtrGebenSieBitte.setBounds(145, 62, 350, 110); + panel_1.add(txtrGebenSieBitte); + + JPanel panel = new JPanel(); + panel.setBounds(10, 402, 577, 33); + contentPanel.add(panel); + panel.setLayout(null); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); + panel.setBackground(SystemColor.menu); + + JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); + lblPflichtfelder.setBounds(10, 442, 136, 14); + contentPanel.add(lblPflichtfelder); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // Durch den Klick auf Button Hauptmenpue wird dieses Fenster + // unsichtbar und das Hauptmenue sichtbar + + EditImageAllgemein_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Bearbeiten"); + lblNewLabel_1.setBounds(146, 11, 71, 14); + contentPanel.add(lblNewLabel_1); + { + buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + backButton = new JButton("Zur\u00FCck"); + backButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // Setzen der Eingabe im Model, dadurch bleiben die + // Daten bei einem erneuten Aufruf verfuegbar + // Image.image.setImagename(imagename.getText()); + + SearchEditImage_GUI se = new SearchEditImage_GUI(); + se.setVisible(true); + dispose(); + } + }); + backButton.setActionCommand("CANCEL"); + buttonPane.add(backButton); + + } + { + okButton = new JButton("Weiter"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // check is textfield is empty + if (imagename.getText().length() <= 0) { + JOptionPane.showMessageDialog(null, + "Bitte geben Sie einen Labornamen ein.", + "Daten nicht vollst\u00e4ndig", + JOptionPane.INFORMATION_MESSAGE); + + } else { + + // setze Namen, egal ob alt oder nicht + Image.image.setImagename(imagename.getText()); + System.out.println("Changing name to:" + imagename.getText()+ "\nNewName is: "+Image.image.getNewName()); + + + EditImageTechnisch_GUI ea = new EditImageTechnisch_GUI(); + ea.setVisible(true); + dispose(); + }// end else + } + }); + + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem menuItem = new JMenuItem("About"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(menuItem); + // setFocusTraversalPolicy(new FocusTraversalOnArray(new + // Component[]{getContentPane(), panel_2, lblNewLabel, + // txtpnBitteWhlenSie, contentPanel, panel_1, label, Vorname, label_7, + // Nachname, label_8, Hochschule, label_9, EMail, lblImagename, + // imagename, txtrGebenSieBitte, panel, lblPflichtfelder, lblHauptmen, + // label_1, lblVlimage, label_2, lblNewLabel_1, buttonPane, backButton, + // okButton, separator, separator_1, menuBar, mnNewMenu_1, mntmFaq, + // mntmOtrs})); + + } + + public void initData() { + try { + + Map map = client.getImageData( + Image.image.getImageId(), Image.image.getVersion()); + if (map.get("internet").equals("0")) { + Image.image.setInternet(false); + } else { + Image.image.setInternet(true); + } + if (map.get("license").equals("0")) { + Image.image.setLicensed(false); + } else { + Image.image.setLicensed(true); + } + Image.image.setImagename(map.get("name")); + Image.image.setRam(Integer.parseInt(map.get("ram"))); + Image.image.setCpu(Integer.parseInt(map.get("cpu"))); + Image.image.setImagepath(map.get("path")); + Image.image.setFilesize(Long.parseLong(map.get("filesize"))); + int mode=0; + if(map.get("shareMode").equals("only_local")){ + mode=0; + } + else + { + mode=1; + } + Image.image.setShareMode(mode); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause() + "\n" + e.getMessage(), "Debug-Message", + JOptionPane.ERROR_MESSAGE); + } + } + +} diff --git a/Dozentenmodul/src/main/java/gui/image/EditImageFreigabe_GUI.java b/Dozentenmodul/src/main/java/gui/image/EditImageFreigabe_GUI.java new file mode 100644 index 00000000..e28b774b --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/EditImageFreigabe_GUI.java @@ -0,0 +1,262 @@ +package gui.image; + + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Links; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class EditImageFreigabe_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private final ButtonGroup buttonGrouplicense = new ButtonGroup(); + private final ButtonGroup buttonGroupInternet = new ButtonGroup(); + JComboBox comboBox; + + /** + * Create the dialog. + */ + public EditImageFreigabe_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Image erzeugen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Image Freigabe"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("W\u00E4hlen Sie bitte hier die von Ihnen gew\u00FCnschte Freigabe f\u00FCr Ihr Image aus."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Freigabe", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 51, 557, 124); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Freigabemodus:"); + lblNewLabel_2.setBounds(10, 55, 250, 20); + panel_1.add(lblNewLabel_2); + + comboBox = new JComboBox(); + comboBox.setModel(new DefaultComboBoxModel(new String[] {"Lokal (Eigene Hochschule)", "\u00D6ffentlich (Alle Hochschulen)"})); + comboBox.setSelectedIndex(Image.image.getShareMode()); + comboBox.setBounds(270, 55, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + EditImageFreigabe_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton cancelButton = new JButton("Zur\u00FCck"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + Image.image.setShareMode(comboBox.getSelectedIndex()); + EditImageTechnisch_GUI sr=new EditImageTechnisch_GUI(); + sr.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("OK"); + buttonPane.add(cancelButton); + //getRootPane().setDefaultButton(cancelButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Image.image.setShareMode(comboBox.getSelectedIndex()); + FTPEditUploader_GUI ea=new FTPEditUploader_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + continueButton.setActionCommand("Cancel"); + buttonPane.add(continueButton); + getRootPane().setDefaultButton(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java b/Dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java new file mode 100644 index 00000000..825292c2 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/EditImageTechnisch_GUI.java @@ -0,0 +1,403 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.SpinnerNumberModel; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import util.GuiOrganizer; +import util.OpenLinks; +import models.Image; +import models.Links; + +@SuppressWarnings("serial") +public class EditImageTechnisch_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JSpinner spinnerCPU; + JSpinner spinnerRam; + JRadioButton rdbtnlicenseJa; + JRadioButton rdbtnlicenseNein; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + private final ButtonGroup buttonGrouplicense = new ButtonGroup(); + private final ButtonGroup buttonGroupInternet = new ButtonGroup(); + + /** + * Create the dialog. + */ + public EditImageTechnisch_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung bei Klick auf das X + + System.exit(0); + } + + }); + // Verhindert das Vergroe�ern des Fensters + setResizable(false); + + try { + // setzt das Look & Feel + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Titel des Fensters + setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); + // Zentriert das Fenster + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe technischer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Geben Sie hier bitte einige technische Daten ein."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Image", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 66, 557, 95); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel( + "Image enth\u00E4lt lizenzpflichtige Software:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + rdbtnlicenseJa = new JRadioButton("Ja"); + rdbtnlicenseJa.setSelected(true); + buttonGrouplicense.add(rdbtnlicenseJa); + rdbtnlicenseJa.setBounds(266, 29, 109, 23); + panel_1.add(rdbtnlicenseJa); + + rdbtnlicenseNein = new JRadioButton("Nein"); + buttonGrouplicense.add(rdbtnlicenseNein); + rdbtnlicenseNein.setBounds(377, 29, 109, 23); + panel_1.add(rdbtnlicenseNein); + if (Image.image.isLicensed() == true) { + rdbtnlicenseJa.setSelected(true); + } else { + rdbtnlicenseNein.setSelected(true); + } + + JLabel lblInternetIstInnerhalb = new JLabel( + "Internet ist innerhalb des Image gesperrt:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + rdbtnInternetJa = new JRadioButton("Ja"); + buttonGroupInternet.add(rdbtnInternetJa); + rdbtnInternetJa.setBounds(266, 57, 109, 23); + panel_1.add(rdbtnInternetJa); + + rdbtnInternetNein = new JRadioButton("Nein"); + rdbtnInternetNein.setSelected(true); + buttonGroupInternet.add(rdbtnInternetNein); + rdbtnInternetNein.setBounds(377, 57, 109, 23); + panel_1.add(rdbtnInternetNein); + if (Image.image.isInternet() == true) { + rdbtnInternetJa.setSelected(true); + } else { + rdbtnInternetNein.setSelected(true); + } + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // Macht dieses Fenster unsichtbar und das vorhergehende Fenster + // sichtbar + EditImageTechnisch_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + + JPanel panel_2 = new JPanel(); + panel_2.setLayout(null); + panel_2.setBorder(new TitledBorder(null, + "Empfehlung bez\u00fcglich Ressourcen", TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(10, 172, 557, 338); + contentPanel.add(panel_2); + + JTextArea txtrHinweisSolltenSie = new JTextArea(); + txtrHinweisSolltenSie.setBackground(SystemColor.menu); + txtrHinweisSolltenSie.setFont(new Font("Tahoma", Font.PLAIN, 13)); + txtrHinweisSolltenSie + .setText("Hinweis: Sollten Sie keine Software einsetzen, die viele Ressourcen ben\u00F6tigt,\r\nk\u00F6nnen Sie sich an den Beispielwerten orientieren."); + txtrHinweisSolltenSie.setBounds(10, 25, 537, 55); + panel_2.add(txtrHinweisSolltenSie); + + JLabel lblNewLabel_3 = new JLabel( + "Wie viel Arbeitsspeicher empfehlen Sie f\u00FCr das Image:"); + lblNewLabel_3.setBounds(10, 91, 280, 20); + panel_2.add(lblNewLabel_3); + + JLabel lblMindestens = new JLabel("mindestens"); + lblMindestens.setBounds(315, 91, 60, 20); + panel_2.add(lblMindestens); + + spinnerRam = new JSpinner(); + spinnerRam.setModel(new SpinnerNumberModel(1, 1, 8, 1)); + spinnerRam.setBounds(385, 88, 29, 20); + spinnerRam.setValue(Image.image.getRam()); + panel_2.add(spinnerRam); + + JLabel lblGbyte = new JLabel("GByte"); + lblGbyte.setBounds(424, 91, 46, 20); + panel_2.add(lblGbyte); + + JTextArea txtrBeispielWindows = new JTextArea(); + txtrBeispielWindows + .setText("Beispiel:\r\nWindows 7 32/64 Bit: 2 GByte\r\nLinux/Unix 32/64 Bit: 1 GByte"); + txtrBeispielWindows.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrBeispielWindows.setBackground(SystemColor.menu); + txtrBeispielWindows.setBounds(20, 111, 280, 55); + panel_2.add(txtrBeispielWindows); + + JTextArea txtrBeispielWindows_1 = new JTextArea(); + txtrBeispielWindows_1 + .setText("Beispiel:\r\nWindows 7 32/64 Bit: 1 Kern\r\nLinux/Unix 32/64 Bit: 1 Kern"); + txtrBeispielWindows_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrBeispielWindows_1.setBackground(SystemColor.menu); + txtrBeispielWindows_1.setBounds(20, 226, 280, 55); + panel_2.add(txtrBeispielWindows_1); + + JLabel lblWieVieleCpus = new JLabel( + "Wie viele CPUs empfehlen Sie f\u00FCr das Image:"); + lblWieVieleCpus.setBounds(10, 201, 280, 20); + panel_2.add(lblWieVieleCpus); + + JLabel label_3 = new JLabel("mindestens"); + label_3.setBounds(315, 201, 60, 20); + panel_2.add(label_3); + + spinnerCPU = new JSpinner(); + spinnerCPU.setModel(new SpinnerNumberModel(1, 1, 4, 1)); + spinnerCPU.setBounds(385, 198, 29, 20); + spinnerCPU.setValue(Image.image.getCpu()); + panel_2.add(spinnerCPU); + + JLabel lblKerne = new JLabel("Kerne"); + lblKerne.setBounds(424, 201, 46, 20); + panel_2.add(lblKerne); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // Setzt die Imagewerte in das Model + Image.image.setCpu(Integer.valueOf( + spinnerCPU.getValue().toString()).intValue()); + Image.image.setRam(Integer.valueOf( + spinnerRam.getValue().toString()).intValue()); + if (rdbtnInternetJa.isSelected() == true) { + Image.image.setInternet(true); + } else { + Image.image.setInternet(false); + } + + if (rdbtnlicenseJa.isSelected() == true) { + Image.image.setLicensed(true); + } else { + Image.image.setLicensed(false); + } + // oeffnet das vorherige Fenster + EditImageAllgemein_GUI ei = new EditImageAllgemein_GUI(); + ei.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Image.image.setCpu(Integer.valueOf( + spinnerCPU.getValue().toString()).intValue()); + Image.image.setRam(Integer.valueOf( + spinnerRam.getValue().toString()).intValue()); + if (rdbtnInternetJa.isSelected() == true) { + Image.image.setInternet(true); + } else { + Image.image.setInternet(false); + } + + if (rdbtnlicenseJa.isSelected() == true) { + Image.image.setLicensed(true); + } else { + Image.image.setLicensed(false); + } + // oeffnet das naechste Fenster + EditImageFreigabe_GUI ea=new EditImageFreigabe_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java new file mode 100644 index 00000000..b850ccb2 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java @@ -0,0 +1,547 @@ +package gui.image; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; + +import models.Image; +import models.Links; +import models.SessionData; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; +import ftp.UploadTask; +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +@SuppressWarnings("serial") +public class FTPCreateUploader_GUI extends JFrame implements + PropertyChangeListener { + + @SuppressWarnings("unused") + private JPanel contentPane; + private final JPanel contentPanel = new JPanel(); + JLabel lblPath; + JProgressBar progressBar; + String host = SessionData.session.getServerAdress(); + int port = 21; + server.User user; + String filename = ""; + File uploadFile; + static String arg = ""; + UploadTask task; + JLabel UpSpeed; + JLabel labelfertig; + JLabel labelfilesize; + JLabel labelZeit; + JLabel labelverbleibend; + long filesize; + double speed; + long bytesread; + boolean taskrun = false; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + JButton finishButton = new JButton("Fertigstellen"); + JButton btnUploadStarten = new JButton("Upload auf Server starten"); + JButton btnZurck = new JButton("Zur\u00FCck"); + int progress = 0; // progress of upload + + + /** + * Create the frame. + */ + public FTPCreateUploader_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + task.cancel(true); + } + con.closeThriftConnection(); + System.exit(0); + }// end window closing + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + + // filename=name; + setBackground(Color.WHITE); + setTitle("Dozentenmodul *Prototyp* - Image erzeugen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + contentPanel.setLayout(null); + { + JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); + btnSpeicherortAuswhlen.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.FILES_ONLY); + + fc.showOpenDialog(getParent()); + File file = fc.getSelectedFile(); + // check if a file is selected and exists + if (file != null) { + // file selected + uploadFile = file; + filename = uploadFile.getName(); + lblPath.setText(file.getAbsolutePath()); + } else { + // no file selected + lblPath.setText(""); + }// end if + } + }); + + btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); + btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); + contentPanel.add(btnSpeicherortAuswhlen); + } + + lblPath = new JLabel(""); + lblPath.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent arg0) { + if (lblPath.getText().isEmpty()) { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(false); + btnUploadStarten.setText("Bitte warten"); + } else { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(true); + btnUploadStarten.setText("Upload auf Server starten"); + } + } + }); + lblPath.setHorizontalAlignment(SwingConstants.LEFT); + lblPath.setBounds(102, 158, 485, 23); + contentPanel.add(lblPath); + + btnUploadStarten.setEnabled(false); + btnUploadStarten.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + buttonUploadActionPerformed(arg0); + + } + }); + + btnUploadStarten.setBounds(102, 200, 173, 23); + contentPanel.add(btnUploadStarten); + + progressBar = new JProgressBar(0, 100); + progressBar.setStringPainted(true); + + progressBar.setBounds(102, 234, 485, 30); + contentPanel.add(progressBar); + + JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); + lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); + contentPanel.add(lblUploadgeschwindigkeit); + + JLabel label_1 = new JLabel("Fertig:"); + label_1.setBounds(102, 325, 46, 14); + contentPanel.add(label_1); + + labelfertig = new JLabel("0"); + labelfertig.setHorizontalAlignment(SwingConstants.LEFT); + labelfertig.setBounds(183, 325, 108, 14); + contentPanel.add(labelfertig); + + UpSpeed = new JLabel("0"); + UpSpeed.setHorizontalAlignment(SwingConstants.LEFT); + UpSpeed.setBounds(374, 275, 117, 14); + contentPanel.add(UpSpeed); + + JLabel label_4 = new JLabel("von:"); + label_4.setBounds(318, 325, 46, 14); + contentPanel.add(label_4); + + labelfilesize = new JLabel("0"); + labelfilesize.setHorizontalAlignment(SwingConstants.LEFT); + labelfilesize.setBounds(374, 325, 117, 14); + contentPanel.add(labelfilesize); + + JLabel label_6 = new JLabel("Verbleibend:"); + label_6.setBounds(102, 350, 71, 14); + contentPanel.add(label_6); + + JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); + label_7.setBounds(102, 300, 150, 14); + contentPanel.add(label_7); + + labelZeit = new JLabel("0"); + labelZeit.setHorizontalAlignment(SwingConstants.LEFT); + labelZeit.setBounds(374, 300, 117, 14); + contentPanel.add(labelZeit); + + labelverbleibend = new JLabel("0"); + labelverbleibend.setHorizontalAlignment(SwingConstants.LEFT); + labelverbleibend.setBounds(183, 350, 108, 14); + contentPanel.add(labelverbleibend); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + contentPanel.add(panel); + + JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); + lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblUploadIhresImage.setBounds(10, 11, 509, 22); + panel.add(lblUploadIhresImage); + + JTextPane txtpnFhreSieBitte = new JTextPane(); + txtpnFhreSieBitte + .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); + txtpnFhreSieBitte.setEditable(false); + txtpnFhreSieBitte.setBackground(SystemColor.menu); + txtpnFhreSieBitte.setBounds(10, 36, 509, 32); + panel.add(txtpnFhreSieBitte); + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 79, 597, 2); + contentPanel.add(separator); + + JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); + lblNewLabel_1.setForeground(Color.BLUE); + lblNewLabel_1.setBounds(20, 88, 61, 20); + contentPanel.add(lblNewLabel_1); + + JLabel label_3 = new JLabel(">"); + label_3.setBounds(80, 91, 14, 14); + contentPanel.add(label_3); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(91, 88, 46, 20); + contentPanel.add(lblVlimage); + + JLabel label_5 = new JLabel(">"); + label_5.setBounds(139, 91, 14, 14); + contentPanel.add(label_5); + + JLabel lblNeubearbeiten = new JLabel("Neu"); + lblNeubearbeiten.setBounds(149, 91, 108, 14); + contentPanel.add(lblNeubearbeiten); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + contentPanel.add(separator_1); + + JLabel lblSchritt_1 = new JLabel("Schritt 1:"); + lblSchritt_1.setBounds(24, 128, 57, 14); + contentPanel.add(lblSchritt_1); + + JLabel lblSchritt_2 = new JLabel("Schritt 2:"); + lblSchritt_2.setBounds(24, 204, 57, 14); + contentPanel.add(lblSchritt_2); + + JLabel lblSchritt_3 = new JLabel("Schritt 3:"); + lblSchritt_3.setBounds(20, 423, 57, 14); + contentPanel.add(lblSchritt_3); + + JLabel lblKlickenSieAuf = new JLabel( + "Klicken Sie auf \"Fertigstellen\"."); + lblKlickenSieAuf.setBounds(98, 423, 241, 14); + contentPanel.add(lblKlickenSieAuf); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBackground(UIManager.getColor("Button.background")); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + finishButton.setEnabled(false); + finishButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + writeData(); + dispose(); + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + task.cancel(true); + } + + } + }); + + btnZurck.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + dispose(); + + CreateImageTechnisch_GUI m = new CreateImageTechnisch_GUI(); + m.setVisible(true); + } + }); + btnZurck.setActionCommand("Cancel"); + buttonPane.add(btnZurck); + finishButton.setActionCommand("Cancel"); + buttonPane.add(finishButton); + } + } + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu menu = new JMenu("Hilfe"); + menuBar.add(menu); + + JMenuItem menuItem = new JMenuItem("FAQ"); + menuItem.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + + menu.add(menuItem); + + JMenuItem menuItem_1 = new JMenuItem("OTRS"); + menuItem_1.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + menu.add(menuItem_1); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + menu.add(mntmAbout); + setVisible(true); + + } + + private void buttonUploadActionPerformed(ActionEvent event) { + + progressBar.setValue(0); + btnUploadStarten.setEnabled(false); // verhindert einen weiteren klick + btnUploadStarten.setText("Bitte warten"); + + try { + System.out.println("Test"); + user = client.getFtpUser(); + System.out.println("FTP name" + user.userName); + System.out.println("FTP path" + user.path); + System.out.println("FTP pass" + user.password); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); + + System.out.println(formatter.format(new Date()) + "_" + + person.verantwortlicher.getHochschule() + "_" + + person.verantwortlicher.getUsername() + "_" + + Image.image.getImagename() + ".vmdk"); + Image.image.setNewName(formatter.format(new Date()) + "_" + + person.verantwortlicher.getHochschule() + "_" + + person.verantwortlicher.getUsername() + "_" + + Image.image.getImagename() + ".vmdk"); + System.out.println("Uploading to host: "+host); + + task = new UploadTask(host, port, user.userName, user.password, + user.path+"temp/", uploadFile); + + task.addPropertyChangeListener(this); + task.execute(); + taskrun = true; + + } + + public void propertyChange(PropertyChangeEvent arg0) { + progress = 0; + if ("progress" == arg0.getPropertyName()) { + progress = (Integer) arg0.getNewValue(); + progressBar.setValue(progress); + + // Button zum Fertigstellen freischalten, wenn 100% erreicht sind + if (progress == 0 || progress == 100) { + // not uploading currently + btnZurck.setEnabled(true); + } else { + // currently uploading, don't let user interact + btnZurck.setEnabled(false); + } + + // Fertigstellen erlauben wenn upload abgeschlossen + if (progress == 100) { + finishButton.setEnabled(true); + + } else { + finishButton.setEnabled(false); + + } + + } + + + + if ("speed" == arg0.getPropertyName()) { + speed = (double) arg0.getNewValue(); + // if(speed<=1){ + + UpSpeed.setText(String.valueOf(speed).substring(0, + String.valueOf(speed).lastIndexOf(".") + 3) + + " MB/s"); + + } + if ("bytesread" == arg0.getPropertyName()) { + bytesread = (long) arg0.getNewValue(); + labelfertig.setText((bytesread / 1024 / 1024) + " MB"); + labelverbleibend + .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) + + " MB"); + + labelZeit + .setText(String + .valueOf( + ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) + .substring( + 0, + String.valueOf( + (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + .lastIndexOf(".")) + + " Minuten"); + + } + if ("filesize" == arg0.getPropertyName()) { + filesize = (long) arg0.getNewValue(); + labelfilesize.setText((filesize / 1024 / 1024) + " MB"); + + } + + } + + public boolean writeData() { + + try { + + client.writeVLdata(Image.image.getImagename(), + person.verantwortlicher.getUsername(), + person.verantwortlicher.getVorname(), + person.verantwortlicher.getName(), + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getEMail(), + person.verantwortlicher.getTel(), + person.verantwortlicher.getFakultaet(), + Image.image.isLicensed(), Image.image.isInternet(), + Image.image.getRam(), Image.image.getCpu(), + "temp/" + Image.image.getNewName(),false,Image.image.getFilesize(),Image.image.getShareMode()); + client.startFileCopy(Image.image.getNewName()); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/gui/image/FTPDownloader_GUI.java b/Dozentenmodul/src/main/java/gui/image/FTPDownloader_GUI.java new file mode 100644 index 00000000..d21da67e --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/FTPDownloader_GUI.java @@ -0,0 +1,484 @@ +package gui.image; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; + +import models.Image; +import models.Links; +import models.SessionData; + +import org.apache.thrift.TException; + +import server.Server.Client; +import server.User; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; +import ftp.DownloadTask; +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +@SuppressWarnings("serial") +public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener { + + @SuppressWarnings("unused") + private JPanel contentPane; + private final JPanel contentPanel = new JPanel(); + JLabel lblPath; + JLabel downspeed; + User user; + JProgressBar progressBar; + String host = SessionData.session.getServerAdress(); + int port = 21; + String downloadFile = ""; + static String arg = ""; + DownloadTask task; + JLabel lblBytesread; + JLabel lblNewLabel_3; + JLabel labelVerbleibend; + long filesize; + double speed; + int progress = 0; // progress of download + long bytesread; + JLabel labelZeit; + boolean taskrun = false; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + JButton btnZurck = new JButton("Zur\u00FCck"); + JButton btnDownloadStarten = new JButton("Download starten"); + JButton btnMainMenu = new JButton("Hauptmen\u00FC"); + + + /** + * Create the frame. + */ + public FTPDownloader_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + con.closeThriftConnection(); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + task.cancel(true); + } + //dispose(); + System.exit(0); + }//end window closing + }); + setResizable(false); + // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + setBackground(Color.WHITE); + setTitle("Dozentenmodul *Prototyp* - Image herunterladen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + contentPanel.setLayout(null); + { + JButton btnSpeicherortAuswhlen = new JButton( + "Speicherort ausw\u00E4hlen"); + btnSpeicherortAuswhlen.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + fc.showOpenDialog(getParent()); + File dir = fc.getSelectedFile(); + // check if directory is selected + if (dir != null) { + // is selected + lblPath.setText(dir.getAbsolutePath()); + } else { + // no directory selected + lblPath.setText(""); + }// end if + } + }); + + btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); + btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); + contentPanel.add(btnSpeicherortAuswhlen); + } + + lblPath = new JLabel(""); + lblPath.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent arg0) { + if (lblPath.getText().isEmpty()) { + // wenn leer, dann upload button nicht freigeben + btnDownloadStarten.setEnabled(false); + btnDownloadStarten.setText("Bitte warten"); + } else { + // wenn leer, dann upload button nicht freigeben + btnDownloadStarten.setEnabled(true); + btnDownloadStarten.setText("Download starten"); + } + } + }); + lblPath.setBounds(102, 158, 485, 23); + contentPanel.add(lblPath); + + btnDownloadStarten.setEnabled(false); + btnDownloadStarten.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + buttonDownloadActionPerformed(arg0); + } + }); + + btnDownloadStarten.setBounds(102, 200, 173, 23); + contentPanel.add(btnDownloadStarten); + + progressBar = new JProgressBar(0, 100); + progressBar.setStringPainted(true); + + progressBar.setBounds(102, 234, 485, 30); + contentPanel.add(progressBar); + + JLabel lblDownloadgeschwindigkeit = new JLabel( + "Downloadgeschwindigkeit:"); + lblDownloadgeschwindigkeit.setBounds(102, 275, 141, 14); + contentPanel.add(lblDownloadgeschwindigkeit); + + downspeed = new JLabel("0"); + downspeed.setBounds(374, 275, 117, 14); + contentPanel.add(downspeed); + + JLabel lblFertig = new JLabel("Fertig:"); + lblFertig.setBounds(102, 325, 46, 14); + contentPanel.add(lblFertig); + + lblBytesread = new JLabel("0"); + lblBytesread.setBounds(183, 325, 108, 14); + contentPanel.add(lblBytesread); + + JLabel lblVon = new JLabel("von:"); + lblVon.setBounds(318, 325, 46, 14); + contentPanel.add(lblVon); + + lblNewLabel_3 = new JLabel("0"); + lblNewLabel_3.setBounds(374, 325, 117, 14); + contentPanel.add(lblNewLabel_3); + + JLabel lblMbVerbleibend = new JLabel("Verbleibend:"); + lblMbVerbleibend.setBounds(102, 350, 71, 14); + contentPanel.add(lblMbVerbleibend); + + labelVerbleibend = new JLabel("0"); + labelVerbleibend.setBounds(183, 350, 108, 14); + contentPanel.add(labelVerbleibend); + + JLabel lblGeschtzteVerbleibendeZeit = new JLabel( + "Gesch\u00E4tzte Verbleibende Zeit:"); + lblGeschtzteVerbleibendeZeit.setBounds(102, 300, 150, 14); + contentPanel.add(lblGeschtzteVerbleibendeZeit); + + labelZeit = new JLabel("0"); + labelZeit.setBounds(374, 300, 117, 14); + contentPanel.add(labelZeit); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 24, 577, 57); + contentPanel.add(panel); + + JLabel lblImageDownloader = new JLabel("Image Downloader"); + lblImageDownloader.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblImageDownloader.setBounds(10, 11, 509, 22); + panel.add(lblImageDownloader); + + JTextPane txtpnWhlenSieEinen = new JTextPane(); + txtpnWhlenSieEinen.setText("W\u00E4hlen Sie einen Ort aus, um das von Ihnen gw\u00E4hlte Image erunter zu laden."); + txtpnWhlenSieEinen.setEditable(false); + txtpnWhlenSieEinen.setBackground(SystemColor.menu); + txtpnWhlenSieEinen.setBounds(10, 36, 509, 32); + panel.add(txtpnWhlenSieEinen); + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 88, 597, 2); + contentPanel.add(separator); + + JLabel label_1 = new JLabel("Hauptmen\u00FC"); + label_1.setForeground(Color.BLUE); + label_1.setBounds(20, 92, 61, 20); + contentPanel.add(label_1); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(80, 95, 14, 14); + contentPanel.add(label_2); + + JLabel label_3 = new JLabel("VL-Image"); + label_3.setForeground(Color.BLUE); + label_3.setBounds(91, 92, 46, 20); + contentPanel.add(label_3); + + JLabel label_4 = new JLabel(">"); + label_4.setBounds(139, 95, 14, 14); + contentPanel.add(label_4); + + JLabel label_5 = new JLabel("Neu/Bearbeiten"); + label_5.setBounds(149, 95, 108, 14); + contentPanel.add(label_5); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(-10, 648, 597, 2); + contentPanel.add(separator_1); + + JLabel lblSchritt = new JLabel("Schritt 1:"); + lblSchritt.setBounds(24, 128, 57, 14); + contentPanel.add(lblSchritt); + + JLabel lblSchritt_1 = new JLabel("Schritt 2:"); + lblSchritt_1.setBounds(24, 204, 57, 14); + contentPanel.add(lblSchritt_1); + + JLabel lblSchritt_3 = new JLabel("Schritt 3:"); + lblSchritt_3.setBounds(20, 423, 57, 14); + contentPanel.add(lblSchritt_3); + + JLabel lblKlickenSieAuf = new JLabel( + "Klicken Sie auf \"Fertigstellen\"."); + lblKlickenSieAuf.setBounds(98, 423, 241, 14); + contentPanel.add(lblKlickenSieAuf); + + JMenuBar menuBar = new JMenuBar(); + menuBar.setBounds(0, 0, 597, 21); + contentPanel.add(menuBar); + + JMenu menu = new JMenu("Hilfe"); + menuBar.add(menu); + + JMenuItem menuItem = new JMenuItem("FAQ"); + menuItem.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + + menu.add(menuItem); + + JMenuItem menuItem_1 = new JMenuItem("OTRS"); + menuItem_1.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + + menu.add(menuItem_1); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + menu.add(mntmAbout); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBackground(UIManager.getColor("Button.background")); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + btnZurck.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (taskrun == true) { + task.cancel(true); + try { + client.DeleteFtpUser(user.userName); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + } + + SearchEditImage_GUI se = new SearchEditImage_GUI(); + se.setVisible(true); + dispose(); + } + }); + btnZurck.setActionCommand("Cancel"); + buttonPane.add(btnZurck); + } + + + btnMainMenu.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + MainMenue_GUI mm = new MainMenue_GUI(); + mm.setVisible(true); + dispose(); + } + }); + btnMainMenu.setActionCommand("Cancel"); + buttonPane.add(btnMainMenu); + } + setVisible(true); + + } + + private void buttonDownloadActionPerformed(ActionEvent event) { + + progressBar.setValue(0); + btnDownloadStarten.setEnabled(false); // verhindert schnellen zweiten + // Klick + btnDownloadStarten.setText("Bitte warten"); + try { + user = client.getFtpUser(); + + downloadFile = user.path+"/"+client.getPathOfImage(Image.image.getImageId(), + Image.image.getVersion()); + + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + + task = new DownloadTask(host, port, user.userName, user.password, + downloadFile, lblPath.getText(), this); + task.addPropertyChangeListener(this); + task.execute(); + taskrun = true; + + } + + public void propertyChange(PropertyChangeEvent arg0) { + + progress = 0; + if ("progress" == arg0.getPropertyName()) { + progress = (Integer) arg0.getNewValue(); + progressBar.setValue(progress); + + // Button zum Fertigstellen freischalten, wenn 100% erreicht sind + if (progress == 0 || progress == 100) { + // not uploading currently + btnZurck.setEnabled(true); + btnMainMenu.setEnabled(true); + } else { + // currently uploading, don't let user interact + btnZurck.setEnabled(false); + btnMainMenu.setEnabled(false); + } + } + + if ("speed" == arg0.getPropertyName()) { + speed = (double) arg0.getNewValue(); + // if(speed<=1){ + + downspeed.setText(String.valueOf(speed).substring(0, + String.valueOf(speed).lastIndexOf(".") + 3) + + " MB/s"); + + } + if ("bytesread" == arg0.getPropertyName()) { + bytesread = (long) arg0.getNewValue(); + lblBytesread.setText((bytesread / 1024 / 1024) + " MB"); + labelVerbleibend + .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) + + " MB"); + + labelZeit + .setText(String + .valueOf( + ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) + .substring( + 0, + String.valueOf( + (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + .lastIndexOf(".")) + + " Minuten"); + + } + if ("filesize" == arg0.getPropertyName()) { + filesize = (long) arg0.getNewValue(); + lblNewLabel_3.setText((filesize / 1024 / 1024) + " MB"); + + } + + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java b/Dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java new file mode 100644 index 00000000..a2123712 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java @@ -0,0 +1,538 @@ +package gui.image; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; + +import models.Image; +import models.Links; +import models.SessionData; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; +import ftp.UploadTask; +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +@SuppressWarnings("serial") +public class FTPEditUploader_GUI extends JFrame implements + PropertyChangeListener { + + @SuppressWarnings("unused") + private JPanel contentPane; + private final JPanel contentPanel = new JPanel(); + JLabel lblPath; + JProgressBar progressBar; + String host = SessionData.session.getServerAdress(); + int port = 21; + server.User user; + String filename = ""; + File uploadFile; + static String arg = ""; + UploadTask task; + JLabel UpSpeed; + JLabel labelfertig; + JLabel labelfilesize; + JLabel labelZeit; + JLabel labelverbleibend; + long filesize; + double speed; + long bytesread; + boolean taskrun = false; + int progress = 0; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + JButton btnUploadStarten = new JButton("Upload auf Server starten"); + JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); + JButton finishButton = new JButton("Fertigstellen"); + JButton btnZurck = new JButton("Zur\u00FCck"); + + + /** + * Create the frame. + */ + public FTPEditUploader_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + if (taskrun == true) { + try { + + client.DeleteFtpUser(user.userName); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + task.cancel(true); + } + con.closeThriftConnection(); + System.exit(0); + }// end window closing + }); + setResizable(false); + // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + // filename=name; + setBackground(Color.WHITE); + setTitle("Dozentenmodul *Prototyp* - Image bearbeiten"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + contentPanel.setLayout(null); + { + + btnSpeicherortAuswhlen.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.FILES_ONLY); + + fc.showOpenDialog(getParent()); + File file = fc.getSelectedFile(); + // check if a file is selected and exists + if (file != null) { + // file exists + uploadFile = file; + filename = uploadFile.getName(); + lblPath.setText(file.getAbsolutePath()); + } else { + // no file selected + lblPath.setText(""); + }// end if + } + }); + + btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); + btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); + contentPanel.add(btnSpeicherortAuswhlen); + } + + lblPath = new JLabel(""); + lblPath.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent arg0) { + if (lblPath.getText().isEmpty()) { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(false); + btnUploadStarten.setText("Bitte warten"); + } else { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(true); + btnUploadStarten.setText("Upload auf Server starten"); + } + } + }); + lblPath.setBounds(102, 158, 485, 23); + contentPanel.add(lblPath); + + btnUploadStarten.setEnabled(false); + btnUploadStarten.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + buttonUploadActionPerformed(arg0); + + } + }); + + btnUploadStarten.setBounds(102, 200, 173, 23); + contentPanel.add(btnUploadStarten); + + progressBar = new JProgressBar(0, 100); + progressBar.setStringPainted(true); + + progressBar.setBounds(102, 234, 485, 30); + contentPanel.add(progressBar); + + JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); + lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); + contentPanel.add(lblUploadgeschwindigkeit); + + JLabel label_1 = new JLabel("Fertig:"); + label_1.setBounds(102, 325, 46, 14); + contentPanel.add(label_1); + + labelfertig = new JLabel("0"); + labelfertig.setBounds(183, 325, 108, 14); + contentPanel.add(labelfertig); + + UpSpeed = new JLabel("0"); + UpSpeed.setBounds(374, 275, 117, 14); + contentPanel.add(UpSpeed); + + JLabel label_4 = new JLabel("von:"); + label_4.setBounds(318, 325, 46, 14); + contentPanel.add(label_4); + + labelfilesize = new JLabel("0"); + labelfilesize.setBounds(374, 325, 117, 14); + contentPanel.add(labelfilesize); + + JLabel label_6 = new JLabel("Verbleibend:"); + label_6.setBounds(102, 350, 71, 14); + contentPanel.add(label_6); + + JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); + label_7.setBounds(102, 300, 150, 14); + contentPanel.add(label_7); + + labelZeit = new JLabel("0"); + labelZeit.setBounds(374, 300, 117, 14); + contentPanel.add(labelZeit); + + labelverbleibend = new JLabel("0"); + labelverbleibend.setBounds(183, 350, 108, 14); + contentPanel.add(labelverbleibend); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + contentPanel.add(panel); + + JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); + lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblUploadIhresImage.setBounds(10, 11, 509, 22); + panel.add(lblUploadIhresImage); + + JTextPane txtpnFhreSieBitte = new JTextPane(); + txtpnFhreSieBitte + .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); + txtpnFhreSieBitte.setEditable(false); + txtpnFhreSieBitte.setBackground(SystemColor.menu); + txtpnFhreSieBitte.setBounds(10, 36, 509, 32); + panel.add(txtpnFhreSieBitte); + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 79, 597, 2); + contentPanel.add(separator); + + JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); + lblNewLabel_1.setForeground(Color.BLUE); + lblNewLabel_1.setBounds(20, 88, 61, 20); + contentPanel.add(lblNewLabel_1); + + JLabel label_3 = new JLabel(">"); + label_3.setBounds(80, 91, 14, 14); + contentPanel.add(label_3); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(91, 88, 46, 20); + contentPanel.add(lblVlimage); + + JLabel label_5 = new JLabel(">"); + label_5.setBounds(139, 91, 14, 14); + contentPanel.add(label_5); + + JLabel lblNeubearbeiten = new JLabel("Bearbeiten"); + lblNeubearbeiten.setBounds(149, 91, 108, 14); + contentPanel.add(lblNeubearbeiten); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + contentPanel.add(separator_1); + + JLabel lblSchritt_1 = new JLabel("Schritt 1:"); + lblSchritt_1.setBounds(24, 128, 57, 14); + contentPanel.add(lblSchritt_1); + + JLabel lblSchritt_2 = new JLabel("Schritt 2:"); + lblSchritt_2.setBounds(24, 204, 57, 14); + contentPanel.add(lblSchritt_2); + + JLabel label = new JLabel("Schritt 3:"); + label.setBounds(20, 423, 57, 14); + contentPanel.add(label); + + JLabel label_2 = new JLabel("Klicken Sie auf \"Fertigstellen\"."); + label_2.setBounds(98, 423, 241, 14); + contentPanel.add(label_2); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBackground(UIManager.getColor("Button.background")); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + + //finishButton.setEnabled(false); + finishButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + updateData(); + dispose(); + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); + + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + task.cancel(true); + } + + } + }); + btnZurck.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI(); + ei.setVisible(true); + } + }); + + btnZurck.setActionCommand("Cancel"); + buttonPane.add(btnZurck); + finishButton.setActionCommand("Cancel"); + buttonPane.add(finishButton); + } + } + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu menu = new JMenu("Hilfe"); + menuBar.add(menu); + + JMenuItem menuItem = new JMenuItem("FAQ"); + menuItem.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } + }); + + menu.add(menuItem); + + JMenuItem menuItem_1 = new JMenuItem("OTRS"); + menuItem_1.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } + }); + + menu.add(menuItem_1); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + menu.add(mntmAbout); + setVisible(true); + + } + + private void buttonUploadActionPerformed(ActionEvent event) { + + progressBar.setValue(0); + btnUploadStarten.setEnabled(false); // verhindert einen weiteren klick + btnUploadStarten.setText("Bitte warten"); + + try { + user = client.getFtpUser(); + System.out.println("FTP name" + user.userName); + System.out.println("FTP path" + user.path); + System.out.println("FTP pass" + user.password); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); + + Image.image.setNewName(formatter.format(new Date()) + "_" + + person.verantwortlicher.getHochschule() + "_" + + person.verantwortlicher.getUsername() + "_" + + Image.image.getImagename()+ ".vmdk"); + task = new UploadTask(host, port, user.userName, user.password, + user.path+"temp/", uploadFile); + + task.addPropertyChangeListener(this); + task.execute(); + taskrun = true; + + } + + public void propertyChange(PropertyChangeEvent arg0) { + if ("progress" == arg0.getPropertyName()) { + progress = (Integer) arg0.getNewValue(); + progressBar.setValue(progress); + + // Button zum Fertigstellen freischalten, wenn 100% erreicht sind + if (progress == 100) { + // not uploading currently + btnZurck.setEnabled(true); + } else { + // currently uploading, don't let user interact + btnZurck.setEnabled(false); + } + + // Fertigstellen erlauben wenn upload abgeschlossen + if (progress == 100) { + finishButton.setEnabled(true); + } else { + finishButton.setEnabled(false); + } + } + + + + if ("speed" == arg0.getPropertyName()) { + speed = (double) arg0.getNewValue(); + // if(speed<=1){ + + UpSpeed.setText(String.valueOf(speed).substring(0, + String.valueOf(speed).lastIndexOf(".") + 3) + + " MB/s"); + + } + if ("bytesread" == arg0.getPropertyName()) { + bytesread = (long) arg0.getNewValue(); + labelfertig.setText((bytesread / 1024 / 1024) + " MB"); + labelverbleibend + .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) + + " MB"); + + labelZeit + .setText(String + .valueOf( + ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) + .substring( + 0, + String.valueOf( + (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + .lastIndexOf(".")) + + " Minuten"); + + } + if ("filesize" == arg0.getPropertyName()) { + filesize = (long) arg0.getNewValue(); + labelfilesize.setText((filesize / 1024 / 1024) + " MB"); + + } + + } + + public boolean updateData() { + + try { + System.out.println("NewName="+Image.image.getNewName()); + System.out.println("OldName="+Image.image.getImagename()); + if(Image.image.getNewName().isEmpty()){ + client.updateImageData(Image.image.getImagename(), + Image.image.getImagename(),Image.image.getImagepath(), Image.image.isLicensed(), + Image.image.isInternet(), Image.image.getRam(), + Image.image.getCpu(), Image.image.getImageId(), + Image.image.getVersion(), false,Image.image.getFilesize(),Image.image.getShareMode()); + client.startFileCopy(Image.image.getNewName()); + } + else{ + + + client.updateImageData(Image.image.getImagename(), + Image.image.getImagename(),"temp/" + Image.image.getNewName(), Image.image.isLicensed(), + Image.image.isInternet(), Image.image.getRam(), + Image.image.getCpu(), Image.image.getImageId(), + Image.image.getVersion(), false,Image.image.getFilesize(),Image.image.getShareMode()); + client.startFileCopy(Image.image.getNewName()); + } + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java b/Dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java new file mode 100644 index 00000000..58fba9e7 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java @@ -0,0 +1,596 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Image; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +//import models.person; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class SearchEditImage_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox comboBox; + JTable tableAllImages; + JTable tablemyImages; + boolean activeSearch=false; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", + "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyImages = new TableRowSorter( + modelMyImages); + + + /** + * Create the dialog. + */ + public SearchEditImage_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + + @Override + public void windowOpened(WindowEvent arg0) { + initTableModel(modelMyImages); + initTableModel(modelAll); + textFieldName.requestFocusInWindow(); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Image bearbeiten"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext.isEmpty()==false) { + activeSearch=true; + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + } + else{ + activeSearch=false; + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + username, 4)); + rowSorterAll.setRowFilter(null); + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche *Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(365, 106, 155, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox(); + try { + // Holt sich eine Liste aller verfuegbaren Betriebssysteme vom Server + List list = client.getAllOS(); + // Leeres Item hinzufuegen + comboBox.addItem(""); + for (int i = 0; i < list.size(); i++) { + // Hinzufuegen der verfuegbaren Betriebssysteme + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + JOptionPane.showMessageDialog(null, + e2.getCause()+"\n"+e2.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + // Registriert Auswahlaenderungen der Box + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // Prueft das die Auswahl nicht leer ist + if (comboBox.getSelectedItem().toString().isEmpty()==false) { + // Filtert nach dem ausgewaehlten Betriebssystem + activeSearch=true; + rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox + .getSelectedItem().toString(), 2)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + comboBox.getSelectedItem().toString(), 2)); + } + else{ + activeSearch=false; + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + username, 4)); + + rowSorterAll.setRowFilter(null); + } + } + + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Hauuetmenue + + SearchEditImage_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(146, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if (tabbedPane.getSelectedIndex() == 0 && activeSearch==false) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + // String username="Spitzer Tobias"; + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + username, 4)); + } else if(tabbedPane.getSelectedIndex()==1 && activeSearch==false){ + rowSorterAll.setRowFilter(null); + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages = new JTable(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages = new JTable(); + tablemyImages.setModel(modelMyImages); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyImages.setRowSorter(rowSorterMyImages); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + tableAllImages.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + JTable tableCoopImages = new JTable(); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + JTable tablePublicImages = new JTable(); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + JTable tablePublicVorlagen = new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + JButton btnDownload = new JButton("Download"); + btnDownload.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // oeffnet den Downloader + + if (tablemyImages.getSelectedRow() != -1) { + String imageid = modelMyImages.getValueAt( + tablemyImages.convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7).toString(); + + Image.image.setImageId(imageid); + String imageversion = modelMyImages.getValueAt( + tablemyImages.convertRowIndexToModel(tablemyImages + .getSelectedRow()), 8).toString(); + + Image.image.setVersion(imageversion); + SearchEditImage_GUI.this.setVisible(false); + FTPDownloader_GUI down = new FTPDownloader_GUI(); + down.setVisible(true); + + + } else { + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein Image f\u00fcr den Download aus", + "Message", JOptionPane.INFORMATION_MESSAGE); + } + } + }); + btnDownload.setBounds(449, 508, 118, 23); + contentPanel.add(btnDownload); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // oeffnet das Hauptmenue + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + + // check if user is in correct tab + if (tabbedPane.getSelectedIndex() == 0) { + //check if a row is selected + if (tablemyImages.getSelectedRow() != -1) { + String imageid = modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), + 7).toString(); + + Image.image.setImageId(imageid); + String imageversion = modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), + 8).toString(); + + Image.image.setVersion(imageversion); + + EditImageAllgemein_GUI ea = new EditImageAllgemein_GUI(); + ea.setVisible(true); + dispose(); + } else { + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein Image aus.", + "Image Auswahl", JOptionPane.INFORMATION_MESSAGE); + }// end check if row is selected + } else { + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein eigenes Image aus.", + "Image Auswahl", JOptionPane.INFORMATION_MESSAGE); + }//end check if correct tab is selected + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List images; + try { + // Hole eine Liste der Images + images = client.getImageList(); + + Iterator i = images.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), + images.get(x).getLectureName(), + images.get(x).getUserData(), + images.get(x).getUpdateTime(), "", images.get(x).id, + images.get(x).getVersion() }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java b/Dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java new file mode 100644 index 00000000..ef8b75bb --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java @@ -0,0 +1,529 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Image; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class SearchImage_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox comboBox; + JTable tableAllImages; + JTable tablemyImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", + "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyImages = new TableRowSorter( + modelMyImages); + + + /** + * Create the dialog. + */ + public SearchImage_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + + @Override + public void windowOpened(WindowEvent arg0) { + textFieldName.requestFocusInWindow(); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Suche VL-Image"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext != "") { + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche *Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(360, 106, 160, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox(); + try { + // Holt sich eine Liste aller verfuegbaren Betriebssysteme vom Server + List list = client.getAllOS(); + // Leeres Item hinzufuegen + comboBox.addItem(""); + for (int i = 0; i < list.size(); i++) { + // Hinzufuegen der verfuegbaren Betriebssysteme + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + JOptionPane.showMessageDialog(null, + e2.getCause()+"\n"+e2.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + // Registriert Auswahlaenderungen der Box + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // Prueft das die Auswahl nicht leer ist + if (comboBox.getSelectedItem().toString() != "") { + // Filtert nach dem ausgewaehlten Betriebssystem + rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox + .getSelectedItem().toString(), 2)); + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + comboBox.getSelectedItem().toString(), 2)); + } + } + + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Hauuetmenue + + SearchImage_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(146, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if (tabbedPane.getSelectedIndex() == 0) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + // String username="Spitzer Tobias"; + rowSorterMyImages.setRowFilter(RowFilter.regexFilter( + username, 4)); + } else if (tabbedPane.getSelectedIndex() == 1) { + + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + initTableModel(modelMyImages); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages = new JTable(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages = new JTable(); + tablemyImages.setModel(modelMyImages); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyImages.setRowSorter(rowSorterMyImages); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + tableAllImages.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + JTable tableCoopImages = new JTable(); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + JTable tablePublicImages = new JTable(); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + JTable tablePublicVorlagen = new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + JButton btnDownload = new JButton("Download"); + btnDownload.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + // oeffnet den Downloader + + if (tablemyImages.getSelectedRow() != -1) { + String imageid = modelMyImages.getValueAt( + tablemyImages.convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7).toString(); + + Image.image.setImageId(imageid); + String imageversion = modelMyImages.getValueAt( + tablemyImages.convertRowIndexToModel(tablemyImages + .getSelectedRow()), 8).toString(); + + Image.image.setVersion(imageversion); + SearchImage_GUI.this.setVisible(false); + FTPDownloader_GUI down = new FTPDownloader_GUI(); + down.setVisible(true); + + + } else { + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein Image f\u00fcr den Download aus", + "Message", JOptionPane.INFORMATION_MESSAGE); + } + } + }); + btnDownload.setBounds(449, 508, 118, 23); + contentPanel.add(btnDownload); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // oeffnet das Hauptmenue + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List images; + try { + // Hole eine Liste der Images + images = client.getImageList(); + + Iterator i = images.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), + images.get(x).getLectureName(), + images.get(x).getUserData(), + images.get(x).getUpdateTime(), "", images.get(x).id, + images.get(x).getVersion() }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/gui/image/SearchMethodLecture_GUI.java b/Dozentenmodul/src/main/java/gui/image/SearchMethodLecture_GUI.java new file mode 100644 index 00000000..4eda36f0 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/image/SearchMethodLecture_GUI.java @@ -0,0 +1,290 @@ +package gui.image; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Links; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class SearchMethodLecture_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnSearchByImage; + JRadioButton rdbtnSearchByLecture; + private final ButtonGroup buttonGroup = new ButtonGroup(); + + + + /** + * Create the dialog. + */ + public SearchMethodLecture_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Suchmethode w\u00E4hlen"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suchmethode ausw\u00E4hlen"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Geben Sie bitte an, nach welchem Kriterium Sie suchen m\u00F6chten."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, + "W\u00e4hlen Sie bitte die Suchmethode Ihrer Suche", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 36, 557, 369); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + rdbtnSearchByImage = new JRadioButton( + "Nach einem VL-Image oder Vorlagen suchen"); + buttonGroup.add(rdbtnSearchByImage); + rdbtnSearchByImage.setBounds(6, 38, 545, 23); + panel_1.add(rdbtnSearchByImage); + + JTextArea txtrHierKlickenWenn = new JTextArea(); + txtrHierKlickenWenn.setBackground(SystemColor.menu); + txtrHierKlickenWenn.setLineWrap(true); + txtrHierKlickenWenn.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrHierKlickenWenn + .setText("Hier klicken, wenn Sie nach einem konkreten Image suchen, von dem Sie exakte Daten kennen. Hierzu geh\u00F6ren z.B. das Betriebssystem oder die installierte Software.\r\nEs werden zudem alle Vorlagen aufgelistet."); + txtrHierKlickenWenn.setBounds(25, 68, 518, 80); + panel_1.add(txtrHierKlickenWenn); + + JTextArea txtrHierKlickenWenn_1 = new JTextArea(); + txtrHierKlickenWenn_1 + .setText("Hier klicken, wenn Sie nur wissen f\u00FCr welche Veranstaltung das gesuchte Image verwendet wird. Hierzu geh\u00F6ren z.B. der Name des Dozenten oder der Name der Veranstaltung."); + txtrHierKlickenWenn_1.setLineWrap(true); + txtrHierKlickenWenn_1.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtrHierKlickenWenn_1.setBackground(SystemColor.menu); + txtrHierKlickenWenn_1.setBounds(25, 210, 518, 80); + panel_1.add(txtrHierKlickenWenn_1); + + rdbtnSearchByLecture = new JRadioButton( + "Nach einer Veranstaltung suchen"); + buttonGroup.add(rdbtnSearchByLecture); + rdbtnSearchByLecture.setBounds(6, 180, 545, 23); + panel_1.add(rdbtnSearchByLecture); + + JPanel panel = new JPanel(); + panel.setBounds(10, 402, 577, 33); + contentPanel.add(panel); + panel.setLayout(null); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); + panel.setBackground(SystemColor.menu); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + SearchMethodLecture_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Suchmethode"); + lblNewLabel_1.setBounds(146, 11, 82, 14); + contentPanel.add(lblNewLabel_1); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton backButton = new JButton("Zur\u00FCck"); + backButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + MainMenue_GUI sr = new MainMenue_GUI(); + sr.setVisible(true); + dispose(); + } + }); + backButton.setActionCommand("CANCEL"); + buttonPane.add(backButton); + getRootPane().setDefaultButton(backButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + if (rdbtnSearchByImage.isSelected() == true) { + SearchImage_GUI si = new SearchImage_GUI(); + si.setVisible(true); + dispose(); + } + } + + }); + continueButton.setActionCommand("OK"); + buttonPane.add(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/intro/About_GUI.java b/Dozentenmodul/src/main/java/gui/intro/About_GUI.java new file mode 100644 index 00000000..447f18ee --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/intro/About_GUI.java @@ -0,0 +1,95 @@ +package gui.intro; + +import java.awt.Image; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; + +import util.GuiOrganizer; + +@SuppressWarnings("serial") +public class About_GUI extends JFrame { + + private JPanel contentPane; + private JTextPane txtpnVersionVBuilddate; + + /** + * Create the frame. + */ + public About_GUI() { + // Fenster darf nicht vergroessert werden + setResizable(false); + + try { + // Setzt das Look and Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause() + "\n" + e.getMessage(), "Debug-Message", + JOptionPane.ERROR_MESSAGE); + } + // Titel des Fensters setzen + setTitle("Dozentenmodul *Prototyp* - About"); + // Aktion die beim Schliessen durchgefuehrt werden soll + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + // Groesse des Fensters definieren + setBounds(0, 0, 355, 309); + GuiOrganizer.centerGUI(this); + // Erzeugen eines Panels + contentPane = new JPanel(); + // Hintergrund Farbe des Panels setzen + contentPane.setBackground(SystemColor.menu); + // Rahmen des Fensters setzen + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + // Layout setzen + contentPane.setLayout(null); + // Label fuer das Logo erzeugen + JLabel imgLabel = new JLabel(); + // Groesse und Position des Logos festelegen + imgLabel.setBounds(30, 18, 294, 80); + // Pfadangabe des Logos + + ImageIcon icon = new ImageIcon(getClass().getResource( + "/Logo_bwLehrpool.png"), "Logo"); + // Skalierung des Logos + Image scaled = icon.getImage().getScaledInstance(270, 64, 0); + imgLabel.setIcon(new ImageIcon(scaled)); + // Hinzufuegen des Logos in das Fenster + contentPane.add(imgLabel); + + // Erzeugen, Hinzufuegen und definierung der Aktion des Buttons + JButton BtnClose = new JButton("Close"); + BtnClose.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + dispose(); + + }// end actionPerformed + }); + + BtnClose.setBounds(62, 226, 237, 23); + contentPane.add(BtnClose); + + txtpnVersionVBuilddate = new JTextPane(); + txtpnVersionVBuilddate + .setText("Version: v0.1\r\nBuild-Date: 03.06.2014\r\n\r\nContact: michael.wilson@hs-offenburg.de\r\nWebsite: http://bwlehrpool.hs-offenburg.de/"); + txtpnVersionVBuilddate.setEditable(false); + txtpnVersionVBuilddate.setBackground(SystemColor.menu); + txtpnVersionVBuilddate.setBounds(62, 95, 224, 90); + contentPane.add(txtpnVersionVBuilddate); + }// end LoginGUI() +}// end class diff --git a/Dozentenmodul/src/main/java/gui/intro/BillOfRights_GUI.java b/Dozentenmodul/src/main/java/gui/intro/BillOfRights_GUI.java new file mode 100644 index 00000000..21d15d40 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/intro/BillOfRights_GUI.java @@ -0,0 +1,241 @@ +package gui.intro; + + +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import models.Links; + +import org.ini4j.InvalidFileFormatException; +import org.ini4j.Wini; + +import util.GuiOrganizer; +import util.OpenLinks; + + + +@SuppressWarnings("serial") +public class BillOfRights_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JButton fwdButton; + JCheckBox chckbxAkzeptieren; + + /** + * Create the dialog. + */ + public BillOfRights_GUI() { + setResizable(false); + + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + //Beendet das Programm beim Klick auf das X + System.exit(0); + } + }); + try { + //Setzt das Look & Feel auf das System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp*"); + + //Zentiert das Fenster in der Bildschirmmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 567, 60); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Hinweis"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("Bitte lesen und best\u00E4tigen Sie folgende rechtliche Hinweise"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 22); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 95, 567, 485); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JTextArea txtrLoremIpsumDolor = new JTextArea(); + txtrLoremIpsumDolor.setWrapStyleWord(true); + txtrLoremIpsumDolor.setLineWrap(true); + txtrLoremIpsumDolor.setEditable(false); + JScrollPane scr=new JScrollPane(txtrLoremIpsumDolor); + scr.setBounds(0, 0, 567, 477); + txtrLoremIpsumDolor.setBounds(0, 0, 567, 477); + txtrLoremIpsumDolor.setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \r\n\r\nUt wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. \r\n\r\nNam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis. \r\n\r\nAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat. \r\n\r\nConsetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus. \r\n\r\nLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \r\n\r\nDuis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \r\n\r\nUt wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. \r\n\r\nNam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo"); + + contentPanel.add(scr); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 630, 587, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + fwdButton = new JButton("Weiter"); + fwdButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + Wini ini=new Wini(new File("C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + ini.put("main", "BillOfRights",true); + ini.store(); + } catch (InvalidFileFormatException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + VmWareLink_GUI ac=new VmWareLink_GUI(); + ac.setVisible(true); + dispose(); + } + }); + fwdButton.setEnabled(false); + + buttonPane.add(fwdButton); + } + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 617, 587, 2); + getContentPane().add(separator); + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 82, 587, 2); + getContentPane().add(separator); + } + + chckbxAkzeptieren = new JCheckBox("Ja, ich akzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen."); + chckbxAkzeptieren.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + //Beim Akzeptieren der Bestaetigung wird der Weiter-Button verfuegbar gemacht + if(chckbxAkzeptieren.isSelected()==true) + { + + fwdButton.setEnabled(true); + + } + else + { + + } + } + }); + chckbxAkzeptieren.setBackground(SystemColor.menu); + chckbxAkzeptieren.setBounds(10, 587, 567, 23); + getContentPane().add(chckbxAkzeptieren); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + mnNewMenu_1.setHorizontalAlignment(SwingConstants.CENTER); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/intro/Login_GUI.java b/Dozentenmodul/src/main/java/gui/intro/Login_GUI.java new file mode 100644 index 00000000..06a87307 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/intro/Login_GUI.java @@ -0,0 +1,336 @@ +package gui.intro; + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Image; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.IOException; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; + +import models.SessionData; +import models.person; + +import org.apache.thrift.TException; +import org.ini4j.Wini; + +import thrift.ImageServer.Client; +import thrift.MasterThriftConnection; +import thrift.ThriftConnection; +import thrift.UserInfo; +import util.GuiOrganizer; +import config.config_file; + +@SuppressWarnings("serial") +public class Login_GUI extends JFrame { + + private JPanel contentPane; + private JTextField lblusername; + private JPasswordField lblpass; + JLabel lblConnectionInfo = new JLabel(""); + boolean isClientReturnedCorrectly = false; + boolean login; + String masterServerIP = MasterThriftConnection.MASTERSERVERIP; + MasterThriftConnection thrift; + Client client; + String token; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + // Pruefe und Erzeuge gegebenfalls Config + config_file cf = new config_file(); + boolean conf = cf.createConfig(); + if (conf == true) { + // Aufruf und Anzeige des Login Fensters + Login_GUI frame = new Login_GUI(); + frame.setVisible(true); + } else { + JOptionPane.showMessageDialog(null, + "Fehler beim erzeugen der Konfigurationsfile", + "Message", JOptionPane.ERROR_MESSAGE); + } + + } catch (Exception e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, e.getStackTrace(), + "Message", JOptionPane.ERROR_MESSAGE); + } + } + }); + } + + /** + * Create the frame. + */ + public Login_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + + // Fenster darf nicht vergroessert werden + setResizable(false); + + try { + // Setzt das Look and Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause() + "\n" + e.getMessage(), "Debug-Message", + JOptionPane.ERROR_MESSAGE); + } + // Titel des Fensters setzen + setTitle("Dozentenmodul *Prototyp*"); + // Aktion die beim Schliessen durchgefuehrt werden soll + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + //Größe setzen und mittig ausrichten + setBounds(0, 0, 603, 400); + GuiOrganizer.centerGUI(this); + + // Erzeugen eines Panels + contentPane = new JPanel(); + // Hintergrund Farbe des Panels setzen + contentPane.setBackground(SystemColor.menu); + // Rahmen des Fensters setzen + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + // Layout setzen + contentPane.setLayout(null); + // Label fuer das Logo erzeugen + JLabel imgLabel = new JLabel(); + // Groesse und Position des Logos festelegen + imgLabel.setBounds(150, 11, 350, 142); + // Pfadangabe des Logos + + ImageIcon icon = new ImageIcon(getClass().getResource( + "/Logo_bwLehrpool.png"), "Logo"); + // Skalierung des Logos + Image scaled = icon.getImage().getScaledInstance(270, 64, 0); + imgLabel.setIcon(new ImageIcon(scaled)); + // Hinzufuegen des Logos in das Fenster + contentPane.add(imgLabel); + + // Erzeugen und Hinzufuegen des Labels + JLabel LabelUser = new JLabel("bwIDM-Benutzername:"); + LabelUser.setBounds(111, 164, 134, 20); + contentPane.add(LabelUser); + + // Erzeugen und Hinzufuegen des Textfeldes + lblusername = new JTextField(); + lblusername + .setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein."); + lblusername.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + performLogin(); + } + }); + lblusername.setBounds(292, 164, 237, 20); + contentPane.add(lblusername); + lblusername.setColumns(10); + + // Erzeugen und Hinzufuegen des Labels + JLabel LabelPass = new JLabel("bwIDM-Passwort:"); + LabelPass.setBounds(111, 195, 134, 20); + contentPane.add(LabelPass); + + // Erzeugen, Hinzufuegen und definierung der Aktion des Buttons + JButton BtnLogin = new JButton("Login"); + BtnLogin.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + performLogin(); + }// end actionPerformed + }); + + BtnLogin.setBounds(292, 244, 237, 23); + contentPane.add(BtnLogin); + + // Erzeugen und Hinzufuegen des Passwortfeldes + lblpass = new JPasswordField(); + lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein."); + lblpass.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + performLogin(); + } + }); + lblpass.setBounds(292, 195, 237, 20); + contentPane.add(lblpass); + + lblConnectionInfo.setHorizontalAlignment(SwingConstants.LEFT); + lblConnectionInfo.setBounds(292, 290, 237, 20); + contentPane.add(lblConnectionInfo); + //GuiOrganizer.centerGUI(this); + }// end LoginGUI() + + // Versuche den Benutzer einzuloggen + public void performLogin() { + + login = false; + thrift = new MasterThriftConnection(); + client = thrift.getMasterThriftConnection(); + token = null; + thrift.SessionData result = null; + + try { + login = true; + String passText = new String(lblpass.getPassword()); + // check if client has received a connection with information or a + // null package + if (checkClientPackage() == true) { + // package has information + result = client.authenticate(lblusername.getText(), passText); + SessionData.session.setAuthToken(result.authToken); + SessionData.session.setSessionID(result.sessionId); + SessionData.session.setServerAdress(result.serverAddress); + + // set connection to bwLehrpoolSuiteServer + ThriftConnection bwthrift = new ThriftConnection(); + server.Server.Client bwClient = bwthrift.getThriftConnection(); + models.Client.clientcon.setClient(bwClient); + + System.out.println("Session-ID: " + result.sessionId + + "\nToken: " + result.authToken); + + if (login == true) { + //Daten speichern + if (SessionData.session.getAuthToken() == null) { + System.out.println("Token ist null"); + JOptionPane.showMessageDialog(null, + "Error: Token ist null", "Token defekt", + JOptionPane.ERROR_MESSAGE); + } + System.out.println("Hole jetzt Infos aus SessionData..."); + UserInfo user = client.getUserFromToken(SessionData.session + .getAuthToken()); + + String hochschule = user.eMail.substring(user.eMail + .indexOf("@") + 1); + + person.verantwortlicher.setUsername(lblusername.getText() + .substring(0, lblusername.getText().indexOf("@"))); + person.verantwortlicher.setName(user.lastName); + person.verantwortlicher.setVorname(user.firstName); + person.verantwortlicher.setEMail(user.eMail); + person.verantwortlicher.setHochschule(hochschule); + + try { + // Lege config File an und entscheide welches Fenster + // als naechstes geoeffnet wird + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + // Pruefe ob Bills Of Rights schon akzeptiert wurden, + // wenn + // nicht zeige diese an + if (ini.get("main", "BillOfRights", boolean.class) == false) { + // Erstellen einer Instanz der Aktionsauswahl + BillOfRights_GUI re = new BillOfRights_GUI(); + re.setVisible(true); + // Schliessen des Fensters nach erfolgreichen Login + setVisible(false); + } else { + // Pruefe ob die Links zu vmware angezeigt werden + // sollen + if (ini.get("main", "vmware", boolean.class) == false) { + VmWareLink_GUI vm = new VmWareLink_GUI(); + vm.setVisible(true); + setVisible(false); + } else { + + // oeffne das Hauptmenue + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + setVisible(false); + } + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, e.getCause() + "\n" + + e.getMessage(), "Debug-Message", + JOptionPane.ERROR_MESSAGE); + } + + } else { + JOptionPane.showMessageDialog(null, "Login denied!", + "Message", JOptionPane.INFORMATION_MESSAGE); + } + + } else { + // package from server is null + login = false; + lblConnectionInfo.setForeground(Color.red); + lblConnectionInfo + .setText("Fehler: Client nicht mit Server verbunden."); + + } + + } catch (thrift.AuthenticationException e) { + System.out + .println("Authentifizierung fehlgeschlagen: " + e.message); + JOptionPane + .showMessageDialog( + null, + "Benutzeranmeldung fehlgeschlagen: Bitte Benutzername und Passwort \u00fcberpr\u00fcfen.", + "Anmeldung fehlgeschlagen", + JOptionPane.ERROR_MESSAGE); + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause() + "\n" + e.getMessage(), "Message", + JOptionPane.ERROR_MESSAGE); + return; + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause() + "\n" + e.getMessage(), "Debug-Message", + JOptionPane.ERROR_MESSAGE); + return; + } + }// end performLogin + + public boolean checkClientPackage() { + // check if client is null or has been returned with information + if (client != null) { + // client contains information + isClientReturnedCorrectly = true; + System.out.println("Verbindungsinformationen erhalten"); + } else { + // client has returned with error + isClientReturnedCorrectly = false; + System.out + .println("Fehler: Keine korrekten Verbindungsdaten erhalten."); + } + + return isClientReturnedCorrectly; + }// end checkServerConnection() + +}// end class diff --git a/Dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java b/Dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java new file mode 100644 index 00000000..2954ca3b --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java @@ -0,0 +1,462 @@ +package gui.intro; + +import gui.image.CreateImageAllgemein_GUI; +import gui.image.DeleteImage_GUI; +import gui.image.SearchEditImage_GUI; +import gui.image.SearchImage_GUI; +import gui.lecture.CreateLectureAllgemein_GUI; +import gui.lecture.DeleteLecture_GUI; +import gui.lecture.EditLectureSearch_GUI; +import gui.lecture.SearchLecture_GUI; + +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.ScrollPane; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.SwingConstants; +import javax.swing.ToolTipManager; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Links; +import models.SessionData; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class MainMenue_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + String descNewImage, descEditImage, descDeleteImage, descSearchImage, + descNewLecture, descEditLecture, descDeleteLecture, + descSearchLecture = ""; + JRadioButton rdbtnImageNew; + JRadioButton rdbtnImageEdit; + JRadioButton rdbtnImageSearchDownload; + JRadioButton rdbtnLectureNew; + JRadioButton rdbtnImageDelete; + JRadioButton rdbtnLectureEdit; + JRadioButton rdbtnLectureDelete; + JRadioButton rdbtnLectureSearch; + private final ButtonGroup buttonGroup = new ButtonGroup(); + private JMenuItem mntmAbout; + + + /** + * Create the dialog. + */ + public MainMenue_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Connected Server: "+SessionData.session.getServerAdress()); + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 567, 69); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Hauptmen\u00FC"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Bitte w\u00E4hlen Sie ihre gew\u00FCnschte Aktion."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 22); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 104, 567, 502); + contentPanel.setBackground(SystemColor.menu); + + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panelImage = new JPanel(); + panelImage.setBackground(SystemColor.menu); + panelImage.setBorder(new TitledBorder(null, "VL-Image", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelImage.setBounds(10, 146, 270, 170); + contentPanel.add(panelImage); + panelImage.setLayout(null); + + rdbtnImageNew = new JRadioButton("Neu"); + rdbtnImageNew + .setToolTipText("Hier k\u00F6nnen Sie eine standard Laborvorlage downloaden"); + rdbtnImageNew.setBounds(6, 22, 159, 23); + panelImage.add(rdbtnImageNew); + rdbtnImageNew.setSelected(true); + buttonGroup.add(rdbtnImageNew); + rdbtnImageNew.setBackground(SystemColor.menu); + + rdbtnImageEdit = new JRadioButton("Bearbeiten"); + rdbtnImageEdit + .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); + rdbtnImageEdit.setBounds(6, 48, 185, 23); + panelImage.add(rdbtnImageEdit); + buttonGroup.add(rdbtnImageEdit); + rdbtnImageEdit.setHorizontalAlignment(SwingConstants.LEFT); + rdbtnImageEdit.setBackground(SystemColor.menu); + + rdbtnImageDelete = new JRadioButton("L\u00F6schen"); + rdbtnImageDelete.setEnabled(true); + buttonGroup.add(rdbtnImageDelete); + rdbtnImageDelete + .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); + rdbtnImageDelete.setHorizontalAlignment(SwingConstants.LEFT); + rdbtnImageDelete.setBackground(SystemColor.menu); + rdbtnImageDelete.setBounds(6, 74, 185, 23); + panelImage.add(rdbtnImageDelete); + + rdbtnImageSearchDownload = new JRadioButton("Suche und Download"); + buttonGroup.add(rdbtnImageSearchDownload); + rdbtnImageSearchDownload + .setToolTipText("Hier k\u00F6nnen Sie ein bestehendes Labor zum ver\u00E4ndern downloaden"); + rdbtnImageSearchDownload.setHorizontalAlignment(SwingConstants.LEFT); + rdbtnImageSearchDownload.setBackground(SystemColor.menu); + rdbtnImageSearchDownload.setBounds(6, 100, 185, 23); + panelImage.add(rdbtnImageSearchDownload); + + JPanel panelDesc = new JPanel(); + panelDesc.setLayout(null); + panelDesc.setBorder(new TitledBorder(UIManager + .getBorder("TitledBorder.border"), "Erkl\u00e4rung", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelDesc.setBackground(SystemColor.menu); + panelDesc.setBounds(290, 146, 270, 170); + contentPanel.add(panelDesc); + + ScrollPane scrollPaneDesc = new ScrollPane(); + scrollPaneDesc.setBounds(10, 15, 250, 145); + final JTextArea txtDesc = new JTextArea(); + txtDesc.setLineWrap(true); + txtDesc.setWrapStyleWord(true); + txtDesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtDesc.setBackground(SystemColor.menu); + scrollPaneDesc.add(txtDesc); + // Pro AUswahl + txtDesc.setText("Legen Sie ein neues Image an und laden Sie anschlie\u00dfend die passende .vmdk-Datei hoch. Ein Image (wenn auch von einem anderen Dozenten) ist die Voraussetzung f\u00fcr eine Veranstaltung."); + panelDesc.add(scrollPaneDesc); + + JPanel panelVeranstaltung = new JPanel(); + panelVeranstaltung.setLayout(null); + panelVeranstaltung.setBorder(new TitledBorder(UIManager + .getBorder("TitledBorder.border"), "Veranstaltung (VMChooser)", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelVeranstaltung.setBackground(SystemColor.menu); + panelVeranstaltung.setBounds(10, 327, 270, 170); + contentPanel.add(panelVeranstaltung); + + rdbtnLectureNew = new JRadioButton("Neu"); + buttonGroup.add(rdbtnLectureNew); + rdbtnLectureNew + .setToolTipText("Hier k\u00F6nnen Sie Ihre Labordaten eingeben"); + rdbtnLectureNew.setBounds(6, 24, 185, 23); + panelVeranstaltung.add(rdbtnLectureNew); + rdbtnLectureNew.setBackground(SystemColor.menu); + + rdbtnLectureEdit = new JRadioButton("Bearbeiten"); + rdbtnLectureEdit + .setToolTipText("Hier k\u00F6nnen Sie einen Link auf ein bestehendes Labor erzeugen"); + rdbtnLectureEdit.setBounds(6, 50, 230, 23); + panelVeranstaltung.add(rdbtnLectureEdit); + buttonGroup.add(rdbtnLectureEdit); + rdbtnLectureEdit.setBackground(SystemColor.menu); + + rdbtnLectureDelete = new JRadioButton("L\u00F6schen"); + rdbtnLectureDelete + .setToolTipText("Hier k\u00F6nnen Sie ein Labor l\u00F6schen"); + rdbtnLectureDelete.setBounds(6, 76, 175, 23); + panelVeranstaltung.add(rdbtnLectureDelete); + buttonGroup.add(rdbtnLectureDelete); + rdbtnLectureDelete.setBackground(SystemColor.menu); + + rdbtnLectureSearch = new JRadioButton("Suche"); + buttonGroup.add(rdbtnLectureSearch); + rdbtnLectureSearch + .setToolTipText("Hier k\u00F6nnen Sie ein Labor l\u00F6schen"); + rdbtnLectureSearch.setBackground(SystemColor.menu); + rdbtnLectureSearch.setBounds(6, 102, 175, 23); + panelVeranstaltung.add(rdbtnLectureSearch); + + JPanel panelNews = new JPanel(); + panelNews.setLayout(null); + panelNews.setBorder(new TitledBorder(UIManager + .getBorder("TitledBorder.border"), "News", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panelNews.setBackground(SystemColor.menu); + panelNews.setBounds(290, 327, 270, 170); + contentPanel.add(panelNews); + + ScrollPane scrollPaneNews = new ScrollPane(); + // scrollPaneDesc.setBounds(10, 15, 250, 145); + scrollPaneNews.setBounds(10, 15, 250, 145); + JTextArea txtNews = new JTextArea(); + txtNews.setFont(new Font("Tahoma", Font.PLAIN, 11)); + txtNews.setBackground(SystemColor.menu); + txtNews.setWrapStyleWord(true); + txtNews.setLineWrap(true); + txtNews.setText("Hier werden mal die Neuigkeiten stehen. Diese kommen direkt vom Satelliten, sind als HS-spezifisch :)"); + scrollPaneNews.add(txtNews); + panelNews.add(scrollPaneNews); + + /* + * Funktion Texte f\u00fcr das Klicken der RadioButtons + */ + rdbtnImageNew.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + descNewImage = "Legen Sie ein neues Image an und laden Sie anschlie\u00dfend die passende .vmdk-Datei hoch. Ein Image (wenn auch von einem anderen Dozenten) ist die Voraussetzung f\u00fcr eine Veranstaltung."; + txtDesc.setText(descNewImage); + } + }); + rdbtnImageEdit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descEditImage = "Bearbeiten Sie die hinterlegten Informationen zu einem Image oder laden Sie eine neue .vmdk-Datei hoch."; + txtDesc.setText(descEditImage); + } + }); + rdbtnImageDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descDeleteImage = "Suchen Sie alte und nicht mehr ben\u00f6tigte Images und l\u00f6schen Sie diese."; + txtDesc.setText(descDeleteImage); + } + }); + rdbtnImageSearchDownload.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descSearchImage = "Suchen Sie nach bestimmten Images oder verschaffen Sie sich einen \u00fcberblick \u00fcber alle verf\u00fcgbaren Images. Sie k\u00f6nnen gew\u00fcnschte Images umgehend herunterladen."; + txtDesc.setText(descSearchImage); + } + }); + rdbtnLectureNew.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descNewLecture = "Legen Sie eine neue Veranstaltung an und verkn\u00fcpfen Sie diese mit einem bereits vorhandenem Image. Ihre neue Veranstaltung kann auch auf dem Image eines anderen Dozenten beruhen."; + txtDesc.setText(descNewLecture); + } + }); + rdbtnLectureEdit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descEditLecture = "Bearbeiten Sie die hinterlegten Informationen zu einer Veranstaltung."; + txtDesc.setText(descEditLecture); + } + }); + rdbtnLectureDelete.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descDeleteLecture = "Suchen und l\u00f6schen Sie eine Veranstaltung. Das hiermit verbundene Image bleibt erhalten."; + txtDesc.setText(descDeleteLecture); + } + }); + rdbtnLectureSearch.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + descSearchLecture = "Suchen Sie nach bestimmten Veranstaltungen oder verschaffen Sie sich einen \u00fcberblick \u00fcber alle verf\u00fcgbaren Veranstaltungen. Eventuell gibt es bereits etwas passendes f\u00fcr Ihre Vorlesung."; + txtDesc.setText(descSearchLecture); + } + }); + /* + * Ende der Radiobuttons + */ + + JLabel lblGrafik = new JLabel(""); + // ToolTipp fuer Grafik + lblGrafik + .setToolTipText("" + + "Ein virtuelles Labor besteht immer aus den beiden Komponenten
" + + "Image und Veranstaltung. Ein Image ist dabei die Grundlage f\u00FCr
" + + "mehrere Veranstaltungen. Somit kann eine neue Veranstaltung
" + + "erstellt werden, ohne ein neues Image hochladen zu m\u00FCssen.


" + + "Image: Das Image enth\u00E4lt die ben\u00F6tigte Software, die im
" + + "virtuellen Labor ben\u00F6tigt wird. Es wird von genau einem Dozenten
" + + "angelegt und besitzt einen allgemeinen Namen, z.B. \"Programmieren\".
" + + "Bei einem Image handelt es sich um eine Datei vom Typ VMDK.


" + + "Veranstaltung: Es k\u00F6nnen nun, basierend auf einem Image,
" + + " beliebig viele Veranstaltungen von unterschiedlichen Dozenten erstellt
" + + "werden. Diese k\u00F6nnten z.B. konkret \"Web-Entwicklung\" oder \"K\u00FCnstliche
" + + "Intelligenz\" lauten und referenzieren dabei auf das allgemeine Image
" + + "\"Programmieren\"."); + lblGrafik.setIcon(new ImageIcon(MainMenue_GUI.class + .getResource("/Image_zu_Veranstaltung_HDD.png"))); + // ToolTipp lange anzeigen - 60sec + ToolTipManager.sharedInstance().setDismissDelay(60000); + ToolTipManager.sharedInstance().registerComponent(lblGrafik); + lblGrafik.setBounds(82, 3, 391, 110); + contentPanel.add(lblGrafik); + + JTextPane txtpnUmDetaillierteInformationen = new JTextPane(); + txtpnUmDetaillierteInformationen + .setText("Um detaillierte Informationen zu erhalten, fahren Sie bitte mit der Maus \u00FCber die Grafik."); + txtpnUmDetaillierteInformationen.setEditable(false); + txtpnUmDetaillierteInformationen.setBackground(SystemColor.menu); + txtpnUmDetaillierteInformationen.setBounds(10, 113, 509, 22); + contentPanel.add(txtpnUmDetaillierteInformationen); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 630, 587, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton continueButton = new JButton("Weiter"); + + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // Images + if (rdbtnImageNew.isSelected() == true) { + CreateImageAllgemein_GUI sr = new CreateImageAllgemein_GUI(); + sr.setVisible(true); + dispose(); + } else if (rdbtnImageEdit.isSelected() == true) { + SearchEditImage_GUI si = new SearchEditImage_GUI(); + si.setVisible(true); + dispose(); + } else if (rdbtnImageDelete.isSelected() == true) { + DeleteImage_GUI di = new DeleteImage_GUI(); + di.setVisible(true); + dispose(); + } else if (rdbtnImageSearchDownload.isSelected() == true) { + // SearchMethodLecture_GUI sm = new + // SearchMethodLecture_GUI(); + SearchImage_GUI si = new SearchImage_GUI(); + si.setVisible(true); + dispose(); + // Lectures + } else if (rdbtnLectureNew.isSelected() == true) { + CreateLectureAllgemein_GUI av = new CreateLectureAllgemein_GUI(); + av.setVisible(true); + dispose(); + } else if (rdbtnLectureEdit.isSelected() == true) { + EditLectureSearch_GUI el = new EditLectureSearch_GUI(); + el.setVisible(true); + dispose(); + } else if (rdbtnLectureDelete.isSelected() == true) { + DeleteLecture_GUI dl = new DeleteLecture_GUI(); + dl.setVisible(true); + dispose(); + } else if (rdbtnLectureSearch.isSelected() == true) { + SearchLecture_GUI sl = new SearchLecture_GUI(); + sl.setVisible(true); + dispose(); + } + } + }); + continueButton.setActionCommand("OK"); + buttonPane.add(continueButton); + getRootPane().setDefaultButton(continueButton); + } + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 617, 587, 2); + getContentPane().add(separator); + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 91, 587, 2); + getContentPane().add(separator); + } + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + }// end main +}// end class diff --git a/Dozentenmodul/src/main/java/gui/intro/VmWareLink_GUI.java b/Dozentenmodul/src/main/java/gui/intro/VmWareLink_GUI.java new file mode 100644 index 00000000..87c6b2a2 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/intro/VmWareLink_GUI.java @@ -0,0 +1,292 @@ +package gui.intro; + + +import java.awt.Desktop; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import models.Links; + +import org.ini4j.InvalidFileFormatException; +import org.ini4j.Wini; + +import util.GuiOrganizer; +import util.OpenLinks; + + +@SuppressWarnings("serial") +public class VmWareLink_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JCheckBox chckbxNewCheckBox; + private JButton btnWindows; + + + /** + * Create the dialog. + */ + public VmWareLink_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("Dozentenmodul *Prototyp*"); + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBounds(0, 0, 577, 80); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Hinweis VMWare Player"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 42); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 104, 567, 502); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JTextPane txtpnUmIhreVmdk = new JTextPane(); + txtpnUmIhreVmdk.setBackground(SystemColor.menu); + txtpnUmIhreVmdk.setEditable(false); + txtpnUmIhreVmdk.setText("F\u00FCr die Arbeit mit der bwLehrpool Suite wird zwingend ein VMWare Player ben\u00F6tigt. Diesen k\u00F6nnen Sie sich unter folgendem Link kostenfrei downloaden."); + txtpnUmIhreVmdk.setBounds(10, 16, 499, 66); + contentPanel.add(txtpnUmIhreVmdk); + + JLabel lblNewLabel_1 = new JLabel("Windows: "); + lblNewLabel_1.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent arg0) { + URI url; + try { + url = new URI("https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"); + Desktop.getDesktop().browse(url); + } catch (URISyntaxException | IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + + } + }); + + lblNewLabel_1.setBounds(10, 93, 499, 14); + contentPanel.add(lblNewLabel_1); + + chckbxNewCheckBox = new JCheckBox("Diese Benachrichtigung nicht mehr anzeigen."); + chckbxNewCheckBox.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if(chckbxNewCheckBox.isSelected()==true) + { + try { + Wini ini=new Wini(new File("C:\\Users\\"+System.getProperty("user.name")+"\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + ini.put("main", "vmware",true); + ini.store(); + } catch (InvalidFileFormatException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + } + } + }); + chckbxNewCheckBox.setBounds(6, 472, 555, 23); + contentPanel.add(chckbxNewCheckBox); + + JLabel lbllinuxvmwarePlayer = new JLabel("Linux: "); + lbllinuxvmwarePlayer.setBounds(10, 178, 499, 14); + contentPanel.add(lbllinuxvmwarePlayer); + + btnWindows = new JButton("VMware Player herunterladen"); + btnWindows.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + try { + + OpenLinks open = new OpenLinks(); + + URI windows= new URI(Links.getUriWindows()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + btnWindows.setBounds(10, 119, 186, 23); + contentPanel.add(btnWindows); + + JButton btnLinux = new JButton("VMware Player herunterladen"); + btnLinux.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + OpenLinks open = new OpenLinks(); + + URI linux= new URI(Links.getUriLinux()); + + open.openWebpage(linux); + + } catch (URISyntaxException f) { + // TODO Auto-generated catch block + f.printStackTrace(); + } + } + }); + btnLinux.setBounds(10, 203, 186, 23); + contentPanel.add(btnLinux); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 630, 587, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + MainMenue_GUI ea=new MainMenue_GUI(); + ea.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 617, 587, 2); + getContentPane().add(separator); + } + { + JSeparator separator = new JSeparator(); + separator.setBounds(0, 91, 587, 2); + getContentPane().add(separator); + } + { + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + { + JMenu mnHilfe = new JMenu("Hilfe"); + menuBar.add(mnHilfe); + { + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + + mnHilfe.add(mntmFaq); + } + { + JMenuItem mntmOTRS = new JMenuItem("OTRS"); + mntmOTRS.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + + mnHilfe.add(mntmOTRS); + } + } + } + + + + }//end constructor + + + +}// end class diff --git a/Dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java new file mode 100644 index 00000000..44e8bd50 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/CreateLectureAllgemein_GUI.java @@ -0,0 +1,545 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.ScrollPane; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Calendar; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Lecture; +import models.Links; +import models.person; +import util.GuiOrganizer; +import util.OpenLinks; + +import com.toedter.calendar.JDateChooser; + +@SuppressWarnings("serial") +public class CreateLectureAllgemein_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private JTextField Vorname; + private JTextField Nachname; + private JTextField Hochschule; + private JTextField EMail; + private JTextField txtFldVeranstaltungsname; + JTextArea description; + JRadioButton radioButtonyes; + JRadioButton radioButtonno; + JDateChooser dateChooserend; + JDateChooser dateChooserstart; + Date startDate = new Date(); + Date endDate; + int maxLifeTime = 180; // Anzahl Tage, die eine Veranstaltung in der Zukunft + // aktiv sein darf + boolean isDateOrderCorrect, isDateMaxLifeTimeCorrect, + isAllInformationReady = false; + + + /** + * Create the dialog. + */ + public CreateLectureAllgemein_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + + @Override + public void windowOpened(WindowEvent arg0) { + txtFldVeranstaltungsname.requestFocusInWindow(); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung erzeugen"); + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 21); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 331, 557, 162); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel label = new JLabel("Vorname: *"); + label.setBackground(SystemColor.menu); + label.setBounds(10, 33, 125, 20); + panel_1.add(label); + + Vorname = new JTextField(); + Vorname.setEditable(false); + Vorname.setEnabled(false); + Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setBackground(Color.WHITE); + Vorname.setColumns(10); + Vorname.setBounds(145, 33, 350, 20); + panel_1.add(Vorname); + + JLabel label_7 = new JLabel("Nachname: *"); + label_7.setBackground(SystemColor.menu); + label_7.setBounds(10, 64, 125, 20); + panel_1.add(label_7); + + Nachname = new JTextField(); + Nachname.setEnabled(false); + Nachname.setEditable(false); + Nachname.setText(person.verantwortlicher.getName()); + Nachname.setBackground(Color.WHITE); + Nachname.setColumns(10); + Nachname.setBounds(145, 64, 350, 20); + panel_1.add(Nachname); + + JLabel label_8 = new JLabel("Hochschule: *"); + label_8.setBackground(SystemColor.menu); + label_8.setBounds(10, 95, 125, 20); + panel_1.add(label_8); + + Hochschule = new JTextField(); + Hochschule.setEnabled(false); + Hochschule.setEditable(false); + Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setBackground(Color.WHITE); + Hochschule.setColumns(10); + Hochschule.setBounds(145, 95, 350, 20); + panel_1.add(Hochschule); + + JLabel label_9 = new JLabel("E-Mail: *"); + label_9.setBackground(SystemColor.menu); + label_9.setBounds(10, 126, 125, 20); + panel_1.add(label_9); + + EMail = new JTextField(); + EMail.setEnabled(false); + EMail.setEditable(false); + EMail.setText(person.verantwortlicher.getEMail()); + EMail.setBackground(Color.WHITE); + EMail.setColumns(10); + EMail.setBounds(145, 126, 350, 20); + panel_1.add(EMail); + + JPanel panel = new JPanel(); + panel.setBounds(10, 402, 577, 33); + contentPanel.add(panel); + panel.setLayout(null); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); + panel.setBackground(SystemColor.menu); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + CreateLectureAllgemein_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + + JPanel panel_2 = new JPanel(); + panel_2.setLayout(null); + panel_2.setBorder(new TitledBorder(null, "Veranstaltungsdaten", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(10, 36, 557, 284); + contentPanel.add(panel_2); + + JLabel label_3 = new JLabel("Laborname (Anzeigename): *"); + label_3.setBounds(10, 25, 180, 14); + panel_2.add(label_3); + + txtFldVeranstaltungsname = new JTextField(); + txtFldVeranstaltungsname.setColumns(10); + txtFldVeranstaltungsname.setBounds(200, 22, 347, 20); + txtFldVeranstaltungsname.setText(Lecture.lecture.getName()); + panel_2.add(txtFldVeranstaltungsname); + + JTextArea textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setWrapStyleWord(true); + textArea.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an. Dieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + textArea.setLineWrap(true); + textArea.setFont(new Font("Tahoma", Font.PLAIN, 12)); + textArea.setBackground(SystemColor.menu); + textArea.setBounds(10, 49, 537, 49); + panel_2.add(textArea); + + JLabel lblDesc = new JLabel("Beschreibung: *"); + lblDesc.setBounds(10, 111, 180, 14); + panel_2.add(lblDesc); + + ScrollPane scrollPane = new ScrollPane(); + scrollPane.setBounds(200, 104, 347, 78); + panel_2.add(scrollPane); + description = new JTextArea(); + description.setFont(new Font("Tahoma", Font.PLAIN, 11)); + description.setLineWrap(true); + description.setText(Lecture.lecture.getDesc()); + scrollPane.add(description); + description.setBounds(0, 0, 4, 22); + scrollPane.add(description); + + dateChooserend = new JDateChooser(); + endDate = addDays(new Date(), maxLifeTime); // Datum darf weiter als 6 + // Monate in der Zukunft + // liegen + dateChooserend.setDate(endDate); + if (Lecture.lecture.getEnddate() == null) { + // is not defined yet + dateChooserend.setDate(endDate); + } else { + // already defined from last visit on this page + dateChooserend.setDate(Lecture.lecture.getEnddate()); + } + dateChooserend.setDateFormatString("yyyy-MM-dd hh:mm:ss"); + dateChooserend.setBounds(404, 188, 143, 20); + panel_2.add(dateChooserend); + + JLabel lblBis = new JLabel("bis:"); + lblBis.setBounds(378, 188, 21, 20); + panel_2.add(lblBis); + + dateChooserstart = new JDateChooser(); + if (Lecture.lecture.getStartdate() == null) { + // is not defined yet + dateChooserstart.setDate(startDate); + } else { + // already defined from last visit on this page + dateChooserstart.setDate(Lecture.lecture.getStartdate()); + } + dateChooserstart.setDateFormatString("yyyy-MM-dd hh:mm:ss"); + dateChooserstart.setBounds(226, 188, 143, 20); + panel_2.add(dateChooserstart); + + JLabel label_6 = new JLabel("von:"); + label_6.setBounds(200, 188, 30, 20); + panel_2.add(label_6); + + JLabel label_10 = new JLabel("G\u00FCltigkeitsdatum: *"); + label_10.setBounds(10, 194, 127, 14); + panel_2.add(label_10); + + JLabel label_11 = new JLabel("Aktiv:"); + label_11.setBounds(10, 229, 127, 14); + panel_2.add(label_11); + + radioButtonyes = new JRadioButton("Ja"); + radioButtonyes.setSelected(true); + radioButtonyes.setBounds(200, 225, 73, 23); + panel_2.add(radioButtonyes); + + radioButtonno = new JRadioButton("Nein"); + radioButtonyes.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + radioButtonyes.setSelected(true); + radioButtonno.setSelected(false); + } + }); + radioButtonno.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + radioButtonno.setSelected(true); + radioButtonyes.setSelected(false); + } + }); + radioButtonno.setBounds(296, 225, 73, 23); + panel_2.add(radioButtonno); + + JLabel lblimVmchooserSichtbar = new JLabel("(im VMChooser sichtbar)"); + lblimVmchooserSichtbar.setBounds(10, 245, 127, 14); + panel_2.add(lblimVmchooserSichtbar); + + JLabel lblmaxMonate = new JLabel("(max. 6 Monate)"); + lblmaxMonate.setBounds(10, 208, 127, 14); + panel_2.add(lblmaxMonate); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton backButton = new JButton("Zur\u00FCck"); + backButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (radioButtonyes.isSelected() == true) { + Lecture.lecture.setActive(true); + } else { + Lecture.lecture.setActive(false); + } + + Lecture.lecture.setName(txtFldVeranstaltungsname + .getText()); + Lecture.lecture.setDesc(description.getText()); + Lecture.lecture.setEnddate(dateChooserend.getDate()); + Lecture.lecture.setStartdate(dateChooserstart.getDate()); + Image.image.setImagename(txtFldVeranstaltungsname + .getText()); + + MainMenue_GUI sr = new MainMenue_GUI(); + sr.setVisible(true); + dispose(); + } + }); + backButton.setActionCommand("Cancel"); + buttonPane.add(backButton); + getRootPane().setDefaultButton(backButton); + } + { + JButton continueButton = new JButton("Weiter"); + continueButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // liegt das End-Datum vor dem Start-Datum? + if (dateChooserend.getDate().before( + dateChooserstart.getDate())) { + // datum ist falsch rum + isDateOrderCorrect = false; + JOptionPane + .showMessageDialog( + null, + "Das End-Datum liegt vor dem Start-Datum. Bitte \u00e4ndern.", + "Datum fehlerhaft", + JOptionPane.INFORMATION_MESSAGE); + } else { + // bereit + isDateOrderCorrect = true; + } + // liegt das eingegebene Datum nach dem erlaubten + // End-Datum? + if (dateChooserend.getDate().after(endDate)) { + // Datum zu weit weg + isDateMaxLifeTimeCorrect = false; + JOptionPane.showMessageDialog(null, + "Das End-Datum liegt zu weit in der Zukunft. Erlaubt ist maximal:\n" + + endDate, "Datum fehlerhaft", + JOptionPane.INFORMATION_MESSAGE); + dateChooserend.setDate(endDate); //setze Datum auf maximum + } else { + // bereit + isDateMaxLifeTimeCorrect = true; + } + // Pruefen ob alles eingegeben wurde + if (txtFldVeranstaltungsname.getText().isEmpty() == true + || description.getText().isEmpty() == true) { + // mind 1 Textfeld ist leer + isAllInformationReady = false; + JOptionPane + .showMessageDialog( + null, + "Bitte geben Sie einen Veranstaltungsnamen und eine Beschreibung ein.", + "Datum fehlerhaft", + JOptionPane.INFORMATION_MESSAGE); + } else { + // Textfelder bereit + isAllInformationReady = true; + } + + // welcher Radiobutton ist geklickt? + if (radioButtonyes.isSelected() == true) { + Lecture.lecture.setActive(true); + } else { + Lecture.lecture.setActive(false); + } + // Pruefe ob alle Eingaben korrekt sind, dann mache + // weiter + if (isAllInformationReady == true + && isDateMaxLifeTimeCorrect == true + && isDateOrderCorrect == true) { + // everything is ok, proceed + Lecture.lecture.setName(txtFldVeranstaltungsname + .getText()); + Lecture.lecture.setDesc(description.getText()); + Lecture.lecture.setEnddate(dateChooserend.getDate()); + Lecture.lecture.setStartdate(dateChooserstart + .getDate()); + Image.image.setImagename(txtFldVeranstaltungsname + .getText()); + + CreateLectureLink_GUI ev = new CreateLectureLink_GUI(); + ev.setVisible(true); + dispose(); + } + + } + }); + continueButton.setActionCommand("OK"); + buttonPane.add(continueButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); + lblPflichtfelder.setBounds(32, 602, 136, 14); + getContentPane().add(lblPflichtfelder); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mnmtAbout = new JMenuItem("About"); + mnmtAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mnmtAbout); + + } + + public Date addDays(Date date, int days) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.DATE, days); // minus number would decrement the days + return cal.getTime(); + } +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java new file mode 100644 index 00000000..0a00e781 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java @@ -0,0 +1,540 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.table.DefaultTableModel; + +import models.Lecture; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class CreateLectureLink_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox comboBox; + JTable tableAllImages = new JTable(); + JTable tablemyImages = new JTable(); + JTable tableCoopImages = new JTable(); + JTable tablePublicImages = new JTable(); + JTable tablePublicVorlagen = new JTable(); + private JTextField textFieldName; + String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", + "Verantwortlicher", "Letztes Update", "Schlagwort" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + + + /** + * Create the dialog. + */ + public CreateLectureLink_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + con.closeThriftConnection(); + System.exit(0); + } + + @Override + public void windowOpened(WindowEvent arg0) { + textFieldName.requestFocusInWindow(); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung erzeugen"); + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Image verlinken"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("W\u00E4hlen Sie bitte ein Image aus, auf dem Ihre Versanstaltung basiert."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String stext = textFieldName.getText(); + modelAll.setRowCount(0); + initTableModel(modelAll); + + if (stext != "") + for (int i = 0; i < modelAll.getRowCount(); i++) { + + if (modelAll.getValueAt(i, 0).toString() + .startsWith(stext)) { + + } else { + modelAll.removeRow(i); + } + } + + } + + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(431, 106, 89, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox(); + try { + List list = client.getAllOS(); + comboBox.addItem(""); + for (int i = 0; i < list.size(); i++) { + comboBox.addItem(list.get(i)); + } + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + modelAll.setRowCount(0); + initTableModel(modelAll); + String selItem = comboBox.getSelectedItem().toString(); + if (selItem != "") { + for (int i = 0; i < modelAll.getRowCount(); i++) { + + if (modelAll.getValueAt(i, 2).equals(selItem)) { + + } else { + modelAll.removeRow(i); + } + } + + } + } + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + CreateLectureLink_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("Veranstaltung"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 76, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(151, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); + lblNewLabel_1.setBounds(164, 11, 85, 14); + contentPanel.add(lblNewLabel_1); + + JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + + tablemyImages.setModel(model); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages = new JTable(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + initTableModel(modelAll); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton cancelButton = new JButton("Zur\u00FCck"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + CreateLectureAllgemein_GUI eVAG = new CreateLectureAllgemein_GUI(); + eVAG.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("CANCEL"); + buttonPane.add(cancelButton); + getRootPane().setDefaultButton(cancelButton); + } + { + JButton doLinkButton = new JButton( + "Veranstaltung erzeugen und abschlie\u00DFen"); + doLinkButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // check if a row is selected + if ((tableAllImages.getSelectedRow() != -1) + || (tablemyImages.getSelectedRow() != -1) + || (tableCoopImages.getSelectedRow() != -1) + || (tablePublicImages.getSelectedRow() != -1) + || (tablePublicVorlagen.getSelectedRow() != -1)) { + + // a row is selected, do operations + String imagename = tableAllImages.getValueAt( + tableAllImages.getSelectedRow(), 0) + .toString(); + try { + DateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + client.writeLecturedata( + Lecture.lecture.getName(), + Lecture.lecture.getShortDesc(), + Lecture.lecture.getDesc(), + formatter.format( + Lecture.lecture.getStartdate()) + .toString(), + formatter.format( + Lecture.lecture.getEnddate()) + .toString(), + Lecture.lecture.isActive(), + imagename, + person.verantwortlicher.getUsername(), + person.verantwortlicher.getVorname(), + person.verantwortlicher.getName(), + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getEMail(), + person.verantwortlicher.getTel(), + person.verantwortlicher.getFakultaet()); + JOptionPane + .showMessageDialog( + null, + "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", + "Veranstaltung angelegt", + JOptionPane.INFORMATION_MESSAGE); + // zurueck zum Menue + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + JOptionPane + .showMessageDialog( + null, + "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten.", + "Error", + JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, + e1.getCause()+"\n"+e1.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + } + + dispose(); + + } else { + // nothing selected + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein Image aus.", + "Image Auswahl", + JOptionPane.INFORMATION_MESSAGE); + } + + } + }); + doLinkButton.setActionCommand("OK"); + buttonPane.add(doLinkButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + public DefaultTableModel initTableModel(DefaultTableModel model) { + List images; + try { + images = client.getImageList(); + Iterator i = images.iterator(); + List ListObj = new ArrayList(); + int x = 0; + + while (i.hasNext()) { + + i.next(); + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), + images.get(x).getLectureName(), + images.get(x).getUserData(), + images.get(x).getUpdateTime() + }; + ListObj.add(obj); + model.addRow(ListObj.get(x)); + x++; + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java new file mode 100644 index 00000000..c638e440 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java @@ -0,0 +1,495 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class DeleteLecture_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JTable tableAllLectures; + JTable tablemyLectures; + JTable tableCoopImages; + JTable tablePublicVorlagen; + JTable tablePublicImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Veranstaltungsname", "Beschreibung", + "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", + "Verantwortlicher", "Image", "Schlagwort", "ID" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); + final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0); + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyLectures = new TableRowSorter( + modelMyLectures); + private JButton button; + + + /** + * Create the dialog. + */ + public DeleteLecture_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung l\u00F6schen"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel( + "Zu l\u00F6schende Veranstaltung w\u00E4hlen"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("W\u00E4hlen Sie bitte aus der unten stehenden Liste die zu l\u00F6schende Veranstaltung aus."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext != "") { + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche*Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(336, 106, 184, 14); + panel_1.add(lblErweiterteSuche); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Hauptmenue + + DeleteLecture_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("Veranstaltung"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 75, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(152, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); + lblNewLabel_1.setBounds(166, 11, 128, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if (tabbedPane.getSelectedIndex() == 0) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + username, 5)); + } else if (tabbedPane.getSelectedIndex() == 1) { + + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + initTableModel(modelMyLectures); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllLectures = new JTable(); + tableAllLectures.setModel(modelAll); + tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyLectures = new JTable(); + tablemyLectures.setModel(modelMyLectures); + + tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyLectures.setRowSorter(rowSorterMyLectures); + + scrollPaneMyImage.setViewportView(tablemyLectures); + tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, + null); + tableAllLectures.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllLectures); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + tableCoopImages = new JTable(); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Veranstaltungen", null, + scrollPaneCoopImages, null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + tablePublicImages = new JTable(); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + tablePublicVorlagen = new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + button = new JButton("L\u00F6schen"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + String lectureID=""; + int eingabe; + + //check if a row is selected + if (tablemyLectures.getSelectedRowCount() !=0){ + //a row is selected + //ask for confirmation + eingabe = JOptionPane.showConfirmDialog(null, + "Wollen Sie diese Daten l\u00f6schen?", "L\u00f6schen?", + JOptionPane.YES_NO_OPTION); + + if (eingabe == JOptionPane.YES_OPTION) { + //user has confirmed deletion, now get the ID of the selected lecture + lectureID = modelMyLectures.getValueAt(tablemyLectures.convertColumnIndexToModel(tablemyLectures.getSelectedRow()), 8).toString(); + System.out.println("L\u00f6sche Lecture "+lectureID); + try { + if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ + System.out.println("L\u00f6schen erfolgreich"); + //delete successful + + DeleteLecture_GUI dl = new DeleteLecture_GUI(); + dl.setVisible(true); + dispose(); + } else { + //delete not successful + JOptionPane + .showMessageDialog( + null, + "L\u00f6schen aus Datenbank fehlgeschlagen.", + "Fehler", + JOptionPane.INFORMATION_MESSAGE); + } + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + }//end delete + }//end ask for confirmation + + }//end check if a row is selected + + } + }); + button.setBounds(459, 508, 118, 23); + contentPanel.add(button); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton btnBack = new JButton("Zur\u00FCck"); + btnBack.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // oeffnet das Hauptmenue + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + btnBack.setActionCommand("OK"); + buttonPane.add(btnBack); + getRootPane().setDefaultButton(btnBack); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List lectures; + try { + // Hole eine Liste der Images + lectures = client.getLectureList(); + Iterator i = lectures.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { + lectures.get(x).lecturename, + lectures.get(x).desc, + lectures.get(x).starttime + " " + + lectures.get(x).endtime, + lectures.get(x).isActive, lectures.get(x).lastused, + lectures.get(x).username, " ", + lectures.get(x).imagename, lectures.get(x).id }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java new file mode 100644 index 00000000..b72efce9 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java @@ -0,0 +1,454 @@ +package gui.lecture; + + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.ScrollPane; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Image; +import models.Lecture; +import models.Links; +import models.person; +import util.GuiOrganizer; +import util.OpenLinks; + +import com.toedter.calendar.JDateChooser; + + +@SuppressWarnings("serial") +public class EditLectureAllgemein_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private JTextField Vorname; + private JTextField Nachname; + private JTextField Hochschule; + private JTextField EMail; + private JTextField textFieldLaborname; + JTextArea description; + JRadioButton radioButtonyes; + JDateChooser dateChooserend; + JDateChooser dateChooserstart; + JRadioButton radioButtonno; + private final ButtonGroup buttonGroup = new ButtonGroup(); + + + /** + * Create the dialog. + */ + public EditLectureAllgemein_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten");; + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe Ihrer Daten"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 21); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Informationen zum Besitzer", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 331, 557, 162); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel label = new JLabel("Vorname: *"); + label.setBackground(SystemColor.menu); + label.setBounds(10, 33, 125, 20); + panel_1.add(label); + + Vorname = new JTextField(); + Vorname.setEditable(false); + Vorname.setEnabled(false); + Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setBackground(Color.WHITE); + Vorname.setColumns(10); + Vorname.setBounds(145, 33, 350, 20); + panel_1.add(Vorname); + + JLabel label_7 = new JLabel("Nachname: *"); + label_7.setBackground(SystemColor.menu); + label_7.setBounds(10, 64, 125, 20); + panel_1.add(label_7); + + Nachname = new JTextField(); + Nachname.setEnabled(false); + Nachname.setEditable(false); + Nachname.setText(person.verantwortlicher.getName()); + Nachname.setBackground(Color.WHITE); + Nachname.setColumns(10); + Nachname.setBounds(145, 64, 350, 20); + panel_1.add(Nachname); + + JLabel label_8 = new JLabel("Hochschule: *"); + label_8.setBackground(SystemColor.menu); + label_8.setBounds(10, 95, 125, 20); + panel_1.add(label_8); + + Hochschule = new JTextField(); + Hochschule.setEnabled(false); + Hochschule.setEditable(false); + Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setBackground(Color.WHITE); + Hochschule.setColumns(10); + Hochschule.setBounds(145, 95, 350, 20); + panel_1.add(Hochschule); + + JLabel label_9 = new JLabel("E-Mail: *"); + label_9.setBackground(SystemColor.menu); + label_9.setBounds(10, 126, 125, 20); + panel_1.add(label_9); + + EMail = new JTextField(); + EMail.setEnabled(false); + EMail.setEditable(false); + EMail.setText(person.verantwortlicher.getEMail()); + EMail.setBackground(Color.WHITE); + EMail.setColumns(10); + EMail.setBounds(145, 126, 350, 20); + panel_1.add(EMail); + + JPanel panel = new JPanel(); + panel.setBounds(10, 402, 577, 33); + contentPanel.add(panel); + panel.setLayout(null); + panel.setBorder(new EmptyBorder(5, 5, 5, 5)); + panel.setBackground(SystemColor.menu); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + EditLectureAllgemein_GUI.this.setVisible(false); + MainMenue_GUI main=new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 45, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(133, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Neu"); + lblNewLabel_1.setBounds(146, 11, 46, 14); + contentPanel.add(lblNewLabel_1); + + JPanel panel_2 = new JPanel(); + panel_2.setLayout(null); + panel_2.setBorder(new TitledBorder(null, "Veranstaltungsdaten", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(10, 36, 557, 284); + contentPanel.add(panel_2); + + JLabel label_3 = new JLabel("Laborname (Anzeigename): *"); + label_3.setBounds(10, 25, 180, 14); + panel_2.add(label_3); + + textFieldLaborname = new JTextField(); + textFieldLaborname.setText(Lecture.lecture.getName()); + textFieldLaborname.setColumns(10); + textFieldLaborname.setBounds(200, 22, 347, 20); + panel_2.add(textFieldLaborname); + + JTextArea textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setWrapStyleWord(true); + textArea.setText("Geben Sie bitte einen sprechenden Namen f\u00FCr das Image an. Dieser soll jedoch recht allgemein gehalten werden.\r\nBeispiel: \"Programmieren\", nicht \"Programmieren 1\""); + textArea.setLineWrap(true); + textArea.setFont(new Font("Tahoma", Font.PLAIN, 12)); + textArea.setBackground(SystemColor.menu); + textArea.setBounds(10, 49, 537, 49); + panel_2.add(textArea); + + JLabel label_4 = new JLabel("Beschreibung: *"); + label_4.setBounds(10, 111, 180, 14); + panel_2.add(label_4); + + ScrollPane scrollPane = new ScrollPane(); + scrollPane.setBounds(200, 104, 347, 78); + panel_2.add(scrollPane); + description = new JTextArea(); + description.setFont(new Font("Tahoma", Font.PLAIN, 11)); + description.setText(Lecture.lecture.getDesc()); + description.setLineWrap(true); + scrollPane.add(description); + description.setBounds(0, 0, 4, 22); + scrollPane.add(description); + + dateChooserend = new JDateChooser(); + dateChooserend.setDateFormatString("dd-MM-yyyy hh:mm:ss"); + dateChooserend.setDate(Lecture.lecture.getEnddate()); + dateChooserend.setBounds(385, 188, 100, 20); + panel_2.add(dateChooserend); + + JLabel label_5 = new JLabel("bis"); + label_5.setBounds(351, 188, 24, 20); + panel_2.add(label_5); + + dateChooserstart = new JDateChooser(); + dateChooserstart.setDateFormatString("yyyy-MM-dd hh:mm:ss"); + dateChooserstart.setDate(Lecture.lecture.getStartdate()); + dateChooserstart.setBounds(240, 188, 101, 20); + panel_2.add(dateChooserstart); + + JLabel label_6 = new JLabel("von:"); + label_6.setBounds(200, 188, 30, 20); + panel_2.add(label_6); + + JLabel label_10 = new JLabel("G\u00FCltigkeitsdatum: *"); + label_10.setBounds(10, 188, 250, 14); + panel_2.add(label_10); + + JLabel label_11 = new JLabel("Aktiv:"); + label_11.setBounds(10, 229, 250, 14); + panel_2.add(label_11); + + radioButtonyes = new JRadioButton("Ja"); + buttonGroup.add(radioButtonyes); + if(Lecture.lecture.isActive()==true) + { + radioButtonyes.setSelected(true); + }else + { + radioButtonno.setSelected(true); + } + + radioButtonyes.setBounds(240, 225, 109, 23); + panel_2.add(radioButtonyes); + + radioButtonno = new JRadioButton("Nein"); + buttonGroup.add(radioButtonno); + radioButtonno.setBounds(385, 225, 109, 23); + panel_2.add(radioButtonno); + + JLabel label_12 = new JLabel("(Im VMChooser sichtbar)"); + label_12.setBounds(10, 254, 250, 14); + panel_2.add(label_12); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(radioButtonyes.isSelected()==true) + { + Lecture.lecture.setActive(true); + } + else + { + Lecture.lecture.setActive(false); + } + + Lecture.lecture.setName(textFieldLaborname.getText()); + Lecture.lecture.setDesc(description.getText()); + Lecture.lecture.setEnddate(dateChooserend.getDate()); + Lecture.lecture.setStartdate(dateChooserstart.getDate()); + Image.image.setImagename(textFieldLaborname.getText()); + + MainMenue_GUI sr=new MainMenue_GUI(); + sr.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Weiter"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if(radioButtonyes.isSelected()==true) + { + Lecture.lecture.setActive(true); + } + else + { + Lecture.lecture.setActive(false); + } + + Lecture.lecture.setName(textFieldLaborname.getText()); + Lecture.lecture.setNewName(textFieldLaborname.getText()); + Lecture.lecture.setDesc(description.getText()); + Lecture.lecture.setEnddate(dateChooserend.getDate()); + Lecture.lecture.setStartdate(dateChooserstart.getDate()); + Image.image.setImagename(textFieldLaborname.getText()); + + + EditLectureLink_GUI ev=new EditLectureLink_GUI(); + ev.setVisible(true); + dispose(); + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JLabel lblPflichtfelder = new JLabel("* Pflichtfelder"); + lblPflichtfelder.setBounds(32, 602, 136, 14); + getContentPane().add(lblPflichtfelder); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java new file mode 100644 index 00000000..f7b38b06 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java @@ -0,0 +1,532 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.table.DefaultTableModel; + +import models.Lecture; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class EditLectureLink_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JComboBox comboBox; + JTable tableAllImages = new JTable(); + JTable tablemyImages = new JTable(); + JTable tableCoopImages = new JTable(); + JTable tablePublicImages = new JTable(); + JTable tablePublicVorlagen = new JTable(); + private JTextField textFieldName; + String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", + "Verantwortlicher", "Letztes Update", "Schlagwort", "ID", "Version" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + + /** + * Create the dialog. + */ + public EditLectureLink_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + con.closeThriftConnection(); + System.exit(0); + } + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); + + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Image verlinken"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("W\u00E4hlen Sie bitte ein Image aus, auf dem Ihre Versanstaltung basiert."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); + lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); + panel_1.add(lblInternetIstInnerhalb); + + textFieldName = new JTextField(); + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String stext = textFieldName.getText(); + modelAll.setRowCount(0); + initTableModel(modelAll); + + if (stext != "") + for (int i = 0; i < modelAll.getRowCount(); i++) { + + if (modelAll.getValueAt(i, 0).toString() + .startsWith(stext)) { + + } else { + modelAll.removeRow(i); + } + } + + } + + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche *Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // ExtendedSearchForImages_GUI es = new + // ExtendedSearchForImages_GUI(); + // es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(317, 106, 203, 14); + panel_1.add(lblErweiterteSuche); + + comboBox = new JComboBox(); + try { + List list = client.getAllOS(); + comboBox.addItem(""); + for (int i = 0; i < list.size(); i++) { + comboBox.addItem(list.get(i)); + } + } catch (TException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + comboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + modelAll.setRowCount(0); + initTableModel(modelAll); + String selItem = comboBox.getSelectedItem().toString(); + if (selItem != "") { + for (int i = 0; i < modelAll.getRowCount(); i++) { + + if (modelAll.getValueAt(i, 2).equals(selItem)) { + + } else { + modelAll.removeRow(i); + } + } + + } + } + }); + comboBox.setBounds(270, 58, 250, 20); + panel_1.add(comboBox); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + + EditLectureLink_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("Veranstaltung"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 76, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(151, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Veranstaltung verlinken"); + lblNewLabel_1.setBounds(164, 11, 113, 14); + contentPanel.add(lblNewLabel_1); + + JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); + + tabbedPane.setBounds(10, 197, 557, 300); + contentPanel.add(tabbedPane); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + + tablemyImages.setModel(model); + tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllImages.setModel(modelAll); + tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneAllImages.setViewportView(tableAllImages); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, + null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + + JButton btnLinkLschen = new JButton("Link l\u00F6schen"); + btnLinkLschen.setEnabled(false); + btnLinkLschen.setBounds(478, 508, 89, 23); + contentPanel.add(btnLinkLschen); + + initTableModel(modelAll); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); + el.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton( + "Veranstaltung \u00e4ndern und abschlie\u00DFen"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // check if a row is selected + if ((tableAllImages.getSelectedRow() != -1) + || (tablemyImages.getSelectedRow() != -1) + || (tableCoopImages.getSelectedRow() != -1) + || (tablePublicImages.getSelectedRow() != -1) + || (tablePublicVorlagen.getSelectedRow() != -1)) { + + // a row is selected, do operations + String imagename = tableAllImages.getValueAt( + tableAllImages.getSelectedRow(), 0) + .toString(); + + try { + + DateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + client.updateLecturedata( + Lecture.lecture.getName(), + Lecture.lecture.getNewName(), + Lecture.lecture.getShortDesc(), + Lecture.lecture.getDesc(), + formatter.format( + Lecture.lecture.getStartdate()) + .toString(), + formatter.format( + Lecture.lecture.getEnddate()) + .toString(), + Lecture.lecture.isActive(), + imagename, + person.verantwortlicher.getVorname(), + person.verantwortlicher.getName(), + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getEMail(), + person.verantwortlicher.getTel(), + person.verantwortlicher.getFakultaet(), + Lecture.lecture.getid()); + + JOptionPane + .showMessageDialog( + null, + "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmen\u00fc zur\u00fcck.", + "Veranstaltung angelegt", + JOptionPane.INFORMATION_MESSAGE); + + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + } else { + // nothing selected + JOptionPane.showMessageDialog(null, + "Bitte w\u00e4hlen Sie ein Image aus.", + "Image Auswahl", + JOptionPane.INFORMATION_MESSAGE); + + } + + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); + dispose(); + + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + public DefaultTableModel initTableModel(DefaultTableModel model) { + List images; + try { + images = client.getImageList(); + Iterator i = images.iterator(); + List ListObj = new ArrayList(); + int x = 0; + + while (i.hasNext()) { + + i.next(); + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), + images.get(x).getLectureName(), + images.get(x).getUserData(), + images.get(x).getUpdateTime(), "", images.get(x).id, + images.get(x).getVersion() }; + ListObj.add(obj); + model.addRow(ListObj.get(x)); + x++; + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java new file mode 100644 index 00000000..58329ae2 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java @@ -0,0 +1,563 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Lecture; +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class EditLectureSearch_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JTable tableAllLectures; + JTable tablemyLectures; + JTable tableCoopImages; + JTable tablePublicVorlagen; + JTable tablePublicImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Veranstaltungsname", "Beschreibung", + "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", + "Verantwortlicher", "Image", "Schlagwort", "ID" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyLectures = new TableRowSorter( + modelMyLectures); + + + /** + * Create the dialog. + */ + public EditLectureSearch_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung bearbeiten"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach Veranstaltung"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext != "") { + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche *Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(326, 106, 194, 14); + panel_1.add(lblErweiterteSuche); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Hauptmenue + + EditLectureSearch_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("Veranstaltung"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 75, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(152, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); + lblNewLabel_1.setBounds(166, 11, 128, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if (tabbedPane.getSelectedIndex() == 0) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + username, 5)); + } else if (tabbedPane.getSelectedIndex() == 1) { + + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 323); + contentPanel.add(tabbedPane); + initTableModel(modelMyLectures); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllLectures = new JTable(); + tableAllLectures.setModel(modelAll); + tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyLectures = new JTable(); + tablemyLectures.setModel(modelMyLectures); + + tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyLectures.setRowSorter(rowSorterMyLectures); + + scrollPaneMyImage.setViewportView(tablemyLectures); + tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, + null); + tableAllLectures.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllLectures); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + tableCoopImages = new JTable(); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Veranstaltungen", null, + scrollPaneCoopImages, null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + tablePublicImages = new JTable(); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + tablePublicVorlagen = new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton btnBack = new JButton("Zur\u00FCck"); + btnBack.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // oeffnet das Hauptmenue + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + btnBack.setActionCommand("OK"); + buttonPane.add(btnBack); + getRootPane().setDefaultButton(btnBack); + } + { + JButton btnContinue = new JButton("Weiter"); + btnContinue.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // check if a row is selected + if ((tableAllLectures.getSelectedRow() != -1) + || (tablemyLectures.getSelectedRow() != -1) + || (tableCoopImages.getSelectedRow() != -1) + || (tablePublicImages.getSelectedRow() != -1) + || (tablePublicVorlagen.getSelectedRow() != -1)) { + + // a row is selected, do operations + + if (tabbedPane.getSelectedIndex() == 0) { + + Lecture.lecture.setid(modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 8).toString()); + Lecture.lecture.setName(modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 0).toString()); + Lecture.lecture.setDesc(modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 1).toString()); + String date = modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 2).toString(); + + Lecture.lecture.setLinkedImagename(modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 6).toString()); + + int zweitesLeerzeichen = date.indexOf(" ", + date.indexOf(" ") + 1); + + String startdate = date.substring(0, + zweitesLeerzeichen); + String enddate = date + .substring(zweitesLeerzeichen); + DateFormat df = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + + try { + // Format has to be "yyyy-MM-dd hh:mm:ss" + Lecture.lecture.setEnddate(df + .parse(enddate)); + Lecture.lecture.setStartdate(df + .parse(startdate)); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if (modelMyLectures + .getValueAt( + tablemyLectures + .convertRowIndexToModel(tablemyLectures + .getSelectedRow()), + 3).toString().equals("1")) { + Lecture.lecture.setActive(true); + } else { + Lecture.lecture.setActive(false); + } + + + // EditImageAllgemein_GUI ea=new + // EditImageAllgemein_GUI(); + EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); + el.setVisible(true); + dispose(); + } else { + JOptionPane + .showMessageDialog( + null, + "Bitte w\u00f4hlen Sie ein eigenes Image aus", + "Message", + JOptionPane.INFORMATION_MESSAGE); + } + } else { + // nothing selected + JOptionPane.showMessageDialog(null, + "Bitte w\u00f4hlen Sie ein Image aus.", + "Image Auswahl", + JOptionPane.INFORMATION_MESSAGE); + }// end check if a row is selected + + } + }); + btnContinue.setActionCommand("Cancel"); + buttonPane.add(btnContinue); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List lectures; + try { + // Hole eine Liste der Images + lectures = client.getLectureList(); + Iterator i = lectures.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { + lectures.get(x).lecturename, + lectures.get(x).desc, + lectures.get(x).starttime + " " + + lectures.get(x).endtime, + lectures.get(x).isActive, lectures.get(x).lastused, + lectures.get(x).username, " ", + lectures.get(x).imagename, lectures.get(x).id }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/ExtendedSearchForImages_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/ExtendedSearchForImages_GUI.java new file mode 100644 index 00000000..579ea3bd --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/ExtendedSearchForImages_GUI.java @@ -0,0 +1,269 @@ +package gui.lecture; + + +import gui.image.CreateImageAllgemein_GUI; +import gui.image.FTPCreateUploader_GUI; +import gui.intro.About_GUI; + +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; + +import models.Links; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class ExtendedSearchForImages_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + private JTextField textField; + private JTextField textField_1; + + + /** + * Create the dialog. + */ + public ExtendedSearchForImages_GUI() { + + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("bwLehrpool Suite *Prototyp* - Erweiterte Suche"); + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Weitere Suchoptionen"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("beschreibung"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 493); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Image-Typ", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 11, 557, 95); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Image-Typ"); + lblNewLabel_2.setBounds(10, 39, 176, 20); + panel_1.add(lblNewLabel_2); + + JCheckBox chckbxBestehendesImage = new JCheckBox("Bestehendes Image"); + chckbxBestehendesImage.setSelected(true); + chckbxBestehendesImage.setBounds(192, 38, 138, 23); + panel_1.add(chckbxBestehendesImage); + + JCheckBox chckbxRohling = new JCheckBox("Rohling"); + chckbxRohling.setSelected(true); + chckbxRohling.setBounds(332, 38, 97, 23); + panel_1.add(chckbxRohling); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBorder(new TitledBorder(null, "Image-Inhalt", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 117, 557, 95); + contentPanel.add(panel); + + JLabel lblEnthalteneSoftware = new JLabel("Enthaltene Software"); + lblEnthalteneSoftware.setBounds(10, 39, 176, 20); + panel.add(lblEnthalteneSoftware); + + textField = new JTextField(); + textField.setBounds(196, 39, 351, 20); + panel.add(textField); + textField.setColumns(10); + + JLabel lblNewLabel_1 = new JLabel("Bitte mit ; getrennt angeben"); + lblNewLabel_1.setBounds(196, 70, 351, 14); + panel.add(lblNewLabel_1); + + JPanel panel_2 = new JPanel(); + panel_2.setLayout(null); + panel_2.setBorder(new TitledBorder(null, "Informationen zum Ersteller", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBackground(SystemColor.menu); + panel_2.setBounds(10, 223, 557, 123); + contentPanel.add(panel_2); + + JLabel lblNachnameDesErstellers = new JLabel("Nachname des Erstellers"); + lblNachnameDesErstellers.setBounds(10, 39, 176, 20); + panel_2.add(lblNachnameDesErstellers); + + textField_1 = new JTextField(); + textField_1.setColumns(10); + textField_1.setBounds(196, 39, 351, 20); + panel_2.add(textField_1); + + JLabel lblHochschuleuniversitt = new JLabel("Hochschule/Universit\u00E4t"); + lblHochschuleuniversitt.setBounds(10, 70, 176, 20); + panel_2.add(lblHochschuleuniversitt); + + JComboBox comboBox = new JComboBox(); + comboBox.setBounds(196, 70, 351, 20); + panel_2.add(comboBox); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton okButton = new JButton("Zur\u00FCck"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + + CreateImageAllgemein_GUI sr=new CreateImageAllgemein_GUI(); + sr.setVisible(true); + dispose(); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("\u00DCbernehmen"); + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + + FTPCreateUploader_GUI ea=new FTPCreateUploader_GUI(); + ea.setVisible(true); + dispose(); + + } + }); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("Suchen"); + menuBar.add(mnNewMenu); + + JMenuItem mntmVlSuche = new JMenuItem("VL Suche"); + mnNewMenu.add(mntmVlSuche); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } +} diff --git a/Dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java b/Dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java new file mode 100644 index 00000000..6035ebf5 --- /dev/null +++ b/Dozentenmodul/src/main/java/gui/lecture/SearchLecture_GUI.java @@ -0,0 +1,453 @@ +package gui.lecture; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.RowFilter; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Links; +import models.person; + +import org.apache.thrift.TException; + +import server.Server.Client; +import thrift.ThriftConnection; +import util.GuiOrganizer; +import util.OpenLinks; + +@SuppressWarnings("serial") +public class SearchLecture_GUI extends JFrame { + + private final JPanel contentPanel = new JPanel(); + String[] result; + JRadioButton rdbtnInternetJa; + JRadioButton rdbtnInternetNein; + JTable tableAllLectures; + JTable tablemyLectures; + JTable tableCoopImages; + JTable tablePublicVorlagen; + JTable tablePublicImages; + private JTextField textFieldName; + JTabbedPane tabbedPane; + String[] titles = { "Veranstaltungsname", "Beschreibung", + "G\u00fcltigkeitsdatum", "Aktiv", "Letzte Benutzung", + "Verantwortlicher", "Image", "Schlagwort", "ID" }; + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){ + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } + }; + final TableRowSorter rowSorterAll = new TableRowSorter( + modelAll); + final TableRowSorter rowSorterMyLectures = new TableRowSorter( + modelMyLectures); + + + /** + * Create the dialog. + */ + public SearchLecture_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + System.exit(0); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite *Prototyp* - Veranstaltung suchen"); + // Zentriert das Fenster in die Bildmitte 2; + setBounds(0, 0, 603, 722); + GuiOrganizer.centerGUI(this); + + final DefaultTableModel model = new DefaultTableModel(titles, 0); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Suche nach Veranstaltung"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie + .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 85, 577, 531); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(SystemColor.menu); + panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBounds(10, 49, 557, 131); + contentPanel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); + lblNewLabel_2.setBounds(10, 30, 250, 20); + panel_1.add(lblNewLabel_2); + + textFieldName = new JTextField(); + // Key Listener der Tastatureingabe registriert + textFieldName.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + // Textfield eingabe auslesen + String stext = textFieldName.getText(); + + // Wenn Textfield nicht leer + if (stext != "") { + // Filtere nach der Eingabe + rowSorterAll.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + textFieldName.getText(), 0)); + + } + } + }); + + textFieldName.setBounds(270, 30, 250, 20); + panel_1.add(textFieldName); + textFieldName.setColumns(10); + + JLabel lblErweiterteSuche = new JLabel( + "Erweiterte Suche *Folgt noch*"); + lblErweiterteSuche.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Fenster Extended GUI + + //ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); + //es.setVisible(true); + } + }); + lblErweiterteSuche.setForeground(Color.BLUE); + + lblErweiterteSuche.setBounds(315, 106, 205, 14); + panel_1.add(lblErweiterteSuche); + + JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); + lblHauptmen.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + // oeffnet das Hauptmenue + + SearchLecture_GUI.this.setVisible(false); + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + } + }); + lblHauptmen.setForeground(Color.BLUE); + lblHauptmen.setBounds(10, 11, 61, 14); + contentPanel.add(lblHauptmen); + + JLabel label_1 = new JLabel(">"); + label_1.setBounds(69, 11, 13, 14); + contentPanel.add(label_1); + + JLabel lblVlimage = new JLabel("Veranstaltung"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(81, 11, 75, 14); + contentPanel.add(lblVlimage); + + JLabel label_2 = new JLabel(">"); + label_2.setBounds(152, 11, 13, 14); + contentPanel.add(label_2); + + JLabel lblNewLabel_1 = new JLabel("Veranstaltungsauswahl"); + lblNewLabel_1.setBounds(166, 11, 128, 14); + contentPanel.add(lblNewLabel_1); + + tabbedPane = new JTabbedPane(JTabbedPane.TOP); + tabbedPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent arg0) { + if (tabbedPane.getSelectedIndex() == 0) { + + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( + username, 5)); + } else if (tabbedPane.getSelectedIndex() == 1) { + + } + + } + }); + + tabbedPane.setBounds(10, 197, 557, 323); + contentPanel.add(tabbedPane); + initTableModel(modelMyLectures); + + JScrollPane scrollPaneAllImages = new JScrollPane(); + tableAllLectures = new JTable(); + tableAllLectures.setModel(modelAll); + tableAllLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tableAllLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + initTableModel(modelAll); + + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyLectures = new JTable(); + tablemyLectures.setModel(modelMyLectures); + + tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyLectures.setRowSorter(rowSorterMyLectures); + + scrollPaneMyImage.setViewportView(tablemyLectures); + tabbedPane.addTab("Meine Veranstaltungen", null, scrollPaneMyImage, + null); + tableAllLectures.setRowSorter(rowSorterAll); + + scrollPaneAllImages.setViewportView(tableAllLectures); + tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); + + JScrollPane scrollPaneCoopImages = new JScrollPane(); + tableCoopImages = new JTable(); + tableCoopImages.setModel(model); + tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPaneCoopImages.setViewportView(tableCoopImages); + tabbedPane.addTab("Kooperative Veranstaltungen", null, + scrollPaneCoopImages, null); + tabbedPane.setEnabledAt(2, false); + + JScrollPane scrollPanePublicImages = new JScrollPane(); + tablePublicImages = new JTable(); + tablePublicImages.setModel(model); + tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicImages.setViewportView(tablePublicImages); + tabbedPane.addTab("\u00D6ffentliche Images", null, + scrollPanePublicImages, null); + tabbedPane.setEnabledAt(3, false); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + tablePublicVorlagen = new JTable(); + tablePublicVorlagen.setModel(model); + tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); + tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); + + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, + scrollPanePublicVorlagen, null); + tabbedPane.setEnabledAt(4, false); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 640, 597, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + { + JButton btnBack = new JButton("Zur\u00FCck"); + btnBack.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // oeffnet das Hauptmenue + + MainMenue_GUI main = new MainMenue_GUI(); + main.setVisible(true); + dispose(); + } + }); + btnBack.setActionCommand("OK"); + buttonPane.add(btnBack); + getRootPane().setDefaultButton(btnBack); + } + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 78, 597, 2); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + getContentPane().add(separator_1); + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnNewMenu_1 = new JMenu("Hilfe"); + menuBar.add(mnNewMenu_1); + + JMenuItem mntmFaq = new JMenuItem("FAQ"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getOTRS()); + + open.openWebpage(windows); + + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + } + + // Initiale Beffuelung eines Table models + public DefaultTableModel initTableModel(DefaultTableModel model) { + List lectures; + try { + // Hole eine Liste der Images + lectures = client.getLectureList(); + Iterator i = lectures.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { + lectures.get(x).lecturename, + lectures.get(x).desc, + lectures.get(x).starttime + " " + + lectures.get(x).endtime, + lectures.get(x).isActive, lectures.get(x).lastused, + lectures.get(x).username, " ", + lectures.get(x).imagename, lectures.get(x).id }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + return model; + } + +} diff --git a/Dozentenmodul/src/main/java/models/Client.java b/Dozentenmodul/src/main/java/models/Client.java new file mode 100644 index 00000000..42eccdec --- /dev/null +++ b/Dozentenmodul/src/main/java/models/Client.java @@ -0,0 +1,18 @@ +package models; + +public class Client { + + private server.Server.Client client; + public static Client clientcon=new Client(); + + public server.Server.Client getClient() { + return client; + } + + public void setClient(server.Server.Client client) { + this.client = client; + } + + + +} diff --git a/Dozentenmodul/src/main/java/models/Image.java b/Dozentenmodul/src/main/java/models/Image.java new file mode 100644 index 00000000..86bc1e48 --- /dev/null +++ b/Dozentenmodul/src/main/java/models/Image.java @@ -0,0 +1,172 @@ +package models; + +public class Image { + + + + private String ImageId; + + private String version; + + private String imagename; + + private String newName; + + private String imagepath; + + private int shareMode; + + private boolean licensed; + + private boolean internet; + + private int ram; + + private int cpu; + + private long filesize; + + public static Image image =new Image(); + + + + + + + + public int getShareMode() { + + return shareMode; + + } + + public void setShareMode(int shareMode) { + + this.shareMode = shareMode; + + } + + public String getImagepath() { + + return imagepath; + + } + + public void setImagepath(String imagepath) { + + this.imagepath = imagepath; + + } + + public String getImagename() { + + return imagename; + + } + + public void setImagename(String imagename) { + + this.imagename = imagename; + + } + + public boolean isLicensed() { + + return licensed; + + } + + public void setLicensed(boolean licensed) { + + this.licensed = licensed; + + } + + public boolean isInternet() { + + return internet; + + } + + public void setInternet(boolean internet) { + + this.internet = internet; + + } + + public int getRam() { + + return ram; + + } + + public void setRam(int ram) { + + this.ram = ram; + + } + + public int getCpu() { + + return cpu; + + } + + public void setCpu(int cpu) { + + this.cpu = cpu; + + } + + public String getNewName() { + + return newName; + + } + + public void setNewName(String newName) { + + this.newName = newName; + + } + + public String getImageId() { + + return ImageId; + + } + + public void setImageId(String imageId) { + + ImageId = imageId; + + } + + public String getVersion() { + + return version; + + } + + public void setVersion(String version) { + + this.version = version; + + } + + public long getFilesize() { + + return filesize; + + } + + public void setFilesize(long filesize) { + + this.filesize = filesize; + + } + + + +} + diff --git a/Dozentenmodul/src/main/java/models/Lecture.java b/Dozentenmodul/src/main/java/models/Lecture.java new file mode 100644 index 00000000..8f67baba --- /dev/null +++ b/Dozentenmodul/src/main/java/models/Lecture.java @@ -0,0 +1,141 @@ +package models; + +import java.util.Date; + +public class Lecture { + + private String name; + + private String newName; + + private String shortDesc; + + private String desc; + + private Date startdate; + + private Date enddate; + + private boolean active; + + private String id; + + private String linkedImagename; + + public static Lecture lecture =new Lecture(); + + + + public String getNewName() { + + return newName; + + } + + public void setNewName(String newName) { + + this.newName = newName; + + } + + public String getLinkedImagename() { + + return linkedImagename; + + } + + public void setLinkedImagename(String linkedImagename) { + + this.linkedImagename = linkedImagename; + + } + + public String getid() { + + return id; + + } + + public void setid(String id) { + + this.id = id; + + } + + public String getName() { + + return name; + + } + + public void setName(String name) { + + this.name = name; + + } + + public String getShortDesc() { + + return shortDesc; + + } + + public void setShortDesc(String shortDesc) { + + this.shortDesc = shortDesc; + + } + + public String getDesc() { + + return desc; + + } + + public void setDesc(String desc) { + + this.desc = desc; + + } + + public Date getStartdate() { + + return startdate; + + } + + public void setStartdate(Date startdate) { + + this.startdate = startdate; + + } + + public Date getEnddate() { + + return enddate; + + } + + public void setEnddate(Date enddate) { + + this.enddate = enddate; + + } + + public boolean isActive() { + + return active; + + } + + public void setActive(boolean active) { + + this.active = active; + + } + + + + + +} diff --git a/Dozentenmodul/src/main/java/models/Links.java b/Dozentenmodul/src/main/java/models/Links.java new file mode 100644 index 00000000..693fbb3e --- /dev/null +++ b/Dozentenmodul/src/main/java/models/Links.java @@ -0,0 +1,161 @@ +package models; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; + +public class Links { + + private static String FAQ = "http://bwlehrpool.hs-offenburg.de/"; + private static String OTRS = "https://bwlehrpool-otrs.rz.hs-offenburg.de/otrs/customer.pl"; + private static String uriWindows = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"; + private static String uriLinux = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"; + + public static String getFAQ() { + return FAQ; + } + + public static String getOTRS() { + return OTRS; + } + + public static void openFAQ() { + + String faq = FAQ; + Runtime rt = Runtime.getRuntime(); + String os = System.getProperty("os.name"); + + try { + + + if (os.indexOf( "Win" ) >= 0) { + + rt.exec( "rundll32 url.dll,FileProtocolHandler " + faq); + + } else if (os.indexOf( "Mac" ) >= 0) { + + rt.exec( "open " + faq); + + } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { + + // Do a best guess on unix until we get a platform independent way + // Build a list of browsers to try, in this order. + String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", + "netscape","opera","links","lynx"}; + + StringBuffer cmd = new StringBuffer(); + for (int i=0; i= 0) { + + // this doesn't support showing urls in the form of + // "page.html#nameLink" + rt.exec("rundll32 url.dll,FileProtocolHandler " + faq); + + } else if (os.indexOf("Mac") >= 0) { + + rt.exec("open " + faq); + + } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) { + + // Do a best guess on unix until we get a platform independent + // way + // Build a list of browsers to try, in this order. + String[] browsers = { "epiphany", "firefox", "mozilla", + "konqueror", "netscape", "opera", "links", "lynx" }; + + // Build a command string which looks like + // "browser1 "url" || browser2 "url" ||..." + StringBuffer cmd = new StringBuffer(); + for (int i = 0; i < browsers.length; i++) + cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" + + faq + "\" "); + + rt.exec(new String[] { "sh", "-c", cmd.toString() }); + } + + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public static void openOTRS() { + + String otrs = OTRS; + Runtime rt = Runtime.getRuntime(); + String os = System.getProperty("os.name"); + + try { + + if (os.indexOf( "Win" ) >= 0) { + + rt.exec( "rundll32 url.dll,FileProtocolHandler " + otrs); + + } else if (os.indexOf( "Mac" ) >= 0) { + + rt.exec( "open " + otrs); + + } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { + + String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", + "netscape","opera","links","lynx"}; + + StringBuffer cmd = new StringBuffer(); + for (int i=0; i= 0) { + + // this doesn't support showing urls in the form of + // "page.html#nameLink" + rt.exec("rundll32 url.dll,FileProtocolHandler " + otrs); + + } else if (os.indexOf("Mac") >= 0) { + + rt.exec("open " + otrs); + + } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) { + + // Do a best guess on unix until we get a platform independent + // way + // Build a list of browsers to try, in this order. + String[] browsers = { "epiphany", "firefox", "mozilla", + "konqueror", "netscape", "opera", "links", "lynx" }; + + // Build a command string which looks like + // "browser1 "url" || browser2 "url" ||..." + StringBuffer cmd = new StringBuffer(); + for (int i = 0; i < browsers.length; i++) + cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" + + otrs + "\" "); + + rt.exec(new String[] { "sh", "-c", cmd.toString() }); + } + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public static String getUriWindows() { + return uriWindows; + } + + public static String getUriLinux() { + return uriLinux; + } + +} diff --git a/Dozentenmodul/src/main/java/models/SessionData.java b/Dozentenmodul/src/main/java/models/SessionData.java new file mode 100644 index 00000000..187dc59f --- /dev/null +++ b/Dozentenmodul/src/main/java/models/SessionData.java @@ -0,0 +1,30 @@ +package models; + +public class SessionData { + + private String sessionID; + private String authToken; + private String serverAdress; + public static SessionData session =new SessionData(); + + public String getSessionID() { + return sessionID; + } + public void setSessionID(String sessionID) { + this.sessionID = sessionID; + } + public String getAuthToken() { + return authToken; + } + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + public String getServerAdress() { + return serverAdress; + } + public void setServerAdress(String serverAdress) { + this.serverAdress = serverAdress; + } + + +} diff --git a/Dozentenmodul/src/main/java/models/person.java b/Dozentenmodul/src/main/java/models/person.java new file mode 100644 index 00000000..6e066730 --- /dev/null +++ b/Dozentenmodul/src/main/java/models/person.java @@ -0,0 +1,121 @@ +package models; + +public class person{ + + private String username; + + private String Name; + + private String Vorname; + + private String Hochschule; + + private String EMail; + + private String Tel; + + private String Fakultaet; + + private boolean ischecked; + + public static person verantwortlicher=new person(); + + + + public String getUsername() { + + return username; + + } + + public void setUsername(String username) { + + this.username = username; + + } + + public String getName() { + + return Name; + + } + + public void setName(String name) { + + Name = name; + + } + + public String getVorname() { + + return Vorname; + + } + + public void setVorname(String vorname) { + + Vorname = vorname; + + } + + public String getHochschule() { + + return Hochschule; + + } + + public void setHochschule(String hochschule) { + + Hochschule = hochschule; + + } + + public String getEMail() { + + return EMail; + + } + + public void setEMail(String eMail) { + + EMail = eMail; + + } + + public String getTel() { + + return Tel; + + } + + public void setTel(String tel) { + + Tel = tel; + + } + + public String getFakultaet() { + + return Fakultaet; + + } + + public void setFakultaet(String fakultaet) { + + Fakultaet = fakultaet; + + } + + public boolean isIschecked() { + + return ischecked; + + } + + public void setIschecked(boolean ischecked) { + + this.ischecked = ischecked; + + } + +} diff --git a/Dozentenmodul/src/main/java/models/user.java b/Dozentenmodul/src/main/java/models/user.java new file mode 100644 index 00000000..9aa958a4 --- /dev/null +++ b/Dozentenmodul/src/main/java/models/user.java @@ -0,0 +1,23 @@ +package models; + +public class user { + + private String userName; + private String Password; + + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + public String getPassword() { + return Password; + } + public void setPassword(String password) { + Password = password; + } + + + +} diff --git a/Dozentenmodul/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java b/Dozentenmodul/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java new file mode 100644 index 00000000..8b6d4cc3 --- /dev/null +++ b/Dozentenmodul/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java @@ -0,0 +1,447 @@ +/******************************************************************************* + * Copyright (c) 2011 Google, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Google, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.wb.swt; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. + *

+ * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the + * operating system resources managed by cached objects when those objects and OS resources are no longer + * needed (e.g. on application shutdown) + *

+ * This class may be freely distributed as part of any application or plugin. + *

+ * @author scheglov_ke + * @author Dan Rubel + */ +public class SWTResourceManager { + //////////////////////////////////////////////////////////////////////////// + // + // Color + // + //////////////////////////////////////////////////////////////////////////// + private static Map m_colorMap = new HashMap(); + /** + * Returns the system {@link Color} matching the specific ID. + * + * @param systemColorID + * the ID value for the color + * @return the system {@link Color} matching the specific ID + */ + public static Color getColor(int systemColorID) { + Display display = Display.getCurrent(); + return display.getSystemColor(systemColorID); + } + /** + * Returns a {@link Color} given its red, green and blue component values. + * + * @param r + * the red component of the color + * @param g + * the green component of the color + * @param b + * the blue component of the color + * @return the {@link Color} matching the given red, green and blue component values + */ + public static Color getColor(int r, int g, int b) { + return getColor(new RGB(r, g, b)); + } + /** + * Returns a {@link Color} given its RGB value. + * + * @param rgb + * the {@link RGB} value of the color + * @return the {@link Color} matching the RGB value + */ + public static Color getColor(RGB rgb) { + Color color = m_colorMap.get(rgb); + if (color == null) { + Display display = Display.getCurrent(); + color = new Color(display, rgb); + m_colorMap.put(rgb, color); + } + return color; + } + /** + * Dispose of all the cached {@link Color}'s. + */ + public static void disposeColors() { + for (Color color : m_colorMap.values()) { + color.dispose(); + } + m_colorMap.clear(); + } + //////////////////////////////////////////////////////////////////////////// + // + // Image + // + //////////////////////////////////////////////////////////////////////////// + /** + * Maps image paths to images. + */ + private static Map m_imageMap = new HashMap(); + /** + * Returns an {@link Image} encoded by the specified {@link InputStream}. + * + * @param stream + * the {@link InputStream} encoding the image data + * @return the {@link Image} encoded by the specified input stream + */ + protected static Image getImage(InputStream stream) throws IOException { + try { + Display display = Display.getCurrent(); + ImageData data = new ImageData(stream); + if (data.transparentPixel > 0) { + return new Image(display, data, data.getTransparencyMask()); + } + return new Image(display, data); + } finally { + stream.close(); + } + } + /** + * Returns an {@link Image} stored in the file at the specified path. + * + * @param path + * the path to the image file + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(String path) { + Image image = m_imageMap.get(path); + if (image == null) { + try { + image = getImage(new FileInputStream(path)); + m_imageMap.put(path, image); + } catch (Exception e) { + image = getMissingImage(); + m_imageMap.put(path, image); + } + } + return image; + } + /** + * Returns an {@link Image} stored in the file at the specified path relative to the specified class. + * + * @param clazz + * the {@link Class} relative to which to find the image + * @param path + * the path to the image file, if starts with '/' + * @return the {@link Image} stored in the file at the specified path + */ + public static Image getImage(Class clazz, String path) { + String key = clazz.getName() + '|' + path; + Image image = m_imageMap.get(key); + if (image == null) { + try { + image = getImage(clazz.getResourceAsStream(path)); + m_imageMap.put(key, image); + } catch (Exception e) { + image = getMissingImage(); + m_imageMap.put(key, image); + } + } + return image; + } + private static final int MISSING_IMAGE_SIZE = 10; + /** + * @return the small {@link Image} that can be used as placeholder for missing image. + */ + private static Image getMissingImage() { + Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + // + GC gc = new GC(image); + gc.setBackground(getColor(SWT.COLOR_RED)); + gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); + gc.dispose(); + // + return image; + } + /** + * Style constant for placing decorator image in top left corner of base image. + */ + public static final int TOP_LEFT = 1; + /** + * Style constant for placing decorator image in top right corner of base image. + */ + public static final int TOP_RIGHT = 2; + /** + * Style constant for placing decorator image in bottom left corner of base image. + */ + public static final int BOTTOM_LEFT = 3; + /** + * Style constant for placing decorator image in bottom right corner of base image. + */ + public static final int BOTTOM_RIGHT = 4; + /** + * Internal value. + */ + protected static final int LAST_CORNER_KEY = 5; + /** + * Maps images to decorated images. + */ + @SuppressWarnings("unchecked") + private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @return {@link Image} The resulting decorated image + */ + public static Image decorateImage(Image baseImage, Image decorator) { + return decorateImage(baseImage, decorator, BOTTOM_RIGHT); + } + /** + * Returns an {@link Image} composed of a base image decorated by another image. + * + * @param baseImage + * the base {@link Image} that should be decorated + * @param decorator + * the {@link Image} to decorate the base image + * @param corner + * the corner to place decorator image + * @return the resulting decorated {@link Image} + */ + public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { + if (corner <= 0 || corner >= LAST_CORNER_KEY) { + throw new IllegalArgumentException("Wrong decorate corner"); + } + Map> cornerDecoratedImageMap = m_decoratedImageMap[corner]; + if (cornerDecoratedImageMap == null) { + cornerDecoratedImageMap = new HashMap>(); + m_decoratedImageMap[corner] = cornerDecoratedImageMap; + } + Map decoratedMap = cornerDecoratedImageMap.get(baseImage); + if (decoratedMap == null) { + decoratedMap = new HashMap(); + cornerDecoratedImageMap.put(baseImage, decoratedMap); + } + // + Image result = decoratedMap.get(decorator); + if (result == null) { + Rectangle bib = baseImage.getBounds(); + Rectangle dib = decorator.getBounds(); + // + result = new Image(Display.getCurrent(), bib.width, bib.height); + // + GC gc = new GC(result); + gc.drawImage(baseImage, 0, 0); + if (corner == TOP_LEFT) { + gc.drawImage(decorator, 0, 0); + } else if (corner == TOP_RIGHT) { + gc.drawImage(decorator, bib.width - dib.width, 0); + } else if (corner == BOTTOM_LEFT) { + gc.drawImage(decorator, 0, bib.height - dib.height); + } else if (corner == BOTTOM_RIGHT) { + gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); + } + gc.dispose(); + // + decoratedMap.put(decorator, result); + } + return result; + } + /** + * Dispose all of the cached {@link Image}'s. + */ + public static void disposeImages() { + // dispose loaded images + { + for (Image image : m_imageMap.values()) { + image.dispose(); + } + m_imageMap.clear(); + } + // dispose decorated images + for (int i = 0; i < m_decoratedImageMap.length; i++) { + Map> cornerDecoratedImageMap = m_decoratedImageMap[i]; + if (cornerDecoratedImageMap != null) { + for (Map decoratedMap : cornerDecoratedImageMap.values()) { + for (Image image : decoratedMap.values()) { + image.dispose(); + } + decoratedMap.clear(); + } + cornerDecoratedImageMap.clear(); + } + } + } + //////////////////////////////////////////////////////////////////////////// + // + // Font + // + //////////////////////////////////////////////////////////////////////////// + /** + * Maps font names to fonts. + */ + private static Map m_fontMap = new HashMap(); + /** + * Maps fonts to their bold versions. + */ + private static Map m_fontToBoldFontMap = new HashMap(); + /** + * Returns a {@link Font} based on its name, height and style. + * + * @param name + * the name of the font + * @param height + * the height of the font + * @param style + * the style of the font + * @return {@link Font} The font matching the name, height and style + */ + public static Font getFont(String name, int height, int style) { + return getFont(name, height, style, false, false); + } + /** + * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline + * flags are also supported. + * + * @param name + * the name of the font + * @param size + * the size of the font + * @param style + * the style of the font + * @param strikeout + * the strikeout flag (warning: Windows only) + * @param underline + * the underline flag (warning: Windows only) + * @return {@link Font} The font matching the name, height, style, strikeout and underline + */ + public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { + String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; + Font font = m_fontMap.get(fontName); + if (font == null) { + FontData fontData = new FontData(name, size, style); + if (strikeout || underline) { + try { + Class logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ + Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ + if (logFont != null && logFontClass != null) { + if (strikeout) { + logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ + } + if (underline) { + logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ + } + } + } catch (Throwable e) { + System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + font = new Font(Display.getCurrent(), fontData); + m_fontMap.put(fontName, font); + } + return font; + } + /** + * Returns a bold version of the given {@link Font}. + * + * @param baseFont + * the {@link Font} for which a bold version is desired + * @return the bold version of the given {@link Font} + */ + public static Font getBoldFont(Font baseFont) { + Font font = m_fontToBoldFontMap.get(baseFont); + if (font == null) { + FontData fontDatas[] = baseFont.getFontData(); + FontData data = fontDatas[0]; + font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); + m_fontToBoldFontMap.put(baseFont, font); + } + return font; + } + /** + * Dispose all of the cached {@link Font}'s. + */ + public static void disposeFonts() { + // clear fonts + for (Font font : m_fontMap.values()) { + font.dispose(); + } + m_fontMap.clear(); + // clear bold fonts + for (Font font : m_fontToBoldFontMap.values()) { + font.dispose(); + } + m_fontToBoldFontMap.clear(); + } + //////////////////////////////////////////////////////////////////////////// + // + // Cursor + // + //////////////////////////////////////////////////////////////////////////// + /** + * Maps IDs to cursors. + */ + private static Map m_idToCursorMap = new HashMap(); + /** + * Returns the system cursor matching the specific ID. + * + * @param id + * int The ID value for the cursor + * @return Cursor The system cursor matching the specific ID + */ + public static Cursor getCursor(int id) { + Integer key = Integer.valueOf(id); + Cursor cursor = m_idToCursorMap.get(key); + if (cursor == null) { + cursor = new Cursor(Display.getDefault(), id); + m_idToCursorMap.put(key, cursor); + } + return cursor; + } + /** + * Dispose all of the cached cursors. + */ + public static void disposeCursors() { + for (Cursor cursor : m_idToCursorMap.values()) { + cursor.dispose(); + } + m_idToCursorMap.clear(); + } + //////////////////////////////////////////////////////////////////////////// + // + // General + // + //////////////////////////////////////////////////////////////////////////// + /** + * Dispose of cached objects and their underlying OS resources. This should only be called when the cached + * objects are no longer needed (e.g. on application shutdown). + */ + public static void dispose() { + disposeColors(); + disposeImages(); + disposeFonts(); + disposeCursors(); + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/main/java/thrift/MasterThriftConnection.java b/Dozentenmodul/src/main/java/thrift/MasterThriftConnection.java new file mode 100644 index 00000000..11a27368 --- /dev/null +++ b/Dozentenmodul/src/main/java/thrift/MasterThriftConnection.java @@ -0,0 +1,46 @@ +package thrift; + +import javax.swing.JOptionPane; + +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; + +import thrift.ImageServer.Client; + + + +public class MasterThriftConnection { + + public static final String MASTERSERVERIP="132.230.4.16"; + //public static final String MASTERSERVERIP="127.0.0.1"; + + final TTransport transport = new TSocket(MASTERSERVERIP, 9090); + + public Client getMasterThriftConnection() + { + + try { + transport.open(); + } catch (TTransportException e) { + System.out.println("Keine Verbindung m\u00f6glich!"); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + return null; + } + + final TProtocol protocol = new TBinaryProtocol(transport); + final Client client = new Client(protocol); + System.out.println("Masterserver erreichbar."); + + return client; + } + + public void closeMasterThriftConnection() + { + transport.close(); + } +} diff --git a/Dozentenmodul/src/main/java/thrift/ThriftConnection.java b/Dozentenmodul/src/main/java/thrift/ThriftConnection.java new file mode 100644 index 00000000..3eec5d25 --- /dev/null +++ b/Dozentenmodul/src/main/java/thrift/ThriftConnection.java @@ -0,0 +1,53 @@ +package thrift; + +import javax.swing.JOptionPane; + +import models.SessionData; + +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; + +import server.Server; +import server.Server.Client; + +public class ThriftConnection { + + private String satAddress = ""+SessionData.session.getServerAdress(); + final TTransport transport = new TSocket(satAddress, 9090); + + public ThriftConnection() { + // TODO Auto-generated constructor stub + } + + public Client getThriftConnection() + { + + try { + transport.open(); + } catch (TTransportException e) { + System.out.println("Keine Verbindung m\u00f6glich! Satellit="+satAddress); + e.printStackTrace(); + JOptionPane.showMessageDialog(null, + e.getCause()+"\n"+e.getMessage(), + "Debug-Message", JOptionPane.ERROR_MESSAGE); + //System.out.println("Keine Verbindung moeglich! Satellit="); + return null; + } + + final TProtocol protocol = new TBinaryProtocol(transport); + + final Server.Client client = new Server.Client(protocol); + System.out.println("Verbindung zu "+satAddress+" wurde aufgebaut."); + + return client; + } + + public void closeThriftConnection() + { + System.out.println("Verbindung wird geplant getrennt..."); + transport.close(); + } +} diff --git a/Dozentenmodul/src/main/java/util/GuiOrganizer.java b/Dozentenmodul/src/main/java/util/GuiOrganizer.java new file mode 100644 index 00000000..f03c3811 --- /dev/null +++ b/Dozentenmodul/src/main/java/util/GuiOrganizer.java @@ -0,0 +1,26 @@ +package util; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.Window; + +public abstract class GuiOrganizer { + + + + + /*receive GUI, set it to center of the screen*/ + public static void centerGUI(Window gui) + { + Dimension dm = Toolkit.getDefaultToolkit().getScreenSize(); + double width = dm.getWidth(); + double height = dm.getHeight(); + double xPosition = (width / 2 - gui.getWidth() / 2); + double yPosition = (height / 2 - gui.getHeight() / 2); + gui.setLocation((int) xPosition, (int) yPosition); + } + + + + +} diff --git a/Dozentenmodul/src/main/java/util/OpenLinks.java b/Dozentenmodul/src/main/java/util/OpenLinks.java new file mode 100644 index 00000000..a3968825 --- /dev/null +++ b/Dozentenmodul/src/main/java/util/OpenLinks.java @@ -0,0 +1,20 @@ +package util; + +import java.awt.Desktop; +import java.net.URI; + +public class OpenLinks { + + + public static void openWebpage(URI uri) { + Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; + if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { + try { + desktop.browse(uri); + } catch (Exception e) { + e.printStackTrace(); + } + } + }// end openWebpage + +} diff --git a/Dozentenmodul/src/models/Client.java b/Dozentenmodul/src/models/Client.java deleted file mode 100644 index 42eccdec..00000000 --- a/Dozentenmodul/src/models/Client.java +++ /dev/null @@ -1,18 +0,0 @@ -package models; - -public class Client { - - private server.Server.Client client; - public static Client clientcon=new Client(); - - public server.Server.Client getClient() { - return client; - } - - public void setClient(server.Server.Client client) { - this.client = client; - } - - - -} diff --git a/Dozentenmodul/src/models/Image.java b/Dozentenmodul/src/models/Image.java deleted file mode 100644 index 86bc1e48..00000000 --- a/Dozentenmodul/src/models/Image.java +++ /dev/null @@ -1,172 +0,0 @@ -package models; - -public class Image { - - - - private String ImageId; - - private String version; - - private String imagename; - - private String newName; - - private String imagepath; - - private int shareMode; - - private boolean licensed; - - private boolean internet; - - private int ram; - - private int cpu; - - private long filesize; - - public static Image image =new Image(); - - - - - - - - public int getShareMode() { - - return shareMode; - - } - - public void setShareMode(int shareMode) { - - this.shareMode = shareMode; - - } - - public String getImagepath() { - - return imagepath; - - } - - public void setImagepath(String imagepath) { - - this.imagepath = imagepath; - - } - - public String getImagename() { - - return imagename; - - } - - public void setImagename(String imagename) { - - this.imagename = imagename; - - } - - public boolean isLicensed() { - - return licensed; - - } - - public void setLicensed(boolean licensed) { - - this.licensed = licensed; - - } - - public boolean isInternet() { - - return internet; - - } - - public void setInternet(boolean internet) { - - this.internet = internet; - - } - - public int getRam() { - - return ram; - - } - - public void setRam(int ram) { - - this.ram = ram; - - } - - public int getCpu() { - - return cpu; - - } - - public void setCpu(int cpu) { - - this.cpu = cpu; - - } - - public String getNewName() { - - return newName; - - } - - public void setNewName(String newName) { - - this.newName = newName; - - } - - public String getImageId() { - - return ImageId; - - } - - public void setImageId(String imageId) { - - ImageId = imageId; - - } - - public String getVersion() { - - return version; - - } - - public void setVersion(String version) { - - this.version = version; - - } - - public long getFilesize() { - - return filesize; - - } - - public void setFilesize(long filesize) { - - this.filesize = filesize; - - } - - - -} - diff --git a/Dozentenmodul/src/models/Lecture.java b/Dozentenmodul/src/models/Lecture.java deleted file mode 100644 index 8f67baba..00000000 --- a/Dozentenmodul/src/models/Lecture.java +++ /dev/null @@ -1,141 +0,0 @@ -package models; - -import java.util.Date; - -public class Lecture { - - private String name; - - private String newName; - - private String shortDesc; - - private String desc; - - private Date startdate; - - private Date enddate; - - private boolean active; - - private String id; - - private String linkedImagename; - - public static Lecture lecture =new Lecture(); - - - - public String getNewName() { - - return newName; - - } - - public void setNewName(String newName) { - - this.newName = newName; - - } - - public String getLinkedImagename() { - - return linkedImagename; - - } - - public void setLinkedImagename(String linkedImagename) { - - this.linkedImagename = linkedImagename; - - } - - public String getid() { - - return id; - - } - - public void setid(String id) { - - this.id = id; - - } - - public String getName() { - - return name; - - } - - public void setName(String name) { - - this.name = name; - - } - - public String getShortDesc() { - - return shortDesc; - - } - - public void setShortDesc(String shortDesc) { - - this.shortDesc = shortDesc; - - } - - public String getDesc() { - - return desc; - - } - - public void setDesc(String desc) { - - this.desc = desc; - - } - - public Date getStartdate() { - - return startdate; - - } - - public void setStartdate(Date startdate) { - - this.startdate = startdate; - - } - - public Date getEnddate() { - - return enddate; - - } - - public void setEnddate(Date enddate) { - - this.enddate = enddate; - - } - - public boolean isActive() { - - return active; - - } - - public void setActive(boolean active) { - - this.active = active; - - } - - - - - -} diff --git a/Dozentenmodul/src/models/Links.java b/Dozentenmodul/src/models/Links.java deleted file mode 100644 index 693fbb3e..00000000 --- a/Dozentenmodul/src/models/Links.java +++ /dev/null @@ -1,161 +0,0 @@ -package models; - -import java.awt.Desktop; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; - -public class Links { - - private static String FAQ = "http://bwlehrpool.hs-offenburg.de/"; - private static String OTRS = "https://bwlehrpool-otrs.rz.hs-offenburg.de/otrs/customer.pl"; - private static String uriWindows = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"; - private static String uriLinux = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"; - - public static String getFAQ() { - return FAQ; - } - - public static String getOTRS() { - return OTRS; - } - - public static void openFAQ() { - - String faq = FAQ; - Runtime rt = Runtime.getRuntime(); - String os = System.getProperty("os.name"); - - try { - - - if (os.indexOf( "Win" ) >= 0) { - - rt.exec( "rundll32 url.dll,FileProtocolHandler " + faq); - - } else if (os.indexOf( "Mac" ) >= 0) { - - rt.exec( "open " + faq); - - } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { - - // Do a best guess on unix until we get a platform independent way - // Build a list of browsers to try, in this order. - String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", - "netscape","opera","links","lynx"}; - - StringBuffer cmd = new StringBuffer(); - for (int i=0; i= 0) { - - // this doesn't support showing urls in the form of - // "page.html#nameLink" - rt.exec("rundll32 url.dll,FileProtocolHandler " + faq); - - } else if (os.indexOf("Mac") >= 0) { - - rt.exec("open " + faq); - - } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) { - - // Do a best guess on unix until we get a platform independent - // way - // Build a list of browsers to try, in this order. - String[] browsers = { "epiphany", "firefox", "mozilla", - "konqueror", "netscape", "opera", "links", "lynx" }; - - // Build a command string which looks like - // "browser1 "url" || browser2 "url" ||..." - StringBuffer cmd = new StringBuffer(); - for (int i = 0; i < browsers.length; i++) - cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" - + faq + "\" "); - - rt.exec(new String[] { "sh", "-c", cmd.toString() }); - } - - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public static void openOTRS() { - - String otrs = OTRS; - Runtime rt = Runtime.getRuntime(); - String os = System.getProperty("os.name"); - - try { - - if (os.indexOf( "Win" ) >= 0) { - - rt.exec( "rundll32 url.dll,FileProtocolHandler " + otrs); - - } else if (os.indexOf( "Mac" ) >= 0) { - - rt.exec( "open " + otrs); - - } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { - - String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", - "netscape","opera","links","lynx"}; - - StringBuffer cmd = new StringBuffer(); - for (int i=0; i= 0) { - - // this doesn't support showing urls in the form of - // "page.html#nameLink" - rt.exec("rundll32 url.dll,FileProtocolHandler " + otrs); - - } else if (os.indexOf("Mac") >= 0) { - - rt.exec("open " + otrs); - - } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) { - - // Do a best guess on unix until we get a platform independent - // way - // Build a list of browsers to try, in this order. - String[] browsers = { "epiphany", "firefox", "mozilla", - "konqueror", "netscape", "opera", "links", "lynx" }; - - // Build a command string which looks like - // "browser1 "url" || browser2 "url" ||..." - StringBuffer cmd = new StringBuffer(); - for (int i = 0; i < browsers.length; i++) - cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" - + otrs + "\" "); - - rt.exec(new String[] { "sh", "-c", cmd.toString() }); - } - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public static String getUriWindows() { - return uriWindows; - } - - public static String getUriLinux() { - return uriLinux; - } - -} diff --git a/Dozentenmodul/src/models/SessionData.java b/Dozentenmodul/src/models/SessionData.java deleted file mode 100644 index 187dc59f..00000000 --- a/Dozentenmodul/src/models/SessionData.java +++ /dev/null @@ -1,30 +0,0 @@ -package models; - -public class SessionData { - - private String sessionID; - private String authToken; - private String serverAdress; - public static SessionData session =new SessionData(); - - public String getSessionID() { - return sessionID; - } - public void setSessionID(String sessionID) { - this.sessionID = sessionID; - } - public String getAuthToken() { - return authToken; - } - public void setAuthToken(String authToken) { - this.authToken = authToken; - } - public String getServerAdress() { - return serverAdress; - } - public void setServerAdress(String serverAdress) { - this.serverAdress = serverAdress; - } - - -} diff --git a/Dozentenmodul/src/models/person.java b/Dozentenmodul/src/models/person.java deleted file mode 100644 index 6e066730..00000000 --- a/Dozentenmodul/src/models/person.java +++ /dev/null @@ -1,121 +0,0 @@ -package models; - -public class person{ - - private String username; - - private String Name; - - private String Vorname; - - private String Hochschule; - - private String EMail; - - private String Tel; - - private String Fakultaet; - - private boolean ischecked; - - public static person verantwortlicher=new person(); - - - - public String getUsername() { - - return username; - - } - - public void setUsername(String username) { - - this.username = username; - - } - - public String getName() { - - return Name; - - } - - public void setName(String name) { - - Name = name; - - } - - public String getVorname() { - - return Vorname; - - } - - public void setVorname(String vorname) { - - Vorname = vorname; - - } - - public String getHochschule() { - - return Hochschule; - - } - - public void setHochschule(String hochschule) { - - Hochschule = hochschule; - - } - - public String getEMail() { - - return EMail; - - } - - public void setEMail(String eMail) { - - EMail = eMail; - - } - - public String getTel() { - - return Tel; - - } - - public void setTel(String tel) { - - Tel = tel; - - } - - public String getFakultaet() { - - return Fakultaet; - - } - - public void setFakultaet(String fakultaet) { - - Fakultaet = fakultaet; - - } - - public boolean isIschecked() { - - return ischecked; - - } - - public void setIschecked(boolean ischecked) { - - this.ischecked = ischecked; - - } - -} diff --git a/Dozentenmodul/src/models/user.java b/Dozentenmodul/src/models/user.java deleted file mode 100644 index 9aa958a4..00000000 --- a/Dozentenmodul/src/models/user.java +++ /dev/null @@ -1,23 +0,0 @@ -package models; - -public class user { - - private String userName; - private String Password; - - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getPassword() { - return Password; - } - public void setPassword(String password) { - Password = password; - } - - - -} diff --git a/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java b/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java deleted file mode 100644 index 8b6d4cc3..00000000 --- a/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Google, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Google, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.wb.swt; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Display; - -/** - * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. - *

- * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the - * operating system resources managed by cached objects when those objects and OS resources are no longer - * needed (e.g. on application shutdown) - *

- * This class may be freely distributed as part of any application or plugin. - *

- * @author scheglov_ke - * @author Dan Rubel - */ -public class SWTResourceManager { - //////////////////////////////////////////////////////////////////////////// - // - // Color - // - //////////////////////////////////////////////////////////////////////////// - private static Map m_colorMap = new HashMap(); - /** - * Returns the system {@link Color} matching the specific ID. - * - * @param systemColorID - * the ID value for the color - * @return the system {@link Color} matching the specific ID - */ - public static Color getColor(int systemColorID) { - Display display = Display.getCurrent(); - return display.getSystemColor(systemColorID); - } - /** - * Returns a {@link Color} given its red, green and blue component values. - * - * @param r - * the red component of the color - * @param g - * the green component of the color - * @param b - * the blue component of the color - * @return the {@link Color} matching the given red, green and blue component values - */ - public static Color getColor(int r, int g, int b) { - return getColor(new RGB(r, g, b)); - } - /** - * Returns a {@link Color} given its RGB value. - * - * @param rgb - * the {@link RGB} value of the color - * @return the {@link Color} matching the RGB value - */ - public static Color getColor(RGB rgb) { - Color color = m_colorMap.get(rgb); - if (color == null) { - Display display = Display.getCurrent(); - color = new Color(display, rgb); - m_colorMap.put(rgb, color); - } - return color; - } - /** - * Dispose of all the cached {@link Color}'s. - */ - public static void disposeColors() { - for (Color color : m_colorMap.values()) { - color.dispose(); - } - m_colorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Image - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps image paths to images. - */ - private static Map m_imageMap = new HashMap(); - /** - * Returns an {@link Image} encoded by the specified {@link InputStream}. - * - * @param stream - * the {@link InputStream} encoding the image data - * @return the {@link Image} encoded by the specified input stream - */ - protected static Image getImage(InputStream stream) throws IOException { - try { - Display display = Display.getCurrent(); - ImageData data = new ImageData(stream); - if (data.transparentPixel > 0) { - return new Image(display, data, data.getTransparencyMask()); - } - return new Image(display, data); - } finally { - stream.close(); - } - } - /** - * Returns an {@link Image} stored in the file at the specified path. - * - * @param path - * the path to the image file - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(String path) { - Image image = m_imageMap.get(path); - if (image == null) { - try { - image = getImage(new FileInputStream(path)); - m_imageMap.put(path, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(path, image); - } - } - return image; - } - /** - * Returns an {@link Image} stored in the file at the specified path relative to the specified class. - * - * @param clazz - * the {@link Class} relative to which to find the image - * @param path - * the path to the image file, if starts with '/' - * @return the {@link Image} stored in the file at the specified path - */ - public static Image getImage(Class clazz, String path) { - String key = clazz.getName() + '|' + path; - Image image = m_imageMap.get(key); - if (image == null) { - try { - image = getImage(clazz.getResourceAsStream(path)); - m_imageMap.put(key, image); - } catch (Exception e) { - image = getMissingImage(); - m_imageMap.put(key, image); - } - } - return image; - } - private static final int MISSING_IMAGE_SIZE = 10; - /** - * @return the small {@link Image} that can be used as placeholder for missing image. - */ - private static Image getMissingImage() { - Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - // - GC gc = new GC(image); - gc.setBackground(getColor(SWT.COLOR_RED)); - gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE); - gc.dispose(); - // - return image; - } - /** - * Style constant for placing decorator image in top left corner of base image. - */ - public static final int TOP_LEFT = 1; - /** - * Style constant for placing decorator image in top right corner of base image. - */ - public static final int TOP_RIGHT = 2; - /** - * Style constant for placing decorator image in bottom left corner of base image. - */ - public static final int BOTTOM_LEFT = 3; - /** - * Style constant for placing decorator image in bottom right corner of base image. - */ - public static final int BOTTOM_RIGHT = 4; - /** - * Internal value. - */ - protected static final int LAST_CORNER_KEY = 5; - /** - * Maps images to decorated images. - */ - @SuppressWarnings("unchecked") - private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY]; - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @return {@link Image} The resulting decorated image - */ - public static Image decorateImage(Image baseImage, Image decorator) { - return decorateImage(baseImage, decorator, BOTTOM_RIGHT); - } - /** - * Returns an {@link Image} composed of a base image decorated by another image. - * - * @param baseImage - * the base {@link Image} that should be decorated - * @param decorator - * the {@link Image} to decorate the base image - * @param corner - * the corner to place decorator image - * @return the resulting decorated {@link Image} - */ - public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) { - if (corner <= 0 || corner >= LAST_CORNER_KEY) { - throw new IllegalArgumentException("Wrong decorate corner"); - } - Map> cornerDecoratedImageMap = m_decoratedImageMap[corner]; - if (cornerDecoratedImageMap == null) { - cornerDecoratedImageMap = new HashMap>(); - m_decoratedImageMap[corner] = cornerDecoratedImageMap; - } - Map decoratedMap = cornerDecoratedImageMap.get(baseImage); - if (decoratedMap == null) { - decoratedMap = new HashMap(); - cornerDecoratedImageMap.put(baseImage, decoratedMap); - } - // - Image result = decoratedMap.get(decorator); - if (result == null) { - Rectangle bib = baseImage.getBounds(); - Rectangle dib = decorator.getBounds(); - // - result = new Image(Display.getCurrent(), bib.width, bib.height); - // - GC gc = new GC(result); - gc.drawImage(baseImage, 0, 0); - if (corner == TOP_LEFT) { - gc.drawImage(decorator, 0, 0); - } else if (corner == TOP_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, 0); - } else if (corner == BOTTOM_LEFT) { - gc.drawImage(decorator, 0, bib.height - dib.height); - } else if (corner == BOTTOM_RIGHT) { - gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height); - } - gc.dispose(); - // - decoratedMap.put(decorator, result); - } - return result; - } - /** - * Dispose all of the cached {@link Image}'s. - */ - public static void disposeImages() { - // dispose loaded images - { - for (Image image : m_imageMap.values()) { - image.dispose(); - } - m_imageMap.clear(); - } - // dispose decorated images - for (int i = 0; i < m_decoratedImageMap.length; i++) { - Map> cornerDecoratedImageMap = m_decoratedImageMap[i]; - if (cornerDecoratedImageMap != null) { - for (Map decoratedMap : cornerDecoratedImageMap.values()) { - for (Image image : decoratedMap.values()) { - image.dispose(); - } - decoratedMap.clear(); - } - cornerDecoratedImageMap.clear(); - } - } - } - //////////////////////////////////////////////////////////////////////////// - // - // Font - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps font names to fonts. - */ - private static Map m_fontMap = new HashMap(); - /** - * Maps fonts to their bold versions. - */ - private static Map m_fontToBoldFontMap = new HashMap(); - /** - * Returns a {@link Font} based on its name, height and style. - * - * @param name - * the name of the font - * @param height - * the height of the font - * @param style - * the style of the font - * @return {@link Font} The font matching the name, height and style - */ - public static Font getFont(String name, int height, int style) { - return getFont(name, height, style, false, false); - } - /** - * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline - * flags are also supported. - * - * @param name - * the name of the font - * @param size - * the size of the font - * @param style - * the style of the font - * @param strikeout - * the strikeout flag (warning: Windows only) - * @param underline - * the underline flag (warning: Windows only) - * @return {@link Font} The font matching the name, height, style, strikeout and underline - */ - public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { - String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline; - Font font = m_fontMap.get(fontName); - if (font == null) { - FontData fontData = new FontData(name, size, style); - if (strikeout || underline) { - try { - Class logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$ - Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$ - if (logFont != null && logFontClass != null) { - if (strikeout) { - logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - if (underline) { - logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$ - } - } - } catch (Throwable e) { - System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - font = new Font(Display.getCurrent(), fontData); - m_fontMap.put(fontName, font); - } - return font; - } - /** - * Returns a bold version of the given {@link Font}. - * - * @param baseFont - * the {@link Font} for which a bold version is desired - * @return the bold version of the given {@link Font} - */ - public static Font getBoldFont(Font baseFont) { - Font font = m_fontToBoldFontMap.get(baseFont); - if (font == null) { - FontData fontDatas[] = baseFont.getFontData(); - FontData data = fontDatas[0]; - font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); - m_fontToBoldFontMap.put(baseFont, font); - } - return font; - } - /** - * Dispose all of the cached {@link Font}'s. - */ - public static void disposeFonts() { - // clear fonts - for (Font font : m_fontMap.values()) { - font.dispose(); - } - m_fontMap.clear(); - // clear bold fonts - for (Font font : m_fontToBoldFontMap.values()) { - font.dispose(); - } - m_fontToBoldFontMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // Cursor - // - //////////////////////////////////////////////////////////////////////////// - /** - * Maps IDs to cursors. - */ - private static Map m_idToCursorMap = new HashMap(); - /** - * Returns the system cursor matching the specific ID. - * - * @param id - * int The ID value for the cursor - * @return Cursor The system cursor matching the specific ID - */ - public static Cursor getCursor(int id) { - Integer key = Integer.valueOf(id); - Cursor cursor = m_idToCursorMap.get(key); - if (cursor == null) { - cursor = new Cursor(Display.getDefault(), id); - m_idToCursorMap.put(key, cursor); - } - return cursor; - } - /** - * Dispose all of the cached cursors. - */ - public static void disposeCursors() { - for (Cursor cursor : m_idToCursorMap.values()) { - cursor.dispose(); - } - m_idToCursorMap.clear(); - } - //////////////////////////////////////////////////////////////////////////// - // - // General - // - //////////////////////////////////////////////////////////////////////////// - /** - * Dispose of cached objects and their underlying OS resources. This should only be called when the cached - * objects are no longer needed (e.g. on application shutdown). - */ - public static void dispose() { - disposeColors(); - disposeImages(); - disposeFonts(); - disposeCursors(); - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/test/java/bwlehrpool/AppTest.java b/Dozentenmodul/src/test/java/bwlehrpool/AppTest.java new file mode 100644 index 00000000..ffcdcc2e --- /dev/null +++ b/Dozentenmodul/src/test/java/bwlehrpool/AppTest.java @@ -0,0 +1,38 @@ +package bwlehrpool; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/Dozentenmodul/src/thrift/AuthenticationError.java b/Dozentenmodul/src/thrift/AuthenticationError.java deleted file mode 100644 index 7d543832..00000000 --- a/Dozentenmodul/src/thrift/AuthenticationError.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - - -import java.util.Map; -import java.util.HashMap; -import org.apache.thrift.TEnum; - -public enum AuthenticationError implements org.apache.thrift.TEnum { - GENERIC_ERROR(0), - INVALID_CREDENTIALS(1), - ACCOUNT_SUSPENDED(2), - BANNED_NETWORK(3); - - private final int value; - - private AuthenticationError(int value) { - this.value = value; - } - - /** - * Get the integer value of this enum value, as defined in the Thrift IDL. - */ - public int getValue() { - return value; - } - - /** - * Find a the enum type by its integer value, as defined in the Thrift IDL. - * @return null if the value is not found. - */ - public static AuthenticationError findByValue(int value) { - switch (value) { - case 0: - return GENERIC_ERROR; - case 1: - return INVALID_CREDENTIALS; - case 2: - return ACCOUNT_SUSPENDED; - case 3: - return BANNED_NETWORK; - default: - return null; - } - } -} diff --git a/Dozentenmodul/src/thrift/AuthenticationException.java b/Dozentenmodul/src/thrift/AuthenticationException.java deleted file mode 100644 index d416cacf..00000000 --- a/Dozentenmodul/src/thrift/AuthenticationException.java +++ /dev/null @@ -1,504 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AuthenticationException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException"); - - private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new AuthenticationExceptionStandardSchemeFactory()); - schemes.put(TupleScheme.class, new AuthenticationExceptionTupleSchemeFactory()); - } - - /** - * - * @see AuthenticationError - */ - public AuthenticationError number; // required - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * - * @see AuthenticationError - */ - NUMBER((short)1, "number"), - MESSAGE((short)2, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NUMBER - return NUMBER; - case 2: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AuthenticationError.class))); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap); - } - - public AuthenticationException() { - } - - public AuthenticationException( - AuthenticationError number, - String message) - { - this(); - this.number = number; - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public AuthenticationException(AuthenticationException other) { - if (other.isSetNumber()) { - this.number = other.number; - } - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public AuthenticationException deepCopy() { - return new AuthenticationException(this); - } - - @Override - public void clear() { - this.number = null; - this.message = null; - } - - /** - * - * @see AuthenticationError - */ - public AuthenticationError getNumber() { - return this.number; - } - - /** - * - * @see AuthenticationError - */ - public AuthenticationException setNumber(AuthenticationError number) { - this.number = number; - return this; - } - - public void unsetNumber() { - this.number = null; - } - - /** Returns true if field number is set (has been assigned a value) and false otherwise */ - public boolean isSetNumber() { - return this.number != null; - } - - public void setNumberIsSet(boolean value) { - if (!value) { - this.number = null; - } - } - - public String getMessage() { - return this.message; - } - - public AuthenticationException setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case NUMBER: - if (value == null) { - unsetNumber(); - } else { - setNumber((AuthenticationError)value); - } - break; - - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case NUMBER: - return getNumber(); - - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case NUMBER: - return isSetNumber(); - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof AuthenticationException) - return this.equals((AuthenticationException)that); - return false; - } - - public boolean equals(AuthenticationException that) { - if (that == null) - return false; - - boolean this_present_number = true && this.isSetNumber(); - boolean that_present_number = true && that.isSetNumber(); - if (this_present_number || that_present_number) { - if (!(this_present_number && that_present_number)) - return false; - if (!this.number.equals(that.number)) - return false; - } - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(AuthenticationException other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetNumber()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AuthenticationException("); - boolean first = true; - - sb.append("number:"); - if (this.number == null) { - sb.append("null"); - } else { - sb.append(this.number); - } - first = false; - if (!first) sb.append(", "); - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AuthenticationExceptionStandardSchemeFactory implements SchemeFactory { - public AuthenticationExceptionStandardScheme getScheme() { - return new AuthenticationExceptionStandardScheme(); - } - } - - private static class AuthenticationExceptionStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationException struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NUMBER - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.number = AuthenticationError.findByValue(iprot.readI32()); - struct.setNumberIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationException struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.number != null) { - oprot.writeFieldBegin(NUMBER_FIELD_DESC); - oprot.writeI32(struct.number.getValue()); - oprot.writeFieldEnd(); - } - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AuthenticationExceptionTupleSchemeFactory implements SchemeFactory { - public AuthenticationExceptionTupleScheme getScheme() { - return new AuthenticationExceptionTupleScheme(); - } - } - - private static class AuthenticationExceptionTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetNumber()) { - optionals.set(0); - } - if (struct.isSetMessage()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetNumber()) { - oprot.writeI32(struct.number.getValue()); - } - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.number = AuthenticationError.findByValue(iprot.readI32()); - struct.setNumberIsSet(true); - } - if (incoming.get(1)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/Dozentenmodul/src/thrift/AuthorizationError.java b/Dozentenmodul/src/thrift/AuthorizationError.java deleted file mode 100644 index 443be4f4..00000000 --- a/Dozentenmodul/src/thrift/AuthorizationError.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - - -import java.util.Map; -import java.util.HashMap; -import org.apache.thrift.TEnum; - -public enum AuthorizationError implements org.apache.thrift.TEnum { - GENERIC_ERROR(0), - NOT_AUTHENTICATED(1), - NO_PERMISSION(2); - - private final int value; - - private AuthorizationError(int value) { - this.value = value; - } - - /** - * Get the integer value of this enum value, as defined in the Thrift IDL. - */ - public int getValue() { - return value; - } - - /** - * Find a the enum type by its integer value, as defined in the Thrift IDL. - * @return null if the value is not found. - */ - public static AuthorizationError findByValue(int value) { - switch (value) { - case 0: - return GENERIC_ERROR; - case 1: - return NOT_AUTHENTICATED; - case 2: - return NO_PERMISSION; - default: - return null; - } - } -} diff --git a/Dozentenmodul/src/thrift/AuthorizationException.java b/Dozentenmodul/src/thrift/AuthorizationException.java deleted file mode 100644 index 0d5320c2..00000000 --- a/Dozentenmodul/src/thrift/AuthorizationException.java +++ /dev/null @@ -1,504 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AuthorizationException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException"); - - private static final org.apache.thrift.protocol.TField NUMBER_FIELD_DESC = new org.apache.thrift.protocol.TField("number", org.apache.thrift.protocol.TType.I32, (short)1); - private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new AuthorizationExceptionStandardSchemeFactory()); - schemes.put(TupleScheme.class, new AuthorizationExceptionTupleSchemeFactory()); - } - - /** - * - * @see AuthorizationError - */ - public AuthorizationError number; // required - public String message; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * - * @see AuthorizationError - */ - NUMBER((short)1, "number"), - MESSAGE((short)2, "message"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // NUMBER - return NUMBER; - case 2: // MESSAGE - return MESSAGE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NUMBER, new org.apache.thrift.meta_data.FieldMetaData("number", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, AuthorizationError.class))); - tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthorizationException.class, metaDataMap); - } - - public AuthorizationException() { - } - - public AuthorizationException( - AuthorizationError number, - String message) - { - this(); - this.number = number; - this.message = message; - } - - /** - * Performs a deep copy on other. - */ - public AuthorizationException(AuthorizationException other) { - if (other.isSetNumber()) { - this.number = other.number; - } - if (other.isSetMessage()) { - this.message = other.message; - } - } - - public AuthorizationException deepCopy() { - return new AuthorizationException(this); - } - - @Override - public void clear() { - this.number = null; - this.message = null; - } - - /** - * - * @see AuthorizationError - */ - public AuthorizationError getNumber() { - return this.number; - } - - /** - * - * @see AuthorizationError - */ - public AuthorizationException setNumber(AuthorizationError number) { - this.number = number; - return this; - } - - public void unsetNumber() { - this.number = null; - } - - /** Returns true if field number is set (has been assigned a value) and false otherwise */ - public boolean isSetNumber() { - return this.number != null; - } - - public void setNumberIsSet(boolean value) { - if (!value) { - this.number = null; - } - } - - public String getMessage() { - return this.message; - } - - public AuthorizationException setMessage(String message) { - this.message = message; - return this; - } - - public void unsetMessage() { - this.message = null; - } - - /** Returns true if field message is set (has been assigned a value) and false otherwise */ - public boolean isSetMessage() { - return this.message != null; - } - - public void setMessageIsSet(boolean value) { - if (!value) { - this.message = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case NUMBER: - if (value == null) { - unsetNumber(); - } else { - setNumber((AuthorizationError)value); - } - break; - - case MESSAGE: - if (value == null) { - unsetMessage(); - } else { - setMessage((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case NUMBER: - return getNumber(); - - case MESSAGE: - return getMessage(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case NUMBER: - return isSetNumber(); - case MESSAGE: - return isSetMessage(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof AuthorizationException) - return this.equals((AuthorizationException)that); - return false; - } - - public boolean equals(AuthorizationException that) { - if (that == null) - return false; - - boolean this_present_number = true && this.isSetNumber(); - boolean that_present_number = true && that.isSetNumber(); - if (this_present_number || that_present_number) { - if (!(this_present_number && that_present_number)) - return false; - if (!this.number.equals(that.number)) - return false; - } - - boolean this_present_message = true && this.isSetMessage(); - boolean that_present_message = true && that.isSetMessage(); - if (this_present_message || that_present_message) { - if (!(this_present_message && that_present_message)) - return false; - if (!this.message.equals(that.message)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(AuthorizationException other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetNumber()).compareTo(other.isSetNumber()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetNumber()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.number, other.number); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetMessage()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AuthorizationException("); - boolean first = true; - - sb.append("number:"); - if (this.number == null) { - sb.append("null"); - } else { - sb.append(this.number); - } - first = false; - if (!first) sb.append(", "); - sb.append("message:"); - if (this.message == null) { - sb.append("null"); - } else { - sb.append(this.message); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class AuthorizationExceptionStandardSchemeFactory implements SchemeFactory { - public AuthorizationExceptionStandardScheme getScheme() { - return new AuthorizationExceptionStandardScheme(); - } - } - - private static class AuthorizationExceptionStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, AuthorizationException struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // NUMBER - if (schemeField.type == org.apache.thrift.protocol.TType.I32) { - struct.number = AuthorizationError.findByValue(iprot.readI32()); - struct.setNumberIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // MESSAGE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, AuthorizationException struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.number != null) { - oprot.writeFieldBegin(NUMBER_FIELD_DESC); - oprot.writeI32(struct.number.getValue()); - oprot.writeFieldEnd(); - } - if (struct.message != null) { - oprot.writeFieldBegin(MESSAGE_FIELD_DESC); - oprot.writeString(struct.message); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class AuthorizationExceptionTupleSchemeFactory implements SchemeFactory { - public AuthorizationExceptionTupleScheme getScheme() { - return new AuthorizationExceptionTupleScheme(); - } - } - - private static class AuthorizationExceptionTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetNumber()) { - optionals.set(0); - } - if (struct.isSetMessage()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetNumber()) { - oprot.writeI32(struct.number.getValue()); - } - if (struct.isSetMessage()) { - oprot.writeString(struct.message); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.number = AuthorizationError.findByValue(iprot.readI32()); - struct.setNumberIsSet(true); - } - if (incoming.get(1)) { - struct.message = iprot.readString(); - struct.setMessageIsSet(true); - } - } - } - -} - diff --git a/Dozentenmodul/src/thrift/ImageServer.java b/Dozentenmodul/src/thrift/ImageServer.java deleted file mode 100644 index 410f437b..00000000 --- a/Dozentenmodul/src/thrift/ImageServer.java +++ /dev/null @@ -1,2871 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ImageServer { - - public interface Iface { - - public boolean ping() throws org.apache.thrift.TException; - - public SessionData authenticate(String username, String password) throws AuthenticationException, org.apache.thrift.TException; - - public UserInfo getUserFromToken(String token) throws InvalidTokenException, org.apache.thrift.TException; - - } - - public interface AsyncIface { - - public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void authenticate(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - public void getUserFromToken(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - - } - - public static class Client extends org.apache.thrift.TServiceClient implements Iface { - public static class Factory implements org.apache.thrift.TServiceClientFactory { - public Factory() {} - public Client getClient(org.apache.thrift.protocol.TProtocol prot) { - return new Client(prot); - } - public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - return new Client(iprot, oprot); - } - } - - public Client(org.apache.thrift.protocol.TProtocol prot) - { - super(prot, prot); - } - - public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { - super(iprot, oprot); - } - - public boolean ping() throws org.apache.thrift.TException - { - send_ping(); - return recv_ping(); - } - - public void send_ping() throws org.apache.thrift.TException - { - ping_args args = new ping_args(); - sendBase("ping", args); - } - - public boolean recv_ping() throws org.apache.thrift.TException - { - ping_result result = new ping_result(); - receiveBase(result, "ping"); - if (result.isSetSuccess()) { - return result.success; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "ping failed: unknown result"); - } - - public SessionData authenticate(String username, String password) throws AuthenticationException, org.apache.thrift.TException - { - send_authenticate(username, password); - return recv_authenticate(); - } - - public void send_authenticate(String username, String password) throws org.apache.thrift.TException - { - authenticate_args args = new authenticate_args(); - args.setUsername(username); - args.setPassword(password); - sendBase("authenticate", args); - } - - public SessionData recv_authenticate() throws AuthenticationException, org.apache.thrift.TException - { - authenticate_result result = new authenticate_result(); - receiveBase(result, "authenticate"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.failure != null) { - throw result.failure; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "authenticate failed: unknown result"); - } - - public UserInfo getUserFromToken(String token) throws InvalidTokenException, org.apache.thrift.TException - { - send_getUserFromToken(token); - return recv_getUserFromToken(); - } - - public void send_getUserFromToken(String token) throws org.apache.thrift.TException - { - getUserFromToken_args args = new getUserFromToken_args(); - args.setToken(token); - sendBase("getUserFromToken", args); - } - - public UserInfo recv_getUserFromToken() throws InvalidTokenException, org.apache.thrift.TException - { - getUserFromToken_result result = new getUserFromToken_result(); - receiveBase(result, "getUserFromToken"); - if (result.isSetSuccess()) { - return result.success; - } - if (result.failure != null) { - throw result.failure; - } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserFromToken failed: unknown result"); - } - - } - public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { - public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { - private org.apache.thrift.async.TAsyncClientManager clientManager; - private org.apache.thrift.protocol.TProtocolFactory protocolFactory; - public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) { - this.clientManager = clientManager; - this.protocolFactory = protocolFactory; - } - public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) { - return new AsyncClient(protocolFactory, clientManager, transport); - } - } - - public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) { - super(protocolFactory, clientManager, transport); - } - - public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - ping_call method_call = new ping_call(resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class ping_call extends org.apache.thrift.async.TAsyncMethodCall { - public ping_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("ping", org.apache.thrift.protocol.TMessageType.CALL, 0)); - ping_args args = new ping_args(); - args.write(prot); - prot.writeMessageEnd(); - } - - public boolean getResult() throws org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_ping(); - } - } - - public void authenticate(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - authenticate_call method_call = new authenticate_call(username, password, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class authenticate_call extends org.apache.thrift.async.TAsyncMethodCall { - private String username; - private String password; - public authenticate_call(String username, String password, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.username = username; - this.password = password; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("authenticate", org.apache.thrift.protocol.TMessageType.CALL, 0)); - authenticate_args args = new authenticate_args(); - args.setUsername(username); - args.setPassword(password); - args.write(prot); - prot.writeMessageEnd(); - } - - public SessionData getResult() throws AuthenticationException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_authenticate(); - } - } - - public void getUserFromToken(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { - checkReady(); - getUserFromToken_call method_call = new getUserFromToken_call(token, resultHandler, this, ___protocolFactory, ___transport); - this.___currentMethod = method_call; - ___manager.call(method_call); - } - - public static class getUserFromToken_call extends org.apache.thrift.async.TAsyncMethodCall { - private String token; - public getUserFromToken_call(String token, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { - super(client, protocolFactory, transport, resultHandler, false); - this.token = token; - } - - public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserFromToken", org.apache.thrift.protocol.TMessageType.CALL, 0)); - getUserFromToken_args args = new getUserFromToken_args(); - args.setToken(token); - args.write(prot); - prot.writeMessageEnd(); - } - - public UserInfo getResult() throws InvalidTokenException, org.apache.thrift.TException { - if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { - throw new IllegalStateException("Method call not finished!"); - } - org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); - org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_getUserFromToken(); - } - } - - } - - public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); - public Processor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected Processor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("ping", new ping()); - processMap.put("authenticate", new authenticate()); - processMap.put("getUserFromToken", new getUserFromToken()); - return processMap; - } - - public static class ping extends org.apache.thrift.ProcessFunction { - public ping() { - super("ping"); - } - - public ping_args getEmptyArgsInstance() { - return new ping_args(); - } - - protected boolean isOneway() { - return false; - } - - public ping_result getResult(I iface, ping_args args) throws org.apache.thrift.TException { - ping_result result = new ping_result(); - result.success = iface.ping(); - result.setSuccessIsSet(true); - return result; - } - } - - public static class authenticate extends org.apache.thrift.ProcessFunction { - public authenticate() { - super("authenticate"); - } - - public authenticate_args getEmptyArgsInstance() { - return new authenticate_args(); - } - - protected boolean isOneway() { - return false; - } - - public authenticate_result getResult(I iface, authenticate_args args) throws org.apache.thrift.TException { - authenticate_result result = new authenticate_result(); - try { - result.success = iface.authenticate(args.username, args.password); - } catch (AuthenticationException failure) { - result.failure = failure; - } - return result; - } - } - - public static class getUserFromToken extends org.apache.thrift.ProcessFunction { - public getUserFromToken() { - super("getUserFromToken"); - } - - public getUserFromToken_args getEmptyArgsInstance() { - return new getUserFromToken_args(); - } - - protected boolean isOneway() { - return false; - } - - public getUserFromToken_result getResult(I iface, getUserFromToken_args args) throws org.apache.thrift.TException { - getUserFromToken_result result = new getUserFromToken_result(); - try { - result.success = iface.getUserFromToken(args.token); - } catch (InvalidTokenException failure) { - result.failure = failure; - } - return result; - } - } - - } - - public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { - private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); - public AsyncProcessor(I iface) { - super(iface, getProcessMap(new HashMap>())); - } - - protected AsyncProcessor(I iface, Map> processMap) { - super(iface, getProcessMap(processMap)); - } - - private static Map> getProcessMap(Map> processMap) { - processMap.put("ping", new ping()); - processMap.put("authenticate", new authenticate()); - processMap.put("getUserFromToken", new getUserFromToken()); - return processMap; - } - - public static class ping extends org.apache.thrift.AsyncProcessFunction { - public ping() { - super("ping"); - } - - public ping_args getEmptyArgsInstance() { - return new ping_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(Boolean o) { - ping_result result = new ping_result(); - result.success = o; - result.setSuccessIsSet(true); - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - ping_result result = new ping_result(); - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, ping_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.ping(resultHandler); - } - } - - public static class authenticate extends org.apache.thrift.AsyncProcessFunction { - public authenticate() { - super("authenticate"); - } - - public authenticate_args getEmptyArgsInstance() { - return new authenticate_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(SessionData o) { - authenticate_result result = new authenticate_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - authenticate_result result = new authenticate_result(); - if (e instanceof AuthenticationException) { - result.failure = (AuthenticationException) e; - result.setFailureIsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, authenticate_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.authenticate(args.username, args.password,resultHandler); - } - } - - public static class getUserFromToken extends org.apache.thrift.AsyncProcessFunction { - public getUserFromToken() { - super("getUserFromToken"); - } - - public getUserFromToken_args getEmptyArgsInstance() { - return new getUserFromToken_args(); - } - - public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { - final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback() { - public void onComplete(UserInfo o) { - getUserFromToken_result result = new getUserFromToken_result(); - result.success = o; - try { - fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); - return; - } catch (Exception e) { - LOGGER.error("Exception writing to internal frame buffer", e); - } - fb.close(); - } - public void onError(Exception e) { - byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; - org.apache.thrift.TBase msg; - getUserFromToken_result result = new getUserFromToken_result(); - if (e instanceof InvalidTokenException) { - result.failure = (InvalidTokenException) e; - result.setFailureIsSet(true); - msg = result; - } - else - { - msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; - msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); - } - try { - fcall.sendResponse(fb,msg,msgType,seqid); - return; - } catch (Exception ex) { - LOGGER.error("Exception writing to internal frame buffer", ex); - } - fb.close(); - } - }; - } - - protected boolean isOneway() { - return false; - } - - public void start(I iface, getUserFromToken_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { - iface.getUserFromToken(args.token,resultHandler); - } - } - - } - - public static class ping_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ping_args"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new ping_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new ping_argsTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ping_args.class, metaDataMap); - } - - public ping_args() { - } - - /** - * Performs a deep copy on other. - */ - public ping_args(ping_args other) { - } - - public ping_args deepCopy() { - return new ping_args(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof ping_args) - return this.equals((ping_args)that); - return false; - } - - public boolean equals(ping_args that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(ping_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("ping_args("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class ping_argsStandardSchemeFactory implements SchemeFactory { - public ping_argsStandardScheme getScheme() { - return new ping_argsStandardScheme(); - } - } - - private static class ping_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, ping_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, ping_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class ping_argsTupleSchemeFactory implements SchemeFactory { - public ping_argsTupleScheme getScheme() { - return new ping_argsTupleScheme(); - } - } - - private static class ping_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - - } - - public static class ping_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ping_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new ping_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new ping_resultTupleSchemeFactory()); - } - - public boolean success; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ping_result.class, metaDataMap); - } - - public ping_result() { - } - - public ping_result( - boolean success) - { - this(); - this.success = success; - setSuccessIsSet(true); - } - - /** - * Performs a deep copy on other. - */ - public ping_result(ping_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; - } - - public ping_result deepCopy() { - return new ping_result(this); - } - - @Override - public void clear() { - setSuccessIsSet(false); - this.success = false; - } - - public boolean isSuccess() { - return this.success; - } - - public ping_result setSuccess(boolean success) { - this.success = success; - setSuccessIsSet(true); - return this; - } - - public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); - } - - public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((Boolean)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return Boolean.valueOf(isSuccess()); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof ping_result) - return this.equals((ping_result)that); - return false; - } - - public boolean equals(ping_result that) { - if (that == null) - return false; - - boolean this_present_success = true; - boolean that_present_success = true; - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (this.success != that.success) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(ping_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("ping_result("); - boolean first = true; - - sb.append("success:"); - sb.append(this.success); - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class ping_resultStandardSchemeFactory implements SchemeFactory { - public ping_resultStandardScheme getScheme() { - return new ping_resultStandardScheme(); - } - } - - private static class ping_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, ping_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, ping_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBool(struct.success); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class ping_resultTupleSchemeFactory implements SchemeFactory { - public ping_resultTupleScheme getScheme() { - return new ping_resultTupleScheme(); - } - } - - private static class ping_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, ping_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetSuccess()) { - oprot.writeBool(struct.success); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, ping_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.success = iprot.readBool(); - struct.setSuccessIsSet(true); - } - } - } - - } - - public static class authenticate_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_args"); - - private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new authenticate_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new authenticate_argsTupleSchemeFactory()); - } - - public String username; // required - public String password; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USERNAME((short)1, "username"), - PASSWORD((short)2, "password"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USERNAME - return USERNAME; - case 2: // PASSWORD - return PASSWORD; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_args.class, metaDataMap); - } - - public authenticate_args() { - } - - public authenticate_args( - String username, - String password) - { - this(); - this.username = username; - this.password = password; - } - - /** - * Performs a deep copy on other. - */ - public authenticate_args(authenticate_args other) { - if (other.isSetUsername()) { - this.username = other.username; - } - if (other.isSetPassword()) { - this.password = other.password; - } - } - - public authenticate_args deepCopy() { - return new authenticate_args(this); - } - - @Override - public void clear() { - this.username = null; - this.password = null; - } - - public String getUsername() { - return this.username; - } - - public authenticate_args setUsername(String username) { - this.username = username; - return this; - } - - public void unsetUsername() { - this.username = null; - } - - /** Returns true if field username is set (has been assigned a value) and false otherwise */ - public boolean isSetUsername() { - return this.username != null; - } - - public void setUsernameIsSet(boolean value) { - if (!value) { - this.username = null; - } - } - - public String getPassword() { - return this.password; - } - - public authenticate_args setPassword(String password) { - this.password = password; - return this; - } - - public void unsetPassword() { - this.password = null; - } - - /** Returns true if field password is set (has been assigned a value) and false otherwise */ - public boolean isSetPassword() { - return this.password != null; - } - - public void setPasswordIsSet(boolean value) { - if (!value) { - this.password = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USERNAME: - if (value == null) { - unsetUsername(); - } else { - setUsername((String)value); - } - break; - - case PASSWORD: - if (value == null) { - unsetPassword(); - } else { - setPassword((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USERNAME: - return getUsername(); - - case PASSWORD: - return getPassword(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USERNAME: - return isSetUsername(); - case PASSWORD: - return isSetPassword(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof authenticate_args) - return this.equals((authenticate_args)that); - return false; - } - - public boolean equals(authenticate_args that) { - if (that == null) - return false; - - boolean this_present_username = true && this.isSetUsername(); - boolean that_present_username = true && that.isSetUsername(); - if (this_present_username || that_present_username) { - if (!(this_present_username && that_present_username)) - return false; - if (!this.username.equals(that.username)) - return false; - } - - boolean this_present_password = true && this.isSetPassword(); - boolean that_present_password = true && that.isSetPassword(); - if (this_present_password || that_present_password) { - if (!(this_present_password && that_present_password)) - return false; - if (!this.password.equals(that.password)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(authenticate_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUsername()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetPassword()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("authenticate_args("); - boolean first = true; - - sb.append("username:"); - if (this.username == null) { - sb.append("null"); - } else { - sb.append(this.username); - } - first = false; - if (!first) sb.append(", "); - sb.append("password:"); - if (this.password == null) { - sb.append("null"); - } else { - sb.append(this.password); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class authenticate_argsStandardSchemeFactory implements SchemeFactory { - public authenticate_argsStandardScheme getScheme() { - return new authenticate_argsStandardScheme(); - } - } - - private static class authenticate_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USERNAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // PASSWORD - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.password = iprot.readString(); - struct.setPasswordIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, authenticate_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.username != null) { - oprot.writeFieldBegin(USERNAME_FIELD_DESC); - oprot.writeString(struct.username); - oprot.writeFieldEnd(); - } - if (struct.password != null) { - oprot.writeFieldBegin(PASSWORD_FIELD_DESC); - oprot.writeString(struct.password); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class authenticate_argsTupleSchemeFactory implements SchemeFactory { - public authenticate_argsTupleScheme getScheme() { - return new authenticate_argsTupleScheme(); - } - } - - private static class authenticate_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUsername()) { - optionals.set(0); - } - if (struct.isSetPassword()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetUsername()) { - oprot.writeString(struct.username); - } - if (struct.isSetPassword()) { - oprot.writeString(struct.password); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.username = iprot.readString(); - struct.setUsernameIsSet(true); - } - if (incoming.get(1)) { - struct.password = iprot.readString(); - struct.setPasswordIsSet(true); - } - } - } - - } - - public static class authenticate_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("authenticate_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); - private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new authenticate_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new authenticate_resultTupleSchemeFactory()); - } - - public SessionData success; // required - public AuthenticationException failure; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - FAILURE((short)1, "failure"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // FAILURE - return FAILURE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SessionData.class))); - tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(authenticate_result.class, metaDataMap); - } - - public authenticate_result() { - } - - public authenticate_result( - SessionData success, - AuthenticationException failure) - { - this(); - this.success = success; - this.failure = failure; - } - - /** - * Performs a deep copy on other. - */ - public authenticate_result(authenticate_result other) { - if (other.isSetSuccess()) { - this.success = new SessionData(other.success); - } - if (other.isSetFailure()) { - this.failure = new AuthenticationException(other.failure); - } - } - - public authenticate_result deepCopy() { - return new authenticate_result(this); - } - - @Override - public void clear() { - this.success = null; - this.failure = null; - } - - public SessionData getSuccess() { - return this.success; - } - - public authenticate_result setSuccess(SessionData success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public AuthenticationException getFailure() { - return this.failure; - } - - public authenticate_result setFailure(AuthenticationException failure) { - this.failure = failure; - return this; - } - - public void unsetFailure() { - this.failure = null; - } - - /** Returns true if field failure is set (has been assigned a value) and false otherwise */ - public boolean isSetFailure() { - return this.failure != null; - } - - public void setFailureIsSet(boolean value) { - if (!value) { - this.failure = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((SessionData)value); - } - break; - - case FAILURE: - if (value == null) { - unsetFailure(); - } else { - setFailure((AuthenticationException)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case FAILURE: - return getFailure(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case FAILURE: - return isSetFailure(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof authenticate_result) - return this.equals((authenticate_result)that); - return false; - } - - public boolean equals(authenticate_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_failure = true && this.isSetFailure(); - boolean that_present_failure = true && that.isSetFailure(); - if (this_present_failure || that_present_failure) { - if (!(this_present_failure && that_present_failure)) - return false; - if (!this.failure.equals(that.failure)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(authenticate_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetFailure()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("authenticate_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("failure:"); - if (this.failure == null) { - sb.append("null"); - } else { - sb.append(this.failure); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class authenticate_resultStandardSchemeFactory implements SchemeFactory { - public authenticate_resultStandardScheme getScheme() { - return new authenticate_resultStandardScheme(); - } - } - - private static class authenticate_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, authenticate_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new SessionData(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // FAILURE - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.failure = new AuthenticationException(); - struct.failure.read(iprot); - struct.setFailureIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, authenticate_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.failure != null) { - oprot.writeFieldBegin(FAILURE_FIELD_DESC); - struct.failure.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class authenticate_resultTupleSchemeFactory implements SchemeFactory { - public authenticate_resultTupleScheme getScheme() { - return new authenticate_resultTupleScheme(); - } - } - - private static class authenticate_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetFailure()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - if (struct.isSetFailure()) { - struct.failure.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, authenticate_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = new SessionData(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.failure = new AuthenticationException(); - struct.failure.read(iprot); - struct.setFailureIsSet(true); - } - } - } - - } - - public static class getUserFromToken_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserFromToken_args"); - - private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new getUserFromToken_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getUserFromToken_argsTupleSchemeFactory()); - } - - public String token; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - TOKEN((short)1, "token"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // TOKEN - return TOKEN; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Token"))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserFromToken_args.class, metaDataMap); - } - - public getUserFromToken_args() { - } - - public getUserFromToken_args( - String token) - { - this(); - this.token = token; - } - - /** - * Performs a deep copy on other. - */ - public getUserFromToken_args(getUserFromToken_args other) { - if (other.isSetToken()) { - this.token = other.token; - } - } - - public getUserFromToken_args deepCopy() { - return new getUserFromToken_args(this); - } - - @Override - public void clear() { - this.token = null; - } - - public String getToken() { - return this.token; - } - - public getUserFromToken_args setToken(String token) { - this.token = token; - return this; - } - - public void unsetToken() { - this.token = null; - } - - /** Returns true if field token is set (has been assigned a value) and false otherwise */ - public boolean isSetToken() { - return this.token != null; - } - - public void setTokenIsSet(boolean value) { - if (!value) { - this.token = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case TOKEN: - if (value == null) { - unsetToken(); - } else { - setToken((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case TOKEN: - return getToken(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case TOKEN: - return isSetToken(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof getUserFromToken_args) - return this.equals((getUserFromToken_args)that); - return false; - } - - public boolean equals(getUserFromToken_args that) { - if (that == null) - return false; - - boolean this_present_token = true && this.isSetToken(); - boolean that_present_token = true && that.isSetToken(); - if (this_present_token || that_present_token) { - if (!(this_present_token && that_present_token)) - return false; - if (!this.token.equals(that.token)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(getUserFromToken_args other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetToken()).compareTo(other.isSetToken()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetToken()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("getUserFromToken_args("); - boolean first = true; - - sb.append("token:"); - if (this.token == null) { - sb.append("null"); - } else { - sb.append(this.token); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class getUserFromToken_argsStandardSchemeFactory implements SchemeFactory { - public getUserFromToken_argsStandardScheme getScheme() { - return new getUserFromToken_argsStandardScheme(); - } - } - - private static class getUserFromToken_argsStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, getUserFromToken_args struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // TOKEN - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.token = iprot.readString(); - struct.setTokenIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, getUserFromToken_args struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.token != null) { - oprot.writeFieldBegin(TOKEN_FIELD_DESC); - oprot.writeString(struct.token); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class getUserFromToken_argsTupleSchemeFactory implements SchemeFactory { - public getUserFromToken_argsTupleScheme getScheme() { - return new getUserFromToken_argsTupleScheme(); - } - } - - private static class getUserFromToken_argsTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_args struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetToken()) { - optionals.set(0); - } - oprot.writeBitSet(optionals, 1); - if (struct.isSetToken()) { - oprot.writeString(struct.token); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_args struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(1); - if (incoming.get(0)) { - struct.token = iprot.readString(); - struct.setTokenIsSet(true); - } - } - } - - } - - public static class getUserFromToken_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserFromToken_result"); - - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0); - private static final org.apache.thrift.protocol.TField FAILURE_FIELD_DESC = new org.apache.thrift.protocol.TField("failure", org.apache.thrift.protocol.TType.STRUCT, (short)1); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new getUserFromToken_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getUserFromToken_resultTupleSchemeFactory()); - } - - public UserInfo success; // required - public InvalidTokenException failure; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short)0, "success"), - FAILURE((short)1, "failure"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 0: // SUCCESS - return SUCCESS; - case 1: // FAILURE - return FAILURE; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserInfo.class))); - tmpMap.put(_Fields.FAILURE, new org.apache.thrift.meta_data.FieldMetaData("failure", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserFromToken_result.class, metaDataMap); - } - - public getUserFromToken_result() { - } - - public getUserFromToken_result( - UserInfo success, - InvalidTokenException failure) - { - this(); - this.success = success; - this.failure = failure; - } - - /** - * Performs a deep copy on other. - */ - public getUserFromToken_result(getUserFromToken_result other) { - if (other.isSetSuccess()) { - this.success = new UserInfo(other.success); - } - if (other.isSetFailure()) { - this.failure = new InvalidTokenException(other.failure); - } - } - - public getUserFromToken_result deepCopy() { - return new getUserFromToken_result(this); - } - - @Override - public void clear() { - this.success = null; - this.failure = null; - } - - public UserInfo getSuccess() { - return this.success; - } - - public getUserFromToken_result setSuccess(UserInfo success) { - this.success = success; - return this; - } - - public void unsetSuccess() { - this.success = null; - } - - /** Returns true if field success is set (has been assigned a value) and false otherwise */ - public boolean isSetSuccess() { - return this.success != null; - } - - public void setSuccessIsSet(boolean value) { - if (!value) { - this.success = null; - } - } - - public InvalidTokenException getFailure() { - return this.failure; - } - - public getUserFromToken_result setFailure(InvalidTokenException failure) { - this.failure = failure; - return this; - } - - public void unsetFailure() { - this.failure = null; - } - - /** Returns true if field failure is set (has been assigned a value) and false otherwise */ - public boolean isSetFailure() { - return this.failure != null; - } - - public void setFailureIsSet(boolean value) { - if (!value) { - this.failure = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((UserInfo)value); - } - break; - - case FAILURE: - if (value == null) { - unsetFailure(); - } else { - setFailure((InvalidTokenException)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SUCCESS: - return getSuccess(); - - case FAILURE: - return getFailure(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SUCCESS: - return isSetSuccess(); - case FAILURE: - return isSetFailure(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof getUserFromToken_result) - return this.equals((getUserFromToken_result)that); - return false; - } - - public boolean equals(getUserFromToken_result that) { - if (that == null) - return false; - - boolean this_present_success = true && this.isSetSuccess(); - boolean that_present_success = true && that.isSetSuccess(); - if (this_present_success || that_present_success) { - if (!(this_present_success && that_present_success)) - return false; - if (!this.success.equals(that.success)) - return false; - } - - boolean this_present_failure = true && this.isSetFailure(); - boolean that_present_failure = true && that.isSetFailure(); - if (this_present_failure || that_present_failure) { - if (!(this_present_failure && that_present_failure)) - return false; - if (!this.failure.equals(that.failure)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(getUserFromToken_result other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetFailure()).compareTo(other.isSetFailure()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetFailure()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failure, other.failure); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("getUserFromToken_result("); - boolean first = true; - - sb.append("success:"); - if (this.success == null) { - sb.append("null"); - } else { - sb.append(this.success); - } - first = false; - if (!first) sb.append(", "); - sb.append("failure:"); - if (this.failure == null) { - sb.append("null"); - } else { - sb.append(this.failure); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - if (success != null) { - success.validate(); - } - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class getUserFromToken_resultStandardSchemeFactory implements SchemeFactory { - public getUserFromToken_resultStandardScheme getScheme() { - return new getUserFromToken_resultStandardScheme(); - } - } - - private static class getUserFromToken_resultStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, getUserFromToken_result struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.success = new UserInfo(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 1: // FAILURE - if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { - struct.failure = new InvalidTokenException(); - struct.failure.read(iprot); - struct.setFailureIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, getUserFromToken_result struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.success != null) { - oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - struct.success.write(oprot); - oprot.writeFieldEnd(); - } - if (struct.failure != null) { - oprot.writeFieldBegin(FAILURE_FIELD_DESC); - struct.failure.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class getUserFromToken_resultTupleSchemeFactory implements SchemeFactory { - public getUserFromToken_resultTupleScheme getScheme() { - return new getUserFromToken_resultTupleScheme(); - } - } - - private static class getUserFromToken_resultTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_result struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSuccess()) { - optionals.set(0); - } - if (struct.isSetFailure()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetSuccess()) { - struct.success.write(oprot); - } - if (struct.isSetFailure()) { - struct.failure.write(oprot); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getUserFromToken_result struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); - if (incoming.get(0)) { - struct.success = new UserInfo(); - struct.success.read(iprot); - struct.setSuccessIsSet(true); - } - if (incoming.get(1)) { - struct.failure = new InvalidTokenException(); - struct.failure.read(iprot); - struct.setFailureIsSet(true); - } - } - } - - } - -} diff --git a/Dozentenmodul/src/thrift/InvalidTokenException.java b/Dozentenmodul/src/thrift/InvalidTokenException.java deleted file mode 100644 index 914199b5..00000000 --- a/Dozentenmodul/src/thrift/InvalidTokenException.java +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class InvalidTokenException extends TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidTokenException"); - - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new InvalidTokenExceptionStandardSchemeFactory()); - schemes.put(TupleScheme.class, new InvalidTokenExceptionTupleSchemeFactory()); - } - - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { -; - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidTokenException.class, metaDataMap); - } - - public InvalidTokenException() { - } - - /** - * Performs a deep copy on other. - */ - public InvalidTokenException(InvalidTokenException other) { - } - - public InvalidTokenException deepCopy() { - return new InvalidTokenException(this); - } - - @Override - public void clear() { - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof InvalidTokenException) - return this.equals((InvalidTokenException)that); - return false; - } - - public boolean equals(InvalidTokenException that) { - if (that == null) - return false; - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(InvalidTokenException other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("InvalidTokenException("); - boolean first = true; - - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class InvalidTokenExceptionStandardSchemeFactory implements SchemeFactory { - public InvalidTokenExceptionStandardScheme getScheme() { - return new InvalidTokenExceptionStandardScheme(); - } - } - - private static class InvalidTokenExceptionStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidTokenException struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, InvalidTokenException struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class InvalidTokenExceptionTupleSchemeFactory implements SchemeFactory { - public InvalidTokenExceptionTupleScheme getScheme() { - return new InvalidTokenExceptionTupleScheme(); - } - } - - private static class InvalidTokenExceptionTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, InvalidTokenException struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, InvalidTokenException struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - } - } - -} - diff --git a/Dozentenmodul/src/thrift/MasterThriftConnection.java b/Dozentenmodul/src/thrift/MasterThriftConnection.java deleted file mode 100644 index 11a27368..00000000 --- a/Dozentenmodul/src/thrift/MasterThriftConnection.java +++ /dev/null @@ -1,46 +0,0 @@ -package thrift; - -import javax.swing.JOptionPane; - -import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.transport.TSocket; -import org.apache.thrift.transport.TTransport; -import org.apache.thrift.transport.TTransportException; - -import thrift.ImageServer.Client; - - - -public class MasterThriftConnection { - - public static final String MASTERSERVERIP="132.230.4.16"; - //public static final String MASTERSERVERIP="127.0.0.1"; - - final TTransport transport = new TSocket(MASTERSERVERIP, 9090); - - public Client getMasterThriftConnection() - { - - try { - transport.open(); - } catch (TTransportException e) { - System.out.println("Keine Verbindung m\u00f6glich!"); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - return null; - } - - final TProtocol protocol = new TBinaryProtocol(transport); - final Client client = new Client(protocol); - System.out.println("Masterserver erreichbar."); - - return client; - } - - public void closeMasterThriftConnection() - { - transport.close(); - } -} diff --git a/Dozentenmodul/src/thrift/SessionData.java b/Dozentenmodul/src/thrift/SessionData.java deleted file mode 100644 index f754ecb3..00000000 --- a/Dozentenmodul/src/thrift/SessionData.java +++ /dev/null @@ -1,597 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; - -import javax.swing.JOptionPane; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SessionData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SessionData"); - - private static final org.apache.thrift.protocol.TField SESSION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField AUTH_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authToken", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField SERVER_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("serverAddress", org.apache.thrift.protocol.TType.STRING, (short)3); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new SessionDataStandardSchemeFactory()); - schemes.put(TupleScheme.class, new SessionDataTupleSchemeFactory()); - } - - public String sessionId; // required - public String authToken; // required - public String serverAddress; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SESSION_ID((short)1, "sessionId"), - AUTH_TOKEN((short)2, "authToken"), - SERVER_ADDRESS((short)3, "serverAddress"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // SESSION_ID - return SESSION_ID; - case 2: // AUTH_TOKEN - return AUTH_TOKEN; - case 3: // SERVER_ADDRESS - return SERVER_ADDRESS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SESSION_ID, new org.apache.thrift.meta_data.FieldMetaData("sessionId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "ID"))); - tmpMap.put(_Fields.AUTH_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authToken", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Token"))); - tmpMap.put(_Fields.SERVER_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("serverAddress", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SessionData.class, metaDataMap); - } - - public SessionData() { - } - - public SessionData( - String sessionId, - String authToken, - String serverAddress) - { - this(); - this.sessionId = sessionId; - this.authToken = authToken; - this.serverAddress = serverAddress; - } - - /** - * Performs a deep copy on other. - */ - public SessionData(SessionData other) { - if (other.isSetSessionId()) { - this.sessionId = other.sessionId; - } - if (other.isSetAuthToken()) { - this.authToken = other.authToken; - } - if (other.isSetServerAddress()) { - this.serverAddress = other.serverAddress; - } - } - - public SessionData deepCopy() { - return new SessionData(this); - } - - @Override - public void clear() { - this.sessionId = null; - this.authToken = null; - this.serverAddress = null; - } - - public String getSessionId() { - return this.sessionId; - } - - public SessionData setSessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - public void unsetSessionId() { - this.sessionId = null; - } - - /** Returns true if field sessionId is set (has been assigned a value) and false otherwise */ - public boolean isSetSessionId() { - return this.sessionId != null; - } - - public void setSessionIdIsSet(boolean value) { - if (!value) { - this.sessionId = null; - } - } - - public String getAuthToken() { - return this.authToken; - } - - public SessionData setAuthToken(String authToken) { - this.authToken = authToken; - return this; - } - - public void unsetAuthToken() { - this.authToken = null; - } - - /** Returns true if field authToken is set (has been assigned a value) and false otherwise */ - public boolean isSetAuthToken() { - return this.authToken != null; - } - - public void setAuthTokenIsSet(boolean value) { - if (!value) { - this.authToken = null; - } - } - - public String getServerAddress() { - return this.serverAddress; - } - - public SessionData setServerAddress(String serverAddress) { - this.serverAddress = serverAddress; - return this; - } - - public void unsetServerAddress() { - this.serverAddress = null; - } - - /** Returns true if field serverAddress is set (has been assigned a value) and false otherwise */ - public boolean isSetServerAddress() { - return this.serverAddress != null; - } - - public void setServerAddressIsSet(boolean value) { - if (!value) { - this.serverAddress = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case SESSION_ID: - if (value == null) { - unsetSessionId(); - } else { - setSessionId((String)value); - } - break; - - case AUTH_TOKEN: - if (value == null) { - unsetAuthToken(); - } else { - setAuthToken((String)value); - } - break; - - case SERVER_ADDRESS: - if (value == null) { - unsetServerAddress(); - } else { - setServerAddress((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case SESSION_ID: - return getSessionId(); - - case AUTH_TOKEN: - return getAuthToken(); - - case SERVER_ADDRESS: - return getServerAddress(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case SESSION_ID: - return isSetSessionId(); - case AUTH_TOKEN: - return isSetAuthToken(); - case SERVER_ADDRESS: - return isSetServerAddress(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof SessionData) - return this.equals((SessionData)that); - return false; - } - - public boolean equals(SessionData that) { - if (that == null) - return false; - - boolean this_present_sessionId = true && this.isSetSessionId(); - boolean that_present_sessionId = true && that.isSetSessionId(); - if (this_present_sessionId || that_present_sessionId) { - if (!(this_present_sessionId && that_present_sessionId)) - return false; - if (!this.sessionId.equals(that.sessionId)) - return false; - } - - boolean this_present_authToken = true && this.isSetAuthToken(); - boolean that_present_authToken = true && that.isSetAuthToken(); - if (this_present_authToken || that_present_authToken) { - if (!(this_present_authToken && that_present_authToken)) - return false; - if (!this.authToken.equals(that.authToken)) - return false; - } - - boolean this_present_serverAddress = true && this.isSetServerAddress(); - boolean that_present_serverAddress = true && that.isSetServerAddress(); - if (this_present_serverAddress || that_present_serverAddress) { - if (!(this_present_serverAddress && that_present_serverAddress)) - return false; - if (!this.serverAddress.equals(that.serverAddress)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(SessionData other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetSessionId()).compareTo(other.isSetSessionId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetSessionId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionId, other.sessionId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetAuthToken()).compareTo(other.isSetAuthToken()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAuthToken()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authToken, other.authToken); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetServerAddress()).compareTo(other.isSetServerAddress()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetServerAddress()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverAddress, other.serverAddress); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("SessionData("); - boolean first = true; - - sb.append("sessionId:"); - if (this.sessionId == null) { - sb.append("null"); - } else { - sb.append(this.sessionId); - } - first = false; - if (!first) sb.append(", "); - sb.append("authToken:"); - if (this.authToken == null) { - sb.append("null"); - } else { - sb.append(this.authToken); - } - first = false; - if (!first) sb.append(", "); - sb.append("serverAddress:"); - if (this.serverAddress == null) { - sb.append("null"); - } else { - sb.append(this.serverAddress); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - JOptionPane.showMessageDialog(null, - te.getCause()+"\n"+te.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - JOptionPane.showMessageDialog(null, - te.getCause()+"\n"+te.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - throw new java.io.IOException(te); - } - } - - private static class SessionDataStandardSchemeFactory implements SchemeFactory { - public SessionDataStandardScheme getScheme() { - return new SessionDataStandardScheme(); - } - } - - private static class SessionDataStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, SessionData struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // SESSION_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.sessionId = iprot.readString(); - struct.setSessionIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // AUTH_TOKEN - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.authToken = iprot.readString(); - struct.setAuthTokenIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // SERVER_ADDRESS - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.serverAddress = iprot.readString(); - struct.setServerAddressIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, SessionData struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.sessionId != null) { - oprot.writeFieldBegin(SESSION_ID_FIELD_DESC); - oprot.writeString(struct.sessionId); - oprot.writeFieldEnd(); - } - if (struct.authToken != null) { - oprot.writeFieldBegin(AUTH_TOKEN_FIELD_DESC); - oprot.writeString(struct.authToken); - oprot.writeFieldEnd(); - } - if (struct.serverAddress != null) { - oprot.writeFieldBegin(SERVER_ADDRESS_FIELD_DESC); - oprot.writeString(struct.serverAddress); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class SessionDataTupleSchemeFactory implements SchemeFactory { - public SessionDataTupleScheme getScheme() { - return new SessionDataTupleScheme(); - } - } - - private static class SessionDataTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, SessionData struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetSessionId()) { - optionals.set(0); - } - if (struct.isSetAuthToken()) { - optionals.set(1); - } - if (struct.isSetServerAddress()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetSessionId()) { - oprot.writeString(struct.sessionId); - } - if (struct.isSetAuthToken()) { - oprot.writeString(struct.authToken); - } - if (struct.isSetServerAddress()) { - oprot.writeString(struct.serverAddress); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, SessionData struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.sessionId = iprot.readString(); - struct.setSessionIdIsSet(true); - } - if (incoming.get(1)) { - struct.authToken = iprot.readString(); - struct.setAuthTokenIsSet(true); - } - if (incoming.get(2)) { - struct.serverAddress = iprot.readString(); - struct.setServerAddressIsSet(true); - } - } - } - -} - diff --git a/Dozentenmodul/src/thrift/ThriftConnection.java b/Dozentenmodul/src/thrift/ThriftConnection.java deleted file mode 100644 index 3eec5d25..00000000 --- a/Dozentenmodul/src/thrift/ThriftConnection.java +++ /dev/null @@ -1,53 +0,0 @@ -package thrift; - -import javax.swing.JOptionPane; - -import models.SessionData; - -import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.transport.TSocket; -import org.apache.thrift.transport.TTransport; -import org.apache.thrift.transport.TTransportException; - -import server.Server; -import server.Server.Client; - -public class ThriftConnection { - - private String satAddress = ""+SessionData.session.getServerAdress(); - final TTransport transport = new TSocket(satAddress, 9090); - - public ThriftConnection() { - // TODO Auto-generated constructor stub - } - - public Client getThriftConnection() - { - - try { - transport.open(); - } catch (TTransportException e) { - System.out.println("Keine Verbindung m\u00f6glich! Satellit="+satAddress); - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - //System.out.println("Keine Verbindung moeglich! Satellit="); - return null; - } - - final TProtocol protocol = new TBinaryProtocol(transport); - - final Server.Client client = new Server.Client(protocol); - System.out.println("Verbindung zu "+satAddress+" wurde aufgebaut."); - - return client; - } - - public void closeThriftConnection() - { - System.out.println("Verbindung wird geplant getrennt..."); - transport.close(); - } -} diff --git a/Dozentenmodul/src/thrift/UserInfo.java b/Dozentenmodul/src/thrift/UserInfo.java deleted file mode 100644 index 56678646..00000000 --- a/Dozentenmodul/src/thrift/UserInfo.java +++ /dev/null @@ -1,688 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.1) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -package thrift; - -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class UserInfo implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo"); - - private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField FIRST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("firstName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField LAST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastName", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField E_MAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("eMail", org.apache.thrift.protocol.TType.STRING, (short)4); - - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new UserInfoStandardSchemeFactory()); - schemes.put(TupleScheme.class, new UserInfoTupleSchemeFactory()); - } - - public String userId; // required - public String firstName; // required - public String lastName; // required - public String eMail; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - USER_ID((short)1, "userId"), - FIRST_NAME((short)2, "firstName"), - LAST_NAME((short)3, "lastName"), - E_MAIL((short)4, "eMail"); - - private static final Map byName = new HashMap(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // USER_ID - return USER_ID; - case 2: // FIRST_NAME - return FIRST_NAME; - case 3: // LAST_NAME - return LAST_NAME; - case 4: // E_MAIL - return E_MAIL; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.FIRST_NAME, new org.apache.thrift.meta_data.FieldMetaData("firstName", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.LAST_NAME, new org.apache.thrift.meta_data.FieldMetaData("lastName", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.E_MAIL, new org.apache.thrift.meta_data.FieldMetaData("eMail", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserInfo.class, metaDataMap); - } - - public UserInfo() { - } - - public UserInfo( - String userId, - String firstName, - String lastName, - String eMail) - { - this(); - this.userId = userId; - this.firstName = firstName; - this.lastName = lastName; - this.eMail = eMail; - } - - /** - * Performs a deep copy on other. - */ - public UserInfo(UserInfo other) { - if (other.isSetUserId()) { - this.userId = other.userId; - } - if (other.isSetFirstName()) { - this.firstName = other.firstName; - } - if (other.isSetLastName()) { - this.lastName = other.lastName; - } - if (other.isSetEMail()) { - this.eMail = other.eMail; - } - } - - public UserInfo deepCopy() { - return new UserInfo(this); - } - - @Override - public void clear() { - this.userId = null; - this.firstName = null; - this.lastName = null; - this.eMail = null; - } - - public String getUserId() { - return this.userId; - } - - public UserInfo setUserId(String userId) { - this.userId = userId; - return this; - } - - public void unsetUserId() { - this.userId = null; - } - - /** Returns true if field userId is set (has been assigned a value) and false otherwise */ - public boolean isSetUserId() { - return this.userId != null; - } - - public void setUserIdIsSet(boolean value) { - if (!value) { - this.userId = null; - } - } - - public String getFirstName() { - return this.firstName; - } - - public UserInfo setFirstName(String firstName) { - this.firstName = firstName; - return this; - } - - public void unsetFirstName() { - this.firstName = null; - } - - /** Returns true if field firstName is set (has been assigned a value) and false otherwise */ - public boolean isSetFirstName() { - return this.firstName != null; - } - - public void setFirstNameIsSet(boolean value) { - if (!value) { - this.firstName = null; - } - } - - public String getLastName() { - return this.lastName; - } - - public UserInfo setLastName(String lastName) { - this.lastName = lastName; - return this; - } - - public void unsetLastName() { - this.lastName = null; - } - - /** Returns true if field lastName is set (has been assigned a value) and false otherwise */ - public boolean isSetLastName() { - return this.lastName != null; - } - - public void setLastNameIsSet(boolean value) { - if (!value) { - this.lastName = null; - } - } - - public String getEMail() { - return this.eMail; - } - - public UserInfo setEMail(String eMail) { - this.eMail = eMail; - return this; - } - - public void unsetEMail() { - this.eMail = null; - } - - /** Returns true if field eMail is set (has been assigned a value) and false otherwise */ - public boolean isSetEMail() { - return this.eMail != null; - } - - public void setEMailIsSet(boolean value) { - if (!value) { - this.eMail = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case USER_ID: - if (value == null) { - unsetUserId(); - } else { - setUserId((String)value); - } - break; - - case FIRST_NAME: - if (value == null) { - unsetFirstName(); - } else { - setFirstName((String)value); - } - break; - - case LAST_NAME: - if (value == null) { - unsetLastName(); - } else { - setLastName((String)value); - } - break; - - case E_MAIL: - if (value == null) { - unsetEMail(); - } else { - setEMail((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case USER_ID: - return getUserId(); - - case FIRST_NAME: - return getFirstName(); - - case LAST_NAME: - return getLastName(); - - case E_MAIL: - return getEMail(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case USER_ID: - return isSetUserId(); - case FIRST_NAME: - return isSetFirstName(); - case LAST_NAME: - return isSetLastName(); - case E_MAIL: - return isSetEMail(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof UserInfo) - return this.equals((UserInfo)that); - return false; - } - - public boolean equals(UserInfo that) { - if (that == null) - return false; - - boolean this_present_userId = true && this.isSetUserId(); - boolean that_present_userId = true && that.isSetUserId(); - if (this_present_userId || that_present_userId) { - if (!(this_present_userId && that_present_userId)) - return false; - if (!this.userId.equals(that.userId)) - return false; - } - - boolean this_present_firstName = true && this.isSetFirstName(); - boolean that_present_firstName = true && that.isSetFirstName(); - if (this_present_firstName || that_present_firstName) { - if (!(this_present_firstName && that_present_firstName)) - return false; - if (!this.firstName.equals(that.firstName)) - return false; - } - - boolean this_present_lastName = true && this.isSetLastName(); - boolean that_present_lastName = true && that.isSetLastName(); - if (this_present_lastName || that_present_lastName) { - if (!(this_present_lastName && that_present_lastName)) - return false; - if (!this.lastName.equals(that.lastName)) - return false; - } - - boolean this_present_eMail = true && this.isSetEMail(); - boolean that_present_eMail = true && that.isSetEMail(); - if (this_present_eMail || that_present_eMail) { - if (!(this_present_eMail && that_present_eMail)) - return false; - if (!this.eMail.equals(that.eMail)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public int compareTo(UserInfo other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - - lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetUserId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetFirstName()).compareTo(other.isSetFirstName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetFirstName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstName, other.firstName); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetLastName()).compareTo(other.isSetLastName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetLastName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastName, other.lastName); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetEMail()).compareTo(other.isSetEMail()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetEMail()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eMail, other.eMail); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("UserInfo("); - boolean first = true; - - sb.append("userId:"); - if (this.userId == null) { - sb.append("null"); - } else { - sb.append(this.userId); - } - first = false; - if (!first) sb.append(", "); - sb.append("firstName:"); - if (this.firstName == null) { - sb.append("null"); - } else { - sb.append(this.firstName); - } - first = false; - if (!first) sb.append(", "); - sb.append("lastName:"); - if (this.lastName == null) { - sb.append("null"); - } else { - sb.append(this.lastName); - } - first = false; - if (!first) sb.append(", "); - sb.append("eMail:"); - if (this.eMail == null) { - sb.append("null"); - } else { - sb.append(this.eMail); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - // check for sub-struct validity - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private static class UserInfoStandardSchemeFactory implements SchemeFactory { - public UserInfoStandardScheme getScheme() { - return new UserInfoStandardScheme(); - } - } - - private static class UserInfoStandardScheme extends StandardScheme { - - public void read(org.apache.thrift.protocol.TProtocol iprot, UserInfo struct) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField schemeField; - iprot.readStructBegin(); - while (true) - { - schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (schemeField.id) { - case 1: // USER_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.userId = iprot.readString(); - struct.setUserIdIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // FIRST_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.firstName = iprot.readString(); - struct.setFirstNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // LAST_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.lastName = iprot.readString(); - struct.setLastNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // E_MAIL - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.eMail = iprot.readString(); - struct.setEMailIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - struct.validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot, UserInfo struct) throws org.apache.thrift.TException { - struct.validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (struct.userId != null) { - oprot.writeFieldBegin(USER_ID_FIELD_DESC); - oprot.writeString(struct.userId); - oprot.writeFieldEnd(); - } - if (struct.firstName != null) { - oprot.writeFieldBegin(FIRST_NAME_FIELD_DESC); - oprot.writeString(struct.firstName); - oprot.writeFieldEnd(); - } - if (struct.lastName != null) { - oprot.writeFieldBegin(LAST_NAME_FIELD_DESC); - oprot.writeString(struct.lastName); - oprot.writeFieldEnd(); - } - if (struct.eMail != null) { - oprot.writeFieldBegin(E_MAIL_FIELD_DESC); - oprot.writeString(struct.eMail); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - } - - private static class UserInfoTupleSchemeFactory implements SchemeFactory { - public UserInfoTupleScheme getScheme() { - return new UserInfoTupleScheme(); - } - } - - private static class UserInfoTupleScheme extends TupleScheme { - - @Override - public void write(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetUserId()) { - optionals.set(0); - } - if (struct.isSetFirstName()) { - optionals.set(1); - } - if (struct.isSetLastName()) { - optionals.set(2); - } - if (struct.isSetEMail()) { - optionals.set(3); - } - oprot.writeBitSet(optionals, 4); - if (struct.isSetUserId()) { - oprot.writeString(struct.userId); - } - if (struct.isSetFirstName()) { - oprot.writeString(struct.firstName); - } - if (struct.isSetLastName()) { - oprot.writeString(struct.lastName); - } - if (struct.isSetEMail()) { - oprot.writeString(struct.eMail); - } - } - - @Override - public void read(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(4); - if (incoming.get(0)) { - struct.userId = iprot.readString(); - struct.setUserIdIsSet(true); - } - if (incoming.get(1)) { - struct.firstName = iprot.readString(); - struct.setFirstNameIsSet(true); - } - if (incoming.get(2)) { - struct.lastName = iprot.readString(); - struct.setLastNameIsSet(true); - } - if (incoming.get(3)) { - struct.eMail = iprot.readString(); - struct.setEMailIsSet(true); - } - } - } - -} - diff --git a/Dozentenmodul/src/util/GuiOrganizer.java b/Dozentenmodul/src/util/GuiOrganizer.java deleted file mode 100644 index f03c3811..00000000 --- a/Dozentenmodul/src/util/GuiOrganizer.java +++ /dev/null @@ -1,26 +0,0 @@ -package util; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.Window; - -public abstract class GuiOrganizer { - - - - - /*receive GUI, set it to center of the screen*/ - public static void centerGUI(Window gui) - { - Dimension dm = Toolkit.getDefaultToolkit().getScreenSize(); - double width = dm.getWidth(); - double height = dm.getHeight(); - double xPosition = (width / 2 - gui.getWidth() / 2); - double yPosition = (height / 2 - gui.getHeight() / 2); - gui.setLocation((int) xPosition, (int) yPosition); - } - - - - -} diff --git a/Dozentenmodul/src/util/OpenLinks.java b/Dozentenmodul/src/util/OpenLinks.java deleted file mode 100644 index a3968825..00000000 --- a/Dozentenmodul/src/util/OpenLinks.java +++ /dev/null @@ -1,20 +0,0 @@ -package util; - -import java.awt.Desktop; -import java.net.URI; - -public class OpenLinks { - - - public static void openWebpage(URI uri) { - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - desktop.browse(uri); - } catch (Exception e) { - e.printStackTrace(); - } - } - }// end openWebpage - -} -- cgit v1.2.3-55-g7522