Compare commits
476 Commits
f5538bc220
...
json
| Author | SHA1 | Date | |
|---|---|---|---|
| c7a2e80f1e | |||
| 83d48d4db1 | |||
| f2644392ad | |||
| 641ce80102 | |||
| 7924212fed | |||
| 3090e80f72 | |||
| b418066932 | |||
| f5eaf3df25 | |||
| bf5a648582 | |||
| 114e2ac4ad | |||
| b5e3a2c011 | |||
| b8d10a1434 | |||
| 46cdd480bc | |||
| 93396a00b1 | |||
| eeb57ab7c2 | |||
| e53f0ed939 | |||
| 9eede4802e | |||
| 688f36c4c3 | |||
| c270429c66 | |||
| 6135b738ba | |||
| 41ce6527d5 | |||
| cba4425cd7 | |||
| 0cb4022969 | |||
| 0ec1ce09da | |||
| ef92651552 | |||
| d8178fa704 | |||
| c148f62198 | |||
| e1291446c8 | |||
| 1f4b736188 | |||
| 47a4772632 | |||
| 571e2d2544 | |||
| 62a45fd8be | |||
| 6e0956e3e5 | |||
| b46f86bebb | |||
| d2c2f571ff | |||
| 70771dd0ce | |||
| b37e20e4a4 | |||
| e8c748eb7e | |||
| da4e8b07bc | |||
| 611194be8c | |||
| a0c45a2df0 | |||
| 8d236c99b8 | |||
| ccf20c354b | |||
| 28eee09056 | |||
| cb1f19cfb7 | |||
| 74f9a68ceb | |||
| 9303839e8e | |||
| dc17b7d741 | |||
| eb86b936bc | |||
| cd86f1257a | |||
| 46e1bd17f1 | |||
| 7efe852bc1 | |||
| 829cd0c770 | |||
| 6faf06f949 | |||
| 73a39681f1 | |||
| 4c5331de55 | |||
| 411e97abb8 | |||
| fd21de489e | |||
| aac4221a4d | |||
| f1a1ce0436 | |||
| 419af0766e | |||
| 98ec37233a | |||
| 32e1e68d9a | |||
| 68cf40367a | |||
| c6d2452530 | |||
| 76c710b1bc | |||
| 029947c793 | |||
| 38f39411ad | |||
| cb7b5809f1 | |||
| ddf04c6f39 | |||
| 48290ccf97 | |||
| e706b52b53 | |||
| c8045a5db1 | |||
| 5ef516d019 | |||
| 4f5a091af7 | |||
| cc21931ebe | |||
| 18227f565a | |||
| ef5bd5b1a8 | |||
| 41b98607cd | |||
| 7178ecbc9c | |||
| dcdbaa83cf | |||
| 86b582dd1f | |||
| c7a618dd25 | |||
| fb296a02ee | |||
| 19afec4d25 | |||
| 1ae4d1980a | |||
| 919e7a2e10 | |||
| fef75270a7 | |||
| 2a30a42e77 | |||
| b900622e4e | |||
| a47a6705d8 | |||
| 809b1f8d14 | |||
| 23b143f916 | |||
| 7ef9ee0d5c | |||
| a60ed8f661 | |||
| 74ae6abf50 | |||
| b4d0a62d6c | |||
| 535053baca | |||
| af644f8f04 | |||
| dae9d58d82 | |||
| 4f50c4a559 | |||
| fcebae094f | |||
| abab3f067c | |||
| 167ceb42a5 | |||
| cf9b028400 | |||
| b763c2c266 | |||
| 811acba5a7 | |||
| bc1faa1a06 | |||
| f6cc447481 | |||
| 10c213feae | |||
| 74146fae4c | |||
| df204b64a7 | |||
| 2d0d69fd7a | |||
| 637e9c5c0f | |||
| 78ee5bc428 | |||
| 0b5f8c6ec7 | |||
| 3f4ef5f198 | |||
| afaaaba1e7 | |||
| 21a41987b4 | |||
| 933638afb8 | |||
| b6b7bb3ae5 | |||
| 6a3be45b1a | |||
| 55aa66fa18 | |||
| 2ab2a79d8d | |||
| c8d597e9cd | |||
| 9a5b84c068 | |||
| 174bc344a4 | |||
| e2b307d4f6 | |||
| a2017f9e01 | |||
| 9f4eb9d88e | |||
| 04cf5c1552 | |||
| c7626e877e | |||
|
|
cb7360ae86 | ||
| 8fc70d48ad | |||
| 4ce7190905 | |||
| dc68667b20 | |||
| 1d97048de1 | |||
| 91e40c4393 | |||
| a6e02172f8 | |||
| 8a6c9804b4 | |||
| 8aea85a009 | |||
| b1740da1f1 | |||
| 5653438b75 | |||
| c85661a264 | |||
| d2a333c7cb | |||
| f3747a359b | |||
| e123600e06 | |||
| c4157fc30b | |||
| e428d621ac | |||
| aa5bcc7df7 | |||
| dec4835187 | |||
| d66fdc5e77 | |||
| 670324837d | |||
| ab0e0af6b3 | |||
| b08242fed4 | |||
| 7b81a8bdd0 | |||
| 20aef1f340 | |||
| 39f5b99ade | |||
| e8d6764563 | |||
| 9c0f3215ad | |||
| b908ddc8f1 | |||
| 0b35c948ab | |||
| b79b33e232 | |||
| 0e2d2abb84 | |||
| fe78d89a58 | |||
| 7f9305f02b | |||
|
|
fca5bb42bd | ||
|
|
4ae8c2f664 | ||
|
|
683d5249eb | ||
|
|
278782a244 | ||
|
|
4288f83105 | ||
|
|
242719e7a7 | ||
| 4da5f4bc03 | |||
| cba10bef14 | |||
| 7728ddbf23 | |||
| d455c21b9c | |||
|
|
b8751d9b67 | ||
|
|
74f4be7027 | ||
| eb7c0ffbc5 | |||
| b4808bcd7c | |||
|
|
90b45fc806 | ||
|
|
9b02a5c9ea | ||
| e98127880b | |||
| 1ee8256885 | |||
| c9a013a17b | |||
| 6413f2340a | |||
| 3c9bc3f9b7 | |||
| d019beff5f | |||
| 4441864b6f | |||
| 33f3d615da | |||
| 61d8670416 | |||
| c551fdd2c9 | |||
| d7ea2f862e | |||
| d81abc226c | |||
| 2f4f841dcc | |||
| c83cfd9eff | |||
| f7973e0991 | |||
| 8701c8ba36 | |||
| 49f0a56c4f | |||
| ed61eb2ae0 | |||
| 25fc55c03e | |||
| a8244bf872 | |||
| daa53d9d73 | |||
| b445e3e879 | |||
| f1440dd1e2 | |||
| 4e3597ba7a | |||
| 7a9c70f396 | |||
| 8215388bc6 | |||
| 39595d849e | |||
| 024f274360 | |||
| 7eba13370d | |||
| 5046d84b86 | |||
| 073bbfd544 | |||
| 1b4b375f39 | |||
| 794097f81f | |||
| 9d11ebb653 | |||
| 0a123988b3 | |||
| 9c0ed53d52 | |||
| 77179789f5 | |||
| 68bd1ef6b4 | |||
| c76908ad58 | |||
| 209bb2455d | |||
| a86a5b1e6b | |||
| 05b49a842e | |||
| 6d9bd4bc9b | |||
| 245ed7c5f0 | |||
| f2b2acb49f | |||
| 36438e5b20 | |||
| 5e6719412d | |||
| 0bdc870a72 | |||
| 54ec1fee99 | |||
| 91f4ed4a17 | |||
| dd1f7f8040 | |||
| 016e51dbe5 | |||
| 90b6f3648e | |||
| 57baa6c9c1 | |||
| 74fcc2150d | |||
| b80bea4c1b | |||
| ede6438fbf | |||
| 62de67ccb7 | |||
| c69e7194bc | |||
| 25eabf6852 | |||
| 4ef8d4b52c | |||
| 0049409cdf | |||
| 7eecdf8f4d | |||
| bc750f8db0 | |||
| 75abb0ae46 | |||
| a27ab3acef | |||
| 950b47d145 | |||
| 2eca19cad4 | |||
| b8f1ad56ed | |||
| 7dd3069445 | |||
| 407294c6ae | |||
| 0c2b716368 | |||
| bd2e8643fd | |||
| dcdd392e95 | |||
| fa31d5570c | |||
| 16c307103f | |||
| 467c9b5b31 | |||
| 305b607c24 | |||
| 20e82075b7 | |||
| 6e0e51beff | |||
| 63b923e33b | |||
| 775526b5e3 | |||
| 82fbe8a751 | |||
| 19bcc13048 | |||
|
|
d5aabbace7 | ||
|
|
fa12c4b672 | ||
| de9f5ce5c7 | |||
| 905a31da1f | |||
|
|
68c21c6955 | ||
| e259a3c2a9 | |||
| c89e757171 | |||
| dd90100bfa | |||
| 13cda78d47 | |||
| a19a9759d3 | |||
| bcae6820af | |||
| 5841f5ca7d | |||
| d4c2875ed5 | |||
| b05e7ffaec | |||
| e18d605d5b | |||
| 7212dd7d31 | |||
| e1fc740321 | |||
| 7855ce62a4 | |||
| 281ec9bfc2 | |||
| fb98945b38 | |||
| b0941d6bfd | |||
| d35848478f | |||
| 87a761f5a6 | |||
| 353c0b2dbe | |||
| c2256a247b | |||
| 8696c7e66f | |||
| e15f2921ee | |||
| 0373e7b546 | |||
| ae2327347a | |||
| 505d151ee5 | |||
| 26434b21ab | |||
| 458e250b5c | |||
| aefbd50612 | |||
| 46f44f48b7 | |||
| e0f441d82a | |||
| 6911bc6cdb | |||
| ef5089443a | |||
| f7de2590b9 | |||
| f5e411c827 | |||
| 8c9835f8fd | |||
| 58312b9c3d | |||
| 94208ec25c | |||
| 6c0c103804 | |||
| 29176ebb4a | |||
| 18b4d58682 | |||
| 69151dd7a8 | |||
| 3d8ba57f4a | |||
| 9034636067 | |||
| 30fcf649c3 | |||
| 28fe6ee235 | |||
| 01da3b3a70 | |||
| 72e4fbdf31 | |||
| 095c0bad9a | |||
| 328a00063e | |||
| 96a269004d | |||
| 1b6db1fd5b | |||
| 6d7f885926 | |||
| 0f7b65f467 | |||
| 483089e954 | |||
| 63112eed7b | |||
| 3decbe5212 | |||
| 6e28bfa809 | |||
| d2c4794690 | |||
| 7a06c2ce2b | |||
| 8b2fb67422 | |||
| fe752d2073 | |||
| bbe99efefe | |||
| b48e2c995d | |||
| fc60b78784 | |||
| 0d3edd7e3f | |||
| 9c6198656f | |||
| 3de25ff12d | |||
| bd705813e9 | |||
| d495a5afb7 | |||
| fcc2bbaf04 | |||
| f3f6c52f81 | |||
| 0b7b793571 | |||
| 10a4ebfe43 | |||
| 9bc35c0ca6 | |||
| 368fcf4a8e | |||
| a38427a25a | |||
| 8536ba9d77 | |||
| 03b73e98f8 | |||
| 9c8abd7ee4 | |||
| dd674dce48 | |||
| 216b595450 | |||
| b76aa24ae4 | |||
| 01957b9fb3 | |||
| d559e9963d | |||
| 14f2e90d7a | |||
| 18414e5c80 | |||
| 3add52b2b7 | |||
| 784e4dbbca | |||
| f66790f67a | |||
| d5b6d9dd55 | |||
| 7e0332fad0 | |||
| a4b35c2258 | |||
| 025a04d0ed | |||
| 1259db5041 | |||
| 3dd7845d76 | |||
| 493b19c5e4 | |||
| b79002edcc | |||
| 910901f940 | |||
| de960b6a9b | |||
| b6d106aeb7 | |||
| ddd975a37f | |||
| 3e32e51e57 | |||
| e0fa7abeb4 | |||
| 901eb0f623 | |||
| cd0bae2620 | |||
| 62e734f725 | |||
| 2712b904b1 | |||
| c78c5d464d | |||
| 192e20be30 | |||
| 9daf69107a | |||
| 56981686e1 | |||
| ed37dd2107 | |||
| c3ce2fed96 | |||
| a79816082a | |||
| ffcad7a620 | |||
| 48d96d51d7 | |||
| 1d1618ae95 | |||
| d537cbe00d | |||
| 2490a783dd | |||
| f6ab578ce2 | |||
| f2de9054d0 | |||
| 9482abefcc | |||
| aa490e4181 | |||
| 36c11ac93f | |||
| f811d9b3ac | |||
| cee06af384 | |||
| c160a20d06 | |||
| bf5d5442d4 | |||
| 84c3813894 | |||
| 2fed433634 | |||
| 2edaffd634 | |||
| a0ceafff0a | |||
| a60fd375d0 | |||
| 38b2896e4a | |||
| 319e6575c8 | |||
| 54a52a1e6e | |||
| fc6282cd22 | |||
| b696af952f | |||
| 348b7602ff | |||
| 20044315fb | |||
| f1c0523753 | |||
| 6af0df7835 | |||
| 4999e1587f | |||
| 0b6f555099 | |||
| fda2940a79 | |||
| 99643aa755 | |||
| b40328f931 | |||
| f6da288ec5 | |||
| a042f24833 | |||
| 3f42f61c76 | |||
| 10422327ba | |||
| ffb719cbb5 | |||
| f13a9cda2e | |||
| dc53ecd6c8 | |||
| 96df1c3a18 | |||
| 4c2d39cb92 | |||
| c16948a9e4 | |||
| afea3e0233 | |||
| b871d2673b | |||
| 6b7ed74c60 | |||
| c9c8519a10 | |||
| 452c023f1d | |||
| debc1a6cae | |||
| 7b56eae371 | |||
| 3b5bffe998 | |||
| 2b9fc52c12 | |||
| d027036a99 | |||
| 66fa638ec4 | |||
| 01d366e256 | |||
| e34778d6be | |||
| 17c2644766 | |||
| 592ef14909 | |||
| c902dd0b91 | |||
| 5503751e07 | |||
| 307b83f8c9 | |||
| 9dc4922b89 | |||
| d01dab21b2 | |||
| 788bd67201 | |||
| cf660d26ea | |||
| 071aab5ea6 | |||
| b79474fdd1 | |||
| 5c432c0ea4 | |||
| 2fa413b1c6 | |||
| 7d789b22d3 | |||
| fae3ecc8b9 | |||
| f353c1b90c | |||
| 01041ccf75 | |||
| f181f5ab1d | |||
| f44ccf7893 | |||
| 5e2a9848da | |||
| b7b82e54c6 | |||
| e4d907e4a3 | |||
| 2999390b91 | |||
| 1f6cc4a579 | |||
| 7f1d21a067 | |||
| 84acf05c19 | |||
| bdbd49fa6d | |||
| 45447f34f8 | |||
| 702529147d | |||
| 066ebfaa71 | |||
| 5e09fb44ea | |||
| 8eef367bd4 | |||
| e64a4f4c47 | |||
| e1627badd3 | |||
| e265a2a3b6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -36,6 +36,7 @@ BackUps/*
|
||||
*.ilk
|
||||
Bugs/*
|
||||
Archives/*
|
||||
Downloads/*
|
||||
Temp/*
|
||||
Projects/*
|
||||
CompilationTasks/*
|
||||
@@ -48,5 +49,6 @@ Makefiles/*
|
||||
Repo/*
|
||||
Sts/*
|
||||
Tests/*
|
||||
Keys/*
|
||||
debug.log
|
||||
properties
|
||||
2
.idea/artifacts/VisualSapfor_jar.xml
generated
2
.idea/artifacts/VisualSapfor_jar.xml
generated
@@ -22,6 +22,8 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/junit-4.12.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/log4j-1.2.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/xmlbeans-2.6.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/commons-lang-2.6.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/libs/java-diff-utils.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
9
.idea/libraries/commons_lang_2_6_0.xml
generated
Normal file
9
.idea/libraries/commons_lang_2_6_0.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="commons-lang-2.6.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/libs/commons-lang-2.6.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
37
.idea/workspace.xml
generated
37
.idea/workspace.xml
generated
@@ -8,9 +8,7 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/MainModule_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/MainModule_.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -49,8 +47,8 @@
|
||||
</file-type-list>
|
||||
</component>
|
||||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishGroup.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/ConvertCorrectnessTests.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishGroup.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/Passes/All/PublishTest.java" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/_VisualDVM/TestingSystem/Common/TestingServer.java" root0="FORCE_HIGHLIGHTING" />
|
||||
</component>
|
||||
@@ -61,7 +59,7 @@
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProblemsViewState">
|
||||
<option name="selectedTabId" value="ProjectErrors" />
|
||||
<option name="selectedTabId" value="CurrentFile" />
|
||||
</component>
|
||||
<component name="ProjectId" id="1UqWSAGBQQNofrCLxSPPtOZrGP7" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
@@ -80,6 +78,7 @@
|
||||
<property name="JavaClassFindUsagesOptions.isDerivedClasses" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isFieldsUsages" value="true" />
|
||||
<property name="JavaClassFindUsagesOptions.isMethodsUsages" value="true" />
|
||||
<property name="OverrideImplement.combined" value="false" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
@@ -89,10 +88,10 @@
|
||||
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.SHOW" value="true" />
|
||||
<property name="UI_DESIGNER_EDITOR_MODE.UIDesignerToolWindowManager.WIDTH" value="509" />
|
||||
<property name="extract.method.default.visibility" value="public" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/Common/icons" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src" />
|
||||
<property name="project.structure.last.edited" value="Artifacts" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
<property name="project.structure.side.proportion" value="0.27322906" />
|
||||
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
|
||||
<property name="settings.editor.selected.configurable" value="reference.settings.project.statistic.project.settings" />
|
||||
</component>
|
||||
@@ -102,25 +101,25 @@
|
||||
<recent name="controls.Trees" />
|
||||
</key>
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_dif_utils" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\libs" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\Transformations" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\icons\versions" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\files" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\DVM\DVMTasks\UI" />
|
||||
</key>
|
||||
<key name="MoveMembersDialog.RECENTS_KEY">
|
||||
<recent name="Common.Visual.CommonUI" />
|
||||
<recent name="CommomUI" />
|
||||
<recent name="_VisualDVM.ComponentsServer.Component.Sapfor.Sapfor" />
|
||||
<recent name="_VisualDVM.Constants" />
|
||||
<recent name="_VisualDVM.Global" />
|
||||
<recent name="Common.CurrentAnchestor" />
|
||||
<recent name="Common.Utils.CommonUtils" />
|
||||
<recent name="_VisualDVM.ProjectData.SapforData.Arrays.UI.ProjectArraysForm" />
|
||||
<recent name="_VisualDVM.TestingSystem.SAPFOR.SapforPackage.UI.SapforPackagesForm" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\TestingSystem\SAPFOR\SapforSettingsCommand\UI" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\GlobalData\FileObject\UI" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\Visual\Windows" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\Visual\Windows" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\Visual\Main" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\Common\icons" />
|
||||
<recent name="C:\Users\misha\Documents\visual_sapfor_2023\src\_VisualDVM\Visual\Syntax" />
|
||||
</key>
|
||||
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
|
||||
<recent name="_VisualDVM.Visual.Windows" />
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"inter":[{"col_op":[{"comm":0.0,"ncall":8,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0}],"id":{"expr":2000000000,"nenter":1.0,"nlev":0,"nline":6,"nline_end":64,"pname":"jac3d.f","t":21},"proc_times":[{"comm":0.0,"exec_time":0.3102550506591797,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":0.3100552558898926,"prod_io":0.0001800060272216797,"prod_sys":1.9788742065429688e-05,"real_comm":0.0,"synch":0.0,"sys_time":0.0,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.0}],"times":{"comm":0.0,"comm_start":0.0,"efficiency":1.0,"exec_time":0.3102550506591797,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"idle":0.0,"insuf":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0,"nproc":1,"overlap":0.0,"prod_cpu":0.3100552558898926,"prod_io":0.0001800060272216797,"prod_sys":1.9788742065429688e-05,"real_comm":0.0,"synch":0.0,"sys_time":0.3102550506591797,"thr_sys_time":0.0,"thr_user_time":0.0,"threadsOfAllProcs":2,"time_var":0.0}}],"iscomp":false,"nproc":1,"p_heading":"1*1","proc":[{"node_name":"mic.dvm-system.org","test_time":0.5540609359741211}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"inter":[{"col_op":[{"comm":0.0,"ncall":107,"overlap":0.0,"real_comm":0.0,"synch":0.09642767906188965,"time_var":0.10170316696166992},{"comm":0.09526991844177246,"ncall":100,"overlap":0.00025081634521484375,"real_comm":0.0,"synch":2.384185791015625e-05,"time_var":1.5735626220703125e-05},{"comm":0.01116180419921875,"ncall":100,"overlap":7.390975952148438e-05,"real_comm":0.0,"synch":0.0018832683563232422,"time_var":0.0013852119445800781},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0}],"id":{"expr":2000000000,"nenter":1.0,"nlev":0,"nline":15,"nline_end":71,"pname":"jac2d.for","t":21},"proc_times":[{"comm":0.008355379104614258,"exec_time":4.960660934448242,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.00014519691467285156,"insuf_sys":0.02597987651824951,"insuf_user":0.002836167812347412,"load_imb":0.0,"lost_time":0.03731662034988403,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":4.9148295521736145,"prod_io":0.0015007257461547852,"prod_sys":0.007159233093261719,"real_comm":0.0,"synch":0.015146493911743164,"sys_time":1.42268456e-316,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.011813640594482422},{"comm":0.020066499710083008,"exec_time":4.960740089416504,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":6.604194641113281e-05,"insuf_sys":0.022036850452423096,"insuf_user":0.0030239224433898926,"load_imb":0.006429493427276611,"lost_time":0.04519331455230713,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":4.9082671999931335,"prod_io":5.352497100830078e-05,"prod_sys":0.0072920918464660645,"real_comm":0.0,"synch":0.021478652954101563,"sys_time":1632742196.495043,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.024171829223632813},{"comm":0.05277681350708008,"exec_time":4.960806131362915,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.0,"insuf_sys":0.023320376873016357,"insuf_user":0.0034398436546325684,"load_imb":0.040790677070617676,"lost_time":0.079537034034729,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":4.873495638370514,"prod_io":7.098913192749023e-05,"prod_sys":0.007702469825744629,"real_comm":0.0,"synch":0.03799128532409668,"sys_time":5.51718905656e-313,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.04065394401550293},{"comm":0.025233030319213867,"exec_time":4.960805177688599,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":9.5367431640625e-07,"insuf_sys":0.022124826908111572,"insuf_user":0.0031962990760803223,"load_imb":0.011793673038482666,"lost_time":0.05055510997772217,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":4.902876079082489,"prod_io":5.5909156799316406e-05,"prod_sys":0.007319033145904541,"real_comm":0.0,"synch":0.02371835708618164,"sys_time":1.4228205e-316,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.02646470069885254}],"times":{"comm":0.10643172264099121,"comm_start":0.0,"efficiency":0.989285910732807,"exec_time":4.960806131362915,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"idle":0.00021219253540039063,"insuf":0.10595816373825073,"insuf_sys":0.09346193075180054,"insuf_user":0.012496232986450195,"load_imb":0.05901384353637695,"lost_time":0.21260207891464233,"nproc":4,"overlap":0.0003247261047363281,"prod_cpu":19.59946846961975,"prod_io":0.0016811490058898926,"prod_sys":0.029472827911376953,"real_comm":0.0,"synch":0.09833478927612305,"sys_time":19.84322452545166,"thr_sys_time":0.0,"thr_user_time":0.0,"threadsOfAllProcs":4,"time_var":0.1031041145324707}}],"iscomp":false,"nproc":4,"p_heading":"2*2","proc":[{"node_name":"mic.dvm-system.org","test_time":0.5796339511871338},{"node_name":"mic.dvm-system.org","test_time":0.5798628330230713},{"node_name":"mic.dvm-system.org","test_time":0.5795998573303223},{"node_name":"mic.dvm-system.org","test_time":0.5797138214111328}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"inter":[{"col_op":[{"comm":0.0,"ncall":107,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0012249946594238281,"ncall":100,"overlap":0.00010442733764648438,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":100,"overlap":5.507469177246094e-05,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0}],"id":{"expr":2000000000,"nenter":1.0,"nlev":0,"nline":15,"nline_end":71,"pname":"jac2d.for","t":21},"proc_times":[{"comm":0.0012249946594238281,"exec_time":12.855837106704712,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0012249946594238281,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":12.844730615615845,"prod_io":0.0035636425018310547,"prod_sys":0.006317853927612305,"real_comm":0.0,"synch":0.0,"sys_time":1.4784531e-316,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.0}],"times":{"comm":0.0012249946594238281,"comm_start":0.0,"efficiency":0.9999047129604042,"exec_time":12.855837106704712,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"idle":0.0,"insuf":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0012249946594238281,"nproc":1,"overlap":0.0001595020294189453,"prod_cpu":12.844730615615845,"prod_io":0.0035636425018310547,"prod_sys":0.006317853927612305,"real_comm":0.0,"synch":0.0,"sys_time":12.855837106704712,"thr_sys_time":0.0,"thr_user_time":0.0,"threadsOfAllProcs":1,"time_var":0.0}}],"iscomp":false,"nproc":1,"p_heading":"1*1","proc":[{"node_name":"mic.dvm-system.org","test_time":0.5531537532806396}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"inter":[{"col_op":[{"comm":0.0,"ncall":54,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0}],"id":{"expr":2000000000,"nenter":1.0,"nlev":0,"nline":174,"nline_end":298,"pname":"bt.f","t":21},"proc_times":[{"comm":0.0,"exec_time":37.97893500328064,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":37.97744798660278,"prod_io":0.0006661415100097656,"prod_sys":0.0008208751678466797,"real_comm":0.0,"synch":0.0,"sys_time":4.080717506121202e-33,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.0}],"times":{"comm":0.0,"comm_start":0.0,"efficiency":1.0,"exec_time":37.97893500328064,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"idle":0.0,"insuf":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0,"nproc":1,"overlap":0.0,"prod_cpu":37.97744798660278,"prod_io":0.0006661415100097656,"prod_sys":0.0008208751678466797,"real_comm":0.0,"synch":0.0,"sys_time":37.97893500328064,"thr_sys_time":0.0,"thr_user_time":0.0,"threadsOfAllProcs":12,"time_var":0.0}}],"iscomp":false,"nproc":1,"p_heading":"1*1*1*1","proc":[{"node_name":"mic.dvm-system.org","test_time":0.5507678985595703}]}
|
||||
@@ -1 +0,0 @@
|
||||
{"inter":[{"col_op":[{"comm":0.0,"ncall":107,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0011873245239257813,"ncall":100,"overlap":9.274482727050781e-05,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":100,"overlap":5.435943603515625e-05,"real_comm":0.0,"synch":0.0,"time_var":0.0},{"comm":0.0,"ncall":0,"overlap":0.0,"real_comm":0.0,"synch":0.0,"time_var":0.0}],"id":{"expr":2000000000,"nenter":1.0,"nlev":0,"nline":15,"nline_end":71,"pname":"jac2d.for","t":21},"proc_times":[{"comm":0.0011873245239257813,"exec_time":12.533138990402222,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"gpu_times":null,"idle":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0011873245239257813,"num_gpu":0,"num_threads":0,"overlap":0.0,"prod_cpu":12.522205114364624,"prod_io":0.0035867691040039063,"prod_sys":0.006159782409667969,"real_comm":0.0,"synch":0.0,"sys_time":2.49049955e-316,"th_times":null,"thr_sys_time":0.0,"thr_user_time":0.0,"time_var":0.0}],"times":{"comm":0.0011873245239257813,"comm_start":0.0,"efficiency":0.999905265191359,"exec_time":12.533138990402222,"gpu_time_lost":0.0,"gpu_time_prod":0.0,"idle":0.0,"insuf":0.0,"insuf_sys":0.0,"insuf_user":0.0,"load_imb":0.0,"lost_time":0.0011873245239257813,"nproc":1,"overlap":0.00014710426330566406,"prod_cpu":12.522205114364624,"prod_io":0.0035867691040039063,"prod_sys":0.006159782409667969,"real_comm":0.0,"synch":0.0,"sys_time":12.533138990402222,"thr_sys_time":0.0,"thr_user_time":0.0,"threadsOfAllProcs":1,"time_var":0.0}}],"iscomp":false,"nproc":1,"p_heading":"1*1","proc":[{"node_name":"mic.dvm-system.org","test_time":0.5526328086853027}]}
|
||||
@@ -94,5 +94,6 @@
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="commons-lang-2.6.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
Visualizer_2.exe
BIN
Visualizer_2.exe
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 163 KiB |
37
debug_properties/properties
Normal file
37
debug_properties/properties
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Mode": "Normal",
|
||||
"ServerAddress": "alex-freenas.ddns.net",
|
||||
"ServerUserName": "testuser",
|
||||
"ServerUserSHHPort": 23,
|
||||
"ComponentsServerPort": 7995,
|
||||
"TestingServerPort": 7996,
|
||||
"SocketTimeout": 5000,
|
||||
"OldServer": false,
|
||||
"SMTPHost": "smtp.mail.ru",
|
||||
"SMTPPort": 465,
|
||||
"MailSocketPort": 465,
|
||||
"BackupWorkspace": "_sapfor_x64_backups",
|
||||
"BackupHour": 5,
|
||||
"BackupMinute": 0,
|
||||
"EmailAdminsOnStart": false,
|
||||
"AutoUpdateSearch": false,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": true,
|
||||
"GlobalDBName": "db7.sqlite",
|
||||
"ProjectDBName": "new_project_base.sqlite",
|
||||
"BugReportsDBName": "bug_reports.sqlite",
|
||||
"TestsDBName": "tests.sqlite",
|
||||
"ComponentsWindowWidth": 843,
|
||||
"ComponentsWindowHeight": 250,
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"TestingKernels": 28,
|
||||
"AutoCheckTesting": false,
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"EmailOnTestingProgress": false
|
||||
}
|
||||
37
normal_properties/properties
Normal file
37
normal_properties/properties
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Mode": "Normal",
|
||||
"ServerAddress": "alex-freenas.ddns.net",
|
||||
"ServerUserName": "testuser",
|
||||
"ServerUserSHHPort": 2000,
|
||||
"ComponentsServerPort": 7995,
|
||||
"TestingServerPort": 7998,
|
||||
"SocketTimeout": 5000,
|
||||
"OldServer": false,
|
||||
"SMTPHost": "smtp.mail.ru",
|
||||
"SMTPPort": 465,
|
||||
"MailSocketPort": 465,
|
||||
"BackupWorkspace": "_sapfor_x64_backups",
|
||||
"BackupHour": 5,
|
||||
"BackupMinute": 0,
|
||||
"EmailAdminsOnStart": false,
|
||||
"AutoUpdateSearch": false,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": true,
|
||||
"GlobalDBName": "db7.sqlite",
|
||||
"ProjectDBName": "new_project_base.sqlite",
|
||||
"BugReportsDBName": "bug_reports.sqlite",
|
||||
"TestsDBName": "tests.sqlite",
|
||||
"ComponentsWindowWidth": 843,
|
||||
"ComponentsWindowHeight": 250,
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"TestingKernels": 28,
|
||||
"AutoCheckTesting": true,
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"EmailOnTestingProgress": false
|
||||
}
|
||||
77
properties
77
properties
@@ -1,40 +1,51 @@
|
||||
{
|
||||
"Mode": "Normal",
|
||||
"ServerAddress": "alex-freenas.ddns.net",
|
||||
"ServerUserName": "testuser",
|
||||
"ServerUserSHHPort": 23,
|
||||
"ComponentsServerPort": 7995,
|
||||
"TestingServerPort": 7996,
|
||||
"SocketTimeout": 5000,
|
||||
"OldServer": false,
|
||||
"SMTPHost": "smtp.mail.ru",
|
||||
"SMTPPort": 465,
|
||||
"MailSocketPort": 465,
|
||||
"collapseCredentials": false,
|
||||
"collapseFileGraphs": false,
|
||||
"collapseFileMessages": false,
|
||||
"collapseProjectTrees": false,
|
||||
"BackupWorkspace": "_sapfor_x64_backups",
|
||||
"BackupHour": 5,
|
||||
"BackupMinute": 0,
|
||||
"EmailAdminsOnStart": false,
|
||||
"AutoUpdateSearch": false,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": true,
|
||||
"ProjectDBName": "new_project_base.sqlite",
|
||||
"BugReportsDBName": "bug_reports.sqlite",
|
||||
"TestsDBName": "tests.sqlite",
|
||||
"ComponentsWindowWidth": 843,
|
||||
"ComponentsWindowHeight": 250,
|
||||
"Email": "vmk-post@yandex.ru",
|
||||
"Name": "M",
|
||||
"ServerUserPassword": "mprit_2011",
|
||||
"OfferRegistrationOnStart": true,
|
||||
"Workspace": "E:\\Tests",
|
||||
"ProjectsSearchDirectory": "E:\\Tests\\Downloads\\bugreport_1701089001",
|
||||
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"AutoCheckTesting": false,
|
||||
"InstructionPath": "C:\\Users\\misha\\Documents",
|
||||
"PerformanceAnalyzerPath": "C:\\Users\\misha\\Documents",
|
||||
"AutoBugReportsLoad": true,
|
||||
"AutoTestsLoad": true,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": false,
|
||||
"collapseCredentials": true,
|
||||
"collapseFileGraphs": false,
|
||||
"collapseFileMessages": false,
|
||||
"collapseProjectTrees": false,
|
||||
"EditorFontSize": 17,
|
||||
"ComponentsWindowWidth": 929,
|
||||
"ComponentsWindowHeight": 250,
|
||||
"Kernels": 8,
|
||||
"LocalMakePathWindows": "C:\\MinGW\\msys\\1.0\\bin\\make.exe",
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"AutoCheckTesting": true,
|
||||
"EmailOnTestingProgress": true,
|
||||
"eraseTestingWorkspaces": true
|
||||
"CompleteCompilationOptions": true,
|
||||
"CompleteRunEnvironments": true,
|
||||
"CreateEthalonTasks": true,
|
||||
"ErasePackageWorkspace": true,
|
||||
"lastMachineId": 13,
|
||||
"lastUserId": 34,
|
||||
"lastCompilerId": 52,
|
||||
"RegisterOn": false,
|
||||
"SpacesOn": false,
|
||||
"EmptyLinesOn": false,
|
||||
"FortranWrapsOn": false,
|
||||
"ExtensionsOn": false,
|
||||
"ComparsionDiffMergeOn": true,
|
||||
"ShowFullArraysDeclarations": true,
|
||||
"ShowFullTabsNames": true,
|
||||
"SmallScreen": false,
|
||||
"BugReportsAgeLimit": 1,
|
||||
"FastAccessPassesCount": 10,
|
||||
"LastOpenedProjectsCount": 25,
|
||||
"Mode": "Normal"
|
||||
}
|
||||
43
server_debug_properties/properties
Normal file
43
server_debug_properties/properties
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"Mode": "Normal",
|
||||
"ServerAddress": "alex-freenas.ddns.net",
|
||||
"ServerUserName": "testuser",
|
||||
"ServerUserSHHPort": 2000,
|
||||
"ComponentsServerPort": 7996,
|
||||
"TestingServerPort": 7998,
|
||||
"SocketTimeout": 5000,
|
||||
"OldServer": false,
|
||||
"SMTPHost": "smtp.mail.ru",
|
||||
"SMTPPort": 465,
|
||||
"MailSocketPort": 465,
|
||||
"collapseCredentials": false,
|
||||
"collapseFileGraphs": false,
|
||||
"collapseFileMessages": false,
|
||||
"collapseProjectTrees": false,
|
||||
"BackupWorkspace": "_sapfor_x64_backups",
|
||||
"BackupHour": 5,
|
||||
"BackupMinute": 0,
|
||||
"EmailAdminsOnStart": false,
|
||||
"AutoUpdateSearch": true,
|
||||
"ConfirmPassesStart": true,
|
||||
"ShowPassesDone": true,
|
||||
"FocusPassesResult": true,
|
||||
"ProjectDBName": "new_project_base.sqlite",
|
||||
"BugReportsDBName": "bug_reports.sqlite",
|
||||
"TestsDBName": "tests.sqlite",
|
||||
"ComponentsWindowWidth": 924,
|
||||
"ComponentsWindowHeight": 250,
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
"Visualizer_2Path": "C:\\Users\\misha\\Documents",
|
||||
"InstructionPath": "",
|
||||
"PerformanceAnalyzerPath": "",
|
||||
"ComponentsBackUpsCount": 10,
|
||||
"AutoCheckTesting": true,
|
||||
"CheckTestingIntervalSeconds": 10,
|
||||
"EmailOnTestingProgress": true,
|
||||
"eraseTestingWorkspaces": true,
|
||||
"lastMachineId": 13,
|
||||
"lastUserId": 34,
|
||||
"lastCompilerId": 52
|
||||
}
|
||||
3
src/Common/ApplicationMode.java
Normal file
3
src/Common/ApplicationMode.java
Normal file
@@ -0,0 +1,3 @@
|
||||
package Common;
|
||||
public interface ApplicationMode {
|
||||
}
|
||||
@@ -7,6 +7,15 @@ public class CommonConstants {
|
||||
public static final int Nan = -1;
|
||||
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
|
||||
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
|
||||
//--
|
||||
//-файлы-признаки
|
||||
public static final String LOADED = "LOADED";
|
||||
public static final String STARTED = "STARTED";
|
||||
public static final String ABORTED = "ABORTED";
|
||||
public static final String INTERRUPT = "INTERRUPT"; //файл признак прерывания.
|
||||
public final static String DONE = "DONE";
|
||||
public final static String TIMEOUT = "TIMEOUT";
|
||||
//--
|
||||
public static char[] regular_metasymbols = new char[]{
|
||||
'<', '>', '(', ')', '[', ']', '{', '}', '^', '-', '=', '$', '!', '|', '?', '*', '+', '.'
|
||||
};
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package Common;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Utils.TextLog;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public interface Current_ {
|
||||
default String getDescription(){
|
||||
default String getDescription() {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package Common.Database;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.Repository.RepositoryRefuseException;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -14,11 +15,14 @@ import java.util.Vector;
|
||||
//самый общий интерфейс базы данных, независимо от реализации.
|
||||
public abstract class Database {
|
||||
//------------------------------
|
||||
public LinkedHashMap<Class<? extends DBObject>, DBTable> tables = new LinkedHashMap<>(); //таблицы
|
||||
protected LinkedHashMap<Class<? extends DBObject>, DBTable> tables = new LinkedHashMap<>(); //таблицы
|
||||
protected File file = null;
|
||||
public Database(File file_in) {
|
||||
file = file_in;
|
||||
}
|
||||
public <T extends DBObject> DBTable<?, T> getTable(Class<T> tableClass) {
|
||||
return tables.get(tableClass);
|
||||
}
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
@@ -30,6 +34,12 @@ public abstract class Database {
|
||||
// UI.Print(DebugPrintLevel.Database, "соединение с базой данных " + file.getAbsolutePath());
|
||||
connect();
|
||||
}
|
||||
public void Activate() throws Exception {
|
||||
Connect();
|
||||
CreateAllTables();
|
||||
prepareTablesStatements();
|
||||
Synchronize();
|
||||
}
|
||||
public void prepareTablesStatements() throws Exception {
|
||||
}
|
||||
public void Disconnect() throws Exception {
|
||||
@@ -84,7 +94,7 @@ public abstract class Database {
|
||||
public DBObject InsertS(DBObject object) throws Exception {
|
||||
DBTable table = tables.get(object.getClass());
|
||||
if (!(object instanceof iDBObject) && table.Data.containsKey(object.getPK()))
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " уже содержит объект с ключом " + Utils_.Brackets(object.getPK().toString()));
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.getName()) + " уже содержит объект с ключом " + Utils_.Brackets(object.getPK().toString()));
|
||||
insert(table, object);
|
||||
table.Data.put(object.getPK(), object);
|
||||
return object;
|
||||
@@ -111,7 +121,7 @@ public abstract class Database {
|
||||
table.Data.remove(o.getPK());
|
||||
return o;
|
||||
} else
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " не содержит объект с ключом " + Utils_.Brackets(to_delete.getPK().toString()));
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.getName()) + " не содержит объект с ключом " + Utils_.Brackets(to_delete.getPK().toString()));
|
||||
}
|
||||
public DBObject DeleteByPK(Class object_class, Object key) throws Exception {
|
||||
DBTable table = tables.get(object_class);
|
||||
@@ -121,7 +131,7 @@ public abstract class Database {
|
||||
table.Data.remove(key);
|
||||
return o;
|
||||
} else
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.Name) + " не содержит объект с ключом " + Utils_.Brackets(key.toString()));
|
||||
throw new RepositoryRefuseException("Таблица " + Utils_.Brackets(table.getName()) + " не содержит объект с ключом " + Utils_.Brackets(key.toString()));
|
||||
}
|
||||
// не работает с автоинкрементом.
|
||||
public DBObject getObjectCopyByPK(Class table_class, Object pk) throws Exception {
|
||||
@@ -171,11 +181,11 @@ public abstract class Database {
|
||||
}
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="работа с внешними ключами">
|
||||
public <O extends DBObject, F extends DBObject> Vector<DBObject> getVectorByFK(O owner, Class<F> fk_class) {
|
||||
Vector<DBObject> res = new Vector<>();
|
||||
public <O extends DBObject, F extends DBObject> Vector<F> getVectorByFK(O owner, Class<F> fk_class) {
|
||||
Vector<F> res = new Vector<>();
|
||||
try {
|
||||
for (Object o : tables.get(fk_class).Data.values()) {
|
||||
if (fk_class.getField(owner.getFKName()).get(o).equals(owner.getPK())) res.add((DBObject) o);
|
||||
if (fk_class.getField(owner.getFKName()).get(o).equals(owner.getPK())) res.add((F) o);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
@@ -183,7 +193,7 @@ public abstract class Database {
|
||||
return res;
|
||||
}
|
||||
public <F extends DBObject> void DeleteByFK(DBObject master, Class<F> fk_class) throws Exception {
|
||||
Vector<DBObject> to_delete = getVectorByFK(master, fk_class);
|
||||
Vector<F> to_delete = getVectorByFK(master, fk_class);
|
||||
BeginTransaction();
|
||||
for (DBObject object : to_delete)
|
||||
Delete(object);
|
||||
@@ -191,7 +201,7 @@ public abstract class Database {
|
||||
}
|
||||
//-----------
|
||||
public <F extends DBObject> void DropByFK(DBObject master, Class<F> fk_class) throws Exception {
|
||||
Vector<DBObject> to_drop = getVectorByFK(master, fk_class);
|
||||
Vector<F> to_drop = getVectorByFK(master, fk_class);
|
||||
BeginTransaction();
|
||||
for (DBObject object : to_drop) {
|
||||
fk_class.getField(master.getFKName()).set(object, master.getEmptyFK());
|
||||
@@ -214,6 +224,20 @@ public abstract class Database {
|
||||
public <O extends DBObject, F extends iDBObject> LinkedHashMap<Integer, F> getMapByFKi(O owner, Class<F> fk_class) {
|
||||
return getMapByFK(owner, fk_class, java.lang.Integer.class);
|
||||
}
|
||||
public <O extends iDBObject, F extends iDBObject> Vector<Integer> getFKi(
|
||||
Integer owner_pk, Class<O> owner_class, Class<F> fk_class) {
|
||||
String fk_name = owner_class.getSimpleName().toLowerCase() + "_id";
|
||||
Vector<Integer> res = new Vector<>();
|
||||
try {
|
||||
for (Object o : tables.get(fk_class).Data.values()) {
|
||||
F f = (F) o;
|
||||
if (fk_class.getField(fk_name).get(f).equals(owner_pk)) res.add((Integer) f.getPK());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-
|
||||
public <O extends DBObject, F extends DBObject> Vector<String> getVectorStringByFK(O owner, Class<F> fk_class) {
|
||||
Vector<String> res = new Vector<>();
|
||||
@@ -270,13 +294,63 @@ public abstract class Database {
|
||||
protected abstract void resetAI(DBTable table) throws Exception;
|
||||
//-
|
||||
public void SaveLastSelections() {
|
||||
for (DataSet dataSet : tables.values())
|
||||
dataSet.SaveLastSelections();
|
||||
for (DataSet dataSet : tables.values()) {
|
||||
if (dataSet.getUI() != null)
|
||||
dataSet.getUI().SaveLastCurrent();
|
||||
}
|
||||
}
|
||||
public void RestoreLastSelections() {
|
||||
for (DataSet dataSet : tables.values())
|
||||
dataSet.RestoreLastSelections();
|
||||
for (DataSet dataSet : tables.values()) {
|
||||
if (dataSet.getUI() != null)
|
||||
dataSet.getUI().RestoreLastCurrent();
|
||||
}
|
||||
}
|
||||
//---
|
||||
public abstract PassCode getSynchronizePassCode(); //если бд есть на сервере.
|
||||
public boolean CheckCurrent(TextLog log, Class... tablesClasses) {
|
||||
for (Class tableClass : tablesClasses) {
|
||||
DBTable table = getTable(tableClass);
|
||||
if (table.getUI() != null)
|
||||
table.getUI().CheckCurrent(log);
|
||||
}
|
||||
return log.isEmpty();
|
||||
}
|
||||
public boolean canModifyCurrent(TextLog log, Class... tablesClasses) {
|
||||
for (Class tableClass : tablesClasses) {
|
||||
DBTable table = getTable(tableClass);
|
||||
if (table.getUI() != null)
|
||||
table.getUI().canModifyCurrent(log);
|
||||
}
|
||||
return log.isEmpty();
|
||||
}
|
||||
public abstract PassCode_ getSynchronizePassCode(); //если бд есть на сервере.
|
||||
//--
|
||||
public void ReplaceFileAndReconnect(File file_in) throws Exception {
|
||||
Disconnect();
|
||||
Utils_.forceDeleteWithCheck(getFile());
|
||||
FileUtils.moveFile(file_in, getFile());
|
||||
Connect();
|
||||
prepareTablesStatements();
|
||||
Synchronize();
|
||||
}
|
||||
public void DeleteDependencies(DBObject object) throws Exception {
|
||||
DBTable object_table = getTable(object.getClass());
|
||||
for (Class dep : object_table.getFKDependencies().keySet()) {
|
||||
switch (object_table.getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
break;
|
||||
case DROP:
|
||||
DropByFK(object, dep);
|
||||
break;
|
||||
case DELETE:
|
||||
DeleteByFK(object, dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DropUI() {
|
||||
SaveLastSelections();
|
||||
}
|
||||
public void ResetUI() {
|
||||
RestoreLastSelections();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,20 +12,20 @@ public class DBForm extends DBObject {
|
||||
public int Height = 0;
|
||||
public DBForm(String type_, Window window) {
|
||||
type = type_;
|
||||
Init(window);
|
||||
Fill(window);
|
||||
}
|
||||
public DBForm() {
|
||||
}
|
||||
public void Init(Window window) {
|
||||
X = window.getX();
|
||||
Y = window.getY();
|
||||
Width = window.getWidth();
|
||||
Height = window.getHeight();
|
||||
}
|
||||
public void Apply(Window window) {
|
||||
window.setSize(Width, Height);
|
||||
window.setLocation(X, Y);
|
||||
}
|
||||
public void Fill(Window window) {
|
||||
X = window.getX();
|
||||
Y = window.getY();
|
||||
Width = window.getWidth();
|
||||
Height = window.getHeight();
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return type;
|
||||
|
||||
@@ -4,8 +4,4 @@ public class FormsDBTable extends DBTable<String, DBForm> {
|
||||
public FormsDBTable() {
|
||||
super(String.class, DBForm.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "параметры окна";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package Common.Database.Objects;
|
||||
import Common.Utils.Index;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Selectable;
|
||||
import Common.Utils.Index;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -10,6 +10,12 @@ public abstract class DBObject implements Selectable, Serializable {
|
||||
//<editor-fold desc="Selectable">
|
||||
@Description("IGNORE")
|
||||
private boolean selected = false;
|
||||
//------
|
||||
public DBObject() {
|
||||
}
|
||||
public DBObject(DBObject src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return selected;
|
||||
@@ -29,9 +35,6 @@ public abstract class DBObject implements Selectable, Serializable {
|
||||
public Index getSelectionCounter() {
|
||||
return null;
|
||||
}
|
||||
public boolean isVisible() {
|
||||
return true;
|
||||
}
|
||||
public abstract Object getPK();
|
||||
public String getBDialogName() {
|
||||
return Utils_.Brackets(getDialogName());
|
||||
@@ -50,13 +53,7 @@ public abstract class DBObject implements Selectable, Serializable {
|
||||
return getBDialogName();
|
||||
}
|
||||
//---
|
||||
public void SynchronizeFields(DBObject src){
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
selected = src.selected;
|
||||
}
|
||||
//------
|
||||
public DBObject(){}
|
||||
public DBObject(DBObject src){
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
//---------
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.GlobalData.Grid;
|
||||
package Common.Database.Objects.Grid;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.stream.Collectors;
|
||||
public class TableVisualData extends DBObject {
|
||||
@Description("PRIMARY KEY, UNIQUE") //имя таблицы
|
||||
public String name = null;
|
||||
|
||||
//todo запаковать в json (?)
|
||||
@Description("DEFAULT ''")
|
||||
public String sizes = ""; //ширины столбцов запакованные через |. вводить объекты ради них нецелесообразно.
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.GlobalData.Grid;
|
||||
package Common.Database.Objects.Grid;
|
||||
import Common.Database.Tables.DBTable;
|
||||
public class TablesVisualDatasDBTable extends DBTable<String, TableVisualData> {
|
||||
public TablesVisualDatasDBTable() {
|
||||
@@ -4,10 +4,6 @@ public class PassStatsDBTable extends DBTable<String, PassStats> {
|
||||
public PassStatsDBTable() {
|
||||
super(String.class, PassStats.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "статистика выполнения прохода";
|
||||
}
|
||||
public void IncPassStat(String passName) throws Exception {
|
||||
PassStats passStats = null;
|
||||
if (Data.containsKey(passName)) {
|
||||
@@ -20,5 +16,4 @@ public class PassStatsDBTable extends DBTable<String, PassStats> {
|
||||
getDb().Insert(passStats);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.GlobalData.Splitter;
|
||||
package Common.Database.Objects.Splitter;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.GlobalData.Splitter;
|
||||
package Common.Database.Objects.Splitter;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
@@ -7,6 +7,11 @@ public class iDBObject extends DBObject {
|
||||
@Expose
|
||||
@Description("PRIMARY KEY,AUTOINCREMENT")
|
||||
public int id;
|
||||
public iDBObject() {
|
||||
}
|
||||
public iDBObject(iDBObject src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return id;
|
||||
@@ -19,10 +24,6 @@ public class iDBObject extends DBObject {
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
id = ((iDBObject)src).id;
|
||||
}
|
||||
public iDBObject(){}
|
||||
public iDBObject(iDBObject src){
|
||||
this.SynchronizeFields(src);
|
||||
id = ((iDBObject) src).id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import com.sun.org.glassfish.gmbal.Description;
|
||||
public abstract class nDBObject extends DBObject {
|
||||
@Description("PRIMARY KEY, UNIQUE")
|
||||
public String id = "";
|
||||
public nDBObject(nDBObject src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
public nDBObject() {
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return id;
|
||||
@@ -12,6 +17,9 @@ public abstract class nDBObject extends DBObject {
|
||||
public Object getEmptyFK() {
|
||||
return "";
|
||||
}
|
||||
public String getFKName() {
|
||||
return getClass().getSimpleName().toLowerCase() + "_id";
|
||||
}
|
||||
public void genName() {
|
||||
id = Utils_.getDateName(getClass().getSimpleName().toLowerCase());
|
||||
}
|
||||
@@ -19,10 +27,6 @@ public abstract class nDBObject extends DBObject {
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
id = ((nDBObject)src).id;
|
||||
id = ((nDBObject) src).id;
|
||||
}
|
||||
public nDBObject(nDBObject src){
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
public nDBObject(){}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ public class rDBObject extends nDBObject {
|
||||
//-
|
||||
public long date = 0;
|
||||
public long change_date;
|
||||
public rDBObject(rDBObject src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
public rDBObject() {
|
||||
}
|
||||
public Date getDate() {
|
||||
return new Date(date);
|
||||
}
|
||||
@@ -24,9 +29,4 @@ public class rDBObject extends nDBObject {
|
||||
date = r.date;
|
||||
change_date = r.change_date;
|
||||
}
|
||||
public rDBObject(rDBObject src) {
|
||||
this.SynchronizeFields(src);
|
||||
}
|
||||
public rDBObject() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package Common.Database.Objects;
|
||||
public class riDBObject extends iDBObject {
|
||||
//-
|
||||
//todo int useraccount_id по объекту аккаунтов. сюда и права. и проверку их.
|
||||
public String sender_name = "";
|
||||
public String sender_address = "";
|
||||
//---
|
||||
public String description = "";
|
||||
//-
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package _VisualDVM.Repository;
|
||||
public class RepositoryRefuseException extends Exception{
|
||||
package Common.Database;
|
||||
public class RepositoryRefuseException extends Exception {
|
||||
//исключение для "штатных" отказов. например отсутствие объекта с заданным ключом.
|
||||
public RepositoryRefuseException(String message_in){
|
||||
public RepositoryRefuseException(String message_in) {
|
||||
super(message_in);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package Common.Database.SQLITE;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DBTableColumn;
|
||||
import Common.Database.Database;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Passes.PassException;
|
||||
import javafx.util.Pair;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
@@ -15,12 +15,12 @@ import java.util.Vector;
|
||||
|
||||
import static Common.Utils.Utils_.requireNonNullElse;
|
||||
public abstract class SQLiteDatabase extends Database {
|
||||
protected Connection conn = null;
|
||||
protected Statement statement = null;
|
||||
protected ResultSet resSet = null;
|
||||
public LinkedHashMap<Class<? extends DBObject>, PreparedStatement> insertStatements = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class<? extends DBObject>, PreparedStatement> updateStatements = new LinkedHashMap<>();
|
||||
public LinkedHashMap<Class<? extends DBObject>, PreparedStatement> deleteStatements = new LinkedHashMap<>();
|
||||
protected Connection conn = null;
|
||||
protected Statement statement = null;
|
||||
protected ResultSet resSet = null;
|
||||
//->>
|
||||
public SQLiteDatabase(File file_in) {
|
||||
super(file_in);
|
||||
@@ -210,7 +210,7 @@ public abstract class SQLiteDatabase extends Database {
|
||||
protected void insert(DBTable table, DBObject o) throws Exception {
|
||||
PreparedStatement ps = insertStatements.get(table.d);
|
||||
if (ps == null)
|
||||
UI_.Info("INSERT NULL");
|
||||
UI.Info("INSERT NULL");
|
||||
int i = 1;
|
||||
for (DBTableColumn column : table.columns.values()) {
|
||||
if (!column.AutoIncrement) {
|
||||
@@ -234,7 +234,7 @@ public abstract class SQLiteDatabase extends Database {
|
||||
protected void update(DBTable table, DBObject o) throws Exception {
|
||||
PreparedStatement ps = updateStatements.get(table.d);
|
||||
if (ps == null)
|
||||
UI_.Info("UPDATE NULL");
|
||||
UI.Info("UPDATE NULL");
|
||||
int i = 1;
|
||||
for (DBTableColumn column : table.columns.values()) {
|
||||
if (!column.AutoIncrement) {
|
||||
@@ -255,5 +255,4 @@ public abstract class SQLiteDatabase extends Database {
|
||||
}
|
||||
//--
|
||||
//https://stackoverflow.com/questions/8558099/sqlite-query-with-byte-where-clause
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Vector;
|
||||
public abstract class DBTable<K, D extends DBObject> extends DataSet<K, D> {
|
||||
//-
|
||||
public DBTableColumn PK = null;
|
||||
@@ -29,9 +30,36 @@ public abstract class DBTable<K, D extends DBObject> extends DataSet<K, D> {
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder res = new StringBuilder(Name + "\n");
|
||||
StringBuilder res = new StringBuilder(getName() + "\n");
|
||||
for (DBTableColumn c : columns.values())
|
||||
res.append(c).append("\n");
|
||||
return res.toString();
|
||||
}
|
||||
boolean vectorContains(D object, Vector<D> vector) {
|
||||
for (D v_object : vector) {
|
||||
if (isEqual(object, v_object))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void ActualizeData(Vector<D> old, Vector<D> actual) throws Exception {
|
||||
//привести данные вектора old в соответствие с вектором new
|
||||
//те, что в нем появились вставить, те что отсутствуют но есть в old удалить
|
||||
Vector<D> to_delete = new Vector<>();
|
||||
Vector<D> to_insert = new Vector<>();
|
||||
for (D object : old) {
|
||||
if (!vectorContains(object, actual))
|
||||
to_delete.add(object);
|
||||
}
|
||||
for (D object : actual) {
|
||||
if (!vectorContains(object, old))
|
||||
to_insert.add(object);
|
||||
}
|
||||
db.BeginTransaction();
|
||||
for (D object : to_delete)
|
||||
db.Delete(object);
|
||||
for (D object : to_insert)
|
||||
db.Insert(object);
|
||||
db.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,111 +1,69 @@
|
||||
package Common.Database.Tables;
|
||||
import Common.Current_;
|
||||
import Common.Visual.DataSetFilter;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Tables.ColumnFilter;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.FilterInterface;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
//-
|
||||
public LinkedHashMap<Class, Object> selections = new LinkedHashMap<>();
|
||||
//---
|
||||
public String Name;
|
||||
public Class<K> k; //класс первичного ключа.
|
||||
public Class<D> d; //класс объектов.
|
||||
public LinkedHashMap<K, D> Data = new LinkedHashMap<>(); //наполнение
|
||||
Class<K> k; //класс первичного ключа.
|
||||
//-
|
||||
public DataSetControlForm ui_;
|
||||
protected FilterInterface f_ui; // отображение количества объектов
|
||||
//-
|
||||
public LinkedHashMap<Integer, ColumnFilter> columnsFilters = new LinkedHashMap<>(); //текстовые фильтры столбцов
|
||||
//--
|
||||
protected Vector<DataSetFilter<D>> filters = new Vector<>();
|
||||
protected void createFilters() {
|
||||
}
|
||||
DataSetControlForm ui = null;
|
||||
//--
|
||||
public DataSet(Class<K> k_in, Class<D> d_in) {
|
||||
k = k_in;
|
||||
d = d_in;
|
||||
Name = d.getSimpleName();
|
||||
}
|
||||
public void mountUI(JPanel content_in) {
|
||||
UI_.Clear(content_in);
|
||||
//-->
|
||||
ui_ = createUI();
|
||||
ui_.setContent(content_in);
|
||||
//-->
|
||||
if ( UI_.menuBars.containsKey(getClass())) {
|
||||
DataMenuBar bar = UI_.menuBars.get(getClass());
|
||||
content_in.add(bar, BorderLayout.NORTH);
|
||||
setFilterUI(count -> UI_.menuBars.get(getClass()).countLabel.setText(String.valueOf(count)));
|
||||
if (ui_.hasCheckBox())
|
||||
bar.createSelectionButtons(this);
|
||||
}
|
||||
content_in.add(ui_.getDataPanel(), BorderLayout.CENTER);
|
||||
//----
|
||||
createFilters();
|
||||
if (!filters.isEmpty()) {
|
||||
DataMenuBar menuBar = UI_.menuBars.get(getClass());
|
||||
for (DataSetFilter<D> filter : filters)
|
||||
menuBar.addMenus(filter.menu);
|
||||
}
|
||||
//--
|
||||
public String getPluralDescription() {
|
||||
return "";
|
||||
}
|
||||
public DataSetControlForm getUi() {
|
||||
return ui_;
|
||||
public String getSingleDescription() {
|
||||
return "";
|
||||
}
|
||||
public void setFilterUI(FilterInterface ui_in) {
|
||||
f_ui = ui_in;
|
||||
}
|
||||
public void ClearUI() {
|
||||
if ((ui_ != null) && ui_.isShown()) {
|
||||
ui_.ClearSelection();
|
||||
ui_.Clear();
|
||||
if (f_ui != null)
|
||||
f_ui.ShowNoMatches();
|
||||
}
|
||||
}
|
||||
public void RefreshUI() {
|
||||
if (ui_ != null) ui_.Refresh();
|
||||
}
|
||||
public int getRowCountUI() {
|
||||
return ui_.getRowCount();
|
||||
}
|
||||
public void SetCurrentObjectUI(Object pk) {
|
||||
if (ui_ != null) {
|
||||
//todo возможно проверить, что текущий объект уже соответствует ключу, и если да, то ничего делать.
|
||||
ui_.ClearSelection(); //сброс текущего объекта и всего что с ним связано.
|
||||
ui_.Select(pk);
|
||||
}
|
||||
}
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{};
|
||||
}
|
||||
protected DataSetControlForm createUI() {
|
||||
//---
|
||||
protected DataSetControlForm createUI(JPanel mountPanel) {
|
||||
return null;
|
||||
}
|
||||
public boolean hasUI() {
|
||||
return ui_ != null;
|
||||
//БАЗА ДАННЫХ
|
||||
public String getName() {
|
||||
return d.getSimpleName();
|
||||
}
|
||||
public void CheckAll(boolean flag) {
|
||||
for (D object : Data.values()) {
|
||||
if (object.isVisible())
|
||||
object.Select(flag);
|
||||
public String QName() {
|
||||
return "\"" + getName() + "\"";
|
||||
}
|
||||
public String getPKName() {
|
||||
return "";
|
||||
} //получить имя ключевого поля. нужно для таблиц.
|
||||
//ИНТЕРФЕЙС
|
||||
public DataSetControlForm<D> getUI() {
|
||||
return ui;
|
||||
}
|
||||
public void mountUI(JPanel mountPanel_in) {
|
||||
UI.Clear(mountPanel_in);
|
||||
ui = createUI(mountPanel_in);
|
||||
}
|
||||
public void ClearUI() {
|
||||
if ((ui != null) && ui.isShown()) {
|
||||
ui.ClearSelection();
|
||||
ui.Clear();
|
||||
}
|
||||
RefreshUI();
|
||||
}
|
||||
public void ShowUI() {
|
||||
if (ui != null) {
|
||||
ui.Show();
|
||||
}
|
||||
}
|
||||
public void ShowUI(Object key) {
|
||||
if (ui != null) {
|
||||
ui.Show(key);
|
||||
}
|
||||
}
|
||||
//СОДЕРЖИМОЕ
|
||||
public D getFirstRecord() {
|
||||
return Data.values().stream().findFirst().orElse(null);
|
||||
}
|
||||
@@ -114,50 +72,12 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
res.sort(comparator);
|
||||
return res;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public DBObjectDialog<D, ? extends DialogFields> getDialog() {
|
||||
return null;
|
||||
}
|
||||
public boolean ShowAddObjectDialog(DBObject object) {
|
||||
return getDialog().ShowDialog(getSingleDescription() + ": добавление", object);
|
||||
}
|
||||
public boolean ShowEditObjectDialog(DBObject object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.edit = true;
|
||||
dialog.SetEditLimits();
|
||||
return dialog.ShowDialog(getSingleDescription() + ": редактирование", object);
|
||||
}
|
||||
public boolean ViewObject(DBObject object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.SetReadonly();
|
||||
dialog.ShowDialog(getSingleDescription() + ": просмотр", object);
|
||||
return false;
|
||||
}
|
||||
public boolean ShowDeleteObjectDialog(DBObject object) {
|
||||
return UI_.Warning(getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
|
||||
}
|
||||
public String QName() {
|
||||
return "\"" + Name + "\"";
|
||||
}
|
||||
public String getPKName() {
|
||||
return "";
|
||||
} //получить имя ключевого поля. нужно для таблиц.
|
||||
public String getPluralDescription() {
|
||||
return "";
|
||||
}
|
||||
public String getSingleDescription() {
|
||||
return "";
|
||||
}
|
||||
//-
|
||||
public void put(Object key, D object) {
|
||||
Data.put((K) key, object);
|
||||
}
|
||||
public D get(Object key) {
|
||||
return Data.get(key);
|
||||
}
|
||||
public Object getFieldAt(D object, int columnIndex) {
|
||||
return null;
|
||||
}
|
||||
public void clear() {
|
||||
Data.clear();
|
||||
}
|
||||
@@ -167,128 +87,8 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
public boolean containsKey(Object key) {
|
||||
return Data.containsKey(key);
|
||||
}
|
||||
//-
|
||||
public Vector<K> getVisibleKeys() {
|
||||
Comparator<D> comparator = getComparator();
|
||||
Vector<K> res = new Vector<>();
|
||||
if (comparator == null) {
|
||||
for (K key : Data.keySet())
|
||||
if (Data.get(key).isVisible())
|
||||
res.add(key);
|
||||
} else {
|
||||
Vector<D> raw = new Vector<>();
|
||||
for (D object : Data.values()) {
|
||||
if (object.isVisible())
|
||||
raw.add(object);
|
||||
}
|
||||
raw.sort(comparator);
|
||||
for (D object : raw)
|
||||
res.add((K) object.getPK());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
protected Comparator<D> getComparator() {
|
||||
return null;
|
||||
}
|
||||
public int getCheckedCount() {
|
||||
return (int) Data.values().stream().filter(d -> d.isVisible() && d.isSelected()).count();
|
||||
}
|
||||
public Vector<D> getCheckedItems() {
|
||||
return Data.values().stream().filter(d -> d.isVisible() && d.isSelected()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
public Vector<K> getCheckedKeys() {
|
||||
return Data.values().stream().filter(DBObject::isSelected).map(d -> (K) d.getPK()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
//--
|
||||
// применить значение фильтра к фильру объекта напирмер Message.filterValue = text;
|
||||
public void changeColumnFilterValue(int columnIndex, String text) {
|
||||
public boolean isEqual(D o1, D o2) {
|
||||
return false;
|
||||
}
|
||||
public Object getColumnFilterValue(int columnIndex) {
|
||||
return "";
|
||||
}
|
||||
//--
|
||||
public void ShowUI() {
|
||||
for (DataSetFilter<D> filter : filters)
|
||||
filter.Drop();
|
||||
//--
|
||||
if (ui_ != null) {
|
||||
ui_.Show();
|
||||
if (f_ui != null)
|
||||
f_ui.ShowMatchesCount(getRowCountUI());
|
||||
}
|
||||
//--
|
||||
for (DataSetFilter<D> filter : filters)
|
||||
filter.Refresh();
|
||||
}
|
||||
public void ShowUI(Object key) {
|
||||
for (DataSetFilter<D> filter : filters)
|
||||
filter.Drop();
|
||||
//--
|
||||
if (ui_ != null) {
|
||||
ui_.Show(key);
|
||||
if (f_ui != null)
|
||||
f_ui.ShowMatchesCount(getRowCountUI());
|
||||
}
|
||||
//--
|
||||
for (DataSetFilter<D> filter : filters)
|
||||
filter.Refresh();
|
||||
}
|
||||
public boolean applyFilters(D object) {
|
||||
for (DataSetFilter<D> filter : filters) {
|
||||
if (!filter.Validate(object))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------
|
||||
public Current_ CurrentName() {
|
||||
return null;
|
||||
}
|
||||
public boolean CheckCurrent(TextLog log) {
|
||||
return Global.mainModule.Check(log, CurrentName());
|
||||
}
|
||||
public boolean hasCurrent() {
|
||||
return Global.mainModule.get(CurrentName()) != null;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
Global.mainModule.set(CurrentName(), null);
|
||||
}
|
||||
public D getCurrent() {
|
||||
return (D) Global.mainModule.get(CurrentName());
|
||||
}
|
||||
public void setCurrent(D o) {
|
||||
Global.mainModule.set(CurrentName(), o);
|
||||
}
|
||||
public Vector<D> getCheckedOrCurrent() {
|
||||
Vector<D> res = new Vector<>();
|
||||
if (getCheckedCount() > 0)
|
||||
res = getCheckedItems();
|
||||
else {
|
||||
if (CurrentName()!=null) {
|
||||
if (getCurrent() != null) {
|
||||
res.add(getCurrent());
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void SaveLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = null;
|
||||
if ((CurrentName() != null) && (getCurrent() != null))
|
||||
lastPk = getCurrent().getPK();
|
||||
if (!selections.containsKey(getClass()))
|
||||
selections.put(getClass(), lastPk);
|
||||
else selections.replace(getClass(), lastPk);
|
||||
}
|
||||
}
|
||||
public void RestoreLastSelections() {
|
||||
if (hasUI()) {
|
||||
Object lastPk = selections.get(getClass());
|
||||
if ((CurrentName() != null) && (lastPk != null)) {
|
||||
ui_.Select(lastPk);
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package Common.Database;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Database.Objects.DBForm.FormsDBTable;
|
||||
import Common.Database.Objects.Grid.TablesVisualDatasDBTable;
|
||||
import Common.Database.Objects.PassStats.PassStatsDBTable;
|
||||
import _VisualDVM.GlobalData.Grid.TablesVisualDatasDBTable;
|
||||
import _VisualDVM.GlobalData.Splitter.SplittersDBTable;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Database.Objects.Splitter.SplittersDBTable;
|
||||
import Common.Database.SQLITE.SQLiteDatabase;
|
||||
import Common.Passes.PassCode_;
|
||||
|
||||
import java.io.File;
|
||||
public class VisualiserDatabase extends SQLiteDatabase {
|
||||
@@ -23,7 +23,7 @@ public class VisualiserDatabase extends SQLiteDatabase {
|
||||
addTable(passStats = new PassStatsDBTable());
|
||||
}
|
||||
@Override
|
||||
public PassCode getSynchronizePassCode() {
|
||||
public PassCode_ getSynchronizePassCode() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +1,64 @@
|
||||
package Common;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import Common.Database.Objects.PassStats.PassStats;
|
||||
import Common.Database.VisualiserDatabase;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Database.Objects.PassStats.PassStats;
|
||||
import Common.Visual.Windows.PassForm;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.UIModule_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
//Основной объект визуализатора.
|
||||
public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
public static MainModule_ object =null;
|
||||
public abstract class MainModule_<D extends VisualiserDatabase, U extends UIModule_> {
|
||||
public static MainModule_ instance = null; //текущий экземпляр. всегда один.
|
||||
//--
|
||||
D db;
|
||||
Class<D> db_class;
|
||||
D db = null;
|
||||
Class<D> db_class = null;
|
||||
LinkedHashMap<Current_, Object> objects = null; //Current/ большинство выведено
|
||||
//--
|
||||
LinkedHashMap<PassCode_, Pass> passes;
|
||||
LinkedHashMap<Current_, Object> objects; //Current
|
||||
LinkedHashMap<PassCode_, Pass> passes = null;
|
||||
//--
|
||||
U ui = null;
|
||||
Class<U> ui_class = null;
|
||||
MenuElement[] last_menu_path = null;
|
||||
//--
|
||||
public MainModule_(Class<D> db_class_in, Class<U> ui_class_in) throws Exception {
|
||||
ui_class = ui_class_in;
|
||||
db_class = db_class_in;
|
||||
instance = this;
|
||||
}
|
||||
public void Init() throws Exception {
|
||||
//нужно потому что внутри есть ссылки на экземпляр объекта, и конструктор не годится
|
||||
if (ui_class != null) {
|
||||
ui = ui_class.newInstance();
|
||||
}
|
||||
//--
|
||||
createPasses();
|
||||
//-
|
||||
objects = new LinkedHashMap<>();
|
||||
}
|
||||
//ИНТЕРФЕЙС
|
||||
public boolean hasUI() {
|
||||
return ui != null;
|
||||
}
|
||||
public U getUI() {
|
||||
return ui;
|
||||
}
|
||||
public boolean hasLastMenuPath() {
|
||||
return last_menu_path != null;
|
||||
}
|
||||
public MenuElement[] getLastMenuPath() {
|
||||
return last_menu_path;
|
||||
}
|
||||
public MenuElement[] setLastMenuPath(MenuElement[] last_menu_path_in) {
|
||||
return last_menu_path = last_menu_path_in;
|
||||
}
|
||||
//БАЗА ДАННЫХ И ТЕКУЩИЕ ОБЪЕКТЫ
|
||||
public D getDb() {
|
||||
return db;
|
||||
}
|
||||
//---
|
||||
private void createPasses(){
|
||||
passes= new LinkedHashMap<>();
|
||||
for (Object code: getPassCodesEnum().getEnumConstants()){
|
||||
try {
|
||||
Class<?> clazz = Class.forName(getAllPassesClassPrefix() + code.toString());
|
||||
Pass pass = ((Pass) clazz.newInstance());
|
||||
passes.put((PassCode_) code, pass);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setPassesControlsVisible(boolean flag, PassCode_... codes_in) {
|
||||
for (PassCode_ code_in : codes_in)
|
||||
getPass(code_in).setControlsVisible(flag);
|
||||
}
|
||||
public boolean HasPassForm() {
|
||||
return get(Current.PassForm) != null;
|
||||
}
|
||||
public PassForm getPassForm() {
|
||||
return (PassForm) get(Current.PassForm);
|
||||
}
|
||||
public Pass getPass(PassCode_ code){
|
||||
return passes.get(code);
|
||||
}
|
||||
public String getPassDescription(String passName){
|
||||
return ((PassCode_)Enum.valueOf(MainModule_.object.getPassCodesEnum(), passName)).getDescription();
|
||||
}
|
||||
//---
|
||||
public MainModule_(Class<D> db_class_in) {
|
||||
objects = new LinkedHashMap<>();
|
||||
createPasses();
|
||||
try {
|
||||
db_class = db_class_in;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//---
|
||||
object = this;
|
||||
System.out.println("main module created");
|
||||
}
|
||||
public abstract Class getPassCodesEnum();
|
||||
public abstract String getAllPassesClassPrefix();
|
||||
public void ActivateDB() throws Exception {
|
||||
db = db_class.newInstance();
|
||||
db.Connect();
|
||||
@@ -75,13 +66,12 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
}
|
||||
public void DeactivateDB() throws Exception{
|
||||
public void DeactivateDB() throws Exception {
|
||||
if (db != null) db.Disconnect();
|
||||
}
|
||||
//--
|
||||
public Object get(Current_ name) {
|
||||
if (!objects.containsKey(name))
|
||||
objects.put(name,null);
|
||||
objects.put(name, null);
|
||||
return objects.get(name);
|
||||
}
|
||||
public Object set(Current_ name, Object object) {
|
||||
@@ -96,12 +86,32 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
Log.Writeln_(name.getDescription() + " не выбран(а)");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
//применять только для наследников iDBObject
|
||||
public boolean matchCurrentID(Current_ name, int id) {
|
||||
return (get(name) != null) && (((iDBObject) get(name)).id == id);
|
||||
//ПРОХОДЫ
|
||||
public abstract Class getPassCodesEnum();
|
||||
public abstract String getAllPassesClassPrefix();
|
||||
private void createPasses() {
|
||||
passes = new LinkedHashMap<>();
|
||||
for (Object code : getPassCodesEnum().getEnumConstants()) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(getAllPassesClassPrefix() + code.toString());
|
||||
Pass pass = ((Pass) clazz.newInstance());
|
||||
passes.put((PassCode_) code, pass);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<Pass> getFirstAccessPasses(){
|
||||
public void setPassesControlsVisible(boolean flag, PassCode_... codes_in) {
|
||||
for (PassCode_ code_in : codes_in)
|
||||
getPass(code_in).setControlsVisible(flag);
|
||||
}
|
||||
public Pass getPass(PassCode_ code) {
|
||||
return passes.get(code);
|
||||
}
|
||||
public String getPassDescription(String passName) {
|
||||
return ((PassCode_) Enum.valueOf(MainModule_.instance.getPassCodesEnum(), passName)).getDescription();
|
||||
}
|
||||
public Vector<Pass> getFirstAccessPasses() {
|
||||
Vector<PassStats> sortedStats = new Vector<>(getDb().passStats.Data.values());
|
||||
sortedStats.sort(new Comparator<PassStats>() {
|
||||
@Override
|
||||
@@ -109,11 +119,28 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
return Integer.compare(o2.Usages, o1.Usages);
|
||||
}
|
||||
});
|
||||
Vector<Pass> res= new Vector<>();
|
||||
for (PassStats passStats: sortedStats){
|
||||
Vector<Pass> res = new Vector<>();
|
||||
for (PassStats passStats : sortedStats) {
|
||||
PassCode_ passCode = (PassCode_) Enum.valueOf(getPassCodesEnum(), passStats.code);
|
||||
res.add(getPass(passCode));
|
||||
//--
|
||||
Pass pass = getPass(passCode);
|
||||
if (pass.hasStats())
|
||||
res.add(getPass(passCode));
|
||||
//--
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//---
|
||||
public int getFirstAccessPassesCount() {
|
||||
return 0;
|
||||
}
|
||||
public boolean confirmPassesStart() {
|
||||
return false;
|
||||
}
|
||||
public boolean confirmPassesDone() {
|
||||
return false;
|
||||
}
|
||||
public boolean focusPassesResult() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
13
src/Common/MainModules/_MainModule.java
Normal file
13
src/Common/MainModules/_MainModule.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package Common.MainModules;
|
||||
import Common.Database.Database;
|
||||
import Common.Visual.UIModule_;
|
||||
public class _MainModule {
|
||||
protected Database db = null;
|
||||
protected UIModule_ ui = null;
|
||||
public boolean hasUI() {
|
||||
return ui != null;
|
||||
}
|
||||
public Database getDb() {
|
||||
return db;
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,27 @@ public abstract class AddObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
public AddObjectPass(Class<D> d_in) {
|
||||
super(d_in);
|
||||
}
|
||||
public Class<? extends DBObject> getOwner() {
|
||||
protected Class<? extends DBObject> getOwnerClass() {
|
||||
return null;
|
||||
}
|
||||
protected DBObject getOwner() {
|
||||
return getDb().getTable(getOwnerClass()).getUI().getCurrent();
|
||||
}
|
||||
@Override
|
||||
public String getDescription_() {
|
||||
return "добавление";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = d.newInstance();
|
||||
return
|
||||
((getOwner() == null) || (getDb().tables.get(getOwner()).CheckCurrent(Log))) &&
|
||||
fillObjectFields();
|
||||
return ((getOwnerClass() == null) || (getDb().getTable(getOwnerClass()).getUI().CheckCurrent(Log))) && fillObjectFields();
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return getTable().ShowAddObjectDialog(target);
|
||||
return getTable().getUI().ShowAddObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/RedAdd.png";
|
||||
return "/Common/icons/RedAdd.png";
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
@@ -5,13 +5,17 @@ public abstract class DeleteObjectPass<D extends DBObject> extends ObjectPass<D>
|
||||
super(d_in);
|
||||
}
|
||||
@Override
|
||||
public String getDescription_() {
|
||||
return "удаление";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
return "/Common/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (D) getTable().getCurrent();
|
||||
return getTable().CheckCurrent(Log) && getTable().ShowDeleteObjectDialog(target);
|
||||
target = (D) getTable().getUI().getCurrent();
|
||||
return getTable().getUI().CheckCurrent(Log) && getTable().getUI().ShowDeleteObjectDialog(target);
|
||||
}
|
||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||
@Override
|
||||
@@ -23,7 +27,7 @@ public abstract class DeleteObjectPass<D extends DBObject> extends ObjectPass<D>
|
||||
case DROP:
|
||||
break;
|
||||
case DELETE:
|
||||
getDb().tables.get(dep).ClearUI();
|
||||
getDb().getTable(dep).ClearUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -31,25 +35,11 @@ public abstract class DeleteObjectPass<D extends DBObject> extends ObjectPass<D>
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
getDb().Delete(target);
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
switch (getTable().getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
break;
|
||||
case DROP:
|
||||
getDb().DropByFK(target, dep);
|
||||
break;
|
||||
case DELETE:
|
||||
getDb().DeleteByFK(target, dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
getDb().DeleteDependencies(target);
|
||||
}
|
||||
//тут именно на финише, чтобы в любом случае вся таблица всегда была видна.
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
protected void showFinish() throws Exception {
|
||||
getTable().ShowUI();
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
getDb().tables.get(dep).RefreshUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
58
src/Common/Passes/DeleteObjectsPass.java
Normal file
58
src/Common/Passes/DeleteObjectsPass.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package Common.Passes;
|
||||
import Common.Database.Objects.DBObject;
|
||||
public abstract class DeleteObjectsPass<D extends DBObject> extends ObjectsPass<D> {
|
||||
public DeleteObjectsPass(Class<D> d_in) {
|
||||
super(d_in);
|
||||
}
|
||||
public String getDescription_() {
|
||||
return "удаление";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/Common/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!getTable().getUI().CheckSelectedOrCurrent(Log))
|
||||
return false;
|
||||
target = getTable().getUI().getSelectedOrCurrent();
|
||||
return getTable().getUI().ShowDeleteObjectsDialog(target.size());
|
||||
}
|
||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||
@Override
|
||||
protected void showPreparation() throws Exception {
|
||||
getTable().ClearUI();
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
switch (getTable().getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
case DROP:
|
||||
break;
|
||||
case DELETE:
|
||||
getDb().getTable(dep).ClearUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (D d : target) {
|
||||
getDb().Delete(d);
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
switch (getTable().getFKDependencies().get(dep).data) {
|
||||
case NONE:
|
||||
break;
|
||||
case DROP:
|
||||
getDb().DropByFK(d, dep);
|
||||
break;
|
||||
case DELETE:
|
||||
getDb().DeleteByFK(d, dep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
getTable().ShowUI();
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,20 @@ public abstract class EditObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
public EditObjectPass(Class<D> d_in) {
|
||||
super(d_in);
|
||||
}
|
||||
public String getDescription_() {
|
||||
return "редактирование";
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Edit.png";
|
||||
return "/Common/icons/Edit.png";
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return getTable().getUI().ShowEditObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (D) getTable().getCurrent();
|
||||
return getTable().CheckCurrent(Log) && getTable().ShowEditObjectDialog(target);
|
||||
target = (D) getTable().getUI().getCurrent();
|
||||
return getTable().getUI().CheckCurrent(Log) && fillObjectFields();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
@@ -20,7 +26,9 @@ public abstract class EditObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
@Override
|
||||
protected void showFinish() throws Exception {
|
||||
getTable().ShowUI(target.getPK());
|
||||
for (Class dep : getTable().getFKDependencies().keySet())
|
||||
getDb().tables.get(dep).RefreshUI();
|
||||
for (Class dep : getTable().getFKDependencies().keySet()) {
|
||||
if (getDb().getTable(dep).getUI() != null)
|
||||
getDb().getTable(dep).getUI().RedrawControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,27 @@
|
||||
package Common.Passes;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Database;
|
||||
import Common.MainModule_;
|
||||
public abstract class ObjectPass<D extends DBObject> extends Pass<D> {
|
||||
protected Class<D> d; //класс объектов.
|
||||
public ObjectPass(Class<D> d_in) {
|
||||
d = d_in;
|
||||
}
|
||||
protected Database getDb(){ return MainModule_.object.getDb();}; //источник данных
|
||||
protected Database getDb() {
|
||||
return MainModule_.instance.getDb();
|
||||
}
|
||||
//источник данных
|
||||
public DBTable getTable() {
|
||||
return getDb().tables.get(d);
|
||||
return getDb().getTable(d);
|
||||
} //таблица в источнике данных
|
||||
public String getDescription_() {
|
||||
return "?";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return getTable().getSingleDescription() + ": " + getDescription_();
|
||||
}
|
||||
@Override//sorted
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
|
||||
31
src/Common/Passes/ObjectsPass.java
Normal file
31
src/Common/Passes/ObjectsPass.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package Common.Passes;
|
||||
import Common.Database.Database;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.MainModule_;
|
||||
|
||||
import java.util.Vector;
|
||||
//массовый проход с объектами. на данный момент удаление.
|
||||
public abstract class ObjectsPass<D extends DBObject> extends Pass<Vector<D>> {
|
||||
protected Class<D> d; //класс объектов.
|
||||
public ObjectsPass(Class<D> d_in) {
|
||||
d = d_in;
|
||||
}
|
||||
protected Database getDb() {
|
||||
return MainModule_.instance.getDb();
|
||||
}
|
||||
public DBTable getTable() {
|
||||
return getDb().getTable(d);
|
||||
} //таблица в источнике данных
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
public String getDescription_() {
|
||||
return "?";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return getTable().getPluralDescription() + ": " + getDescription_();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
package Common.Passes;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Stopwatch;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Visual.UI_;
|
||||
import Common.MainModule_;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.PassButton;
|
||||
import Common.Visual.Controls.PassControl;
|
||||
import Common.Visual.Controls.StablePassMenuItem;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.PassForm;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.Controls.PassButton;
|
||||
import _VisualDVM.Visual.Controls.PassControl;
|
||||
import _VisualDVM.Visual.Menus.StablePassMenuItem;
|
||||
import _VisualDVM.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -24,15 +20,20 @@ public class Pass<T> {
|
||||
public PassState state = PassState.Inactive; //текущее состояние прохода.
|
||||
public Semaphore animation_sem;
|
||||
//--------------
|
||||
public boolean ui_visible = true;
|
||||
public Vector<PassControl> controls = new Vector<>();
|
||||
public TextLog Log; //внутренний журнал прохода.
|
||||
protected boolean interrupt;
|
||||
protected SwingWorker dispatcher = null;
|
||||
private PassForm form = null;
|
||||
protected JMenuItem menuItem = null;
|
||||
private PassForm form = null;
|
||||
private JButton button = null;
|
||||
private JButton tabButton = null;
|
||||
private Exception last_error; //последнее пойманное исключение выполнения.
|
||||
public void addControl(PassControl control_in) {
|
||||
control_in.setVisible(ui_visible);
|
||||
controls.add(control_in);
|
||||
}
|
||||
//->>
|
||||
public Throwable getCauseRec(Throwable ex) {
|
||||
Throwable cause = ex.getCause();
|
||||
@@ -78,8 +79,9 @@ public class Pass<T> {
|
||||
control.setEnabled(flag);
|
||||
}
|
||||
public void setControlsVisible(boolean flag) {
|
||||
ui_visible = flag;
|
||||
for (PassControl control : controls)
|
||||
control.setVisible(flag);
|
||||
control.setVisible(ui_visible);
|
||||
}
|
||||
public void setControlsToolTipText(String text) {
|
||||
for (PassControl control : controls)
|
||||
@@ -93,22 +95,25 @@ public class Pass<T> {
|
||||
public void UpdateStatsIfNeed() {
|
||||
if (hasStats()) {
|
||||
try {
|
||||
MainModule_.object.getDb().passStats.IncPassStat(getName());
|
||||
MainModule_.instance.getDb().passStats.IncPassStat(getName());
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
UI.fastAccessMenuBar.Refresh(); //todo все бары в мейн модуль. или уи.мейн модуль
|
||||
if (UI.isActive())
|
||||
MainModule_.instance.getUI().getFastAccessMenuBar().Refresh();
|
||||
}
|
||||
}
|
||||
public boolean isDone() {
|
||||
return state.equals(PassState.Done);
|
||||
}
|
||||
public void setDone() {
|
||||
state.equals(PassState.Done);
|
||||
state = PassState.Done;
|
||||
}
|
||||
public String getName() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
public String getName(){return getClass().getSimpleName();}
|
||||
public String getDescription() {
|
||||
return MainModule_.object.getPassDescription(getName());
|
||||
return MainModule_.instance.getPassDescription(getName());
|
||||
}
|
||||
public String getStartDescription() {
|
||||
return getDescription();
|
||||
@@ -151,34 +156,34 @@ public class Pass<T> {
|
||||
//-
|
||||
private void PerformCanNotStart() throws Exception {
|
||||
performCanNotStart();
|
||||
if (UI_.isActive())
|
||||
if (UI.isActive())
|
||||
showCanNotStart();
|
||||
}
|
||||
protected void PerformPreparation() throws Exception {
|
||||
performPreparation();
|
||||
if (UI_.isActive())
|
||||
if (UI.isActive())
|
||||
showPreparation();
|
||||
}
|
||||
private void PerformFinish() throws Exception {
|
||||
performFinish();
|
||||
//-
|
||||
if (UI_.isActive())
|
||||
if (UI.isActive())
|
||||
showFinish();
|
||||
}
|
||||
private void PerformDone() throws Exception {
|
||||
performDone();
|
||||
//-
|
||||
if (UI_.isActive())
|
||||
if (UI.isActive())
|
||||
showDone();
|
||||
}
|
||||
private void PerformFail() throws Exception {
|
||||
performFail();
|
||||
//-
|
||||
if (UI_.isActive())
|
||||
if (UI.isActive())
|
||||
showFail();
|
||||
}
|
||||
//------
|
||||
protected PassCode necessary() {
|
||||
protected PassCode_ necessary() {
|
||||
return null;
|
||||
}
|
||||
protected boolean resetsNecessary() {
|
||||
@@ -196,29 +201,29 @@ public class Pass<T> {
|
||||
ToPrint.add(this.getStartDescription());
|
||||
}
|
||||
if (necessary() != null) {
|
||||
Pass next = MainModule_.object.getPass(necessary());
|
||||
Pass next = MainModule_.instance.getPass(necessary());
|
||||
if (resetsNecessary() || !next.isDone())
|
||||
next.createStack_r(ToDo, ToPrint);
|
||||
}
|
||||
}
|
||||
//todo обращение к пропертиес как то пофиксить
|
||||
public boolean Do(Object... args) {
|
||||
Stack<Pass> ToDo = new Stack<>();
|
||||
Vector<String> ToPrint = new Vector<>();
|
||||
createStack_r(ToDo, ToPrint);
|
||||
if (Global.properties.ConfirmPassesStart && !ToPrint.isEmpty() &&
|
||||
!UI_.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))
|
||||
if (
|
||||
UI.isActive() && MainModule_.instance.confirmPassesStart() && !ToPrint.isEmpty() &&
|
||||
!UI.Question("Выполнить проход(ы):\n" + String.join("\n", ToPrint))
|
||||
) return false;
|
||||
while (ToDo.size() > 1) {
|
||||
if (!ToDo.pop().start()) return false;
|
||||
}
|
||||
if (start(args)) {
|
||||
if (Global.properties.FocusPassesResult)
|
||||
if (UI.isActive() && MainModule_.instance.focusPassesResult())
|
||||
FocusResult();
|
||||
//-
|
||||
if (Global.properties.ShowPassesDone && !ToPrint.isEmpty()
|
||||
if (UI.isActive() && MainModule_.instance.confirmPassesDone() && !ToPrint.isEmpty()
|
||||
) {
|
||||
UI_.Info("Проход(ы)\n\n" + String.join("\n", ToPrint) +
|
||||
UI.Info("Проход(ы)\n\n" + String.join("\n", ToPrint) +
|
||||
"\nуспешно выполнен(ы)!");
|
||||
}
|
||||
//-
|
||||
@@ -232,7 +237,7 @@ public class Pass<T> {
|
||||
return false;
|
||||
}
|
||||
public void Interrupt() throws Exception {
|
||||
UI_.Info("Проход " + Utils_.Brackets(getDescription()) + " не разрешено прерывать.");
|
||||
UI.Info("Проход " + Utils_.Brackets(getDescription()) + " не разрешено прерывать.");
|
||||
}
|
||||
public boolean needsConfirmations() {
|
||||
return false;
|
||||
@@ -259,18 +264,18 @@ public class Pass<T> {
|
||||
timer.Start();
|
||||
//------------------------------->
|
||||
try {
|
||||
if (UI_.isActive()) FocusBeforeStart();
|
||||
if (UI.isActive()) FocusBeforeStart();
|
||||
if (canStart(args)) {
|
||||
PerformPreparation();
|
||||
if (UI_.isActive() && needsAnimation()) {
|
||||
if (UI.isActive() && needsAnimation()) {
|
||||
animation_sem = new Semaphore(1);
|
||||
animation_sem.acquire();
|
||||
//---
|
||||
form = null;
|
||||
MainModule_.object.set(Current.PassForm, null);
|
||||
MainModule_.instance.getUI().DropPassForm();
|
||||
System.gc();
|
||||
//--
|
||||
MainModule_.object.set(Current.PassForm, form = new PassForm(this));
|
||||
form = MainModule_.instance.getUI().SetPassForm(new PassForm(this));
|
||||
dispatcher = new SwingWorker() {
|
||||
@Override
|
||||
protected Object doInBackground() {
|
||||
@@ -342,8 +347,8 @@ public class Pass<T> {
|
||||
" окончен за " + timer.Print() +
|
||||
" состояние " + Utils_.Brackets(state.getDescription())
|
||||
);
|
||||
if (!Log.isEmpty() && UI_.isActive())
|
||||
UI_.Error(
|
||||
if (!Log.isEmpty() && UI.isActive())
|
||||
UI.Error(
|
||||
"проход " + Utils_.Brackets(getDescription()) + "\n" + state.getDescription() + "\n\n" +
|
||||
Log.toString());
|
||||
}
|
||||
@@ -352,7 +357,7 @@ public class Pass<T> {
|
||||
}
|
||||
//--
|
||||
public void ShowSapforMessage(String message) {
|
||||
if (UI_.isActive() && form != null) {
|
||||
if (UI.isActive() && form != null) {
|
||||
String[] data = message.split(":");
|
||||
switch (data[0]) {
|
||||
case "message_1":
|
||||
@@ -365,17 +370,15 @@ public class Pass<T> {
|
||||
form.fields.ProgressBar.setValue((data.length > 1) ? Integer.parseInt(data[1]) : 0);
|
||||
break;
|
||||
}
|
||||
} else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
}
|
||||
public void ShowMessage1(String message) {
|
||||
if (form != null)
|
||||
form.fields.Label1.setText((message.length() > 1) ? message : "");
|
||||
else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
public void ShowMessage2(String message) {
|
||||
if (form != null)
|
||||
form.fields.Label2.setText((message.isEmpty() ? "" : message));
|
||||
else System.out.println(Utils_.Brackets(message));
|
||||
}
|
||||
public void ShowProgress(int total, int current, boolean auto) {
|
||||
if (form != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Passes;
|
||||
public interface PassCode_ {
|
||||
default String getDescription(){
|
||||
default String getDescription() {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
94
src/Common/Properties.java
Normal file
94
src/Common/Properties.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package Common;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.LinkedHashMap;
|
||||
public class Properties {
|
||||
protected LinkedHashMap<String, JMenuItem> controls = new LinkedHashMap<>();
|
||||
private File file = null; //файл где хранятся настройки.
|
||||
public Properties() {
|
||||
}
|
||||
public Properties(File file_in) {
|
||||
setFile(file_in);
|
||||
}
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
public void Update() {
|
||||
try {
|
||||
Utils_.jsonToFile(this, getFile());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public boolean updateField(String name, Object newValue) {
|
||||
try {
|
||||
Field field = getClass().getField(name);
|
||||
Object oldValue = field.get(this);
|
||||
//---
|
||||
if (newValue.equals(oldValue))
|
||||
return false;
|
||||
//--
|
||||
field.set(this, newValue);
|
||||
Update();
|
||||
return true;
|
||||
//--
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public String getFieldDescription(String fieldName) {
|
||||
return "?";
|
||||
}
|
||||
public boolean controlAction(String fieldName, JMenuItem control
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
public JMenuItem getMenuItem(String fieldName) {
|
||||
final JMenuItem menuItem;
|
||||
if (controls.containsKey(fieldName))
|
||||
menuItem = controls.get(fieldName);
|
||||
else {
|
||||
menuItem = new StableMenuItem();
|
||||
Mark(fieldName, menuItem);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (controlAction(fieldName, menuItem))
|
||||
Mark(fieldName, menuItem);
|
||||
}
|
||||
});
|
||||
controls.put(fieldName, menuItem);
|
||||
}
|
||||
return menuItem;
|
||||
}
|
||||
public void Mark(String fieldName, JMenuItem control) {
|
||||
String description = getFieldDescription(fieldName);
|
||||
try {
|
||||
Object value = this.getClass().getField(fieldName).get(this);
|
||||
if (value instanceof Boolean) {
|
||||
Boolean flag = (Boolean) value;
|
||||
control.setText(description);
|
||||
control.setIcon(Utils_.getIcon(flag ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||||
} else {
|
||||
control.setText(description + " : " + value);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void setControlVisible(String settingName, boolean flag) {
|
||||
if (controls.containsKey(settingName)) {
|
||||
controls.get(settingName).setVisible(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/Common/Utils/IntegerPairJson.java
Normal file
20
src/Common/Utils/IntegerPairJson.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package Common.Utils;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class IntegerPairJson {
|
||||
@Expose
|
||||
public int key;
|
||||
@Expose
|
||||
public int value;
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
public IntegerPairJson(int key_in, int value_in) {
|
||||
key = key_in;
|
||||
value = value_in;
|
||||
}
|
||||
public IntegerPairJson() {
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package Common.Utils;
|
||||
import _VisualDVM.Constants;
|
||||
import Common.CommonConstants;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.Callable;
|
||||
public class InterruptThread extends Thread{
|
||||
public class InterruptThread extends Thread {
|
||||
//------------
|
||||
public InterruptThread(int sleep_ms, Callable action){
|
||||
public InterruptThread(int sleep_ms, Callable action) {
|
||||
super(() -> {
|
||||
File interruptFile = new File(Constants.INTERRUPT);
|
||||
File interruptFile = new File(CommonConstants.INTERRUPT);
|
||||
try {
|
||||
while (true) {
|
||||
Thread.sleep(sleep_ms);
|
||||
if (interruptFile.exists()) {
|
||||
FileUtils.writeStringToFile(new File(Constants.ABORTED), "");
|
||||
FileUtils.writeStringToFile(new File(CommonConstants.ABORTED), "");
|
||||
FileUtils.forceDelete(interruptFile);
|
||||
action.call();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Utils;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Utils;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.ReadOnlyMultilineTextForm;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@@ -16,7 +16,7 @@ public interface Loggable {
|
||||
}
|
||||
default void ClearLog() {
|
||||
try {
|
||||
Utils.forceDeleteWithCheck(getLogFile());
|
||||
Utils_.forceDeleteWithCheck(getLogFile());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,10 @@ public interface Loggable {
|
||||
ex.printStackTrace(writer);
|
||||
writer.flush();
|
||||
Print(out.toString());
|
||||
if (UI_.isActive())
|
||||
UI_.Error("Возникло исключение. Подробности в файле журнала\n" +
|
||||
Utils_.Brackets(getLogFile().getAbsolutePath()));
|
||||
if (UI.isActive()) {
|
||||
Utils_.CopyToClipboard(out.toString());
|
||||
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
|
||||
ff.ShowDialog("Возникло исключение", out.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
95
src/Common/Utils/Pair.java
Normal file
95
src/Common/Utils/Pair.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package Common.Utils;
|
||||
import java.io.Serializable;
|
||||
public class Pair<K, V> implements Serializable {
|
||||
/**
|
||||
* Key of this <code>Pair</code>.
|
||||
*/
|
||||
private K key;
|
||||
/**
|
||||
* Value of this this <code>Pair</code>.
|
||||
*/
|
||||
private V value;
|
||||
/**
|
||||
* Creates a new pair
|
||||
*
|
||||
* @param key The key for this pair
|
||||
* @param value The value to use for this pair
|
||||
*/
|
||||
public Pair(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* Gets the key for this pair.
|
||||
*
|
||||
* @return key for this pair
|
||||
*/
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
/**
|
||||
* Gets the value for this pair.
|
||||
*
|
||||
* @return value for this pair
|
||||
*/
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* <p><code>String</code> representation of this
|
||||
* <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The default name/value delimiter '=' is always used.</p>
|
||||
*
|
||||
* @return <code>String</code> representation of this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
/**
|
||||
* <p>Generate a hash code for this <code>Pair</code>.</p>
|
||||
*
|
||||
* <p>The hash code is calculated using both the name and
|
||||
* the value of the <code>Pair</code>.</p>
|
||||
*
|
||||
* @return hash code for this <code>Pair</code>
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// name's hashCode is multiplied by an arbitrary prime number (13)
|
||||
// in order to make sure there is a difference in the hashCode between
|
||||
// these two parameters:
|
||||
// name: a value: aa
|
||||
// name: aa value: a
|
||||
return key.hashCode() * 13 + (value == null ? 0 : value.hashCode());
|
||||
}
|
||||
/**
|
||||
* <p>Test this <code>Pair</code> for equality with another
|
||||
* <code>Object</code>.</p>
|
||||
*
|
||||
* <p>If the <code>Object</code> to be tested is not a
|
||||
* <code>Pair</code> or is <code>null</code>, then this method
|
||||
* returns <code>false</code>.</p>
|
||||
*
|
||||
* <p>Two <code>Pair</code>s are considered equal if and only if
|
||||
* both the names and values are equal.</p>
|
||||
*
|
||||
* @param o the <code>Object</code> to test for
|
||||
* equality with this <code>Pair</code>
|
||||
* @return <code>true</code> if the given <code>Object</code> is
|
||||
* equal to this <code>Pair</code> else <code>false</code>
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof Pair) {
|
||||
Pair pair = (Pair) o;
|
||||
if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
|
||||
if (value != null ? !value.equals(pair.value) : pair.value != null) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
85
src/Common/Utils/TimerTask.java
Normal file
85
src/Common/Utils/TimerTask.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package Common.Utils;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
public abstract class TimerTask {
|
||||
int maxtime;
|
||||
int attempts;
|
||||
boolean success;
|
||||
Semaphore semaphore = null;
|
||||
Thread actionThread = null;
|
||||
//--
|
||||
public TimerTask(int maxtime_in, int attempts_in) {
|
||||
maxtime = maxtime_in;
|
||||
attempts = attempts_in;
|
||||
semaphore = new Semaphore(1);
|
||||
actionThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Action();
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Thread occured exception!");
|
||||
ex.printStackTrace();
|
||||
System.out.println("-------------------------");
|
||||
} finally {
|
||||
releaseSemaphore();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//--
|
||||
public abstract void Action() throws Exception;
|
||||
public void finalizeThread() {
|
||||
}
|
||||
void acquireSemaphore() {
|
||||
try {
|
||||
semaphore.acquire();
|
||||
System.out.println("semaphore acquired");
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
void releaseSemaphore() {
|
||||
semaphore.release();
|
||||
System.out.println("semaphore released");
|
||||
}
|
||||
void waitForThread() {
|
||||
int i = 0;
|
||||
success = false;
|
||||
while (true) {
|
||||
try {
|
||||
++i;
|
||||
if (semaphore.tryAcquire(1, TimeUnit.SECONDS)) {
|
||||
System.out.println("thread finished for " + i + " seconds");
|
||||
success = true;
|
||||
return;
|
||||
} else {
|
||||
System.out.println("thread active " + i + " seconds");
|
||||
if (i >= maxtime) {
|
||||
System.out.println("maxtime reached: " + i + " seconds");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println("waiting exception");
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean Perform(int attempts) {
|
||||
int i = 0;
|
||||
while (i < attempts) {
|
||||
acquireSemaphore();
|
||||
actionThread.start();
|
||||
waitForThread();
|
||||
finalizeThread();
|
||||
++i;
|
||||
System.out.println("task finished for " + i + " attempts");
|
||||
if (success) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
System.out.println("attempts overlimited");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package Common.Utils;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.VisualiserDatabase;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Properties;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -22,28 +25,10 @@ import java.util.concurrent.Semaphore;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.stream.Collectors;
|
||||
public class Utils_ {
|
||||
static String HomePath = System.getProperty("user.dir");
|
||||
public static void setHomePath(String path_in){
|
||||
HomePath = path_in;
|
||||
}
|
||||
//Текущая оперционная система
|
||||
public static boolean isWindows() {
|
||||
return System.getProperty("os.name").startsWith("Windows");
|
||||
}
|
||||
public static String getHomePath(){
|
||||
return HomePath;
|
||||
}
|
||||
public static File getHomeDirectory(){
|
||||
return new File(getHomePath());
|
||||
};
|
||||
//ГЛОБАЛЬНЫЙ ЖУРНАЛ
|
||||
public static Loggable MainLog;
|
||||
public static Semaphore date_semaphore = new Semaphore(1);
|
||||
public static long last_ticks = CommonConstants.Nan;
|
||||
//--------------------------------------------------
|
||||
public static Object requireNonNullElse(Object value, Object default_value) {
|
||||
return (value != null) ? value : default_value;
|
||||
}
|
||||
//--
|
||||
//JSON
|
||||
//--
|
||||
@@ -55,6 +40,24 @@ public class Utils_ {
|
||||
// }
|
||||
//--
|
||||
public static Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
|
||||
static String HomePath = System.getProperty("user.dir");
|
||||
//Текущая оперционная система
|
||||
public static boolean isWindows() {
|
||||
return System.getProperty("os.name").startsWith("Windows");
|
||||
}
|
||||
public static String getHomePath() {
|
||||
return HomePath;
|
||||
}
|
||||
public static void setHomePath(String path_in) {
|
||||
HomePath = path_in;
|
||||
}
|
||||
public static File getHomeDirectory() {
|
||||
return new File(getHomePath());
|
||||
}
|
||||
//--------------------------------------------------
|
||||
public static Object requireNonNullElse(Object value, Object default_value) {
|
||||
return (value != null) ? value : default_value;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//-
|
||||
public static <T> T jsonFromFile(File file, Class<T> json_class) throws Exception {
|
||||
@@ -63,6 +66,16 @@ public class Utils_ {
|
||||
public static void jsonToFile(Object json_object, File file) throws Exception {
|
||||
FileUtils.writeStringToFile(file, gson.toJson(json_object));
|
||||
}
|
||||
public static JsonObject getPropertiesAsJsonObject() throws Exception {
|
||||
File propertiesFile = new File(System.getProperty("user.dir"), "properties");
|
||||
if (!propertiesFile.exists()) {
|
||||
return null;
|
||||
}
|
||||
String packed = FileUtils.readFileToString(propertiesFile, Charset.defaultCharset());
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject json = parser.parse(packed).getAsJsonObject();
|
||||
return json;
|
||||
}
|
||||
//БУФЕР ОБМЕНА
|
||||
public static void CopyToClipboard(String text) {
|
||||
Toolkit.getDefaultToolkit()
|
||||
@@ -396,6 +409,52 @@ public class Utils_ {
|
||||
os.write(bytes);
|
||||
os.close();
|
||||
}
|
||||
public static void CheckDirectory(File dir) {
|
||||
if (!dir.exists()) {
|
||||
try {
|
||||
FileUtils.forceMkdir(dir);
|
||||
} catch (Exception e) {
|
||||
MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void CheckAndCleanDirectory(File dir) {
|
||||
if (dir.exists()) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files != null)
|
||||
for (File f : files) {
|
||||
try {
|
||||
forceDeleteWithCheck(f);
|
||||
} catch (Exception e) {
|
||||
MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
FileUtils.forceMkdir(dir);
|
||||
} catch (Exception e) {
|
||||
MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void forceDeleteWithCheck(File file) throws Exception {
|
||||
int attempts = 0;
|
||||
while (attempts < 10) {
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileUtils.forceDelete(file);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else return;
|
||||
if (file.exists()) {
|
||||
attempts++;
|
||||
System.out.println("неудачная попытка удаления: файл " + Brackets(file.getAbsolutePath()) + " занят");
|
||||
sleep(2000);
|
||||
} else return;
|
||||
}
|
||||
throw new PassException("Не удалось удалить файл " + Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
|
||||
}
|
||||
//Иконки
|
||||
public static ImageIcon getIcon(String path) {
|
||||
URL imageUrl = Utils_.class.getResource(path);
|
||||
@@ -429,6 +488,16 @@ public class Utils_ {
|
||||
//--
|
||||
return hours + " часов, " + minutes + " минут, " + seconds + " секунд";
|
||||
}
|
||||
public static String printSplittedDateIntervalShort(long milliseconds) {
|
||||
//--
|
||||
long seconds = milliseconds / 1000;
|
||||
long hours = seconds / 3600;
|
||||
seconds = seconds - hours * 3600;
|
||||
long minutes = (seconds) / 60;
|
||||
seconds = seconds - minutes * 60;
|
||||
//--
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
//Синхронизация
|
||||
public static void sleep(long millis) {
|
||||
try {
|
||||
@@ -459,4 +528,40 @@ public class Utils_ {
|
||||
public static int fromBoolean(boolean flag) {
|
||||
return flag ? 1 : 0;
|
||||
}
|
||||
//--
|
||||
public static <T extends Properties> T SynschronizeProperties(File propertiesFile, Class<T> properties_class) {
|
||||
T res = null;
|
||||
try {
|
||||
res = properties_class.newInstance();
|
||||
if (propertiesFile.exists()) {
|
||||
//файл существует. нужно его ссчитать.
|
||||
res = (T) Utils_.jsonFromFile(propertiesFile, properties_class);
|
||||
}
|
||||
res.setFile(propertiesFile);
|
||||
//перезаписываем файл в любом случае, так как может измениться формат.
|
||||
Utils_.jsonToFile(res, propertiesFile);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static <T extends Properties> T ReadProperties(File propertiesFile, Class<T> properties_class) {
|
||||
T res = null;
|
||||
try {
|
||||
res = (T) Utils_.jsonFromFile(propertiesFile, properties_class);
|
||||
res.setFile(propertiesFile);
|
||||
Utils_.jsonToFile(res, propertiesFile);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static File getFile(String... paths) {
|
||||
if (paths.length == 0)
|
||||
return null;
|
||||
File res = new File(paths[0]);
|
||||
for (int i = 1; i < paths.length; ++i)
|
||||
res = new File(res, paths[i]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package Common.Utils;
|
||||
import java.util.Vector;
|
||||
public class Vector_<T> extends Vector<T> {
|
||||
public Vector_(T... data){
|
||||
for (T object: data)
|
||||
public Vector_(T... data) {
|
||||
for (T object : data)
|
||||
this.add(object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,32 +5,35 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
//класс, представляющий собой прокручиваемую панель, на которой лежит нечто.
|
||||
public class ControlForm<C extends Component> {
|
||||
public C control = null;
|
||||
protected Class<C> control_class;
|
||||
protected JPanel content; //задник.
|
||||
public JScrollPane scroll = null;
|
||||
public ControlForm(Class<C> class_in) {
|
||||
protected C control = null;
|
||||
JPanel mountPanel = null; //панель на которую монтируется UI.помимо контрола может содержать меню сверху.
|
||||
JPanel scrollPanel = null; //панель на которой лежит скролл.
|
||||
JScrollPane scroll = null; //панель прокрутки в которую встроен контрол
|
||||
Class<C> control_class = null;
|
||||
public ControlForm(Class<C> class_in, JPanel mountPanel_in) {
|
||||
control_class = class_in;
|
||||
setContent(new JPanel(new BorderLayout()));
|
||||
mountPanel = mountPanel_in;
|
||||
mountPanel.add((scrollPanel = new JPanel(new BorderLayout())), BorderLayout.CENTER);
|
||||
}
|
||||
//нужно будет вывестии сделать нормальные формы для деревьев а не ручное создание.
|
||||
public JPanel getContent() {
|
||||
return content;
|
||||
public C getControl() {
|
||||
return control;
|
||||
}
|
||||
public void setContent(JPanel content_in) {
|
||||
|
||||
content = content_in;
|
||||
}
|
||||
//-
|
||||
public JPanel getMountPanel() {
|
||||
return mountPanel;
|
||||
} //todo осталось только в projectForm, вывести
|
||||
//новое отображение предполагает полную перерисовку контрола.(?)
|
||||
public void Show() {
|
||||
Clear();
|
||||
CreateControl();
|
||||
//------------------------
|
||||
createControl();
|
||||
//--
|
||||
scroll = new JScrollPane(control);
|
||||
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
//--
|
||||
scrollPanel.add(scroll);
|
||||
scrollPanel.updateUI();
|
||||
}
|
||||
public void CreateControl() {
|
||||
protected void createControl() {
|
||||
try {
|
||||
control = control_class.newInstance();
|
||||
} catch (Exception e) {
|
||||
@@ -41,13 +44,14 @@ public class ControlForm<C extends Component> {
|
||||
return control != null;
|
||||
}
|
||||
public void Clear() {
|
||||
UI.Clear(scrollPanel);
|
||||
control = null; //очищено.
|
||||
}
|
||||
public void Refresh() {
|
||||
public void RedrawControl() {
|
||||
if (control != null)
|
||||
refresh();
|
||||
redrawControl();
|
||||
}
|
||||
//-
|
||||
protected void refresh() {
|
||||
protected void redrawControl() {
|
||||
} //перерисовать контрол.
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package Common.Visual;
|
||||
import Common.Current_;
|
||||
|
||||
import java.awt.*;
|
||||
public class ControlWithCurrentForm<C extends Component> extends ControlForm<C> {
|
||||
public ControlWithCurrentForm(Class<C> class_in) {
|
||||
super(class_in);
|
||||
}
|
||||
//-
|
||||
public Current_ CurrentName() {
|
||||
return null;
|
||||
}
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
}
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
}
|
||||
public void MouseAction2() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
public class HyperlinksStyledList extends StyledList {
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
super.applyTheme();
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.Hyperlink));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -9,7 +9,7 @@ import java.awt.*;
|
||||
public class MenuBarButton extends JButton {
|
||||
public MenuBarButton() {
|
||||
super();
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
//
|
||||
setBorderPainted(false);
|
||||
setContentAreaFilled(false);
|
||||
@@ -29,7 +29,7 @@ public class MenuBarButton extends JButton {
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public void setFont(VisualiserFonts font_in){
|
||||
setFont(UI_.getTheme().Fonts.get(font_in));
|
||||
public void setFont(VisualiserFonts font_in) {
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(font_in));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package _VisualDVM.Visual.Controls;
|
||||
import Common.Visual.Controls.MenuBarButton;
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -10,15 +9,14 @@ public class PassButton extends MenuBarButton implements PassControl {
|
||||
if (pass.getIconPath() != null) {
|
||||
if (tab) {
|
||||
setIcon(pass.getTabIcon());
|
||||
setPreferredSize(new Dimension(18,18));
|
||||
setMaximumSize(new Dimension(18,18));
|
||||
setMinimumSize(new Dimension(18,18));
|
||||
}
|
||||
else
|
||||
setIcon(pass.getIconPath());
|
||||
setPreferredSize(new Dimension(18, 18));
|
||||
setMaximumSize(new Dimension(18, 18));
|
||||
setMinimumSize(new Dimension(18, 18));
|
||||
} else
|
||||
setIcon(pass.getIconPath());
|
||||
}
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
public PassButton(Pass pass) {
|
||||
this(pass, false);
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Visual.Controls;
|
||||
package Common.Visual.Controls;
|
||||
public interface PassControl {
|
||||
void setIcon(String icon_path);
|
||||
void setEnabled(boolean flag);
|
||||
@@ -1,18 +1,17 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Visual.Controls.PassControl;
|
||||
public class PassMenuItem extends VisualiserMenuItem implements PassControl {
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public PassMenuItem(Pass pass) {
|
||||
setText(pass.getDescription());
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Visual.Controls;
|
||||
package Common.Visual.Controls;
|
||||
import javax.swing.*;
|
||||
public class ShortLabel extends JLabel {
|
||||
int max = 0;
|
||||
@@ -1,6 +1,6 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
package Common.Visual.Controls;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -15,15 +15,15 @@ class StableItemUI extends BasicMenuItemUI {
|
||||
@Override
|
||||
protected void doClick(MenuSelectionManager msm) {
|
||||
menuItem.doClick(0);
|
||||
if (UI_.last_menu_path != null)
|
||||
MenuSelectionManager.defaultManager().setSelectedPath(UI_.last_menu_path);
|
||||
if (MainModule_.instance.hasLastMenuPath())
|
||||
MenuSelectionManager.defaultManager().setSelectedPath(MainModule_.instance.getLastMenuPath());
|
||||
}
|
||||
}
|
||||
public class StableMenuItem extends VisualiserMenuItem {
|
||||
{
|
||||
getModel().addChangeListener(e -> {
|
||||
if (getModel().isArmed() && isShowing())
|
||||
UI_.last_menu_path = MenuSelectionManager.defaultManager().getSelectedPath();
|
||||
MainModule_.instance.setLastMenuPath(MenuSelectionManager.defaultManager().getSelectedPath());
|
||||
});
|
||||
}
|
||||
public StableMenuItem(String text) {
|
||||
@@ -1,17 +1,16 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
import Common.Utils.Utils_;
|
||||
package Common.Visual.Controls;
|
||||
import Common.Passes.Pass;
|
||||
import _VisualDVM.Visual.Controls.PassControl;
|
||||
import Common.Utils.Utils_;
|
||||
public class StablePassMenuItem extends StableMenuItem implements PassControl {
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public StablePassMenuItem(Pass pass) {
|
||||
setText(pass.getDescription());
|
||||
setToolTipText(pass.getDescription());
|
||||
if (pass.getIconPath() != null) setIcon(pass.getIconPath());
|
||||
addActionListener(pass.getControlAction());
|
||||
pass.controls.add(this);
|
||||
pass.addControl(this);
|
||||
}
|
||||
@Override
|
||||
public void setIcon(String icon_path) {
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.*;
|
||||
public class StyledList extends JList implements ThemeElement {
|
||||
public StyledList() {
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
applyTheme();
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(UI_.getTheme().table_background);
|
||||
setForeground(UI_.getTheme().foreground);
|
||||
setBackground(MainModule_.instance.getUI().getTheme().table_background);
|
||||
setForeground(MainModule_.instance.getUI().getTheme().foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common.Visual.Controls;
|
||||
import Common.Visual.UI_;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -10,7 +10,7 @@ public class StyledProgressBar extends JProgressBar implements ThemeElement {
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(UI_.getTheme().bar_background);
|
||||
setForeground(UI_.getTheme().bar_foreground);
|
||||
setBackground(MainModule_.instance.getUI().getTheme().bar_background);
|
||||
setForeground(MainModule_.instance.getUI().getTheme().bar_foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package _VisualDVM.Visual.Windows;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
||||
package Common.Visual.Controls;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Visual.Menus.VisualiserMenuBar;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
public class TabToolBar extends VisualiserMenuBar {
|
||||
public TabToolBar(String titleText, PassCode... passes) {
|
||||
public TabToolBar(String titleText, PassCode_... passes) {
|
||||
setFloatable(false);
|
||||
setOpaque(false);
|
||||
//-
|
||||
@@ -16,8 +16,8 @@ public class TabToolBar extends VisualiserMenuBar {
|
||||
add(title);
|
||||
addSeparator();
|
||||
//-
|
||||
for (PassCode code : passes)
|
||||
add( Global.mainModule.getPass(code).createTabButton());
|
||||
for (PassCode_ code : passes)
|
||||
add(MainModule_.instance.getPass(code).createTabButton());
|
||||
MouseAdapter adapter = new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -27,9 +27,10 @@ public class TabToolBar extends VisualiserMenuBar {
|
||||
addMouseListener(adapter);
|
||||
title.addMouseListener(adapter);
|
||||
}
|
||||
public void leftMouseAction(){}
|
||||
public void leftMouseAction() {
|
||||
}
|
||||
@Override
|
||||
public void setSizeLimits() {
|
||||
// setPreferredSize(new Dimension(-1, 18));
|
||||
// setPreferredSize(new Dimension(-1, 18));
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package Common.Visual;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
|
||||
import javax.swing.*;
|
||||
//одиночный фильтр, пункт фильтрационного меню.
|
||||
public abstract class DBObjectFilter<D extends DBObject> {
|
||||
public JMenuItem menuItem; //пункт меню фильтра. ( возможно потом сделать и кнопку)
|
||||
//--
|
||||
String description;
|
||||
boolean active = true; //включен ли фильтр
|
||||
int count = 0;
|
||||
//--
|
||||
static String getNotActiveIconPath() {
|
||||
return "/Common/icons/NotPick.png";
|
||||
}
|
||||
static String getActiveIconPath() {
|
||||
return "/Common/icons/Pick.png";
|
||||
}
|
||||
void Mark() {
|
||||
menuItem.setIcon(Utils_.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
}
|
||||
//-------
|
||||
public boolean Validate(D object) {
|
||||
boolean valid = validate(object);
|
||||
if (valid)
|
||||
count++;
|
||||
return valid & active;
|
||||
}
|
||||
public DBObjectFilter(DataSet dataSet, String description_in, boolean active_in) {
|
||||
menuItem = new StableMenuItem((description = description_in) + " (0)");
|
||||
active = active_in;
|
||||
menuItem.addActionListener(e -> {
|
||||
active = !active;
|
||||
Mark();
|
||||
dataSet.ShowUI();
|
||||
});
|
||||
Mark();
|
||||
}
|
||||
public DBObjectFilter(DataSet dataSet, String description_in) {
|
||||
this(dataSet, description_in, true);
|
||||
}
|
||||
public void setActive(boolean flag) {
|
||||
active = flag;
|
||||
Mark();
|
||||
}
|
||||
//--
|
||||
protected abstract boolean validate(D object);
|
||||
//--
|
||||
public void Drop() {
|
||||
count = 0;
|
||||
}
|
||||
public void Refresh() {
|
||||
menuItem.setText(description + " " + Utils_.RBrackets(count));
|
||||
}
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
//--
|
||||
}
|
||||
10
src/Common/Visual/DBObjectFilter_.java
Normal file
10
src/Common/Visual/DBObjectFilter_.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.Visual;
|
||||
import Common.Database.Objects.DBObject;
|
||||
public interface DBObjectFilter_<D extends DBObject> {
|
||||
boolean Validate(D dbObject);
|
||||
default void DropMatchesCount() {
|
||||
}
|
||||
default void ShowMatchesCount() {
|
||||
}
|
||||
//-------
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package Common.Visual;
|
||||
import Common.Current_;
|
||||
public interface DataControl_OLD {
|
||||
//todo скорее всего устареет.
|
||||
default Current_ getCurrent() {
|
||||
return null;
|
||||
}
|
||||
//-?
|
||||
default void ShowCurrentObject() throws Exception {
|
||||
}
|
||||
default void ShowNoCurrentObject() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1,126 +1,207 @@
|
||||
package Common.Visual;
|
||||
import Common.CommonConstants;
|
||||
import Common.Current_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Objects.Grid.TableVisualData;
|
||||
import Common.Database.Tables.DBTable;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Common.Visual.Tables.ColumnInfo;
|
||||
import Common.Visual.Tables.DataTable;
|
||||
import Common.Visual.Tables.*;
|
||||
import Common.Visual.Tables.Grid.GridAnchestor;
|
||||
import _VisualDVM.GlobalData.Grid.TableVisualData;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumn;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static Common.Visual.Tables.TableEditors.EditorSelect;
|
||||
import static Common.Visual.Tables.TableRenderers.RendererSelect;
|
||||
public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
protected JPanel dataPanel;
|
||||
protected DataSet dataSource;
|
||||
public JPanel getDataPanel() {
|
||||
return dataPanel;
|
||||
}
|
||||
protected int current_row_i;
|
||||
public abstract class DataSetControlForm<D extends DBObject> extends ControlForm<DataTable> {
|
||||
protected DataSet<?, D> dataSource; //источник данных
|
||||
protected D current = null; //заменить все обращения к мейн модулю.
|
||||
protected DataMenuBar bar = null; //верхняя панель меню
|
||||
protected int current_row_i; //индекс текущей строки.
|
||||
protected boolean events_on = true;
|
||||
protected String colNamesAndSizes = "";
|
||||
protected Vector<ColumnInfo> columns = new Vector<>();
|
||||
public DataSetControlForm(DataSet dataSource_in) {
|
||||
this(dataSource_in, DataTable.class);
|
||||
}
|
||||
public DataSetControlForm(DataSet dataSource_in, Class tableClass) {
|
||||
super(tableClass);
|
||||
protected Vector<DBObjectFilter_<D>> allFilters = new Vector<>();
|
||||
Vector<ColumnInfo<D>> columns = new Vector<>(); //информация о столбцах и их оформлении
|
||||
MatchesCounter counter_ui = null;
|
||||
//--
|
||||
Object savedCurrentKey = null;
|
||||
Vector<Object> savedSelectedKeys = new Vector<>();
|
||||
public DataSetControlForm(DataSet<?, D> dataSource_in, JPanel mountPanel_in) {
|
||||
super(DataTable.class, mountPanel_in);
|
||||
dataSource = dataSource_in;
|
||||
//---
|
||||
dataPanel = new JPanel(new BorderLayout());
|
||||
content.add(dataPanel, BorderLayout.CENTER);
|
||||
}
|
||||
@Override
|
||||
public void Show() {
|
||||
super.Show();
|
||||
dataPanel.add(scroll);
|
||||
dataPanel.updateUI();
|
||||
}
|
||||
@Override
|
||||
public void Clear() {
|
||||
super.Clear();
|
||||
UI_.Clear(dataPanel);
|
||||
}
|
||||
public DataSet getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
@Override
|
||||
public Current_ CurrentName() {
|
||||
return getDataSource().CurrentName();
|
||||
}
|
||||
public void SaveColumns() {
|
||||
if (Global.mainModule.getDb() != null) {
|
||||
//--
|
||||
columns.clear();
|
||||
columns.add(createPKColumn());
|
||||
if (hasCheckBox())
|
||||
columns.add(createCheckBoxColummn());
|
||||
createColumns();
|
||||
//--
|
||||
createFilters();
|
||||
//--
|
||||
if (hasMenuBar()) {
|
||||
try {
|
||||
if ((CurrentName() != null)) {
|
||||
String tableName= CurrentName().toString();
|
||||
if (!MainModule_.instance.getUI().menuBars.containsKey(dataSource.getClass())) {
|
||||
bar = createMenuBar();
|
||||
if (hasCheckBox())
|
||||
bar.createSelectionButtons(dataSource);
|
||||
MainModule_.instance.getUI().menuBars.put(dataSource.getClass(), bar);
|
||||
} else {
|
||||
bar = MainModule_.instance.getUI().menuBars.get(dataSource.getClass());
|
||||
bar.setDataSource(dataSource);
|
||||
}
|
||||
mountPanel.add(bar, BorderLayout.NORTH);
|
||||
//--
|
||||
counter_ui = (count -> bar.countLabel.setText(String.valueOf(count)));
|
||||
//--фильтры всегда в конец бара.
|
||||
// bar.add(new JSeparator());
|
||||
for (FilterFlag filter : getFilters(FilterFlag.class)) {
|
||||
bar.add(filter.getControl());
|
||||
}
|
||||
for (JMenu filter : getFilters(DataSetFiltersMenu.class)) {
|
||||
bar.addMenus(filter);
|
||||
}
|
||||
//------------------------
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
//--
|
||||
public DataMenuBar getMenuBar() {
|
||||
return bar;
|
||||
}
|
||||
protected boolean isPKVisible() {
|
||||
return true;
|
||||
}
|
||||
protected ColumnInfo<D> createPKColumn() {
|
||||
return new ColumnInfo<D>(dataSource.getPKName()) {
|
||||
@Override
|
||||
public Object getFieldAt(D object) {
|
||||
return object.getPK();
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return isPKVisible();
|
||||
}
|
||||
};
|
||||
}
|
||||
protected boolean hasCheckBox() {
|
||||
return true;
|
||||
}
|
||||
protected ColumnInfo<D> createCheckBoxColummn() {
|
||||
return new ColumnInfo<D>("") {
|
||||
@Override
|
||||
public Object getFieldAt(D object) {
|
||||
return object.isSelected();
|
||||
}
|
||||
@Override
|
||||
public int getMinWidth() {
|
||||
return 25;
|
||||
}
|
||||
@Override
|
||||
public int getMaxWidth() {
|
||||
return 25;
|
||||
}
|
||||
@Override
|
||||
public Class getRendererClass() {
|
||||
return DBObjectSelectionRenderer.class;
|
||||
}
|
||||
@Override
|
||||
public Class getEditorClass() {
|
||||
return DBObjectSelector.class;
|
||||
}
|
||||
};
|
||||
}
|
||||
<M> Vector<M> getFilters(Class<M> f) {
|
||||
Vector<M> res = new Vector<>();
|
||||
for (DBObjectFilter_ filter_ : allFilters) {
|
||||
//либо М, либо наследует от М
|
||||
if (filter_.getClass().equals(f) || filter_.getClass().getSuperclass().equals(f)) {
|
||||
res.add((M) filter_);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
protected final void AddFilters(DBObjectFilter_<D>... new_filters) {
|
||||
Collections.addAll(allFilters, new_filters);
|
||||
}
|
||||
protected final void AddColumns(ColumnInfo<D>... new_columns) {
|
||||
Collections.addAll(columns, new_columns);
|
||||
}
|
||||
public ColumnInfo<D> getColumnInfo(int i) {
|
||||
return columns.get(i);
|
||||
}
|
||||
//--
|
||||
void SaveColumns() {
|
||||
if (MainModule_.instance.getDb() != null) {
|
||||
try {
|
||||
if (needsCurrent()) {
|
||||
Vector<String> widths = IntStream.range(0, columns.size()).mapToObj(i -> String.valueOf(control.getColumnModel().getColumn(i).getWidth())).collect(Collectors.toCollection(Vector::new));
|
||||
String packed = String.join("|", widths);
|
||||
TableVisualData tableVisualData;
|
||||
if (Global.mainModule.getDb().tablesVisualData.containsKey(tableName)) {
|
||||
tableVisualData = Global.mainModule.getDb().tablesVisualData.get(tableName);
|
||||
if (MainModule_.instance.getDb().tablesVisualData.containsKey(getCurrentName())) {
|
||||
tableVisualData = MainModule_.instance.getDb().tablesVisualData.get(getCurrentName());
|
||||
} else {
|
||||
tableVisualData = new TableVisualData(tableName);
|
||||
Global.mainModule.getDb().Insert(tableVisualData);
|
||||
tableVisualData = new TableVisualData(getCurrentName());
|
||||
MainModule_.instance.getDb().Insert(tableVisualData);
|
||||
}
|
||||
tableVisualData.sizes = packed;
|
||||
Global.mainModule.getDb().Update(tableVisualData);
|
||||
MainModule_.instance.getDb().Update(tableVisualData);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean hasCheckBox() {
|
||||
return false;
|
||||
}
|
||||
private Vector<String> getHeaders() {
|
||||
Vector<String> getHeaders() {
|
||||
return columns.stream().map(ColumnInfo::getName).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
protected void CreateColumnsInfo() {
|
||||
columns.clear();
|
||||
columns.add(new ColumnInfo(getDataSource().getPKName()));
|
||||
if (hasCheckBox()) {
|
||||
columns.add(new ColumnInfo("", RendererSelect, EditorSelect));
|
||||
columns.get(1).setMinWidth(25);
|
||||
columns.get(1).setMaxWidth(25);
|
||||
protected Comparator<D> getDefaultComparator() {
|
||||
return null;
|
||||
}
|
||||
Vector<Object> getVisibleKeys() {
|
||||
Comparator comparator = getDefaultComparator();
|
||||
Vector<Object> res_keys = new Vector<>();
|
||||
if (comparator == null) {
|
||||
for (D object : dataSource.Data.values()) {
|
||||
if (isObjectVisible(object))
|
||||
res_keys.add(object.getPK());
|
||||
}
|
||||
} else {
|
||||
Vector<D> raw = new Vector<>();
|
||||
for (D object : dataSource.Data.values()) {
|
||||
if (isObjectVisible(object))
|
||||
raw.add(object);
|
||||
}
|
||||
raw.sort(comparator);
|
||||
for (D object : raw)
|
||||
res_keys.add(object.getPK());
|
||||
}
|
||||
Arrays.stream(getDataSource().getUIColumnNames()).forEach(name -> columns.add(new ColumnInfo(name)));
|
||||
AdditionalInitColumns();
|
||||
return res_keys;
|
||||
}
|
||||
protected void AdditionalInitColumns() {
|
||||
//уточнение инфы по столбцам.
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void CreateControl() {
|
||||
CreateColumnsInfo();
|
||||
GridAnchestor table_data_model = new GridAnchestor(getHeaders(), dataSource.getVisibleKeys()) {
|
||||
protected void createControl() {
|
||||
GridAnchestor table_data_model = new GridAnchestor(getHeaders(), getVisibleKeys()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object key = data.get(rowIndex);
|
||||
if (columnIndex == 0)
|
||||
return key;
|
||||
DBObject object = getDataSource().get((key));
|
||||
if ((columnIndex == 1) && hasCheckBox())
|
||||
return object.isSelected();
|
||||
return getDataSource().getFieldAt(object, columnIndex);
|
||||
D object = dataSource.get((key));
|
||||
return columns.get(columnIndex).getFieldAt(object);
|
||||
}
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int col) {
|
||||
@@ -145,16 +226,16 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
//из таблицы можно пользоваться только getValueAt
|
||||
//иначе сортировка не будет работать.
|
||||
Object key = getValueAt(rowIndex, 0);
|
||||
return getDataSource().get(key);
|
||||
return dataSource.get(key);
|
||||
}
|
||||
//-----------------------------NEW-------------------------------------
|
||||
@Override
|
||||
public void CorrectColumnsSizes() {
|
||||
if ((Global.mainModule.getDb() != null)
|
||||
&& CurrentName() != null
|
||||
&& Global.mainModule.getDb().tablesVisualData.containsKey(CurrentName().toString())) {
|
||||
if ((MainModule_.instance.getDb() != null)
|
||||
&& needsCurrent()
|
||||
&& MainModule_.instance.getDb().tablesVisualData.containsKey(getCurrentName())) {
|
||||
if (!getColumnsProfile().equalsIgnoreCase(colNamesAndSizes)) {
|
||||
TableVisualData grid = Global.mainModule.getDb().tablesVisualData.get(CurrentName().toString());
|
||||
TableVisualData grid = MainModule_.instance.getDb().tablesVisualData.get(getCurrentName());
|
||||
String[] data = grid.sizes.split("\\|");
|
||||
for (int i = 0; i < columns.size(); ++i) {
|
||||
if (i <= (data.length - 1)) {
|
||||
@@ -184,9 +265,9 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
ColumnInfo columnInfo = columns.get(i);
|
||||
if (columnInfo.isVisible()) {
|
||||
if (columnInfo.hasRenderer())
|
||||
getColumnModel().getColumn(i).setCellRenderer(UI.TableRenderers.get(columnInfo.getRenderer()));
|
||||
getColumnModel().getColumn(i).setCellRenderer(MainModule_.instance.getUI().getTableRenderer(columnInfo.getRendererClass()));
|
||||
if (columnInfo.hasEditor())
|
||||
getColumnModel().getColumn(i).setCellEditor(UI.TableEditors.get(columnInfo.getEditor()));
|
||||
getColumnModel().getColumn(i).setCellEditor(MainModule_.instance.getUI().getTableEditor(columnInfo.getEditorClass()));
|
||||
if (columnInfo.hasMaxWidth())
|
||||
getColumnModel().getColumn((i)).setMaxWidth(columnInfo.getMaxWidth());
|
||||
if (columnInfo.hasMinWidth())
|
||||
@@ -210,7 +291,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
//------------------------->>
|
||||
}
|
||||
};
|
||||
if (CurrentName() != null) {
|
||||
if (needsCurrent()) {
|
||||
current_row_i = CommonConstants.Nan;
|
||||
ListSelectionModel selModel = control.getSelectionModel();
|
||||
selModel.addListSelectionListener(e -> {
|
||||
@@ -218,7 +299,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
if ((row >= 0)) {
|
||||
if (row != current_row_i) {
|
||||
current_row_i = row;
|
||||
getDataSource().setCurrent(control.getRowObject(row));
|
||||
setCurrent((D) control.getRowObject(row));
|
||||
if (events_on) {
|
||||
try {
|
||||
ShowCurrentObject();
|
||||
@@ -229,7 +310,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
} else {
|
||||
current_row_i = CommonConstants.Nan;
|
||||
getDataSource().dropCurrent();
|
||||
dropCurrent();
|
||||
if (events_on) {
|
||||
try {
|
||||
ShowNoCurrentObject();
|
||||
@@ -243,7 +324,7 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
control.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if ((e.getClickCount() == 2) && (dataSource.getCurrent() != null)) {
|
||||
if ((e.getClickCount() == 2) && (getCurrent() != null)) {
|
||||
try {
|
||||
MouseAction2();
|
||||
} catch (Exception ex) {
|
||||
@@ -252,78 +333,259 @@ public class DataSetControlForm extends ControlWithCurrentForm<DataTable> {
|
||||
}
|
||||
}
|
||||
});
|
||||
control.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_DELETE:
|
||||
if (getDeletePassCode() != null) {
|
||||
MainModule_.instance.getPass(getDeletePassCode()).Do();
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_ENTER:
|
||||
try {
|
||||
MouseAction2();
|
||||
} catch (Exception ex) {
|
||||
Utils_.MainLog.PrintException(ex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//----------------------------------------------------------------------------
|
||||
//при переотображении таблицы скидываем текущий объект!!
|
||||
getDataSource().dropCurrent();
|
||||
dropCurrent();
|
||||
try {
|
||||
ShowNoCurrentObject();
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
//---
|
||||
/*
|
||||
if (hasCheckBox()) {
|
||||
TableColumn column = control.getColumnModel().getColumn(1)
|
||||
column.setHeaderRenderer(new TableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
for (HeaderTextFilter filter : getFilters(HeaderTextFilter.class))
|
||||
filter.Mount(getControl());
|
||||
}
|
||||
protected DataMenuBar createMenuBar() {
|
||||
return new DataMenuBar(dataSource.getPluralDescription());
|
||||
}
|
||||
protected void createFilters() {
|
||||
}
|
||||
protected abstract void createColumns();
|
||||
boolean ApplyFilters(D object) {
|
||||
for (DBObjectFilter_ filterInterface : allFilters) {
|
||||
if (!filterInterface.Validate(object))
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void refresh() {
|
||||
protected void redrawControl() {
|
||||
control.CorrectSizes();
|
||||
}
|
||||
protected void ShowCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
FKBehaviour behaviour = table.getFKDependencies().get(dep);
|
||||
switch (behaviour.ui) {
|
||||
case ACTIVE:
|
||||
table.getDb().getTable(dep).ShowUI();
|
||||
break;
|
||||
case PASSIVE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void ShowNoCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
FKBehaviour behaviour = table.getFKDependencies().get(dep);
|
||||
switch (behaviour.ui) {
|
||||
case ACTIVE:
|
||||
table.getDb().getTable(dep).ClearUI();
|
||||
break;
|
||||
case PASSIVE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void MouseAction2() throws Exception {
|
||||
}
|
||||
//-
|
||||
protected boolean hasMenuBar() {
|
||||
return true;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
current = null;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
protected DBObjectDialog getDialog() {
|
||||
return null;
|
||||
}
|
||||
protected boolean isObjectEditable(D object) {
|
||||
return true;
|
||||
}
|
||||
//БАЗОВЫЙ ФУНКЦИОНАЛ ФОРМЫ
|
||||
@Override
|
||||
public void Show() {
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.DropMatchesCount();
|
||||
super.Show();
|
||||
if (counter_ui != null) counter_ui.ShowMatchesCount(getRowCount());
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.ShowMatchesCount();
|
||||
}
|
||||
public void Show(Object pk) {
|
||||
Show();
|
||||
Select(pk);
|
||||
SetCurrentByPK(pk);
|
||||
}
|
||||
public void Select(Object pk) {
|
||||
if (isShown())
|
||||
control.SelectRowByPK(pk);
|
||||
}
|
||||
public void ClearSelection() {
|
||||
if (isShown())
|
||||
control.clearSelection(); //строка сбросится сама. благодаря сбросу события выбора
|
||||
@Override
|
||||
public void Clear() {
|
||||
super.Clear();
|
||||
if (counter_ui != null) counter_ui.ShowNoMatches();
|
||||
}
|
||||
public int getRowCount() {
|
||||
return control.getRowCount();
|
||||
}
|
||||
@Override
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
FKBehaviour behaviour = table.getFKDependencies().get(dep);
|
||||
switch (behaviour.ui) {
|
||||
case ACTIVE:
|
||||
table.getDb().tables.get(dep).ShowUI();
|
||||
break;
|
||||
case PASSIVE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//ТЕКУЩИЕ И ВЫБРАННЫЕ ОБЪЕКТЫ
|
||||
public void SaveLastCurrent() {
|
||||
savedCurrentKey = null;
|
||||
savedSelectedKeys.clear();
|
||||
if (needsCurrent() && (getCurrent() != null)) {
|
||||
savedCurrentKey = getCurrent().getPK();
|
||||
}
|
||||
savedSelectedKeys = getAllSelectedKeys();
|
||||
}
|
||||
public void RestoreLastCurrent() {
|
||||
for (Object key : savedSelectedKeys) {
|
||||
if (dataSource.containsKey(key))
|
||||
dataSource.get(key).Select(true);
|
||||
}
|
||||
if ((savedCurrentKey != null) && (dataSource.containsKey(savedCurrentKey))) {
|
||||
SetCurrentByPK(savedCurrentKey);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
FKBehaviour behaviour = table.getFKDependencies().get(dep);
|
||||
switch (behaviour.ui) {
|
||||
case ACTIVE:
|
||||
table.getDb().tables.get(dep).ClearUI();
|
||||
break;
|
||||
case PASSIVE:
|
||||
break;
|
||||
}
|
||||
public boolean isObjectVisible(D object) {
|
||||
return ApplyFilters(object);
|
||||
}
|
||||
public int getSelectedCount() {
|
||||
return (int) dataSource.Data.values().stream().filter(d -> isObjectVisible(d) && d.isSelected()).count();
|
||||
}
|
||||
public Vector<D> getSelectedItems() {
|
||||
return dataSource.Data.values().stream().filter(d -> isObjectVisible(d) && d.isSelected()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
public Vector<Object> getSelectedKeys() {
|
||||
return dataSource.Data.values().stream().filter(d -> isObjectVisible(d) && d.isSelected()).map(d -> d.getPK()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
//в том числе и невидимые. нужно для сохранения галок при перезакачке бд.
|
||||
public Vector<Object> getAllSelectedKeys() {
|
||||
return dataSource.Data.values().stream().filter(DBObject::isSelected).map(d -> d.getPK()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
public boolean CheckCurrent(TextLog log) {
|
||||
if (current == null) {
|
||||
log.Writeln_(dataSource.getSingleDescription() + " не выбран(а)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean matchCurrentID(int id_in) {
|
||||
return (current != null) && (((int) current.getPK()) == id_in);
|
||||
}
|
||||
public boolean CheckSelectedOrCurrent(TextLog log) {
|
||||
if ((getSelectedCount() == 0) && (!needsCurrent() || (getCurrent() == null))) {
|
||||
log.Writeln_(dataSource.getPluralDescription() + ":");
|
||||
log.Writeln_("Отсутствуют отмеченные объекты, или текущий объект!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
protected boolean needsCurrent() {
|
||||
return true;
|
||||
} //нужно ли отслеживать текущий объект.
|
||||
protected String getCurrentName() {
|
||||
return dataSource.d.getSimpleName();
|
||||
}
|
||||
public D getCurrent() {
|
||||
return current;
|
||||
}
|
||||
public D setCurrent(D object) {
|
||||
return current = object;
|
||||
}
|
||||
public Vector<D> getSelectedOrCurrent() {
|
||||
Vector<D> res = new Vector<>();
|
||||
if (getSelectedCount() > 0)
|
||||
res = getSelectedItems();
|
||||
else {
|
||||
if (needsCurrent() && (getCurrent() != null)) {
|
||||
res.add(getCurrent());
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public Vector<Object> getSelectedOrCurrentKeys() {
|
||||
Vector<Object> res = new Vector<>();
|
||||
if (getSelectedCount() > 0)
|
||||
res = getSelectedKeys();
|
||||
else {
|
||||
if (needsCurrent() && (getCurrent() != null)) {
|
||||
res.add(getCurrent().getPK());
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void SetCurrentByPK(Object pk) {
|
||||
if (isShown())
|
||||
control.SelectRowByPK(pk);
|
||||
}
|
||||
public void ClearSelection() {
|
||||
if (isShown()) control.clearSelection(); //строка сбросится сама. благодаря сбросу события выбора
|
||||
}
|
||||
public void SelectAll(boolean flag) {
|
||||
for (D object : dataSource.Data.values()) {
|
||||
if (isObjectVisible(object))
|
||||
object.Select(flag);
|
||||
}
|
||||
RedrawControl();
|
||||
}
|
||||
//ДИАЛОГИ
|
||||
public boolean ShowAddObjectDialog(D object) {
|
||||
return getDialog().ShowDialog(dataSource.getSingleDescription() + ": добавление", object);
|
||||
}
|
||||
public boolean ShowEditObjectDialog(D object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.edit = true;
|
||||
dialog.SetEditLimits();
|
||||
String title = dataSource.getSingleDescription() + ": ";
|
||||
if (isObjectEditable(object)) {
|
||||
title += "редактирование";
|
||||
} else {
|
||||
title += "просмотр";
|
||||
dialog.SetReadonly();
|
||||
dialog.BlockButtons();
|
||||
}
|
||||
return dialog.ShowDialog(title, object);
|
||||
}
|
||||
public boolean ShowDeleteObjectDialog(D object) {
|
||||
return UI.Warning(dataSource.getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
|
||||
}
|
||||
public boolean ShowDeleteObjectsDialog(int toDeleteCount) {
|
||||
return UI.Warning(dataSource.getPluralDescription() + " в количестве " + toDeleteCount + " будут удалены)");
|
||||
}
|
||||
public PassCode_ getDeletePassCode() {
|
||||
return null;
|
||||
}
|
||||
public Object getCurrentPK(Object nanValue) {
|
||||
return current == null ? nanValue : current.getPK();
|
||||
}
|
||||
public boolean canModifyCurrent(TextLog Log) {
|
||||
return CheckCurrent(Log);
|
||||
}
|
||||
public void SelectKeys(Vector<?> keys_in) {
|
||||
SelectAll(false);
|
||||
for (Object key_ : keys_in)
|
||||
dataSource.get(key_).Select(true);
|
||||
if (!keys_in.isEmpty())
|
||||
Show(keys_in.lastElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
package Common.Visual;
|
||||
import _VisualDVM.Visual.Menus.StableMenuItem;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenu;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Visual.Controls.StableMenuItem;
|
||||
import Common.Visual.Menus.VisualiserMenu;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
public abstract class DataSetFilter<D extends DBObject> {
|
||||
public VisualiserMenu menu;
|
||||
public abstract class DataSetFiltersMenu<D extends DBObject> extends VisualiserMenu implements DBObjectFilter_<D> {
|
||||
//--
|
||||
protected DataSet<?, D> dataSet;
|
||||
protected Vector<DBObjectFilter<D>> field_filters;
|
||||
public DataSetFilter(String name, DataSet dataSet_in) {
|
||||
protected Vector<FilterFlag<D>> field_filters;
|
||||
public DataSetFiltersMenu(String name, DataSet dataSet_in) {
|
||||
super(name, "/Common/icons/Filter.png", true);
|
||||
dataSet = dataSet_in;
|
||||
menu = new VisualiserMenu(name, "/Common/icons/Filter.png", true);
|
||||
field_filters = new Vector<>();
|
||||
fill();
|
||||
//-
|
||||
for (DBObjectFilter<D> filter : field_filters)
|
||||
menu.add(filter.menuItem);
|
||||
menu.addSeparator();
|
||||
menu.add(new StableMenuItem("Выбрать всё", "/Common/icons/SelectAll.png") {
|
||||
for (FilterFlag<D> filter : field_filters)
|
||||
add(filter.getControl());
|
||||
addSeparator();
|
||||
add(new StableMenuItem("Выбрать всё", "/Common/icons/SelectAll.png") {
|
||||
{
|
||||
addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -32,7 +31,7 @@ public abstract class DataSetFilter<D extends DBObject> {
|
||||
});
|
||||
}
|
||||
});
|
||||
menu.add(new StableMenuItem("Отменить всё", "/Common/icons/UnselectAll.png") {
|
||||
add(new StableMenuItem("Отменить всё", "/Common/icons/UnselectAll.png") {
|
||||
{
|
||||
addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -44,37 +43,42 @@ public abstract class DataSetFilter<D extends DBObject> {
|
||||
}
|
||||
});
|
||||
}
|
||||
//----
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
if (!isActive()) {
|
||||
//считаем без учета результатов
|
||||
for (FilterFlag<D> filter : field_filters)
|
||||
filter.Validate(object);
|
||||
return true;
|
||||
}
|
||||
boolean res = false;
|
||||
for (FilterFlag<D> filter : field_filters)
|
||||
if (filter.Validate(object))
|
||||
res |= true;
|
||||
return res;
|
||||
}
|
||||
//-------
|
||||
void selectAll(boolean flag) {
|
||||
for (DBObjectFilter filter : field_filters)
|
||||
for (FilterFlag filter : field_filters)
|
||||
filter.setActive(flag);
|
||||
}
|
||||
public abstract void fill();
|
||||
public void Drop() {
|
||||
for (DBObjectFilter<D> filter : field_filters)
|
||||
filter.Drop();
|
||||
@Override
|
||||
public void DropMatchesCount() {
|
||||
for (FilterFlag<D> filter : field_filters)
|
||||
filter.DropMatchesCount();
|
||||
}
|
||||
public void Refresh() {
|
||||
for (DBObjectFilter<D> filter : field_filters)
|
||||
filter.Refresh();
|
||||
@Override
|
||||
public void ShowMatchesCount() {
|
||||
for (FilterFlag<D> filter : field_filters)
|
||||
filter.ShowMatchesCount();
|
||||
}
|
||||
public boolean isActive() {
|
||||
for (DBObjectFilter<D> filter : field_filters) {
|
||||
for (FilterFlag<D> filter : field_filters) {
|
||||
if (filter.isActive())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean Validate(D object) {
|
||||
if (!isActive()) {
|
||||
//считаем без учета результатов
|
||||
for (DBObjectFilter<D> filter : field_filters)
|
||||
filter.Validate(object);
|
||||
return true;
|
||||
}
|
||||
boolean res = false;
|
||||
for (DBObjectFilter<D> filter : field_filters)
|
||||
if (filter.Validate(object))
|
||||
res |= true;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package _VisualDVM.Visual.Editor;
|
||||
package Common.Visual.Editor;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Menus.StyledPopupMenu;
|
||||
import Common.Visual.Menus.TextEditorMenu;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Visual.Syntax.SPFEditorTheme;
|
||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||
|
||||
@@ -14,8 +17,9 @@ import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.net.URI;
|
||||
import java.util.Vector;
|
||||
public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogFields {
|
||||
private final StyledPopupMenu menu;
|
||||
protected final StyledPopupMenu menu;
|
||||
// protected int changesCount = 0;
|
||||
// protected int insertsCount = 0;
|
||||
// protected int removesCount = 0;
|
||||
@@ -45,7 +49,7 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
//todo переход в нужную строку по ctrl+g?
|
||||
case KeyEvent.VK_Z:
|
||||
if (getText().equals(startText)) {
|
||||
UI_.Info("Начальная версия текста достигнута.");
|
||||
UI.Info("Начальная версия текста достигнута.");
|
||||
e.consume();
|
||||
}
|
||||
break;
|
||||
@@ -127,14 +131,6 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
changeFont(getFont().getSize() - 1);
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
float font_size = (float) getFont().getSize();
|
||||
((SPFEditorTheme) UI_.getTheme()).getEditorTheme().apply(this);
|
||||
setFont(getFont().deriveFont(font_size));
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return this;
|
||||
}
|
||||
@@ -151,4 +147,29 @@ public class BaseEditor extends RSyntaxTextArea implements ThemeElement, DialogF
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//todo как то вывести из коммон.
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
float font_size = (float) getFont().getSize();
|
||||
((SPFEditorTheme) MainModule_.instance.getUI().getTheme()).getEditorTheme().apply(this);
|
||||
setFont(getFont().deriveFont(font_size));
|
||||
menu.applyTheme();
|
||||
//меню связано с редактором. поэтому тема меняется только вместе с ним.
|
||||
}
|
||||
//--
|
||||
public Vector<Pair<Integer, Integer>> getErrorsForHightlight() {
|
||||
Vector<Pair<Integer, Integer>> res = new Vector<>();
|
||||
for (int i = 0; i < this.getLineCount(); ++i) {
|
||||
try {
|
||||
int start = getLineStartOffset(i);
|
||||
int end = getLineEndOffset(i);
|
||||
String line = this.getText(start, end);
|
||||
if (Utils.isCrushedLine(line))
|
||||
res.add(new Pair<>(start, end));
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package _VisualDVM.Visual.Editor;
|
||||
package Common.Visual.Editor;
|
||||
public class Viewer extends BaseEditor {
|
||||
public Viewer() {
|
||||
setLineWrap(true);
|
||||
53
src/Common/Visual/FilterFlag.java
Normal file
53
src/Common/Visual/FilterFlag.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package Common.Visual;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
//фильтр флаг. либо в меню, либо на баре. текста нет.
|
||||
public abstract class FilterFlag<D extends DBObject> implements DBObjectFilter_<D> {
|
||||
protected AbstractButton control = null;
|
||||
protected boolean active = true; //включен ли фильтр
|
||||
protected DataSet<?, D> dataSet = null; ///источник данных
|
||||
String description; //описание фильтра
|
||||
public FilterFlag(DataSet<?, D> dataSet_in, AbstractButton control_in, boolean active_in) {
|
||||
dataSet = dataSet_in;
|
||||
active = active_in;
|
||||
control = control_in;
|
||||
description = control.getText();
|
||||
control.addActionListener(e -> {
|
||||
active = !active;
|
||||
System.out.println("active=" + active);
|
||||
Mark();
|
||||
dataSet.ShowUI();
|
||||
});
|
||||
Mark();
|
||||
control.setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreePlain));
|
||||
}
|
||||
protected String getNotActiveIconPath() {
|
||||
return "/Common/icons/NotPick.png";
|
||||
}
|
||||
protected String getActiveIconPath() {
|
||||
return "/Common/icons/Pick.png";
|
||||
}
|
||||
public AbstractButton getControl() {
|
||||
return control;
|
||||
}
|
||||
public void Mark() {
|
||||
control.setIcon(Utils_.getIcon(active ? getActiveIconPath() : getNotActiveIconPath()));
|
||||
}
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
public void setActive(boolean flag) {
|
||||
active = flag;
|
||||
Mark();
|
||||
}
|
||||
protected abstract boolean validate(D object);
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
return !active || validate(object);
|
||||
}
|
||||
}
|
||||
27
src/Common/Visual/FilterMenuFlag.java
Normal file
27
src/Common/Visual/FilterMenuFlag.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package Common.Visual;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
public abstract class FilterMenuFlag<D extends DBObject> extends FilterFlag<D> {
|
||||
int count = 0;
|
||||
public FilterMenuFlag(DataSet<?, D> dataSet_in, AbstractButton control_in, boolean active_in) {
|
||||
super(dataSet_in, control_in, active_in);
|
||||
}
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
boolean valid = validate(object);
|
||||
if (valid)
|
||||
count++;
|
||||
return active & valid;
|
||||
}
|
||||
@Override
|
||||
public void ShowMatchesCount() {
|
||||
control.setText(description + " " + Utils_.RBrackets(count));
|
||||
}
|
||||
@Override
|
||||
public void DropMatchesCount() {
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
10
src/Common/Visual/FormWithSplitters.java
Normal file
10
src/Common/Visual/FormWithSplitters.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package Common.Visual;
|
||||
import Common.MainModule_;
|
||||
public interface FormWithSplitters {
|
||||
default void LoadSplitters() {
|
||||
MainModule_.instance.getDb().splitters.Load(this);
|
||||
}
|
||||
default void SaveSplitters() {
|
||||
MainModule_.instance.getDb().splitters.Save(this);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common.Visual;
|
||||
public interface FilterInterface {
|
||||
public interface MatchesCounter {
|
||||
void ShowMatchesCount(int count);
|
||||
default void ShowNoMatches() {
|
||||
ShowMatchesCount(0);
|
||||
@@ -1,27 +1,27 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Visual.Controls.MenuBarButton;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionListener;
|
||||
public class DataMenuBar extends VisualiserMenuBar {
|
||||
public JLabel countLabel = null;
|
||||
JButton selectAllButton = null;
|
||||
JButton unselectAllButton = null;
|
||||
//-
|
||||
public ActionListener selectAllListener = null;
|
||||
public ActionListener unselectAllListener = null;
|
||||
JButton selectAllButton = null;
|
||||
JButton unselectAllButton = null;
|
||||
private DataSet dataSource = null;
|
||||
//-
|
||||
public DataMenuBar(String dataName, PassCode... passes) {
|
||||
// Font font = Current.getTheme().Fonts.get(VisualiserFonts.TreeBoldItalic).deriveFont(12.0F);
|
||||
public DataMenuBar(String dataName, PassCode_... passes) {
|
||||
add(new JLabel(dataName + " : "));
|
||||
add(countLabel = new JLabel("?"));
|
||||
addPasses(passes);
|
||||
}
|
||||
public void createSelectionButtons(DataSet dataSet) {
|
||||
public void createSelectionButtons(DataSet dataSource_in) {
|
||||
dataSource = dataSource_in;
|
||||
java.awt.Dimension d = new Dimension(25, 25);
|
||||
if (selectAllButton == null) {
|
||||
add(selectAllButton = new MenuBarButton() {
|
||||
@@ -46,11 +46,18 @@ public class DataMenuBar extends VisualiserMenuBar {
|
||||
}, 1);
|
||||
}
|
||||
if (selectAllListener != null) {
|
||||
selectAllButton.removeActionListener(selectAllListener); }
|
||||
selectAllButton.addActionListener(selectAllListener = e -> dataSet.CheckAll(true));
|
||||
selectAllButton.removeActionListener(selectAllListener);
|
||||
}
|
||||
selectAllButton.addActionListener(selectAllListener = e -> getDataSource().getUI().SelectAll(true));
|
||||
if (unselectAllListener != null) {
|
||||
unselectAllButton.removeActionListener(unselectAllListener);
|
||||
}
|
||||
unselectAllButton.addActionListener(unselectAllListener = e -> dataSet.CheckAll(false));
|
||||
unselectAllButton.addActionListener(unselectAllListener = e -> getDataSource().getUI().SelectAll(false));
|
||||
}
|
||||
public DataSet getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
public void setDataSource(DataSet dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
}
|
||||
|
||||
34
src/Common/Visual/Menus/FastAccessMenuBar.java
Normal file
34
src/Common/Visual/Menus/FastAccessMenuBar.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class FastAccessMenuBar extends VisualiserMenuBar {
|
||||
@Override
|
||||
public void setSizeLimits() {
|
||||
//если задавать PreffredSize 0, скролл НЕ РАБОТАЕТ. Магия!
|
||||
}
|
||||
public void showPass(Pass pass) {
|
||||
JButton button = pass.createButton();
|
||||
add(button);
|
||||
Dimension d = button.getPreferredSize();
|
||||
button.setPreferredSize(new Dimension(d.width, 30));
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
public void Refresh() {
|
||||
int limit = MainModule_.instance.getFirstAccessPassesCount();
|
||||
Drop();
|
||||
int i = 1;
|
||||
for (Object pass : MainModule_.instance.getFirstAccessPasses()) {
|
||||
showPass((Pass) pass);
|
||||
++i;
|
||||
if (i > limit) break;
|
||||
}
|
||||
}
|
||||
public void Drop() {
|
||||
UI.Clear(this);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
import Common.Visual.Menus.StyledPopupMenu;
|
||||
import Common.Visual.Menus.VisualiserMenuItem;
|
||||
package Common.Visual.Menus;
|
||||
import Common.Visual.Trees.StyledTree;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Visual.UI_;
|
||||
import Common.MainModule_;
|
||||
import Common.Visual.Themes.ThemeElement;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -21,15 +21,15 @@ public class StyledPopupMenu extends JPopupMenu implements ThemeElement {
|
||||
});
|
||||
}
|
||||
private void refreshTheme_r(MenuElement element) {
|
||||
element.getComponent().setBackground(UI_.getTheme().background);
|
||||
element.getComponent().setForeground(UI_.getTheme().foreground);
|
||||
element.getComponent().setBackground(MainModule_.instance.getUI().getTheme().background);
|
||||
element.getComponent().setForeground(MainModule_.instance.getUI().getTheme().foreground);
|
||||
for (MenuElement se : element.getSubElements())
|
||||
refreshTheme_r(se);
|
||||
}
|
||||
@Override
|
||||
public void applyTheme() {
|
||||
setBackground(UI_.getTheme().background);
|
||||
setForeground(UI_.getTheme().foreground);
|
||||
setBackground(MainModule_.instance.getUI().getTheme().background);
|
||||
setForeground(MainModule_.instance.getUI().getTheme().foreground);
|
||||
refreshTheme_r(this);
|
||||
}
|
||||
public void CheckElementsVisibility() {
|
||||
|
||||
@@ -3,6 +3,8 @@ import Common.CommonConstants;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Vector;
|
||||
public class TableMenu extends StyledPopupMenu {
|
||||
int row = CommonConstants.Nan;
|
||||
int column = CommonConstants.Nan;
|
||||
@@ -10,12 +12,19 @@ public class TableMenu extends StyledPopupMenu {
|
||||
//-
|
||||
JTable owner = null;
|
||||
VisualiserMenuItem mcopy;
|
||||
JTextArea value_view;
|
||||
JScrollPane value_scroll;
|
||||
public TableMenu(JTable owner_in) {
|
||||
owner = owner_in;
|
||||
mcopy = new VisualiserMenuItem("Копировать текст текущей ячейки", "/icons/Editor/Copy.png");
|
||||
//если удалось нажать значит все условия выполнены
|
||||
mcopy.addActionListener(e -> Utils_.CopyToClipboard(target.toString()));
|
||||
add(mcopy);
|
||||
//
|
||||
add(value_scroll = new JScrollPane(value_view = new JTextArea()));
|
||||
value_view.setEditable(false);
|
||||
//value_view.setLineWrap(true);
|
||||
//value_view.setWrapStyleWord(true);
|
||||
}
|
||||
@Override
|
||||
public void CheckElementsVisibility() {
|
||||
@@ -24,7 +33,23 @@ public class TableMenu extends StyledPopupMenu {
|
||||
if ((row >= 0) && (column >= 0)) {
|
||||
target = owner.getValueAt(row, column);
|
||||
mcopy.setVisible(true);
|
||||
} else mcopy.setVisible(false);
|
||||
Dimension d = new Dimension(Math.max(mcopy.getWidth(), 300), 100);
|
||||
value_view.setVisible(true);
|
||||
String res = target.toString();
|
||||
if (target instanceof Vector) {
|
||||
Vector<Object> v = (Vector<Object>) target;
|
||||
Vector<String> res_ = new Vector<>();
|
||||
for (Object o : v) {
|
||||
res_.add(o.toString());
|
||||
}
|
||||
res = String.join("\n", res_);
|
||||
}
|
||||
value_view.setText(res);
|
||||
value_scroll.setPreferredSize(d);
|
||||
} else {
|
||||
mcopy.setVisible(false);
|
||||
value_view.setVisible(false);
|
||||
}
|
||||
super.CheckElementsVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -27,7 +27,7 @@ public class TextComboBoxMenu extends StyledPopupMenu {
|
||||
new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
UI_.TrySelect(box, Utils_.getFromClipboard());
|
||||
UI.TrySelect(box, Utils_.getFromClipboard());
|
||||
}
|
||||
});
|
||||
add(m_paste);
|
||||
|
||||
@@ -8,12 +8,12 @@ import java.util.Vector;
|
||||
public class TextEditorMenu extends StyledPopupMenu {
|
||||
protected JTextComponent editor;
|
||||
protected String selectedText = null;
|
||||
protected JMenuItem m_strike;
|
||||
protected JMenuItem m_unstrike;
|
||||
//-------------------------------------------------
|
||||
JMenuItem m_cut;
|
||||
JMenuItem m_copy;
|
||||
JMenuItem m_paste;
|
||||
protected JMenuItem m_strike;
|
||||
protected JMenuItem m_unstrike;
|
||||
//-------------------------------------------------
|
||||
public TextEditorMenu(JTextComponent editor_in) {
|
||||
editor = editor_in;
|
||||
@@ -44,28 +44,28 @@ public class TextEditorMenu extends StyledPopupMenu {
|
||||
});
|
||||
add(m_paste);
|
||||
//--
|
||||
m_strike = new VisualiserMenuItem("Вычеркнуть","/icons/Editor/Strikethrough.png");
|
||||
m_strike = new VisualiserMenuItem("Вычеркнуть", "/icons/Editor/Strikethrough.png");
|
||||
m_strike.addActionListener(
|
||||
new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String[] data = selectedText.split("\n");
|
||||
Vector<String> new_data = new Vector<>();
|
||||
for (String line: data){
|
||||
for (String line : data) {
|
||||
new_data.add(Utils_.strikeThrough(line));
|
||||
}
|
||||
editor.replaceSelection(String.join("\n", new_data));
|
||||
}
|
||||
});
|
||||
add(m_strike);
|
||||
m_unstrike = new VisualiserMenuItem("Отменить вычёркивание","/icons/Editor/NoStrike.png");
|
||||
m_unstrike = new VisualiserMenuItem("Отменить вычёркивание", "/icons/Editor/NoStrike.png");
|
||||
m_unstrike.addActionListener(
|
||||
new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String[] data = selectedText.split("\n");
|
||||
Vector<String> new_data = new Vector<>();
|
||||
for (String line: data){
|
||||
for (String line : data) {
|
||||
new_data.add(Utils_.noStrikeThrough(line));
|
||||
}
|
||||
editor.replaceSelection(String.join("\n", new_data));
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
package Common.Visual.Menus;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -13,15 +12,15 @@ public class VisualiserMenu extends JMenu {
|
||||
setToolTipText(text);
|
||||
if (textVisible)
|
||||
setText(text);
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
if (!iconPath.isEmpty())
|
||||
setIcon(Utils_.getIcon(iconPath));
|
||||
}
|
||||
public VisualiserMenu(String text, String iconPath) {
|
||||
this(text, iconPath, false);
|
||||
}
|
||||
public void addPasses(PassCode... codes) {
|
||||
for (PassCode code : codes)
|
||||
add( Global.mainModule.getPass(code).createMenuItem());
|
||||
public void addPasses(PassCode_... codes) {
|
||||
for (PassCode_ code : codes)
|
||||
add(MainModule_.instance.getPass(code).createMenuItem());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package _VisualDVM.Visual.Menus;
|
||||
package Common.Visual.Menus;
|
||||
import Common.MainModule_;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Global;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -13,14 +13,18 @@ public class VisualiserMenuBar extends JToolBar {
|
||||
setFloatable(false);
|
||||
setSizeLimits();
|
||||
}
|
||||
public void addPasses(PassCode... codes) {
|
||||
public void addPasses(PassCode_... codes) {
|
||||
//- кнопки. связать их с проходами. (!)
|
||||
for (PassCode code : codes) {
|
||||
if (Global.mainModule.getPass(code) != null) {
|
||||
add(Global.mainModule.getPass(code).createButton());
|
||||
for (PassCode_ code : codes) {
|
||||
if (MainModule_.instance.getPass(code) != null) {
|
||||
add(MainModule_.instance.getPass(code).createButton());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addPasses(Pass... passes) {
|
||||
for (Pass pass : passes)
|
||||
add(pass.createButton());
|
||||
}
|
||||
public JMenuBar addMenus(JMenu... menus) {
|
||||
JMenuBar bar = new JMenuBar() {
|
||||
{
|
||||
@@ -37,7 +41,7 @@ public class VisualiserMenuBar extends JToolBar {
|
||||
public JLabel addLabel(String text_in, String icon_path_in) {
|
||||
JLabel res = new JLabel(text_in) {
|
||||
{
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
if (icon_path_in != null) {
|
||||
setIcon(Utils_.getIcon(icon_path_in));
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
package Common.Visual.Menus;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Common.Visual.Fonts.VisualiserFonts;
|
||||
|
||||
import javax.swing.*;
|
||||
public class VisualiserMenuItem extends JMenuItem {
|
||||
public VisualiserMenuItem(String text) {
|
||||
super(text, null);
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
}
|
||||
public VisualiserMenuItem(String text, String icon_path) {
|
||||
super(text);
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
if (icon_path != null)
|
||||
setIcon(Utils_.getIcon(icon_path));
|
||||
}
|
||||
public VisualiserMenuItem(){
|
||||
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
public VisualiserMenuItem() {
|
||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.Menu));
|
||||
}
|
||||
}
|
||||
|
||||
42
src/Common/Visual/SavedForm.java
Normal file
42
src/Common/Visual/SavedForm.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package Common.Visual;
|
||||
import Common.Database.Objects.DBForm.DBForm;
|
||||
import Common.MainModule_;
|
||||
|
||||
import java.awt.*;
|
||||
public interface SavedForm {
|
||||
default String getFormKey() {
|
||||
return null;
|
||||
}
|
||||
int getDefaultWidth();
|
||||
int getDefaultHeight();
|
||||
default void LoadWindowParameters() {
|
||||
if (this instanceof Window) {
|
||||
Window window = (Window) this;
|
||||
if ((getFormKey() != null) && MainModule_.instance.getDb().forms.Data.containsKey(getFormKey())) {
|
||||
DBForm dbForm = MainModule_.instance.getDb().forms.Data.get(getFormKey());
|
||||
dbForm.Apply(window);
|
||||
return;
|
||||
} else {
|
||||
window.setSize(getDefaultWidth(), getDefaultHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
default void SaveWindowParameters() {
|
||||
if ((this instanceof Window) && (getFormKey() != null)) {
|
||||
Window window = (Window) this;
|
||||
DBForm dbForm = null;
|
||||
try {
|
||||
if (MainModule_.instance.getDb().forms.containsKey(getFormKey())) {
|
||||
dbForm = MainModule_.instance.getDb().forms.get(getFormKey());
|
||||
dbForm.Fill(window);
|
||||
MainModule_.instance.getDb().Update(dbForm);
|
||||
} else {
|
||||
dbForm = new DBForm(getFormKey(), window);
|
||||
MainModule_.instance.getDb().Insert(dbForm);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,7 @@ public interface StatusEnum {
|
||||
default String getDescription() {
|
||||
return toString();
|
||||
}
|
||||
default VisualiserFonts getFont() {return VisualiserFonts.UnknownState;}
|
||||
default VisualiserFonts getFont() {
|
||||
return VisualiserFonts.UnknownState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.MatteBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
public class ColumnFilter {
|
||||
public JTextField textField;
|
||||
public JPopupMenu popup;
|
||||
public ColumnFilter(DataSet dataSet, int columnIndex) {
|
||||
textField = new StyledTextField() {
|
||||
{
|
||||
setBorder(null);
|
||||
addActionListener(e -> {
|
||||
popup.setVisible(false);
|
||||
dataSet.ui_.control.getTableHeader().repaint();
|
||||
});
|
||||
getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
dataSet.changeColumnFilterValue(columnIndex, getText());
|
||||
dataSet.ShowUI();
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
dataSet.changeColumnFilterValue(columnIndex, getText());
|
||||
dataSet.ShowUI();
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
popup = new JPopupMenu() {
|
||||
{
|
||||
setBorder(new MatteBorder(0, 1, 1, 1, Color.DARK_GRAY));
|
||||
}
|
||||
};
|
||||
popup.add(textField);
|
||||
//--
|
||||
dataSet.getUi().control.getColumnModel().getColumn(columnIndex).setHeaderRenderer((table, value, isSelected, hasFocus, row, column1) -> new JLabel() {
|
||||
{
|
||||
setIcon(Utils_.getIcon("/icons/Filter.png"));
|
||||
setForeground(dataSet.getUi().control.getTableHeader().getForeground());
|
||||
setBackground(dataSet.getUi().control.getTableHeader().getBackground());
|
||||
setFont(dataSet.getUi().control.getTableHeader().getFont());
|
||||
setBorder(new MatteBorder(0, 0, 1, 1, Color.DARK_GRAY));
|
||||
setText("текст : "+dataSet.getColumnFilterValue(columnIndex));
|
||||
}
|
||||
});
|
||||
//--
|
||||
dataSet.getUi().control.getTableHeader().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent event) {
|
||||
if (event.getClickCount() == 1) {
|
||||
int columnIndex = dataSet.getUi().control.getTableHeader().columnAtPoint(event.getPoint());
|
||||
if (dataSet.columnsFilters.containsKey(columnIndex)) {
|
||||
Rectangle columnRectangle = dataSet.getUi().control.getTableHeader().getHeaderRect(columnIndex);
|
||||
Dimension d = new Dimension(columnRectangle.width - 72, columnRectangle.height - 1);
|
||||
popup.setPreferredSize(d);
|
||||
popup.setMaximumSize(d);
|
||||
popup.show(dataSet.getUi().control.getTableHeader(), columnRectangle.x + 72, 0);
|
||||
textField.setText(dataSet.getColumnFilterValue(columnIndex).toString());
|
||||
textField.requestFocusInWindow();
|
||||
textField.selectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,13 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.CommonConstants;
|
||||
public class ColumnInfo {
|
||||
public abstract class ColumnInfo<D> {
|
||||
private String Name = "?";
|
||||
private boolean visible = true;
|
||||
private boolean editable = false;
|
||||
private TableRenderers renderer = TableRenderers.RendererDefault;
|
||||
private TableEditors editor = TableEditors.EditorDefault;
|
||||
private int maxWidth = CommonConstants.Nan;
|
||||
private int minWidth = CommonConstants.Nan;
|
||||
//private int lastWidth = Utils.Nan;
|
||||
// public void setLastWidth(int width_in) {
|
||||
// lastWidth = width_in;
|
||||
// }
|
||||
// public int getLastWidth() {
|
||||
// return lastWidth;
|
||||
// }
|
||||
public ColumnInfo(String name_in) {
|
||||
setName(name_in);
|
||||
}
|
||||
public ColumnInfo(String name_in, TableRenderers renderer_in, TableEditors editor_in) {
|
||||
setName(name_in);
|
||||
setRenderer(renderer_in);
|
||||
setEditable(true);
|
||||
setEditor(editor_in);
|
||||
}
|
||||
public ColumnInfo(String name_in, TableRenderers renderer_in) {
|
||||
setName(name_in);
|
||||
setRenderer(renderer_in);
|
||||
}
|
||||
public abstract Object getFieldAt(D object);
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
@@ -41,54 +21,31 @@ public class ColumnInfo {
|
||||
this.visible = visible_in;
|
||||
}
|
||||
public boolean isEditable() {
|
||||
return editable;
|
||||
return getEditorClass() != null;
|
||||
}
|
||||
public void setEditable(boolean editable_in) {
|
||||
this.editable = editable_in;
|
||||
public Class getRendererClass() {
|
||||
return null;
|
||||
}
|
||||
public TableRenderers getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
public void setRenderer(TableRenderers renderer_in) {
|
||||
this.renderer = renderer_in;
|
||||
}
|
||||
public TableEditors getEditor() {
|
||||
return editor;
|
||||
}
|
||||
public void setEditor(TableEditors editor_in) {
|
||||
this.editor = editor_in;
|
||||
setEditable(editor != TableEditors.EditorDefault);
|
||||
public Class getEditorClass() {
|
||||
return null;
|
||||
}
|
||||
public boolean hasRenderer() {
|
||||
return getRenderer() != TableRenderers.RendererDefault;
|
||||
return getRendererClass() != null;
|
||||
}
|
||||
public boolean hasEditor() {
|
||||
return getEditor() != TableEditors.EditorDefault;
|
||||
return getEditorClass() != null;
|
||||
}
|
||||
public int getMaxWidth() {
|
||||
return maxWidth;
|
||||
}
|
||||
public void setMaxWidth(int maxWidth_in) {
|
||||
this.maxWidth = maxWidth_in;
|
||||
return CommonConstants.Nan;
|
||||
}
|
||||
public boolean hasMaxWidth() {
|
||||
return maxWidth != CommonConstants.Nan;
|
||||
return getMaxWidth() != CommonConstants.Nan;
|
||||
}
|
||||
//-
|
||||
public int getMinWidth() {
|
||||
return minWidth;
|
||||
}
|
||||
public void setMinWidth(int minWidth_in) {
|
||||
this.minWidth = minWidth_in;
|
||||
return CommonConstants.Nan;
|
||||
}
|
||||
public boolean hasMinWidth() {
|
||||
return minWidth != CommonConstants.Nan;
|
||||
return getMinWidth() != CommonConstants.Nan;
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean hasLastWidth() {
|
||||
return lastWidth != Utils.Nan;
|
||||
}
|
||||
*/
|
||||
//-
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package Common.Visual.Tables;
|
||||
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
|
||||
public class ConfigurationAutoRenderer extends DBObjectRenderer {
|
||||
@Override
|
||||
public void Display() {
|
||||
if (value != null) {
|
||||
setIcon(((Configuration)value).GetAutoIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package Common.Visual.Tables;
|
||||
public class DBObjectSelectionRenderer extends DBObjectRenderer {
|
||||
public class DBObjectSelectionRenderer extends RendererDBObject {
|
||||
/*
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.Database.Objects.DBObject;
|
||||
public class DBObjectSelector<T extends DBObject> extends DBObjectEditor<T> {
|
||||
public class DBObjectSelector<T extends DBObject> extends EditorDBObject<T> {
|
||||
@Override
|
||||
public void Action() {
|
||||
value.SwitchSelection();
|
||||
|
||||
@@ -10,8 +10,8 @@ public abstract class DataTable extends StyledTable implements DataControl {
|
||||
@Override
|
||||
public void SelectRowByPK(Object pk) {
|
||||
for (int i = 0; i < getRowCount(); ++i) {
|
||||
DBObject o = getRowObject(i);
|
||||
if (o!=null) {
|
||||
DBObject o = getRowObject(i);
|
||||
if (o != null) {
|
||||
if (o.getPK()
|
||||
.equals(pk)) {
|
||||
SelectRow(i);
|
||||
@@ -21,7 +21,7 @@ public abstract class DataTable extends StyledTable implements DataControl {
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------
|
||||
//------------------------------
|
||||
/*
|
||||
public void SelectRow(int r) {
|
||||
getSelectionModel().setSelectionInterval(r, r);
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.swing.table.TableCellEditor;
|
||||
import java.awt.*;
|
||||
import java.util.EventObject;
|
||||
import java.util.Objects;
|
||||
public abstract class DBObjectEditor<T extends DBObject> extends EditorCell implements TableCellEditor {
|
||||
public abstract class EditorDBObject<T extends DBObject> extends EditorCell implements TableCellEditor {
|
||||
//задается при редактировании клетки.
|
||||
public T value = null;
|
||||
protected transient ChangeEvent changeEvent;
|
||||
123
src/Common/Visual/Tables/HeaderTextFilter.java
Normal file
123
src/Common/Visual/Tables/HeaderTextFilter.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package Common.Visual.Tables;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.DataSet;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.DBObjectFilter_;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.MatteBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
public class HeaderTextFilter<D extends DBObject> implements DBObjectFilter_<D> {
|
||||
DataSet dataSet = null; //таблица к интерфейсу которой относится фильтр.
|
||||
int columnIndex = CommonConstants.Nan; //номер столбца к которому привязан фильтр.
|
||||
JTextField textField = null;
|
||||
JPopupMenu popup = null;
|
||||
boolean contains = true;
|
||||
private String filterValue = "";
|
||||
private int offset = 0;
|
||||
//при одиночном клике, показать поверх заголовка столбца выпавшее меню с полем фильтра.
|
||||
public HeaderTextFilter(DataSet dataSet_in, int columnIndex_in, int offset_in, boolean contains_in) {
|
||||
dataSet = dataSet_in;
|
||||
columnIndex = columnIndex_in;
|
||||
offset = offset_in;
|
||||
contains = contains_in;
|
||||
}
|
||||
public HeaderTextFilter(DataSet dataSet_in, int columnIndex_in, int offset_in) {
|
||||
this(dataSet_in, columnIndex_in, offset_in, true);
|
||||
}
|
||||
@Override
|
||||
public boolean Validate(D object) {
|
||||
Object field = dataSet.getUI().getColumnInfo(columnIndex).getFieldAt(object);
|
||||
if (field instanceof String) {
|
||||
String s = field.toString().toLowerCase();
|
||||
return contains ? s.contains(filterValue) :
|
||||
(filterValue.isEmpty() || s.equals(filterValue)) || (filterValue.trim().isEmpty() && s.isEmpty());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
public void Mount(DataTable control) {
|
||||
popup = new JPopupMenu() {
|
||||
{
|
||||
setBorder(new MatteBorder(0, 1, 1, 1, Color.DARK_GRAY));
|
||||
}
|
||||
};
|
||||
textField = new StyledTextField() {
|
||||
{
|
||||
setBorder(null);
|
||||
addActionListener(e -> {
|
||||
popup.setVisible(false);
|
||||
control.getTableHeader().repaint();
|
||||
});
|
||||
getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
setFilterValue(getText());
|
||||
dataSet.getUI().Show();
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
setFilterValue(getText());
|
||||
dataSet.getUI().Show();
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
popup.add(textField);
|
||||
/*
|
||||
Это лучше не использовать. убирание сортера по неведомым причинам урезает размер строк таблицы.
|
||||
control.setRowSorter(null);
|
||||
TableRowSorter<TableModel> sorter = new TableRowSorter<>(control.getModel());
|
||||
sorter.setSortable(columnIndex, false);
|
||||
control.setRowSorter(sorter);
|
||||
*/
|
||||
control.getColumnModel().getColumn(columnIndex).setHeaderRenderer(
|
||||
(table, value, isSelected, hasFocus, row, column1) -> new JLabel() {
|
||||
{
|
||||
setIcon(Utils_.getIcon("/Common/icons/Filter.png"));
|
||||
setForeground(control.getTableHeader().getForeground());
|
||||
setBackground(control.getTableHeader().getBackground());
|
||||
setFont(control.getTableHeader().getFont());
|
||||
setBorder(new MatteBorder(0, 0, 1, 1, Color.DARK_GRAY));
|
||||
setText(dataSet.getUI().getColumnInfo(columnIndex).getName() + " : " + getFilterValue());
|
||||
}
|
||||
});
|
||||
//--
|
||||
control.getTableHeader().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent event) {
|
||||
if (event.getClickCount() == 1) {
|
||||
int clickedColumnIndex = control.getTableHeader().columnAtPoint(event.getPoint());
|
||||
if (columnIndex == clickedColumnIndex) {
|
||||
Rectangle columnRectangle = control.getTableHeader().getHeaderRect(columnIndex);
|
||||
Dimension d = new Dimension(columnRectangle.width - offset, columnRectangle.height - 1);
|
||||
//-
|
||||
popup.setPreferredSize(d);
|
||||
popup.setMaximumSize(d);
|
||||
popup.show(control.getTableHeader(), columnRectangle.x + offset, 0);
|
||||
//-
|
||||
textField.setText(getFilterValue());
|
||||
textField.requestFocusInWindow();
|
||||
textField.selectAll();
|
||||
//-
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public String getFilterValue() {
|
||||
return filterValue;
|
||||
}
|
||||
public void setFilterValue(String filterValue_in) {
|
||||
this.filterValue = filterValue_in.toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ import javax.swing.table.TableCellRenderer;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
public class EditableHeaderRenderer implements TableCellRenderer {
|
||||
public class RendereEditableHeader implements TableCellRenderer {
|
||||
private final JComponent editor;
|
||||
private JTable table = null;
|
||||
private MouseEventReposter reporter = null;
|
||||
private JComponent editor;
|
||||
public EditableHeaderRenderer(JComponent editor) {
|
||||
public RendereEditableHeader(JComponent editor) {
|
||||
this.editor = editor;
|
||||
this.editor.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||
}
|
||||
@@ -30,10 +30,10 @@ public class EditableHeaderRenderer implements TableCellRenderer {
|
||||
return this.editor;
|
||||
}
|
||||
static public class MouseEventReposter extends MouseAdapter {
|
||||
private final JTableHeader header;
|
||||
private final Component editor;
|
||||
private Component dispatchComponent;
|
||||
private JTableHeader header;
|
||||
private int column = -1;
|
||||
private Component editor;
|
||||
public MouseEventReposter(JTableHeader header, int column, Component editor) {
|
||||
this.header = header;
|
||||
this.column = column;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user