Compare commits

..

272 Commits

Author SHA1 Message Date
Francesco Mangiacrapa b28647ec78 updated the `maven-portal-bom` dependency 2024-10-17 12:41:45 +02:00
Francesco Mangiacrapa 05ed0d9ff5 removed -SNAPSHOT to be released 2024-10-16 14:30:55 +02:00
Francesco Mangiacrapa ab06d55c6e added -SNAPSHOT to build it 2024-10-16 14:30:28 +02:00
Francesco Mangiacrapa a0d7501da2 Integrated in the report UI the link of project just saved 2024-10-16 14:29:50 +02:00
Francesco Mangiacrapa b829f0b818 removed -SNAPSHOT to be released 2024-10-15 14:23:11 +02:00
Francesco Mangiacrapa 12646d3a8e Merge pull request 'monitor_status' (!14) from monitor_status into master
Reviewed-on: #14
2024-10-15 14:21:16 +02:00
Francesco Mangiacrapa 3bccd516a3 Declared as geoportal-data-entry-app.v3.3.0-SNAPSHOT 2024-10-15 14:12:01 +02:00
Francesco Mangiacrapa d8f5d0ba53 fixed log import 2024-10-15 13:59:45 +02:00
Francesco Mangiacrapa 6617655492 improved the monitoring.. 2024-10-15 12:41:11 +02:00
Francesco Mangiacrapa 39efa4b27c In progress task [#28268] 2024-10-14 17:21:14 +02:00
Francesco Mangiacrapa c4b9d79e68 Init new feature 2024-10-11 17:17:05 +02:00
Francesco Mangiacrapa 77c6c5c0ce removed -SNAPSHOT 2024-10-04 12:36:07 +02:00
Francesco Mangiacrapa 113c21bf80 just to build SNAPSHOT version 2024-10-04 12:35:11 +02:00
Francesco Mangiacrapa 46e53f8bbe removed TODO 2024-10-04 11:53:39 +02:00
Francesco Mangiacrapa 7a7694e859 Added logs (start/end) for tracing the project creation time 2024-10-04 11:52:39 +02:00
Francesco Mangiacrapa 138bc153a0 removed -SNAPSHOT 2024-10-02 17:12:55 +02:00
Francesco Mangiacrapa 093b869e1f rebuilding SNAPSHOT version 2024-10-02 17:12:24 +02:00
Francesco Mangiacrapa f6a0682777 added check when the file uploaded is null 2024-09-24 16:31:02 +02:00
Francesco Mangiacrapa 58fc9d0d52 removed -SNAPSHOT to be released 2024-06-28 15:58:11 +02:00
Francesco Mangiacrapa 3aa1712faf Merge pull request 'feature_27120' (!13) from feature_27120 into master
Reviewed-on: #13
2024-06-28 15:56:13 +02:00
Francesco Mangiacrapa 40ad3ee2cf updated typo 2024-06-20 17:50:44 +02:00
Francesco Mangiacrapa bb323df98a updated logs 2024-05-22 15:34:23 +02:00
Francesco Mangiacrapa 54545e7048 Enforced deleteProject UX 2024-05-10 12:50:51 +02:00
Francesco Mangiacrapa c3a923eb69 updated exception message 2024-05-10 12:29:33 +02:00
Francesco Mangiacrapa acaf4eb37c Enforced deleteProject method 2024-05-10 12:25:20 +02:00
Francesco Mangiacrapa 89ddb6bc5f updated title 2024-04-16 11:22:38 +02:00
Francesco Mangiacrapa 4a1b26128c commented test 2024-04-15 12:35:16 +02:00
Francesco Mangiacrapa ed5b39d106 updated CSS 2024-04-11 12:22:58 +02:00
Francesco Mangiacrapa 63816fe648 integrated new bean StepPerformedResultDV 2024-04-11 11:04:54 +02:00
Francesco Mangiacrapa 140856db03 - Added optional message when performing lifecycle step [#27192] 2024-04-08 17:18:29 +02:00
Francesco Mangiacrapa c8c500c736 - Integrated new Uri-Resolver-Manager [#27160]
- Added Get Shareable Link facility [#27120]
2024-04-05 15:54:09 +02:00
Francesco Mangiacrapa b86439cba6 added information when resolving shared link 2024-03-27 10:55:42 +01:00
Francesco Mangiacrapa fb7a80bb2f Implementing the init facility to resolve a public link on an item
#27120
2024-03-26 17:00:37 +01:00
Roberto Cirillo 50a688a820 Update 'pom.xml'
fix geoportal-data-viewer-widget range
2024-02-27 10:26:34 +01:00
Francesco Mangiacrapa ecc14f2283 Updated geoportal-data-mapper range at [1.0.1, 2.0.0-SNAPSHOT) 2024-02-26 15:09:40 +01:00
Francesco Mangiacrapa fe2f7b3795 removed -SNAPSHOT to be released 2024-01-11 16:38:28 +01:00
Francesco Mangiacrapa 9ca7b52b60 Improved display of results on multiple fields #26372 2024-01-11 15:56:54 +01:00
Francesco Mangiacrapa c16bcdbc76 Updated README 2023-07-25 11:35:15 +02:00
Francesco Mangiacrapa 4c8a75685b Updated README 2023-07-25 11:29:10 +02:00
Francesco Mangiacrapa e853dd8da3 Update 'README.md' 2023-07-12 23:39:52 +02:00
Francesco Mangiacrapa f32a75b9df Updated README 2023-07-08 18:14:24 +02:00
Francesco Mangiacrapa 1d93733386 removed -SNAPSHOT to be released 2023-06-19 11:00:59 +02:00
Francesco Mangiacrapa c9e2b1598d Merge pull request 'bug_25265' (!12) from bug_25265 into master
Reviewed-on: #12
2023-06-19 10:59:13 +02:00
Francesco Mangiacrapa 20ead3b970 updated description 2023-06-16 15:39:45 +02:00
Francesco Mangiacrapa 869b13d5fe bug fixed the search facility [#25265] 2023-06-16 15:14:15 +02:00
Roberto Cirillo 8eecd5c638 Update 'CHANGELOG.md'
fix changelog
2023-05-31 14:28:29 +02:00
Francesco Mangiacrapa c32af933df removed -SNAPSHOT to be released 2023-05-12 10:58:13 +02:00
Francesco Mangiacrapa 51e9d9f7fe Merge pull request 'task_24166' (!11) from task_24166 into master
Reviewed-on: #11
2023-05-12 10:57:14 +02:00
Francesco Mangiacrapa 4407711fe6 Merged manually against the `task_24166` to resolve conflicts 2023-05-12 10:57:02 +02:00
Francesco Mangiacrapa 84a8bdf5d2 merged manually some files to resolve conflicts with `task_24166` 2023-05-12 10:55:03 +02:00
Francesco Mangiacrapa 4762ad4f35 Implemented - DELETE relation" operation allowed only in DRAFT phase
[#25104]
2023-05-11 16:24:16 +02:00
Francesco Mangiacrapa 79e0e366f1 removed -SNAPSHOT to be released 2023-05-11 15:08:36 +02:00
Francesco Mangiacrapa 3b0dfd0533 geoportal-data-viewer-widget groupid updated at
`org.gcube.portlets.widgets`.
2023-05-11 15:08:13 +02:00
Francesco Mangiacrapa 9e98f5fea8 passed to maven-portal-bom.3.8.0-SNAPSHOT 2023-05-05 17:20:05 +02:00
Francesco Mangiacrapa 623a7af274 removed unused code 2023-05-05 14:59:12 +02:00
Francesco Mangiacrapa 02b3583e61 updated css 2023-05-04 17:10:20 +02:00
Francesco Mangiacrapa 6458b89648 Improved Update facility 2023-05-04 16:27:00 +02:00
Francesco Mangiacrapa 849dec5db3 Gis Link not displayed in the creation report 2023-05-04 12:57:19 +02:00
Francesco Mangiacrapa b51958e7d5 Updated README 2023-05-03 11:32:05 +02:00
Francesco Mangiacrapa 6ddae17b33 Updated README 2023-05-03 11:31:34 +02:00
Francesco Mangiacrapa aae6504d25 Provided the "View Document" and "View As JSON" facilities 2023-05-03 11:29:45 +02:00
Francesco Mangiacrapa cc15c66701 removed unused imports 2023-05-03 10:34:54 +02:00
Francesco Mangiacrapa 83aba5d29f Passed to Geoportal_Resolver service [#25031] 2023-05-03 10:04:48 +02:00
Francesco Mangiacrapa 612e6a3814 Updated "Show on Map" 2023-05-02 15:36:03 +02:00
Francesco Mangiacrapa 2f7d93cd8e Fixed the Update facility, #24166 2023-05-02 15:16:59 +02:00
Francesco Mangiacrapa c330148ac5 Updated README 2023-05-02 11:37:27 +02:00
Francesco Mangiacrapa 5dede1e405 updated POM and README 2023-05-02 11:34:53 +02:00
Francesco Mangiacrapa 9d8c3dbc0a #25015 Integrated the Geoportal Data-Viewer Widget 2023-04-27 16:39:21 +02:00
Francesco Mangiacrapa 5b615a2bd9 Fixed panel height 2023-04-27 09:12:26 +02:00
Francesco Mangiacrapa bf526add90 Pushing first version of update facility, #24166 2023-04-26 17:01:08 +02:00
Francesco Mangiacrapa fbbc84e6e4 Improved GUI. Fixed some issues on Update facility 2023-04-21 16:34:11 +02:00
Francesco Mangiacrapa e8b3c59a6d improved the Update GUI 2023-04-21 15:27:29 +02:00
Francesco Mangiacrapa 5c031270a0 in progress on update facility, #24166 2023-04-20 16:34:52 +02:00
Francesco Mangiacrapa 4a643d7423 in progress on #24166 2023-04-17 16:03:40 +02:00
Francesco Mangiacrapa 8227535521 commented unused class 2023-04-05 12:02:12 +02:00
Francesco Mangiacrapa 861df3980a in progress 2023-03-17 12:41:56 +01:00
Francesco Mangiacrapa ccb66f083d merged with trunk version at 217df66cb3
commit
2023-03-06 15:40:28 +01:00
Francesco Mangiacrapa 217df66cb3 removed -SNAPSHOT to be released 2023-03-06 14:52:29 +01:00
Francesco Mangiacrapa dcc6ca6828 Merge pull request 'task_24567' (!10) from task_24567 into master
Reviewed-on: #10
2023-03-06 14:49:35 +01:00
Francesco Mangiacrapa 3efdb92d2a Performed reload from service 2023-02-21 11:00:26 +01:00
Francesco Mangiacrapa 126939574c Merged with version v3.0.2 and v3.1.0-SNAPSHOT. Branch task_24567 2023-02-09 15:53:44 +01:00
Francesco Mangiacrapa a596e180e5 Done - [#24569] and [#24571] 2023-02-09 14:12:44 +01:00
Francesco Mangiacrapa ed93d7ab43 removed -SNAPSHOT to be released 2023-02-03 15:20:44 +01:00
Francesco Mangiacrapa 7edb0446d4 Merge pull request 'fixes_24532' (!9) from fixes_24532 into master
Reviewed-on: #9
2023-02-03 14:47:36 +01:00
Francesco Mangiacrapa 6f77cf23e9 [#24475] Done 2023-02-03 11:42:06 +01:00
Francesco Mangiacrapa 5474b5e25b #24520 Added parameter "force=true" to Delete Project 2023-02-02 16:56:50 +01:00
Francesco Mangiacrapa 63102043a5 Merged with version 3.0.1 on master
3e01fba65a
2023-01-30 14:47:33 +01:00
Francesco Mangiacrapa 3e01fba65a commented console.log 2023-01-25 11:41:20 +01:00
Francesco Mangiacrapa 1844c32a4b Just updated the message "A Published project cannot be updated" 2023-01-19 15:56:52 +01:00
Francesco Mangiacrapa a89dd687cb [#24458] Published projects cannot be edited/updated 2023-01-19 14:51:42 +01:00
Francesco Mangiacrapa 8dc90cbd6e Fixing #24432 serialization issue using LinkedHashMap<String, String>
instead of LinkedHashMap<String, Object>
2023-01-17 17:07:36 +01:00
Francesco Mangiacrapa 3775f54f02 OVERRDING legend-style into 'metadata-profile-form-builder-widget', see
#24188#note-7
2023-01-13 11:37:20 +01:00
Francesco Mangiacrapa 7f850b805f Removed -SNAPSHOT to be released 2023-01-12 11:51:09 +01:00
Francesco Mangiacrapa 97c9f19b7c Building SNAPSHOT version 2023-01-12 11:49:31 +01:00
Francesco Mangiacrapa 8d6ba8b8f5 Removed -SNAPSHOT to be released 2022-12-21 11:28:56 +01:00
Francesco Mangiacrapa 7e81f7a347 Merge pull request 'task_24282' (!8) from task_24282 into master
Reviewed-on: #8
2022-12-21 11:27:46 +01:00
Francesco Mangiacrapa f1b8777ca0 Merged with the changes implemented in the branch/task_24282 2022-12-13 16:43:11 +01:00
Francesco Mangiacrapa f053195d92 #24049 Fixed "Show on Map" changing its behaviour 2022-12-13 15:30:47 +01:00
Francesco Mangiacrapa 1992d2227a only indentation 2022-12-13 14:41:33 +01:00
Francesco Mangiacrapa bd88048989 #24281 Fixed filtering selection label 2022-12-13 14:40:21 +01:00
Francesco Mangiacrapa 04eb740ea5 In progress on Update facility 2022-12-13 11:14:07 +01:00
Francesco Mangiacrapa 843a9b19b6 In progress on Update facility 2022-12-12 17:28:44 +01:00
Francesco Mangiacrapa 1c9fd0abe4 Removed json.v20140107 library. See #24263 2022-12-07 10:55:06 +01:00
Francesco Mangiacrapa ac95b4616a Fixing the conflict on 'json' library, see #24263?#note-1 2022-12-07 10:53:16 +01:00
Francesco Mangiacrapa 240ac0a74b Integrated with the geoportal-data-mapper library 2022-12-07 09:43:48 +01:00
Francesco Mangiacrapa 95264c261e merged with fix on master 2022-11-30 15:52:51 +01:00
Francesco Mangiacrapa 5a5fbdfabb merged with master branch. Fixing issue on clicking 2022-11-30 10:08:51 +01:00
Francesco Mangiacrapa 2cb435c546 fixing issue on clicking event 2022-11-30 10:06:42 +01:00
Francesco Mangiacrapa 7d2b8844af merged with fixing on pagination 2022-11-30 09:45:36 +01:00
Francesco Mangiacrapa 55dc9379c5 Bug fixing the pagination via getListProjects method 2022-11-29 15:45:43 +01:00
Francesco Mangiacrapa 0bfc938fef fixing refactored Porltet name 2022-11-28 17:10:08 +01:00
Francesco Mangiacrapa 5f1438aae2 Porltet name refactored to GeoPortalDataEntryApp 2022-11-28 16:52:57 +01:00
Francesco Mangiacrapa ad2fdc9d59 reverted Portlet name 2022-11-28 16:43:48 +01:00
Francesco Mangiacrapa e0b3606511 fixed unused code 2022-11-28 15:50:38 +01:00
Francesco Mangiacrapa 0a83c7ab4e Refactored the portlet name to GeoPortalDataEntryApp 2022-11-28 15:47:52 +01:00
Francesco Mangiacrapa 7090f51ee7 removed -SNAPSHOT to be released 2022-11-17 12:28:28 +01:00
Francesco Mangiacrapa 0086b7e454 Updated Changelog 2022-11-17 11:54:48 +01:00
Francesco Mangiacrapa 2ff7473ec9 #24136 Integrated the temporal dimension on the front-end side 2022-11-17 11:53:11 +01:00
Francesco Mangiacrapa d7de30ea5d description updated 2022-11-15 11:29:40 +01:00
Francesco Mangiacrapa ad4995162b Merge branch 'master' into tree_structure_new_layout 2022-11-15 11:19:40 +01:00
Francesco Mangiacrapa d75eaba3fe removed commented code 2022-11-14 16:19:10 +01:00
Francesco Mangiacrapa db8822b214 updated CSS for fixing LR template overriding 2022-11-11 12:21:13 +01:00
Francesco Mangiacrapa 711ce11337 improved CSS 2022-11-11 12:15:52 +01:00
Francesco Mangiacrapa 22c00f80cb changed CSS 2022-11-11 11:48:38 +01:00
Francesco Mangiacrapa ca20f20c11 Applying CSS for overriding LR portal template/css 2022-11-11 11:45:48 +01:00
Francesco Mangiacrapa 38660a489a Fixing. AVOIDING CACHING OF GeoNaFormCardModel. Reloading profiles from
server
2022-11-10 16:38:44 +01:00
Francesco Mangiacrapa 96955abaea Updated CHANGELOG 2022-11-09 15:25:26 +01:00
Francesco Mangiacrapa 2029544649 Removed old model "Concessioni" 2022-11-09 15:12:42 +01:00
Francesco Mangiacrapa 9dd99c5d73 bug fixing init app for handler ID 2022-10-26 16:38:42 +02:00
Francesco Mangiacrapa d03d1a1477 Added code to delte temp directories with uploaded temp files of
Geoportal
2022-10-20 16:58:29 +02:00
Francesco Mangiacrapa cc3595d4d9 copy content of temp files into files with "original" uploading name 2022-10-19 11:42:37 +02:00
Francesco Mangiacrapa a3cc2aeaa9 refactored 2022-10-18 16:38:48 +02:00
Francesco Mangiacrapa c34faa9f68 Added Expand Button into View Relations Panel 2022-10-18 15:30:12 +02:00
Francesco Mangiacrapa f576b0f966 #23941 Implementing the procedure 2022-10-07 18:39:37 +02:00
Francesco Mangiacrapa 0b47ac39d0 commented JUnit Tests 2022-10-06 17:31:55 +02:00
Francesco Mangiacrapa 848f7acb6a In progress the procedure to transform the JSON document into
dispalyable sections
2022-10-06 17:31:10 +02:00
Francesco Mangiacrapa 267b1fd086 Updated 2022-10-06 11:41:28 +02:00
Francesco Mangiacrapa 63642568eb #23926 Integrated a Post Creation Action in the UCD and manage it.
Improved Step Performed Feedback
2022-10-06 11:25:31 +02:00
Francesco Mangiacrapa f14a395b0c #23834 Integrated with the create/view/delete Relationship facility 2022-10-05 14:45:27 +02:00
Francesco Mangiacrapa e7a3c0e52e Added relationships 2022-10-03 17:52:16 +02:00
Francesco Mangiacrapa 197a83c6bf refactored gwt.version 2022-09-28 09:59:13 +02:00
Francesco Mangiacrapa 1672e8f8d5 #23913 Integrated with GUI presentation configurations read from IS 2022-09-26 16:17:41 +02:00
Francesco Mangiacrapa 2f032579f9 improved CSS 2022-09-23 16:59:30 +02:00
Francesco Mangiacrapa 86b16b5187 fixing compile issue 2022-09-23 16:37:37 +02:00
Francesco Mangiacrapa f319dc23fa improved css 2022-09-23 16:34:09 +02:00
Francesco Mangiacrapa 7f89872618 Improved CSS 2022-09-23 16:29:02 +02:00
Francesco Mangiacrapa 30881a9d30 Improved GUI and layout 2022-09-23 15:40:11 +02:00
Francesco Mangiacrapa 6178b38bfa Improved GUI and layout 2022-09-23 12:41:32 +02:00
Francesco Mangiacrapa f110ae1685 In progress on "View Relations" facility 2022-09-21 17:20:09 +02:00
Francesco Mangiacrapa 8c1392b8ff Managed Create Relation facility 2022-09-21 10:52:56 +02:00
Francesco Mangiacrapa 8d4b53388c Performed refactoring 2022-09-21 09:34:02 +02:00
Francesco Mangiacrapa 226c65ade6 Changed Layout and updated Create Relation GUI 2022-09-20 17:01:04 +02:00
Francesco Mangiacrapa f65eb2da95 In progress on "Create Relation facility" 2022-09-19 18:17:00 +02:00
Francesco Mangiacrapa 7932456113 refactored 2022-09-19 14:48:59 +02:00
Francesco Mangiacrapa 42f55ad7e0 Added CloseCrateRelationGUIEvent 2022-09-19 14:48:25 +02:00
Francesco Mangiacrapa fa308fd94f In progress on #23834 "Create Relation" GUI 2022-09-16 17:42:01 +02:00
Francesco Mangiacrapa 59a16651ce Integrated the roles defined in the UCD with the ActionDefinitions 2022-09-15 17:58:04 +02:00
Francesco Mangiacrapa 25ff6fb152 #23785 The "Edit the Project" operation has been migrated 2022-09-14 10:38:17 +02:00
Francesco Mangiacrapa 89214c7200 Implementing Update the JSON 2022-09-14 10:21:13 +02:00
Francesco Mangiacrapa 589acc519f Implemented update project by JSONEditor 2022-09-14 10:12:07 +02:00
Francesco Mangiacrapa 28277db942 Integrated the Workflow Action Panel 2022-09-13 16:18:40 +02:00
Francesco Mangiacrapa e31c7138a4 ActionOnItem.. renamed to OperationOnItem 2022-09-13 13:52:44 +02:00
Francesco Mangiacrapa 6fc0af0192 Re-Activated "Edit the Project" facility. 2022-09-12 15:09:43 +02:00
Francesco Mangiacrapa e350a4b9d8 Fixed initialization for any user role 2022-09-01 18:28:26 +02:00
Francesco Mangiacrapa 2bcd6db875 improved modal view on the "Publication Report" and "Delete" 2022-09-01 17:11:04 +02:00
Francesco Mangiacrapa 2edc77b6ef DialogConfirm renamed to ModalConfirm 2022-09-01 16:51:12 +02:00
Francesco Mangiacrapa e0f872d3be #23785 "Show on Map" and "Delete" operations migrated. 2022-09-01 16:43:25 +02:00
Francesco Mangiacrapa 5b9b776c56 #23785 "Publication Report" facility migrated to new client/service
model based on LifecycleInfo
2022-09-01 12:44:00 +02:00
Francesco Mangiacrapa 68b5548718 #23784 List, Reload, Searching and Ordering facilities migrated 2022-08-31 17:16:39 +02:00
Francesco Mangiacrapa 70723f9878 In progress on searching facility 2022-08-31 16:40:09 +02:00
Francesco Mangiacrapa 5d9ab67261 Migrated the Sort facility 2022-08-31 12:45:01 +02:00
Francesco Mangiacrapa ca4e0bf2d0 Aligned with geoportal-common refactored 2022-08-11 12:07:07 +02:00
Francesco Mangiacrapa 19448bd349 In progress on listing 2022-08-09 16:37:09 +02:00
Francesco Mangiacrapa 9e8aede170 Starting migration to geoportal-data-list configuration for UCD 2022-08-08 17:43:13 +02:00
Francesco Mangiacrapa d62d7c9eec removed ordered cards 2022-08-08 09:54:49 +02:00
Francesco Mangiacrapa a0f3bc915c Project publication with fileset implemented 2022-08-05 12:44:33 +02:00
Francesco Mangiacrapa 3ab1f5c89c JSON object built from TreeNode implemented 2022-08-04 10:57:18 +02:00
Francesco Mangiacrapa c2e4846e58 in progress 2022-08-03 17:50:47 +02:00
Francesco Mangiacrapa 5560a98407 Moved to geoportal-client (>= 1.1.0-SNAPSHOT). Tested loading of N-UCD
(with N=2)
2022-08-02 17:06:50 +02:00
Francesco Mangiacrapa e273a8bced fixed NodeItem 2022-07-08 16:54:52 +02:00
Francesco Mangiacrapa 7c2be535a2 tree node built on the client-side 2022-07-08 16:38:45 +02:00
Francesco Mangiacrapa 7932c31c52 built tree_node on the client side 2022-07-08 11:44:48 +02:00
Francesco Mangiacrapa c28170ee91 in progress 2022-07-07 18:21:34 +02:00
Francesco Mangiacrapa 22713ca924 in progress 2022-07-07 12:36:08 +02:00
Francesco Mangiacrapa 935e0035f1 in progress #23587 2022-07-06 17:47:39 +02:00
Francesco Mangiacrapa c1337ab37a in progress on #23587 2022-07-06 17:12:55 +02:00
Francesco Mangiacrapa 71e26af6dd in progress on #23587 2022-07-06 11:06:35 +02:00
Francesco Mangiacrapa b7836b33ae Passing to tree data-structure 2022-07-05 15:51:43 +02:00
Francesco Mangiacrapa 2eeaabc6b4 Built the base tree 2022-07-04 16:34:15 +02:00
Francesco Mangiacrapa df9f34be49 Changed css from "nth-last-child(-n+3)" to "nth-last-child(-n+4)" 2022-07-01 15:41:24 +02:00
Francesco Mangiacrapa 93f87145b7 #23587 Implementing GUI based on tree data structure 2022-07-01 15:39:27 +02:00
Francesco Mangiacrapa 8a284adcd3 removed -SNAPSHOT to be released 2022-06-29 16:02:34 +02:00
Francesco Mangiacrapa d19720236d - [#23593] Shown the published/unpublished field in the table
- Passed to maven-portal-bom 3.6.4
2022-06-29 15:06:02 +02:00
Francesco Mangiacrapa b32b58e90d removed unused dependencies 2022-06-29 11:48:09 +02:00
Francesco Mangiacrapa 96b3fc36dd commented submit 2022-06-24 15:11:47 +02:00
Francesco Mangiacrapa ad35adee21 removed -SNAPSHOT to be released 2022-06-08 11:47:38 +02:00
Francesco Mangiacrapa eefd49b00a Merge pull request 'feature_23390' (!7) from feature_23390 into master
Reviewed-on: #7
2022-06-08 11:42:50 +02:00
Francesco Mangiacrapa 561ce44ba8 fixed description 2022-06-08 11:32:26 +02:00
Francesco Mangiacrapa 1d5d6f9cb6 in progress on #23457 2022-06-01 17:59:28 +02:00
Francesco Mangiacrapa d87e2499ae "Clone (and publish) Project" facility improved and completed 2022-06-01 12:24:48 +02:00
Francesco Mangiacrapa 59ab1e4285 Updated geoportal-common range to [1.0.0,1.0.9-SNAPSHOT) 2022-05-27 17:39:56 +02:00
Francesco Mangiacrapa 213b515c5d #23390 clone facility implemented 2022-05-27 12:01:30 +02:00
Francesco Mangiacrapa 2c2109836c created the CloneOperationPanel.. 2022-05-26 17:43:48 +02:00
Francesco Mangiacrapa eb6a8ff587 #23390 Implementing facility: "Clone Project" 2022-05-24 18:33:33 +02:00
Francesco Mangiacrapa 0e30076f08 in progress 2022-05-20 12:31:58 +02:00
Francesco Mangiacrapa 0cb588a881 in progress on migration to UCD and Profiled Document 2022-03-17 18:08:58 +01:00
Francesco Mangiacrapa 3c1008eaf8 in progress on convert data-entries input to complex JSON 2022-03-07 17:48:32 +01:00
Francesco Mangiacrapa 53114d699f Improved Intro Page 2022-03-04 17:09:46 +01:00
Francesco Mangiacrapa 11f751e96c Managed min/max form repeatability 2022-03-04 16:44:51 +01:00
Francesco Mangiacrapa 3b8883b1fa Managing multiple data-entry types 2022-03-04 14:40:43 +01:00
Francesco Mangiacrapa 4a725573c9 Loading from (mock of) geoportal configuration, done 2022-03-03 18:44:21 +01:00
Francesco Mangiacrapa 0cd6880a54 removed -SNAPSHOT to be released 2022-01-13 17:07:21 +01:00
Francesco Mangiacrapa d8d34ac827 Merge pull request 'feature_22286' (!6) from feature_22286 into master
Reviewed-on: #6
2022-01-13 17:02:39 +01:00
Francesco Mangiacrapa 2bcebc758d refactoring 2021-12-22 12:20:08 +01:00
Francesco Mangiacrapa 8dd267730c ported to GNADataEntryConfigProfile 2021-12-21 16:51:56 +01:00
Francesco Mangiacrapa 03779582ad integrated with WhereClause 2021-12-15 15:43:36 +01:00
Francesco Mangiacrapa b028fcd4b4 Added "Logged in" role label 2021-12-13 11:27:03 +01:00
Francesco Mangiacrapa ca09e9ef94 removed unused code 2021-12-07 17:14:03 +01:00
Francesco Mangiacrapa 4120928540 #22506 - Re-engineered the common utilities 2021-12-06 17:24:27 +01:00
Francesco Mangiacrapa d19f293930 created GR "GNA-DataEntry-Configs" and using it 2021-12-02 17:13:55 +01:00
Francesco Mangiacrapa deb666d536 integrated "search for" facility 2021-12-02 12:25:05 +01:00
Francesco Mangiacrapa 62f41a960d in progress 2021-12-02 11:33:01 +01:00
Francesco Mangiacrapa 2b98a0849c #22287 starting integration with the base search, ordering and filtering
facility provided by MongoDB
2021-12-01 11:54:39 +01:00
Francesco Mangiacrapa acae8dd735 updated modal window 2021-11-26 17:06:05 +01:00
Francesco Mangiacrapa 2de36fd513 fixing code 2021-11-26 16:59:45 +01:00
Francesco Mangiacrapa ced697f140 removed lock file 2021-11-26 16:55:43 +01:00
Francesco Mangiacrapa ee1e3d8309 fixed pom to include resources of kind *.csv 2021-11-26 16:48:13 +01:00
Francesco Mangiacrapa 6840535bc1 commented Junit Tests 2021-11-26 16:06:35 +01:00
Francesco Mangiacrapa 93c3d1d07d #22455, integrated with roles: (Data-Member as default), Data-Manager,
Data-Editor
2021-11-26 16:05:05 +01:00
Francesco Mangiacrapa 5898e29529 removed -SNAPSHOT to be released 2021-11-17 11:44:45 +01:00
Francesco Mangiacrapa 7dd1a03b41 #22369 Including the bug fix for Policy and LicenseID in the
geoportal-common
2021-11-17 11:34:47 +01:00
Francesco Mangiacrapa eb8dceb8ff Edit mode: showing the field "didascalia" instead of "titolo" in case of
immagini
2021-10-12 17:18:54 +02:00
Francesco Mangiacrapa 17f2c9093d bug fixing manage files 2021-10-11 14:30:41 +02:00
Francesco Mangiacrapa 8f8d07fd44 removed -SNAPSHOT to be released 2021-10-08 15:18:38 +02:00
Francesco Mangiacrapa f56f07cce9 Merge pull request 'removed [' (!5) from task_21856 into master
Reviewed-on: #5
2021-10-07 15:56:25 +02:00
Francesco Mangiacrapa 22e73c94ef removed [ 2021-10-07 15:48:20 +02:00
Francesco Mangiacrapa 304d5c03be Merge pull request 'task_21856 - enhancements' (!4) from task_21856 into master
Reviewed-on: #4
2021-10-07 15:46:56 +02:00
Francesco Mangiacrapa 883850d3f8 moved log to trace 2021-10-06 16:31:31 +02:00
Francesco Mangiacrapa a2a61f9e7c fixed css 2021-10-06 16:28:19 +02:00
Francesco Mangiacrapa 9690b09cb1 #21990 completed edit mode for registerFileSet 2021-10-06 16:01:39 +02:00
Francesco Mangiacrapa 3bda56a55c in progress on registerFileSet 2021-10-05 19:17:05 +02:00
Francesco Mangiacrapa b4ec07371b in progress on edit mode 2021-09-30 13:06:14 +02:00
Francesco Mangiacrapa 765ca9f621 in progress on Edit Mode 2021-09-29 18:27:22 +02:00
Francesco Mangiacrapa 378f9419a6 in progress Edit Mode 2021-09-29 16:13:39 +02:00
Francesco Mangiacrapa 8627416400 removed exclusion of lombok 2021-09-29 12:00:52 +02:00
Francesco Mangiacrapa d358a21182 passing object instead of List<String> into GWT-RPC 2021-09-29 11:38:24 +02:00
Francesco Mangiacrapa 86f9234c83 moved to 2.0.0-SNAPSHOT 2021-09-29 11:08:15 +02:00
Francesco Mangiacrapa 282ad3980d Edit FileSet on-going 2021-09-28 17:31:16 +02:00
Francesco Mangiacrapa 541c190820 FileSet upload in progress 2021-09-27 18:32:19 +02:00
Francesco Mangiacrapa 3df7ab1787 Fired event after Record Updated 2021-09-27 15:28:36 +02:00
Francesco Mangiacrapa 9d3f3bf380 updated label 2021-09-24 17:26:46 +02:00
Francesco Mangiacrapa 486418a6b3 #22040 Revisited the "Abstract Relazione di Scavo" 2021-09-24 12:06:53 +02:00
Francesco Mangiacrapa 71cbc96d10 improved JSON update part 2021-09-22 11:38:52 +02:00
Francesco Mangiacrapa 48d19b6f10 #21990 Integrated with JSONEditor, Improved general CSS 2021-09-20 18:08:43 +02:00
Francesco Mangiacrapa a551e572c5 completed REAMDE. Added calls server-side 2021-09-16 12:15:07 +02:00
Francesco Mangiacrapa 234fd875cf improved the Modal GUI 2021-09-15 16:33:24 +02:00
Francesco Mangiacrapa 1bcd52cc94 fixing NavBar with actions for "List of Project" 2021-09-15 16:14:27 +02:00
Francesco Mangiacrapa 8a74c1f0d0 customized rendering of table according to status 2021-09-14 17:51:20 +02:00
Francesco Mangiacrapa 296703f5fb #22002 Integrated with ValidationReport and status 2021-09-14 13:08:55 +02:00
Francesco Mangiacrapa 2208adec46 refactoring 2021-09-02 18:14:49 +02:00
Francesco Mangiacrapa 34a17253a6 updated uibinder with anchors to page 2021-08-06 17:42:22 +02:00
Francesco Mangiacrapa 16484549ed updated css 2021-08-06 16:47:07 +02:00
Francesco Mangiacrapa 8ed729ea51 moved to gwt.2.9.0. Added Sort By facility 2021-08-06 16:23:17 +02:00
Francesco Mangiacrapa f1f1465696 revisited the columns 2021-08-05 17:38:21 +02:00
Francesco Mangiacrapa 30cedd9376 Delete Operation done 2021-08-05 16:49:04 +02:00
Francesco Mangiacrapa bd49bd6f4e fixed "Get list of Concessioni" table 2021-08-05 11:21:39 +02:00
Francesco Mangiacrapa b5ccba5551 first List of Records with pagination 2021-08-04 17:11:46 +02:00
Francesco Mangiacrapa 5fbb0fa8a7 added a method 2021-08-02 12:52:30 +02:00
Francesco Mangiacrapa a134c87b6d Passed to mongoId. Passed to Nome Autore, Email, Ruolo 2021-07-30 11:53:12 +02:00
Francesco Mangiacrapa 7f8e9da1e2 merged with branch Feature #20435 2021-07-23 17:40:50 +02:00
Francesco Mangiacrapa c511cbd163 Moved to maven-portal-bom 3.6.3. Component updated to 1.3.0-SNAPSHOT 2021-07-21 16:31:42 +02:00
Francesco Mangiacrapa 9fcab465c6 fixed to work with "Run with GWT development mode" 2021-07-16 17:47:11 +02:00
136 changed files with 19764 additions and 1818 deletions

View File

@ -1,16 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.3.0/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry kind="src" path="src/main/resources"/>
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
@ -35,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.3.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-entry-app-3.3.0/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.3.0-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.3.0
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,6 @@
<faceted-project> <faceted-project>
<installed facet="jst.web" version="3.0"/> <installed facet="jst.web" version="3.0"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/> <installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.jaxrs" version="1.1"/> <installed facet="jst.jaxrs" version="1.1"/>
<installed facet="java" version="1.8"/>
</faceted-project> </faceted-project>

View File

@ -4,42 +4,142 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.3.0-SNAPSHOT] - 2021-07-22 ## [v3.3.0] - 2024-10-15
- Implemented the init facility to resolve a public link on an item [#27120]
- Integrated new Uri-Resolver-Manager [#27160]
- Added Get Shareable Link facility [#27120]
- Added optional message when performing lifecycle step [#27192]
- Enforced deleteProject method/UX
- The save operation is now monitored asynchronously [#28268]
- Integrated in the report UI the link of project just saved
## [v3.2.2] - 2024-01-11
- Improved display of results on multiple fields (in the table) [#26372]
## [v3.2.1] - 2023-06-16
- Fixed issue in the Search facility [#25265]
## [v3.2.0] - 2023-05-12
- Implemented the Update facility [#24166]
- Integrated with the geoportal-data-mapper library [#24244]
- Integrated the Geoportal Data-Viewer Widget [#25015]
- Passed to Geoportal_Resolver service [#25031]
- Provided the "View Document" and "View As JSON" facilities
- DELETE relation operation allowed only in DRAFT phase [#25104]
## [v3.1.0] - 2023-03-06
#### Enhancements #### Enhancements
[#20435] Client integration with MongoConcessioni - [#24569] The Edit operation is available only in the "DRAFT" phase
Moved to maven-portal-bom 3.6.3 - [#24571] The "Create Relation" operation is available only in the "DRAFT" phase
## [v3.0.2] - 2023-02-02
#### Fixes
- [#24520] Added parameter "force=true" to Delete Project
- [#24475] Propagated the Access Policy in the fileset
## [v3.0.1] - 2023-01-19
#### Fixes
- [#24281] Fixed filtering selection label
- [#24049] Fixed "Show on Map" facility vs Chrome browser
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
## [v3.0.0] - 2022-11-09
#### Enhancements
- [#22684] Migrated to geoportal-data-entry-app configuration for UCD
- [#23587] GUI model viewer passed to tree data structure
- [#22883] Integrated with (the new) geoportal-client (>= 1.1.0-SNAPSHOT)
- [#22685] Migrated to geoportal-data-list configuration for UCD
- [#23784] Migrated list and reload, searching and ordering functionalities
- [#23785] Migrated the GNA functionalities
- [#23834] Integrated with the create/view/delete Relationship facility
- [#23913] Integrated with GUI presentation configurations read from IS
- [#23926] Integrated a Post Creation Action in the UCD and manage it
- [#24136] Integrated the temporal dimension on the front-end side
- [#24458] Published projects cannot be edited/updated
## [v2.2.1] - 2022-06-29
#### Enhancements
- [#23593] Shown the published/unpublished field in the table
- Passed to maven-portal-bom 3.6.4
## [v2.2.0] - 2022-06-08
#### Enhancements
- [#23390] Implemented facility: "Clone Project"
- [#23457] Implemented the "Publish/UnPublish Project" facility
## [v2.1.0] - 2021-11-24
#### Enhancements
- [#22455] Integrated with roles: (Data-Member as default), Data-Manager, Data-Editor
- [#22287] Integrated with base search, ordering and filtering facility provided by MongoDB
- [#22506] Re-engineered the common utilities
## [v2.0.1] - 2021-11-17
- [#22369] Just to include the bug fix for Policy and LicenseID in the geoportal-common
## [v2.0.0] - 2021-09-29
#### Enhancements
- [#20435] Client integration with MongoConcessioni
- Moved to maven-portal-bom 3.6.3
- [#21856] Implemented new user feedback
- [#21890] Passed to mongoID
- [#20599] Get List of Records
- [#22002] Integrated with ValidationReport and status
- [#21990] Provide the (first version of) edit mode
- [#22040] Revisited the "Abstract Relazione di Scavo"
## [v1.2.0] - 2020-12-18 ## [v1.2.0] - 2020-12-18
#### Enhancements #### Enhancements
[#20357] new requirements - [#20357] new requirements
## [v1.1.0] - 2020-12-1 ## [v1.1.0] - 2020-12-1
#### Enhancements #### Enhancements
[#20210] Updating required for data entry facility after the first feedback by domain experts - [#20210] Updating required for data entry facility after the first feedback by domain experts
## [v1.0.2-SNAPSHOT] - 2020-11-09 ## [v1.0.2] - 2020-11-09
#### Bug fixes #### Bug fixes
[#20092] Repeatible form: validate the card after the create event is fired - [#20092] Repeatible form: validate the card after the create event is fired
## [v1.0.1] - 2020-11-04 ## [v1.0.1] - 2020-11-04
#### Bug fixes #### Bug fixes
[#20063] Fixes for data-entry components - [#20063] Fixes for data-entry components
## [v1.0.0] - 2020-10-07 ## [v1.0.0] - 2020-10-07
[#19916] First release - [#19916] First release

View File

@ -1,15 +1,58 @@
# GeoPortal Data Entry App # GeoPortal Data Entry App
The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project Geoportal data-entry technology allows the actors who use it, the project management of spatio-temporal documents specified by meta-documents called "Use Case Descriptor" (UCD) which determine the document model, management, life cycle, etc. The system allows you to: (i) access and search for published projects by role for VRE, (ii) access the project publication report, view the publication status (SUCCESS, WARNING, ERROR), etc., (iii ) generate links for visualization on the map, (iv) update the contents of the registered projects through the workflow, (v) manage the relationships (quantity and quality temporal links) between the documents. In general, the technology allows the data entry of any document having spatio-temporal characteristics, whose metadata and payload are specified by one or more "gCube Profile" profiles which determine the structure of the resulting document (JSON).
## Built With ## Built With
* [OpenJDK](https://openjdk.java.net/) - The JDK used * [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management * [Maven](https://maven.apache.org/) - Dependency Management
**Uses**
* GWT v.2.10.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* pretty-print-json v.1.1. [pretty-print-json](https://github.com/center-key/pretty-print-json) is licensed under [MIT](https://github.com/center-key/pretty-print-json/blob/main/LICENSE.txt)
* jsoneditor v.9.5.5. [jsoneditor](https://github.com/josdejong/jsoneditor) is licensed under [Apache License 2.0](https://github.com/josdejong/jsoneditor/blob/master/LICENSE)
## Architecture
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/8e/GeoPortalDataEntry_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Architecture" />
## Showcase
##### D4GNA instance of Geoportal D4Science
see at [Dataset per il Geoportale Nazionale per lArcheologia (D4GNA)](https://gna.d4science.org/)
**New Project facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/c/c0/D4GNA_New_Project.png" style="max-width:800px;" alt="Workspace Home" />
**List of Projects facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/67/D4GNA_List_Of_Projects.png" style="max-width:800px;" alt="List of Projects" />
**UnPublish facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/6a/D4GNA_Unpublish.png" style="max-width:800px;" alt="UnPublish" />
**View Relations facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/7/76/D4GNA_ViewRelations.png" style="max-width:800px;" alt="View Relations" />
## Documentation ## Documentation
N/A Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
User Guide (DRAFT ITA) is available at [Guida al Sistema D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b7/D4science_Guida_al_Sistema_D4GNA_bozza.pdf)
D4GNA Use Case - 3 Phase Lifecycle
<img src="https://gcube.wiki.gcube-system.org/images_gcube/4/46/D4GNA_Workflow_Phases_and_Operations.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Workflow & Phases & Operations" />
## Change log ## Change log

145
pom.xml
View File

@ -7,16 +7,16 @@
<parent> <parent>
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId> <groupId>org.gcube.tools</groupId>
<version>1.1.0</version> <version>1.2.0</version>
<relativePath /> <relativePath />
</parent> </parent>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId> <artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>1.3.0-SNAPSHOT</version> <version>3.3.0</version>
<name>GeoPortal Data Entry App</name> <name>GeoPortal Data Entry App</name>
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description> <description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service</description>
<scm> <scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection> <connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection> <developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
@ -25,12 +25,13 @@
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion> <gwt.version>2.10.0</gwt.version>
<!-- GWT needs at least java 1.6 --> <!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
@ -51,24 +52,66 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>3.6.3-SNAPSHOT</version> <version>${gcube-portal-bom-version}</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<profiles>
<!-- PROD profile -->
<profile>
<id>geoportal-data-entry-app-release-profile</id>
<activation>
<property>
<name>Release</name>
</property>
</activation>
<properties>
<gcube-portal-bom-version>4.0.0</gcube-portal-bom-version>
</properties>
</profile>
<!-- DEV profile -->
<profile>
<id>geoportal-data-entry-app-snapshot-profile</id>
<activation>
<property>
<name>!Release</name>
</property>
</activation>
<properties>
<gcube-portal-bom-version>4.0.0-SNAPSHOT</gcube-portal-bom-version>
</properties>
</profile>
</profiles>
<dependencies> <dependencies>
<!-- needed to compile with gwt > 2.7 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version> <version>${gwt.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId> <artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version> <version>${gwt.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -76,17 +119,42 @@
<artifactId>gwt-bootstrap</artifactId> <artifactId>gwt-bootstrap</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>geoportal-data-viewer-widget</artifactId>
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-mapper</artifactId>
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>metadata-profile-form-builder-widget</artifactId> <artifactId>metadata-profile-form-builder-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>openlayer-basic-widgets</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
<!-- does not remove these exclusions, there are conflict with jackson
2.7 used by geo-json dependency -->
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>de.grundid.opendatalab</groupId>
<artifactId>geojson-jackson</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- FWS --> <!-- FWS -->
<dependency> <dependency>
@ -117,19 +185,29 @@
<dependency> <dependency>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId> <artifactId>geoportal-data-common</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.7.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId> <artifactId>geoportal-client</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version> <version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -174,12 +252,27 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- TESTS -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -187,13 +280,29 @@
update them in DevMode --> update them in DevMode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory> <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.csv</include>
</includes>
</resource>
<!-- <resource> -->
<!-- <directory>src/main/resources</directory> -->
<!-- <includes> -->
<!-- <include>**/*.*</include> -->
<!-- </includes> -->
<!-- </resource> -->
</resources>
<plugins> <plugins>
<!-- GWT Maven Plugin --> <!-- GWT Maven Plugin -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId> <artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version> <version>${gwt.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -13,9 +13,17 @@
<inherits name="com.google.gwt.json.JSON" /> <inherits name="com.google.gwt.json.JSON" />
<inherits <inherits
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' /> name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' /> <inherits
name='org.gcube.application.geoportaldatamapper.GeoportalDataMapper' />
<inherits
name='org.gcube.portlets.widgets.gdvw.geoportal_data_viewer_widget' />
<inherits
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->

View File

@ -1,89 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client;
/**
* The Enum ConcessioniFormCardTitle.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 30, 2020
*/
public enum ConcessioniFormCardTitle {
INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false, null),
ABSTRACT_RELAZIONE_DI_SCAVO("Abstract Relazione di Scavo", "Abstract Relazione di Scavo", 2, false, null),
RELAZIONE_DI_SCAVO("Relazione di Scavo", "Relazione di Scavo", 3, false, null),
IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 4, true, 8),
POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 5, false, null),
PIANTA_DI_FINE_SCAVO("Pianta di Fine Scavo", "Pianta di Fine Scavo", 6, true, null);
private String key;
private String title;
private Integer order;
private boolean internalRepeatibleForm;
private Integer maxFormRepeatability;
/**
* Instantiates a new concessioni form card title.
*
* @param key the key
* @param title the title
* @param order the order
* @param internalRepeatibleForm the internal repeatible form
* @param maxFormRepeatability the max form repeatability
*/
private ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm, Integer maxFormRepeatability) {
this.key = key;
this.title = title;
this.order = order;
this.internalRepeatibleForm = internalRepeatibleForm;
this.maxFormRepeatability = maxFormRepeatability;
}
/**
* Gets the key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets the order.
*
* @return the order
*/
public Integer getOrder() {
return order;
}
/**
* Checks if is internal repeatible form.
*
* @return true, if is internal repeatible form
*/
public boolean isInternalRepeatibleForm() {
return internalRepeatibleForm;
}
/**
* Gets the max form repeatability.
*
* @return the max form repeatability
*/
public Integer getMaxFormRepeatability() {
return maxFormRepeatability;
}
}

View File

@ -1,15 +1,102 @@
package org.gcube.portlets.user.geoportaldataentry.client; package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.Arrays;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder; import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.RootPanel;
/**
* The Class ConstantsGeoPortalDataEntryApp.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 6, 2021
*/
public class ConstantsGeoPortalDataEntryApp { public class ConstantsGeoPortalDataEntryApp {
public static final String DIV_PORTLET_ID = "geoportal-data-entry";
public static final String DIV_LOADERS_ID = "geoportal-loaders";
public static final String GET_PARAMETER_ITEM_TYPE = "git";
public static final String GET_PARAMETER_ITEM_ID = "gid";
public static final String GET_PARAMETER_ACTION = "act";
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT; public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT; public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT;
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR; public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!"; public static final int MAX_COLUMN_DISPLAYED_IN_THE_TABLE = 5;
public static final int PAGINATION_SIZE = 20;
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
public static final String CSS_CLASS_ANIMATE_FADE_IN_OUT = "animate-fadeInOut";
public static final RootPanel ROOT_PANEL_DIV_LOADERS = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID);
public static final RootPanel ROOT_PANEL_DIV_PORTLET = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID);
public static final String CSS_CLASS_GEOPORTAL_LOADERS_CENTER = "geoportal-loaders-center";
public static final String WORKFLOW_ACTION_POST_CREATION_ACTION_ID = "post_creation_action";
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
public static final String SHOW_ON_MAP_NOT_AVAILABLE_IN_DRAFT = "The 'Show on Map' facility is not available in DRAFT phase";
public static final String ALERT_MESSAGE_PROJECT_NOT_EDITABLE = "A Project can only be updated in "
+ WORKFLOW_PHASE.DRAFT.name()
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
public static final String ALERT_MESSAGE_CREATE_RELATION_FORBIDDEN = "The Create Relation operation can be performed only in "
+ WORKFLOW_PHASE.DRAFT.name()
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
public static final String ALERT_MESSAGE_DELETE_RELATION_FORBIDDEN = "The Delete Relation operation can be performed only in "
+ WORKFLOW_PHASE.DRAFT.name()
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
/**
* The Enum ACTION_PERFORMED_ON_ITEM.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 25, 2021
*/
public enum ACTION_PERFORMED_ON_ITEM {
UPDATED_PROJECT
}
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
public static void printUCDs(List<UseCaseDescriptorDV> listUCDescriptors) {
GWT.log("print - UCDs");
for (UseCaseDescriptorDV useCaseDescriptorDV : listUCDescriptors) {
GWT.log("print UCD name: " + useCaseDescriptorDV.getName() + ", profileID: "
+ useCaseDescriptorDV.getProfileID());
for (HandlerDeclarationDV handler : useCaseDescriptorDV.getHandlers()) {
GWT.log("\t print handler getDataHandlerType: " + handler.getDataHandlerType() + ", type: "
+ handler.getType());
}
}
}
} }

View File

@ -0,0 +1,293 @@
package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import com.google.gwt.core.client.GWT;
/**
* The Class GeoPortalClientCaches.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 11, 2022
*/
public class GeoPortalClientCaches {
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
private Map<String, UseCaseDescriptorDV> mapUseCaseDescriptor;
private Map<String, CacheSearchingFilterParametersFromConfig> mapSearchingFilterParametersForProfileId;
private Map<String, List<RelationshipDefinitionDV>> mapRelationsNamesForProfileId;
/**
* Instantiates a new geo portal client caches.
*/
public GeoPortalClientCaches() {
mapGcubeProfilePerItemType = new TreeMap<String, List<GeoNaFormCardModel>>();
mapSearchingFilterParametersForProfileId = new HashMap<String, GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig>();
mapUseCaseDescriptor = new HashMap<String, UseCaseDescriptorDV>();
mapRelationsNamesForProfileId = new HashMap<String, List<RelationshipDefinitionDV>>();
}
/**
* Put list relationships definition for profile ID.
*
* @param profileId the profile id
* @param relationshipDef the relationship def
*/
public void putListRelationshipsDefinitionForProfileID(String profileId,
List<RelationshipDefinitionDV> relationshipDef) {
mapRelationsNamesForProfileId.put(profileId, relationshipDef);
}
/**
* Gets the list relationship definition for profile id.
*
* @param profileId the profile id
* @return the list relationship definition for profile id
*/
public List<RelationshipDefinitionDV> getListRelationshipDefinitionForProfileId(String profileId) {
return mapRelationsNamesForProfileId.get(profileId);
}
/**
* Put UCD for profile id.
*
* @param profileID the profile ID
* @param ucdDV the ucd DV
*/
public void putUCDForProfileId(String profileID, UseCaseDescriptorDV ucdDV) {
mapUseCaseDescriptor.put(profileID, ucdDV);
}
/**
* Gets the UCD for profile ID.
*
* @param profileID the profile ID
* @return the UCD for profile ID
*/
public UseCaseDescriptorDV getUCDForProfileID(String profileID) {
return mapUseCaseDescriptor.get(profileID);
}
/**
* Put gcube profile per item type.
*
* @param itemType the item type
* @param listGcubeProfiles the list gcube profiles
*/
public void putGcubeProfilePerItemType(String itemType, List<GeoNaFormCardModel> listGcubeProfiles) {
mapGcubeProfilePerItemType.put(itemType, listGcubeProfiles);
}
/**
* Gets the gcube profile per item type.
*
* @param itemType the item type
* @return the gcube profile per item type
*/
public List<GeoNaFormCardModel> getGcubeProfilePerItemType(String itemType) {
return mapGcubeProfilePerItemType.get(itemType);
}
/**
* Gets the filter parameters for profile id.
*
* @param profileID the profile ID
* @return the filter parameters for profile id
*/
public CacheSearchingFilterParametersFromConfig getFilterParametersForProfileId(String profileID,
GEOPORTAL_DATA_HANDLER handlerType) {
GWT.log("getFilterParametersForProfileId for: " + profileID);
CacheSearchingFilterParametersFromConfig searchingFilterParameters = mapSearchingFilterParametersForProfileId
.get(profileID);
if (searchingFilterParameters == null) {
searchingFilterParameters = new CacheSearchingFilterParametersFromConfig();
UseCaseDescriptorDV ucd = mapUseCaseDescriptor.get(profileID);
for (HandlerDeclarationDV handler : ucd.getHandlers()) {
if (handler.getDataHandlerType().equals(handlerType)) {
ConfigurationDV<?> configurationDV = handler.getConfiguration();
GWT.log("For profileID " + profileID + " and handler type " + handlerType + ", read config for : "
+ configurationDV);
switch (configurationDV.getConfigurationType()) {
case item_fields: {
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
for (ItemFieldDV itemField : listItemFields) {
if (itemField.isDisplayAsResult()) {
searchingFilterParameters.addDisplayField(itemField);
// adding to projection for filtering
for (String jsonFieldPath : itemField.getJsonFields()) {
// String mongoProjection = itemField.getProjection() + "." + jsonField;
searchingFilterParameters.putMongoProjection(jsonFieldPath, 1);
}
}
if (itemField.isSearchable()) {
searchingFilterParameters.addSearchByField(itemField);
}
if (itemField.isSortable()) {
searchingFilterParameters.addOrderByField(itemField);
}
}
break;
}
default: {
break;
}
}
mapSearchingFilterParametersForProfileId.put(profileID, searchingFilterParameters);
}
}
}
return searchingFilterParameters;
}
// /**
// * Prints the cache handler configurations.
// */
// // DEBUGGING
// public void printCacheHandlerConfigurations() {
// GWT.log("print - mapHandlersConfigurationsForProfileId is:");
// for (String key : mapHandlersConfigurationsForProfileId.keySet()) {
// GWT.log("print - key: " + key + ", value: " + mapHandlersConfigurationsForProfileId.get(key));
// }
// }
/**
* Prints the cache gcube profile per item type.
*/
// DEBUGGING
public void printCacheGcubeProfilePerItemType() {
GWT.log("print - mapGcubeProfilePerItemType is:");
for (String key : mapGcubeProfilePerItemType.keySet()) {
GWT.log("print - key: " + key + ", value: " + mapGcubeProfilePerItemType.get(key));
}
}
/**
* The Class CacheSearchingFilterParametersFromConfig.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2022
*/
public class CacheSearchingFilterParametersFromConfig {
List<ItemFieldDV> displayFields;
List<ItemFieldDV> searchByFields;
List<ItemFieldDV> orderByFields;
// The projection
LinkedHashMap<String, Object> projection;
/**
* Instantiates a new cache searching filter parameters from config.
*/
public CacheSearchingFilterParametersFromConfig() {
displayFields = new ArrayList<ItemFieldDV>();
searchByFields = new ArrayList<ItemFieldDV>();
orderByFields = new ArrayList<ItemFieldDV>();
projection = new LinkedHashMap<String, Object>();
}
/**
* Put mongo projection.
*
* @param keyField the key field
* @param value the value
*/
public void putMongoProjection(String keyField, Object value) {
projection.put(keyField, value);
}
/**
* Adds the display field.
*
* @param itemField the item field
*/
public void addDisplayField(ItemFieldDV itemField) {
displayFields.add(itemField);
}
/**
* Adds the search by field.
*
* @param itemField the item field
*/
public void addSearchByField(ItemFieldDV itemField) {
searchByFields.add(itemField);
}
/**
* Adds the order by field.
*
* @param itemField the item field
*/
public void addOrderByField(ItemFieldDV itemField) {
orderByFields.add(itemField);
}
/**
* Gets the display fields.
*
* @return the display fields
*/
public List<ItemFieldDV> getDisplayFields() {
return displayFields;
}
/**
* Gets the search by fields.
*
* @return the search by fields
*/
public List<ItemFieldDV> getSearchByFields() {
return searchByFields;
}
/**
* Gets the order by fields.
*
* @return the order by fields
*/
public List<ItemFieldDV> getOrderByFields() {
return orderByFields;
}
/**
* Gets the projection.
*
* @return the projection
*/
public LinkedHashMap<String, Object> getProjection() {
return projection;
}
}
}

View File

@ -2,31 +2,265 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List; import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport; import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig; import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.monitoring.MonitoringActionsOnClient;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/** /**
* The client side stub for the RPC service. * The client side stub for the RPC service.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/ */
@RemoteServiceRelativePath("geoportaldataentryservice") @RemoteServiceRelativePath("geoportaldataentryservice")
public interface GeoportalDataEntryService extends RemoteService { public interface GeoportalDataEntryService extends RemoteService {
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception; /**
* Save geona data forms.
*
* @param uuid the uuid
* @param profileID the profile ID
* @param tree_Node the tree node
* @param stepsOnPostCreation the steps on post creation
* @return the commit report
* @throws Exception the exception
*/
void saveGeonaDataForms(String uuid, String profileID, Tree_Node<GeoNaFormDataObject> tree_Node,
List<String> stepsOnPostCreation) throws Exception;
GeonaISConfig getGeonaInitConfig(); /**
* Gets the geona init config.
*
* @return the geona init config
*/
GeoportalISConfig getGeonaInitConfig();
/** /**
* Gets the links for. * Gets the links for.
* *
* @param itemId the item id * @param itemId the item id is the mongoId
* @param recordType the record type * @param profileID the profile ID
* @param shareLinkTo the share link to
* @return the links for * @return the links for
* @throws Exception the exception * @throws Exception the exception
*/ */
GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception; GeoportalItemReferences getLinksFor(String itemId, String profileID, SHARE_LINK_TO shareLinkTo) throws Exception;
/**
* Gets the list projects.
*
* @param theProfileID the the profile ID
* @param start the start
* @param limit the limit
* @param filter the filter
* @param reloadFromService the reload from service
* @return the list projects
* @throws Exception the exception
*/
public ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit,
SearchingFilter filter, boolean reloadFromService) throws Exception;
/**
* Gets the JSON record.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the JSON record
* @throws Exception the exception
*/
String getJSONDocumentInTheProject(String profileID, String projectID) throws Exception;
/**
* Update record.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param jsonUpdate the json update
* @return the project DV
* @throws Exception the exception
*/
ProjectDV updateRecord(String profileID, String projectID, String jsonUpdate) throws Exception;
/**
* Read data viewer config.
*
* @return the GNA data entry ext config profile
* @throws Exception the exception
*/
GNADataEntryExtendedConfigProfile readDataEntryPresentationConfig() throws Exception;
/**
* Gets the list use case descriptors.
*
* @param handlersIds the handlers ids
* @return the list use case descriptors
* @throws Exception the exception
*/
List<UseCaseDescriptorDV> getListUseCaseDescriptors(List<String> handlersIds) throws Exception;
/**
* Gets the lifecycle info for project id.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the lifecycle info for project id
* @throws Exception the exception
*/
LifecycleInformationDV getLifecycleInfoForProjectId(String profileID, String projectID) throws Exception;
/**
* Delete project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return true, if successful
* @throws Exception the exception
*/
boolean deleteProject(String profileID, String projectID) throws Exception;
/**
* Perform action steps.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param optionalMessage the optional message
* @param action the action
* @return the project DV
* @throws Exception the exception
*/
StepPerformedResultDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) throws Exception;
/**
* Gets the relationships definition.
*
* @param profileID the profile ID
* @return the relationships definition
* @throws Exception the exception
*/
List<RelationshipDefinitionDV> getRelationshipsDefinition(String profileID) throws Exception;
/**
* Creates the relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipID the relationship ID
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws Exception the exception
*/
void createRelationship(String fromProfileID, String fromProjectID, String relationshipID, String toProfileID,
String toProjectID) throws Exception;
/**
* Gets the project by ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project by ID
* @throws Exception the exception
*/
ProjectDV getProjectByID(String profileID, String projectID) throws Exception;
/**
* Gets the result document fo project by ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the result document fo project by ID
* @throws Exception the exception
*/
ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception;
/**
* Delete relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param id the id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @return the result document DV
* @throws Exception the exception
*/
ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
String toProjectID) throws Exception;
/**
* Temporal reference for project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the temporal reference DV
*/
TemporalReferenceDV temporalReferenceForProject(String profileID, String projectID);
/**
* Gets the project edit.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project edit
* @throws Exception the exception
*/
ProjectEdit getProjectEdit(String profileID, String projectID) throws Exception;
/**
* Update geportal data form.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param section the section
* @param sectionPath the section path
* @param listFilePaths the list file paths
* @return the commit report
* @throws Exception the exception
*/
CommitReport updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
String sectionPath, List<FilePathDV> listFilePaths) throws Exception;
/**
* Gets the project view.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view
* @throws Exception the exception
*/
ProjectView getProjectView(String profileID, String projectID) throws Exception;
/**
* Gets the saving project monitor status.
*
* @param monitorUUID the monitor UUID
* @param isMonitoringTerminatedClientConsumed the is monitoring terminated client consumed
* @return the saving project monitor status
* @throws Exception the exception
*/
MonitoringActionsOnClient getSavingProjectMonitorStatus(String monitorUUID,
boolean isMonitoringTerminatedClientConsumed) throws Exception;
} }

View File

@ -2,45 +2,107 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List; import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport; import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig; import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.monitoring.MonitoringActionsOnClient;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
public interface GeoportalDataEntryServiceAsync /**
{ * The Interface GeoportalDataEntryServiceAsync.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 1, 2022
*/
public interface GeoportalDataEntryServiceAsync {
/** /**
* Utility class to get the RPC Async interface from client-side code * Utility class to get the RPC Async interface from client-side code
*/ */
public static final class Util public static final class Util {
{
private static GeoportalDataEntryServiceAsync instance; private static GeoportalDataEntryServiceAsync instance;
public static final GeoportalDataEntryServiceAsync getInstance() public static final GeoportalDataEntryServiceAsync getInstance() {
{ if (instance == null) {
if ( instance == null )
{
instance = (GeoportalDataEntryServiceAsync) GWT.create(GeoportalDataEntryService.class); instance = (GeoportalDataEntryServiceAsync) GWT.create(GeoportalDataEntryService.class);
} }
return instance; return instance;
} }
private Util() private Util() {
{
// Utility class should not be instantiated // Utility class should not be instantiated
} }
} }
void saveGeonaDataForms(String uuid, String profileID, Tree_Node<GeoNaFormDataObject> tree_Node,
List<String> stepsOnPostCreation, AsyncCallback<Void> callback);
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback); void updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
String sectionPath, List<FilePathDV> listFilePaths, AsyncCallback<CommitReport> callback);
void getGeonaInitConfig(AsyncCallback<GeoportalISConfig> callback);
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback); void getLinksFor(String itemId, String profileID, SHARE_LINK_TO shareLinkTo,
AsyncCallback<GeoportalItemReferences> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
void deleteProject(String profileID, String projectID, AsyncCallback<Boolean> callback);
void getJSONDocumentInTheProject(String profileID, String projectID, AsyncCallback<String> callback);
void updateRecord(String profileID, String projectID, String jsonUpdate, AsyncCallback<ProjectDV> callback);
void readDataEntryPresentationConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);
void getLifecycleInfoForProjectId(String profileID, String projectID,
AsyncCallback<LifecycleInformationDV> callback);
void performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action,
AsyncCallback<StepPerformedResultDV> callback);
void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback);
void createRelationship(String fromProfileID, String fromProjectID, String relationshipID, String toProfileID,
String toProjectID, AsyncCallback<Void> callback);
void getProjectByID(String profileID, String projectID, AsyncCallback<ProjectDV> callback);
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> callback);
void deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
String toProjectID, AsyncCallback<ResultDocumentDV> asyncCallback);
void temporalReferenceForProject(String profileID, String projectID, AsyncCallback<TemporalReferenceDV> callback);
void getProjectEdit(String profileID, String projectID, AsyncCallback<ProjectEdit> callback);
void getProjectView(String profileID, String projectID, AsyncCallback<ProjectView> callback);
void getSavingProjectMonitorStatus(String monitorUUID, boolean isMonitoringTerminatedClientConsumed,
AsyncCallback<MonitoringActionsOnClient> callback);
void getLinksFor(Long itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
} }

View File

@ -0,0 +1,43 @@
package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.LinkedHashMap;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
public class InitExecutor {
private LinkedHashMap<Integer, Command> queueInitStage = new LinkedHashMap<>();
public InitExecutor() {
}
public synchronized void putCommand(Command command) throws InterruptedException {
queueInitStage.put(queueInitStage.size(), command);
}
private synchronized Command pollCommand() throws InterruptedException {
for (Integer key : queueInitStage.keySet()) {
Command command = queueInitStage.get(key);
if(command!=null) {
queueInitStage.put(key, null);
return command;
}
}
return null;
}
protected void execute() {
try {
Command command = pollCommand();
if (command != null)
command.execute();
} catch (InterruptedException e) {
Window.alert("An error occurred while initializing the application. Please contact the support. Error is: "
+ e.getMessage());
}
}
}

View File

@ -0,0 +1,123 @@
package org.gcube.portlets.user.geoportaldataentry.client;
/**
* The Class ProjectFormCard.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 4, 2022
*/
public class ProjectFormCard {
private String key;
private String title; //is the profile title (read from geoportal config)
private Integer order;
private boolean internalRepeatibleForm;
private Integer maxFormRepeatability;
private Integer minFormRepeatability;
/**
* Instantiates a new project form card.
*
* @param key the key
* @param title the title
* @param order the order
* @param internalRepeatibleForm the internal repeatible form
* @param minFormRepeatability the min form repeatability
* @param maxFormRepeatability the max form repeatability
*/
public ProjectFormCard(String key, String title, int order, boolean internalRepeatibleForm,
Integer minFormRepeatability, Integer maxFormRepeatability) {
this.key = key;
this.title = title;
this.order = order;
this.internalRepeatibleForm = internalRepeatibleForm;
this.minFormRepeatability = minFormRepeatability;
this.maxFormRepeatability = maxFormRepeatability;
}
/**
* Gets the key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets the order.
*
* @return the order
*/
public Integer getOrder() {
return order;
}
/**
* Checks if is internal repeatible form.
*
* @return true, if is internal repeatible form
*/
public boolean isInternalRepeatibleForm() {
return internalRepeatibleForm;
}
/**
* Gets the max form repeatability.
*
* @return the max form repeatability
*/
public Integer getMaxFormRepeatability() {
return maxFormRepeatability;
}
/**
* Gets the min form repeatability.
*
* @return the min form repeatability
*/
public Integer getMinFormRepeatability() {
return minFormRepeatability;
}
/**
* Sets the min form repeatability.
*
* @param minFormRepeatability the new min form repeatability
*/
public void setMinFormRepeatability(Integer minFormRepeatability) {
this.minFormRepeatability = minFormRepeatability;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectFormCard [key=");
builder.append(key);
builder.append(", title=");
builder.append(title);
builder.append(", order=");
builder.append(order);
builder.append(", internalRepeatibleForm=");
builder.append(internalRepeatibleForm);
builder.append(", maxFormRepeatability=");
builder.append(maxFormRepeatability);
builder.append(", minFormRepeatability=");
builder.append(minFormRepeatability);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,68 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ClickItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 22, 2021
* @param <T> the generic type
*/
public class ClickItemEvent<T> extends GwtEvent<ClickItemEventHandler> {
public static Type<ClickItemEventHandler> TYPE = new Type<ClickItemEventHandler>();
private List<T> selectItems;
/**
* Instantiates a new click item event.
*
* @param selectItems the select items
*/
public ClickItemEvent(List<T> selectItems) {
this.selectItems = selectItems;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<ClickItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(ClickItemEventHandler handler) {
handler.onClick(this);
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ClickItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public interface ClickItemEventHandler extends EventHandler {
/**
* On click.
*
* @param <T> the generic type
* @param moreInfoShowEvent the more info show event
*/
<T> void onClick(ClickItemEvent<T> moreInfoShowEvent);
}

View File

@ -0,0 +1,50 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class CloseCreateRelationGUIEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 19, 2022
*/
public class CloseCreateRelationGUIEvent extends GwtEvent<CloseCreateRelationGUIEventHandler> {
public static Type<CloseCreateRelationGUIEventHandler> TYPE = new Type<CloseCreateRelationGUIEventHandler>();
/**
* Instantiates a new close create relation GUI.
*/
public CloseCreateRelationGUIEvent() {
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<CloseCreateRelationGUIEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(CloseCreateRelationGUIEventHandler handler) {
handler.onClose(this);
}
}

View File

@ -0,0 +1,22 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface CloseCreateRelationGUIEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 19, 2022
*/
public interface CloseCreateRelationGUIEventHandler extends EventHandler {
/**
* On close.
*
* @param closeCreateRelationGUI the close create relation GUI
*/
void onClose(CloseCreateRelationGUIEvent closeCreateRelationGUI);
}

View File

@ -1,25 +1,40 @@
package org.gcube.portlets.user.geoportaldataentry.client.events; package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
// TODO: Auto-generated Javadoc
/** /**
* The Class CreateNewProjectEvent. * The Class CreateNewProjectEvent.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Oct 13, 2020 * Mar 17, 2022
*/ */
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> { public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
/** The type. */ /** The type. */
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>(); public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
private HandlerDeclarationDV handler;
private List<GcubeProfileDV> listGcubeProfiles;
private String profileID;
/** /**
* Instantiates a new cancel upload event. * Instantiates a new creates the new project event.
*
* @param handler the handler
* @param listGcubeProfiles the list gcube profiles
*/ */
public CreateNewProjectEvent() { // (passing this second argument in order to avoid twice the casting as
// List<GcubeProfileDV>)
public CreateNewProjectEvent(String profileID, HandlerDeclarationDV handler,
List<GcubeProfileDV> listGcubeProfiles) {
this.profileID = profileID;
this.handler = handler;
this.listGcubeProfiles = listGcubeProfiles;
} }
/** /**
@ -27,7 +42,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
* *
* @return the associated type * @return the associated type
*/ */
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/ */
@Override @Override
@ -40,12 +57,33 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
* *
* @param handler the handler * @param handler the handler
*/ */
/* (non-Javadoc) /*
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) * (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/ */
@Override @Override
protected void dispatch(CreateNewProjectEventHandler handler) { protected void dispatch(CreateNewProjectEventHandler handler) {
handler.onCreateNewProject(this); handler.onCreateNewProject(this);
} }
public HandlerDeclarationDV getHandler() {
return handler;
}
/**
* Gets the list gcube profiles.
*
* @return the list gcube profiles
*/
public List<GcubeProfileDV> getListGcubeProfiles() {
return listGcubeProfiles;
}
public String getProfileID() {
return profileID;
}
} }

View File

@ -0,0 +1,125 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class CreateNewProjectEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
/** The type. */
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
private SearchingFilter searchingFilter;
private String profileID;
private String projectName;
private Boolean reloadFilteringParameters = false;
private boolean onApplicationInit = false;
/**
* Instantiates a new gets the list of records event.
*
* @param onApplicationInit the on application init
* @param profileID the profile ID
* @param searchingFilter the searching filter
* @param reloadFilteringParameters the reload filtering parameters
*/
public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter searchingFilter,
Boolean reloadFilteringParameters) {
this.onApplicationInit = onApplicationInit;
this.searchingFilter = searchingFilter;
this.profileID = profileID;
this.reloadFilteringParameters = reloadFilteringParameters;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<GetListOfRecordsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(GetListOfRecordsEventHandler handler) {
handler.onGetList(this);
}
/**
* Gets the searching filter.
*
* @return the searching filter
*/
public SearchingFilter getSearchingFilter() {
return searchingFilter;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Checks if is on application init.
*
* @return true, if is on application init
*/
public boolean isOnApplicationInit() {
return onApplicationInit;
}
/**
* Gets the reload filtering parameters.
*
* @return the reload filtering parameters
*/
public boolean isReloadFilteringParameters() {
return reloadFilteringParameters;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GetListOfRecordsEvent [searchingFilter=");
builder.append(searchingFilter);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectName=");
builder.append(projectName);
builder.append(", reloadFilteringParameters=");
builder.append(reloadFilteringParameters);
builder.append(", onApplicationInit=");
builder.append(onApplicationInit);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,22 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface GetListOfRecordsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/
public interface GetListOfRecordsEventHandler extends EventHandler {
/**
* On get list.
*
* @param getListOfRecordsEvent the get list of records event
*/
void onGetList(GetListOfRecordsEvent getListOfRecordsEvent);
}

View File

@ -0,0 +1,111 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.Element;
/**
* The Class OperationOnItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2021
* @param <T> the generic type
*/
public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<OperationOnItemEventHandler> {
public static Type<OperationOnItemEventHandler> TYPE = new Type<OperationOnItemEventHandler>();
private List<T> selectItems;
private OPERATION_ON_ITEM action;
private Element sourceElement;
private String ucdName;
/**
* Instantiates a new action on item event.
*
* @param selectItems the select items
* @param doAction the do action
* @param profileID the profile ID
*/
public OperationOnItemEvent(List<T> selectItems, OPERATION_ON_ITEM doAction) {
this.selectItems = selectItems;
this.action = doAction;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<OperationOnItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(OperationOnItemEventHandler handler) {
handler.onDoActionFired(this);
}
public String getUcdName() {
return ucdName;
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
/**
* Gets the action.
*
* @return the action
*/
public OPERATION_ON_ITEM getAction() {
return action;
}
public void setSourceElement(Element element) {
this.sourceElement = element;
}
public Element getSourceElement() {
return sourceElement;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OperationOnItemEvent [selectItems=");
builder.append(selectItems);
builder.append(", action=");
builder.append(action);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface OperationOnItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 5, 2021
*/
public interface OperationOnItemEventHandler extends EventHandler {
/**
* On do action fired.
*
* @param <T> the generic type
* @param showItemEvent the show item event
*/
<T extends DocumentDV> void onDoActionFired(OperationOnItemEvent<T> showItemEvent);
}

View File

@ -0,0 +1,90 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class OperationOnItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2021
* @param <T> the generic type
*/
public class OperationPerformedOnItemEvent<T extends DocumentDV> extends GwtEvent<OperationPerformedOnItemEventHandler> {
public static Type<OperationPerformedOnItemEventHandler> TYPE = new Type<OperationPerformedOnItemEventHandler>();
private List<T> selectItems;
private ACTION_PERFORMED_ON_ITEM action;
private String profileID;
/**
* Instantiates a new action performed on item event.
*
* @param selectItems the select items
* @param doAction the do action
*/
public OperationPerformedOnItemEvent(String profileID, List<T> selectItems, ACTION_PERFORMED_ON_ITEM doAction) {
this.profileID = profileID;
this.selectItems = selectItems;
this.action = doAction;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<OperationPerformedOnItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(OperationPerformedOnItemEventHandler handler) {
handler.onDoActionPerformedFired(this);
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
/**
* Gets the action.
*
* @return the action
*/
public ACTION_PERFORMED_ON_ITEM getAction() {
return action;
}
public String getProfileID() {
return profileID;
}
}

View File

@ -0,0 +1,24 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface OperationPerformedOnItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 25, 2021
*/
public interface OperationPerformedOnItemEventHandler extends EventHandler {
/**
* On do action performed fired.
* @param <T>
*
* @param actionPerformedOnItemEvent the action performed on item event
*/
<T extends DocumentDV> void onDoActionPerformedFired(OperationPerformedOnItemEvent<T> actionPerformedOnItemEvent);
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface RelationActionHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 5, 2022
*/
public interface RelationActionHandler extends EventHandler {
/**
* On create relation.
*
* @param createRelationHandlerEvent the create relation handler event
*/
void onCreateRelation(RelationActionHandlerEvent createRelationHandlerEvent);
}

View File

@ -0,0 +1,142 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class RelationActionHandlerEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 5, 2022
*/
public class RelationActionHandlerEvent extends GwtEvent<RelationActionHandler> {
/** The type. */
public static Type<RelationActionHandler> TYPE = new Type<RelationActionHandler>();
private ResultDocumentDV fromProject;
private RelationshipDefinitionDV relationSelected;
private ResultDocumentDV toProject;
private RELACTION_ACTION_TYPE relactionActionType;
private String relationName;
/**
* The Enum RELACTION_ACTION_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 5, 2022
*/
public static enum RELACTION_ACTION_TYPE {
CREATE, DELETE
}
/**
* Instantiates a new relation action handler event.
*
* @param fromProject the from project
* @param relationSelected the relation selected
* @param toProject the to project
*/
public RelationActionHandlerEvent(ResultDocumentDV fromProject, RelationshipDefinitionDV relationSelected,
ResultDocumentDV toProject) {
this.fromProject = fromProject;
this.relationSelected = relationSelected;
this.toProject = toProject;
this.relactionActionType = RELACTION_ACTION_TYPE.CREATE;
}
/**
* Instantiates a new relation action handler event.
*
* @param fromProject the from project
* @param relationName the relation name
* @param toProject the to project
*/
public RelationActionHandlerEvent(ResultDocumentDV fromProject, String relationName, ResultDocumentDV toProject) {
this.fromProject = fromProject;
this.toProject = toProject;
this.relationName = relationName;
this.relactionActionType = RELACTION_ACTION_TYPE.DELETE;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<RelationActionHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(RelationActionHandler handler) {
handler.onCreateRelation(this);
}
/**
* Gets the from project.
*
* @return the from project
*/
public ResultDocumentDV getFromProject() {
return fromProject;
}
/**
* Gets the relation selected.
*
* @return the relation selected
*/
public RelationshipDefinitionDV getRelationSelected() {
return relationSelected;
}
/**
* Gets the to project.
*
* @return the to project
*/
public ResultDocumentDV getToProject() {
return toProject;
}
/**
* Gets the relaction action type.
*
* @return the relaction action type
*/
public RELACTION_ACTION_TYPE getRelactionActionType() {
return relactionActionType;
}
/**
* Gets the relation name.
*
* @return the relation name
*/
public String getRelationName() {
return relationName;
}
}

View File

@ -1,8 +1,7 @@
package org.gcube.portlets.user.geoportaldataentry.client.events; package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
@ -18,16 +17,18 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
/** The type. */ /** The type. */
public static Type<SaveGeonaDataFormsHandler> TYPE = new Type<SaveGeonaDataFormsHandler>(); public static Type<SaveGeonaDataFormsHandler> TYPE = new Type<SaveGeonaDataFormsHandler>();
private List<GeoNaFormDataObject> listGeonaDataForms; private Tree_Node<GeoNaFormDataObject> treeNode;
private String profileID;
/** /**
* Instantiates a new save geona data forms event. * Instantiates a new save geona data forms event.
* *
* @param listGeonaDataForms the list geona data forms * @param profileID the profile ID
* @param treeNode the tree node
*/ */
public SaveGeonaDataFormsEvent(List<GeoNaFormDataObject> listGeonaDataForms) { public SaveGeonaDataFormsEvent(String profileID, Tree_Node<GeoNaFormDataObject> treeNode) {
this.listGeonaDataForms = listGeonaDataForms; this.treeNode = treeNode;
this.profileID = profileID;
} }
/** /**
@ -35,7 +36,9 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
* *
* @return the associated type * @return the associated type
*/ */
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/ */
@Override @Override
@ -48,16 +51,29 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
* *
* @param handler the handler * @param handler the handler
*/ */
/* (non-Javadoc) /*
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) * (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/ */
@Override @Override
protected void dispatch(SaveGeonaDataFormsHandler handler) { protected void dispatch(SaveGeonaDataFormsHandler handler) {
handler.onSave(this); handler.onSave(this);
} }
public List<GeoNaFormDataObject> getListGeonaDataForms() { public Tree_Node<GeoNaFormDataObject> getTreeNode() {
return listGeonaDataForms; return treeNode;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
} }
} }

View File

@ -0,0 +1,101 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.ui.TreeItem;
/**
* The Class TreeItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 4, 2022
* @param <T> the generic type
*/
public class TreeItemEvent extends GwtEvent<TreeItemEventHandler> {
public static Type<TreeItemEventHandler> TYPE = new Type<TreeItemEventHandler>();
private TreeItem treeItem;
private ACTION actionPerformed;
/**
* The Enum ACTION.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 4, 2022
*/
public enum ACTION {
SELECTED, DELETE, DUPLICATE
}
/**
* Instantiates a new click item event.
*
* @param selectItems the select items
* @param action the action
*/
public TreeItemEvent(TreeItem treeItem, ACTION action) {
this.treeItem = treeItem;
this.actionPerformed = action;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<TreeItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(TreeItemEventHandler handler) {
handler.onTreeItemEvent(this);
}
/**
* Gets the select items.
*
* @return the select items
*/
public TreeItem getSelectItem() {
return treeItem;
}
public NodeItem selectedAsNodeItem(){
if(treeItem!=null) {
return (NodeItem) treeItem.getWidget();
}
return null;
}
/**
* Gets the action performed.
*
* @return the action performed
*/
public ACTION getActionPerformed() {
return actionPerformed;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface TreeItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 4, 2022
*/
public interface TreeItemEventHandler extends EventHandler {
/**
* On tree item event.
*
* @param treeItemEvent the tree item event
*/
void onTreeItemEvent(TreeItemEvent treeItemEvent);
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import com.google.gwt.event.shared.GwtEvent;
public class WorkflowActionOnSelectedItemEvent<T extends DocumentDV> extends GwtEvent<WorkflowActionOnSelectedItemEventHandler> {
public static Type<WorkflowActionOnSelectedItemEventHandler> TYPE = new Type<WorkflowActionOnSelectedItemEventHandler>();
private ActionDefinitionDV action;
public WorkflowActionOnSelectedItemEvent(ActionDefinitionDV doAction) {
this.action = doAction;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<WorkflowActionOnSelectedItemEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
protected void dispatch(WorkflowActionOnSelectedItemEventHandler handler) {
handler.onDoActionFired(this);
}
/**
* Gets the action.
*
* @return the action
*/
public ActionDefinitionDV getAction() {
return action;
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface WorkflowActionOnSelectedItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2022
*/
public interface WorkflowActionOnSelectedItemEventHandler extends EventHandler {
/**
* On do action fired.
*
* @param <T> the generic type
* @param workflowActionOnItemEvent the workflow action on item event
*/
<T extends DocumentDV> void onDoActionFired(WorkflowActionOnSelectedItemEvent<T> workflowActionOnItemEvent);
}

View File

@ -0,0 +1,110 @@
@def selectionBorderWidth 1px ; .cellTableWidget {
}
.cellTableFirstColumn {
}
.cellTableLastColumn {
}
.cellTableFooter {
}
.cellTableHeader {
}
.cellTableCell {
}
.cellTableFirstColumnFooter {
}
.cellTableFirstColumnHeader {
}
.cellTableLastColumnFooter {
}
.cellTableLastColumnHeader {
}
.cellTableSortableHeader {
}
.cellTableSortableHeader:hover {
}
.cellTableSortedHeaderAscending {
}
.cellTableSortedHeaderDescending {
}
.cellTableEvenRow {
}
.cellTableEvenRowCell {
}
.cellTableOddRow {
}
.cellTableOddRowCell {
}
.cellTableHoveredRow {
background: #D9EDF7 !important;
cursor: pointer;
}
.cellTableHoveredRowCell {
background: #D9EDF7 !important;
cursor: pointer;
}
.cellTableKeyboardSelectedRow, .cellTableKeyboardSelectedRow td, .cellTableKeyboardSelectedRow th {
background: #3A87AD !important;
}
.cellTableSelectedRow, .cellTableSelectedRow td, .cellTableSelectedRow th
{
/* background: #D9EDF7 !important; */
/* color: white !important; */
/* height: auto; */
/* overflow: auto; */
}
.cellTableSelectedRowCell, .cellTableSelectedRow td.cellTableSelectedRowCell {
background: #3A87AD !important;
}
.cellTableKeyboardSelectedRowCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedRowCell{
background: #3A87AD !important;
}
.cellTableKeyboardSelectedCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedCell{
background: #3A87AD !important;
color: white !important;
}
.cellTableLoading {
margin: 30px;
}

View File

@ -0,0 +1,23 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.resource;
import com.github.gwtbootstrap.client.ui.CellTable;
import com.github.gwtbootstrap.client.ui.CellTable.Resources;
import com.google.gwt.core.shared.GWT;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 23, 2015
*/
public interface CellTableResources extends Resources {
public CellTableResources INSTANCE = GWT.create(CellTableResources.class);
// The styles used in this widget.
@Override
@Source("CellTable.css")
CellTable.Style cellTableStyle();
}

View File

@ -10,4 +10,16 @@ public interface Images extends ClientBundle {
@Source("loading.gif") @Source("loading.gif")
ImageResource loading(); ImageResource loading();
@Source("access_denied.png")
ImageResource accessDenied();
@Source("one-finger-icon.png")
ImageResource oneFingerIcon();
@Source("information_icon.png")
ImageResource info();
@Source("warning_error.png")
ImageResource warningError();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,179 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.MetadataFormCard;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.TabPanel;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class GeonaDataEntryMainForm extends Composite {
private static GeonaDataEntryMainFormUiBinder uiBinder = GWT.create(GeonaDataEntryMainFormUiBinder.class);
interface GeonaDataEntryMainFormUiBinder extends UiBinder<Widget, GeonaDataEntryMainForm> {
}
private List<GeoNaFormCardModel> listCards = new ArrayList<GeoNaFormCardModel>();
@UiField
HTMLPanel mainHTMLPanel;
@UiField
TabPanel mainTabPanel;
@UiField
AlertBlock alertFormAction;
@UiField
Button buttonSave;
private LinkedHashMap<String,MetadataFormCard> mapForms = new LinkedHashMap<String,MetadataFormCard>();
private List<Tab> listTabs = new ArrayList<Tab>();
private HandlerManager appManagerBus;
public GeonaDataEntryMainForm(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
}
public void addForm(String tabHeading, GeoNaFormCardModel geonFormModel){
listCards.add(geonFormModel);
createNewCard(tabHeading, geonFormModel);
}
private void createNewCard(String tabHeading, final GeoNaFormCardModel geonFormModel){
final Tab tab = new Tab();
tab.setHeading(tabHeading);
//MetadataFormCard mfc = new MetadataFormCard(tab, createMetadataForm, repeatible);
MetadataFormCard mfc = new MetadataFormCard(tab,geonFormModel,appManagerBus);
listTabs.add(tab);
mainTabPanel.add(tab);
if(listTabs.size()==1) {
tab.setActive(true);
mainTabPanel.selectTab(0);
}
mapForms.put(tabHeading, mfc);
}
public void reset() {
mapForms.clear();
mainTabPanel.clear();
listTabs.clear();
}
public void selectTab(int index){
GWT.log("Selecting tab index: "+ index +" of "+listTabs.size());
if(listTabs.size()<index) {
mainTabPanel.selectTab(index);
}
}
@UiHandler("buttonSave")
void saveData(ClickEvent e){
boolean canSave = true;
for (String metadataType : mapForms.keySet()) {
MetadataFormCard card = mapForms.get(metadataType);
boolean isValid = card.validateForm();
card.setValidCard(isValid);
if(isValid==false)
canSave = false;
}
List<GeoNaFormDataObject> listGeonaFormObjects = new ArrayList<GeoNaFormDataObject>();
if(canSave) {
for (String metadataType : mapForms.keySet()) {
MetadataFormCard card = mapForms.get(metadataType);
List<GenericDatasetBean> listGDB = new ArrayList<GenericDatasetBean>(card.getListForms().size());
for (CreateMetadataForm form : card.getListForms()) {
listGDB.add(form.getFormDataBean());
}
listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getFormCardTitle()));
}
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(listGeonaFormObjects));
}else {
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
}
//Window.alert("I can save: "+listGeonaFormObjects);
}
public void showAlertOnSaveAction(String text, AlertType type, boolean hideAfterAWhile){
//Window.alert("Called alertOnCreate");
alertFormAction.setText(text);
alertFormAction.setType(type);
alertFormAction.setVisible(true);
//goBackButtonSecondStep.setEnabled(true);
if(hideAfterAWhile){
// hide after some seconds
Timer t = new Timer() {
@Override
public void run() {
alertFormAction.setVisible(false);
}
};
t.schedule(10000);
}
}
public void enableButtonSave(boolean enabled) {
buttonSave.setEnabled(enabled);
}
/**
* Sets the ative after.
*
* @param index the index
* @param bool the bool
*/
public void setAtiveAfter(int index, boolean bool){
// if(listTabs.size()<index) {
// for (int i = index; i < listTabs.size(); i++) {
// listTabs.get(i).setEnabled(bool);
// }
// }
}
}

View File

@ -1,19 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<b:TabPanel ui:field="mainTabPanel" tabPosition="left">
</b:TabPanel>
<b:AlertBlock type="DEFAULT" visible="false" close="false" ui:field="alertFormAction"></b:AlertBlock>
<b:FormActions>
<b:Button type="PRIMARY" icon="SAVE" ui:field="buttonSave">Save</b:Button>
</b:FormActions>
<!-- </b:AlertBlock> -->
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,80 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
// TODO: Auto-generated Javadoc
/**
* The Class GeonaMainPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class GeonaMainPanel extends Composite {
/** The geona main form panel. */
@UiField
HTMLPanel geonaMainFormPanel;
/** The loader. */
@UiField
LoaderIcon loader;
@UiField
GeonaNavigationBar geonaNavigationBar;
private HandlerManager appManagerBus;
/** The ui binder. */
private static GeonaMainPanelUiBinder uiBinder = GWT.create(GeonaMainPanelUiBinder.class);
/**
* The Interface GeonaMainPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
interface GeonaMainPanelUiBinder extends UiBinder<Widget, GeonaMainPanel> {
}
/**
* Instantiates a new geona main panel.
* @param appManagerBus
*/
public GeonaMainPanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
geonaNavigationBar.setAppManagerBus(appManagerBus);
}
/**
* Adds the form panel.
*
* @param formPanel the form panel
*/
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
geonaMainFormPanel.add(formPanel);
}
/**
* Sets the loader visible.
*
* @param txtHTML the txt HTML
* @param visible the visible
*/
public void setLoaderVisible(String txtHTML, boolean visible){
loader.setText(txtHTML);
loader.setVisible(visible);
}
}

View File

@ -1,27 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:m="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui"
xmlns:r="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui.utils">
<ui:style>
.important {
font-weight: bold;
}
.custom-page-header {
padding: 10px;
background-color: #f5f5f5;
margin-bottom: 10px;
border: 1px solid #eee;
}
</ui:style>
<g:HTMLPanel ui:field="geonaMainPanel">
<b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
<m:GeonaNavigationBar ui:field="geonaNavigationBar"></m:GeonaNavigationBar>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,725 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.guipresentation.BodyWelcome;
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
import org.gcube.application.geoportalcommon.shared.guipresentation.Header;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectTablePanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectWorkflowActionsPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.CreateRelationProjectsPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.ViewRelationshipPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DEFAULT_DISPLAYING_COLUMN_NAME;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.UCD_Util;
import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.Hero;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.TabPanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class GeonaMainTabPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
public class GeonaMainTabPanel extends Composite {
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
/**
* The Interface GeonaMainTabPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
interface GeonaMainTabPanelUiBinder extends UiBinder<Widget, GeonaMainTabPanel> {
}
/** The geona main form panel. */
@UiField
HTMLPanel geonaMainFormPanel;
/** The geona main form panel. */
@UiField
HTMLPanel contTabNewProject;
/** The loader. */
@UiField
LoaderIcon loader;
@UiField
TabPanel tabPanel;
@UiField
Tab tabNewProject;
@UiField
Tab tabGetListOfProjects;
@UiField
NavLink navViewAsDocument;
@UiField
NavLink navViewAsJSON;
@UiField
NavLink navShowOnMap;
@UiField
NavLink navShareLink;
@UiField
NavLink navShowReport;
@UiField
NavLink navEditMode;
@UiField
NavLink navDelete;
@UiField
NavLink navCreateRelation;
@UiField
NavLink navViewRelations;
@UiField
Label roleLabel;
@UiField
Dropdown ddCreateNewProject;
@UiField
PageHeader pageHeaderDataEntry;
@UiField
Hero introGNAHero;
@UiField
DockLayoutPanel theDockLayoutPanel;
@UiField
PageHeader pageHeader;
@UiField
Heading welcomeTitle;
@UiField
Paragraph welcomeDescription;
private HandlerManager appManagerBus;
private GeonaRecordsPaginatedView grpw = null;
private List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView = new ArrayList<UseCaseDescriptorDV>();
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
private GcubeUserRole userRole;
private CreateRelationProjectsPanel createRelationProjectsPanel;
private ViewRelationshipPanel viewRelationshipPanel;
private ScrollPanel detailsPanel = new ScrollPanel();
private ListOfProjectTablePanel listOfProjectTablePanel;
private ListOfProjectWorkflowActionsPanel listOfProjectWorkflowActionsPanel;
private DataEntryGUIPresentationConfig dataGUIPresentation;
private Map<String, String[]> mapProfileIdForPostCreationActionSteps = new HashMap<String, String[]>();
/**
* Instantiates a new geona main tab panel.
*
* @param appManagerBus the app manager bus
*/
public GeonaMainTabPanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
bindEvents();
listOfProjectWorkflowActionsPanel = new ListOfProjectWorkflowActionsPanel(appManagerBus);
// listOfProjectWorkflowActionsPanel.setHeight("40px");
theDockLayoutPanel.addNorth(listOfProjectWorkflowActionsPanel, 40);
theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, true);
detailsPanel.addStyleName("theDetailsPanel");
theDockLayoutPanel.addEast(detailsPanel, 450);
theDockLayoutPanel.setWidgetHidden(detailsPanel, true);
listOfProjectTablePanel = new ListOfProjectTablePanel(appManagerBus);
listOfProjectWorkflowActionsPanel.setHeight("100%");
theDockLayoutPanel.add(listOfProjectTablePanel);
setLoaderVisible("", false);
}
/**
* Sets the filtering parameters.
*
* @param sfp the sfp
*/
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
GWT.log("setFilteringParameters instancied");
this.cacheSearchingFilterParameters = sfp;
this.listOfProjectTablePanel.setFilteringParameters(cacheSearchingFilterParameters);
}
/**
* Sets the internal height.
*
* @param height the new internal height
*/
public void setInternalHeight(int height) {
contTabNewProject.asWidget().setHeight(height + "px");
theDockLayoutPanel.setHeight((height - 40) + "px");
detailsPanel.setHeight((height - 90) + "px");
}
/**
* Bind events.
*/
private void bindEvents() {
tabGetListOfProjects.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// instanceAndShowListOfProjects(false);
}
});
navShowOnMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_ON_MAP));
}
});
navShareLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.GET_SHAREABLE_LINK));
}
});
navViewAsDocument.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments,
OPERATION_ON_ITEM.VIEW_PROJECT_AS_DOCUMENT));
}
});
navViewAsJSON.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus.fireEvent(
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_PROJECT_AS_JSON));
}
});
navShowReport.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_REPORT));
}
});
navEditMode.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.EDIT_PROJECT));
}
});
navDelete.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus.fireEvent(
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.DELETE_PROJECT));
}
});
navCreateRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
OperationOnItemEvent oIE = new OperationOnItemEvent<DocumentDV>(listDocuments,
OPERATION_ON_ITEM.CREATE_RELATION);
oIE.setSourceElement(navCreateRelation.getElement());
appManagerBus.fireEvent(
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.CREATE_RELATION));
}
});
navViewRelations.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
OperationOnItemEvent oIE = new OperationOnItemEvent<DocumentDV>(listDocuments,
OPERATION_ON_ITEM.VIEW_RELATIONSHIPS);
oIE.setSourceElement(navViewRelations.getElement());
appManagerBus.fireEvent(
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_RELATIONSHIPS));
}
});
}
/**
* Sets the role label.
*
* @param userRole the user role
*/
public void setRole(GcubeUserRole userRole) {
this.userRole = userRole;
String msg = "Logged in as ";
if (userRole != null && userRole.getName() != null) {
msg += userRole.getName().substring(userRole.getName().indexOf("-") + 1, userRole.getName().length());
} else
msg += "Member";
roleLabel.setText(msg);
}
/**
* Adds the form panel.
*
* @param formPanel the form panel
*/
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
geonaMainFormPanel.add(formPanel);
}
/**
* Show list of projects view.
*
* @param grpw the grpw
*/
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
this.grpw = grpw;
listOfProjectTablePanel.showListOfProjectsView(grpw);
}
/**
* Sets the loader visible.
*
* @param txtHTML the txt HTML
* @param visible the visible
*/
public void setLoaderVisible(String txtHTML, boolean visible) {
loader.setText(txtHTML);
loader.setVisible(visible);
}
/**
* Gets the current projects searching filter.
*
* @return the current projects searching filter
*/
public SearchingFilter getCurrentProjectsSearchingFilter() {
return listOfProjectTablePanel.builtSearchingFilter();
}
/**
* Removes the tab.
*
* @param index the index
*/
public void removeTab(int index) {
tabPanel.remove(index);
}
/**
* Sets the tab active.
*
* @param index the new tab active
*/
public void setTabActive(int index) {
tabPanel.selectTab(index);
}
/**
* Dirty solution. I created this one because I had problem on firing click
* event for Tab element
*
*/
public void instanceAndShowListOfProjects() {
GWT.log("instanceAndShowListOfProjects called");
listOfProjectTablePanel.instanceAndShowListOfProjects(ucdProjectTypesForListingDataView);
}
/**
* Inits the main according to list use case descriptors.
*
* @param listUCDescriptors the list UC descriptors
*/
public void initMainAccordingToListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
GWT.log("initMainAccordingToListUseCaseDescriptors: " + listUCDescriptors);
// this.listUCDescriptors = listUCDescriptors;
ddCreateNewProject.clear();
listOfProjectTablePanel.projectTypeReset();
ucdProjectTypesForListingDataView.clear();
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
HandlerDeclarationDV dataEntryHandler = UCD_Util.getHandlerDeclarationFor(ucd,
GEOPORTAL_DATA_HANDLER.geoportal_data_entry);
if (dataEntryHandler != null) {
ConfigurationDV<?> config = dataEntryHandler.getConfiguration();
List<GcubeProfileDV> listGcubeProfiles = toListGcubeProfiles(config);
final List<GcubeProfileDV> listProfiles = listGcubeProfiles;
NavLink link = new NavLink(ucd.getName());
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (listProfiles == null || listProfiles.size() == 0) {
DialogInform di = new DialogInform(null, "No configuration found",
"No GcubeProfile found in the Configuration for " + config.getConfiguration());
di.center();
return;
}
appManagerBus.fireEvent(
new CreateNewProjectEvent(ucd.getProfileID(), dataEntryHandler, listProfiles));
}
});
ddCreateNewProject.add(link);
}
// Setting Project type having HANDLER DATA LIST
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
GEOPORTAL_DATA_HANDLER.geoportal_data_list);
if (dataListHandler != null) {
ucdProjectTypesForListingDataView.add(ucd);
listOfProjectTablePanel.addProjectType(ucd);
}
initActionListPanel(ucd);
}
// IF one type of document is available, fire
// CreateNewProjectEvent(documentConfigDV));
if (listUCDescriptors.size() == 1) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
GWT.log("One Config loaded. Firing CreateNewProjectEvent");
UseCaseDescriptorDV useCaseDescriptor = listUCDescriptors.get(0);
HandlerDeclarationDV dataEntryHandler = UCD_Util.getHandlerDeclarationFor(useCaseDescriptor,
GEOPORTAL_DATA_HANDLER.geoportal_data_entry);
if (dataEntryHandler != null) {
ConfigurationDV<?> config = dataEntryHandler.getConfiguration();
List<GcubeProfileDV> listGcubeProfiles = toListGcubeProfiles(config);
appManagerBus.fireEvent(new CreateNewProjectEvent(useCaseDescriptor.getProfileID(),
dataEntryHandler, listGcubeProfiles));
}
}
});
}
}
/**
* Sets the GUI presentation.
*
* @param dataEntryGUIPresentation the new GUI presentation
*/
public void setGUIPresentation(DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
this.dataGUIPresentation = dataEntryGUIPresentation;
GWT.log("Setting: " + dataEntryGUIPresentation);
Header header = dataGUIPresentation.getHeader();
if (header != null) {
if (header.getTitle() != null) {
pageHeader.setText(header.getTitle());
}
if (header.getSubtitle() != null) {
pageHeader.setSubtext(header.getSubtitle());
}
}
BodyWelcome bodyWelcome = dataGUIPresentation.getBodyWelcome();
if (bodyWelcome != null) {
if (bodyWelcome.getTitle() != null) {
welcomeTitle.setText(bodyWelcome.getTitle());
}
if (bodyWelcome.getDescription() != null) {
welcomeDescription.setText(bodyWelcome.getDescription());
}
}
}
/**
* Inits the action list panel.
*
* @param ucd the ucd
*/
public void initActionListPanel(UseCaseDescriptorDV ucd) {
GWT.log("Init ActionListPanel for UCD: " + ucd);
listOfProjectWorkflowActionsPanel.initActionListPanel(ucd);
// Setting Project type having HANDLER WORKFLOW ACTION
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list);
String[] callSteps = null;
if (dataListHandler != null) {
ConfigurationDV<?> config = dataListHandler.getConfiguration();
List<ActionDefinitionDV> listActionDef = (List<ActionDefinitionDV>) config.getConfiguration();
for (ActionDefinitionDV actionDefinitionDV : listActionDef) {
// skipping the special workflow action
if (actionDefinitionDV.getId()
.equals(ConstantsGeoPortalDataEntryApp.WORKFLOW_ACTION_POST_CREATION_ACTION_ID)) {
callSteps = actionDefinitionDV.getCallSteps();
mapProfileIdForPostCreationActionSteps.put(ucd.getProfileID(), callSteps);
}
}
}
}
/**
* Gets the post creation action on save.
*
* @param profileID the profile ID
* @return the post creation action on save
*/
public String[] getPostCreationActionOnSave(String profileID) {
return mapProfileIdForPostCreationActionSteps.get(profileID);
}
/**
* Show actions on selected.
*
* @param <T> the generic type
* @param selectItems the select items
*/
public <T> void showActionsOnSelected(List<T> selectItems) {
theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, false);
listOfProjectWorkflowActionsPanel.showActionsOnSelected(selectItems, userRole);
if (createRelationProjectsPanel != null && createRelationProjectsPanel.isVisible()) {
createRelationProjectsPanel.selectedProject((ResultDocumentDV) selectItems.get(0));
}
if (viewRelationshipPanel != null && viewRelationshipPanel.isVisible()) {
viewRelationshipPanel.showRelationsOf((ResultDocumentDV) selectItems.get(0));
}
}
/**
* To list gcube profiles.
*
* @param config the config
* @return the list
*/
private List<GcubeProfileDV> toListGcubeProfiles(ConfigurationDV<?> config) {
try {
return (List<GcubeProfileDV>) config.getConfiguration();
} catch (Exception e) {
GWT.log("Error on casting " + ConfigurationDV.class.getName() + " to List of "
+ GcubeProfileDV.class.getName());
}
return null;
}
/**
* Sets the page header.
*
* @param hDV the new page header
*/
public void setPageHeader(HandlerDeclarationDV hDV) {
introGNAHero.setVisible(false);
this.pageHeaderDataEntry.setVisible(true);
this.pageHeaderDataEntry.setText("");
this.pageHeaderDataEntry.setSubtext("New: " + hDV.getItemType());
}
/**
* Show create relation panel.
*
* @param bool the bool
* @param selectedDocument the document DV
*/
public void showCreateRelationPanel(boolean bool, ResultDocumentDV selectedDocument) {
detailsPanel.clear();
// theDetailsPanel.setVisible(bool);
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
// if hiding, returns
if (!bool) {
return;
}
createRelationProjectsPanel = new CreateRelationProjectsPanel(appManagerBus, selectedDocument);
detailsPanel.add(createRelationProjectsPanel);
}
/**
* Show view project relations panel.
*
* @param bool the bool
* @param selectedDocument the selected document
*/
public void showViewProjectRelationsPanel(boolean bool, ResultDocumentDV selectedDocument) {
detailsPanel.clear();
// theDetailsPanel.setVisible(bool);
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
// if hiding, returns
if (!bool) {
return;
}
viewRelationshipPanel = new ViewRelationshipPanel(appManagerBus, selectedDocument, true);
detailsPanel.add(viewRelationshipPanel);
}
/**
* Enable relatioship facilities.
*
* @param bool the bool
*/
public void enableRelatioshipFacilities(boolean bool) {
navCreateRelation.setVisible(bool);
if (!bool) {
grpw.removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS);
}
}
public ListOfProjectTablePanel getListOfProjectTablePanel() {
return listOfProjectTablePanel;
}
public List<UseCaseDescriptorDV> getUcdProjectTypesForListingDataView() {
return ucdProjectTypesForListingDataView;
}
}

View File

@ -0,0 +1,134 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:m="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui"
xmlns:r="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui.utils">
<ui:style>
.important {
font-weight: bold;
}
.custom-page-header {
background-color: #f5f5f5;
margin-bottom: 10px;
border: 1px solid #eee;
}
.custom-page-header h1 {
font-size: 32px;
}
.margin-top-5 {
margin-top: 5px !important;
}
.float-right {
display: block;
width: 100%;
font-size: 12px;
text-align: right;
}
.display-right {
float: right;
margin-right: 20px;
}
.sub-page-header {
height: 25px;
margin: 0 !important;
position: relative;
top: -20px;
}
.divider-border-right {
border-left: 1px solid #ccc !important;
height: 35px !important;
}
</ui:style>
<g:HTMLPanel>
<b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}" ui:field="pageHeader">GeoPortal</b:PageHeader>
<g:Label ui:field="roleLabel"
addStyleNames="{style.display-right}"></g:Label>
<b:TabPanel tabPosition="above" ui:field="tabPanel">
<b:Tab icon="FILE_TEXT" heading="New Project" active="true"
ui:field="tabNewProject">
<g:ScrollPanel>
<g:HTMLPanel ui:field="contTabNewProject">
<b:Navbar addStyleNames="nav-toolbar-style">
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
<b:Nav>
<b:Dropdown text="Create New Project"
ui:field="ddCreateNewProject" icon="FILE">
</b:Dropdown>
</b:Nav>
</b:Navbar>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage"></div>
<a href="#bottomPage">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="introGNA">
<b:Hero ui:field="introGNAHero">
<b:Heading size="2" ui:field="welcomeTitle">Welcome
to GeoPortal Data
Entry</b:Heading>
<b:Paragraph ui:field="welcomeDescription"></b:Paragraph>
<b:Paragraph>select "Create New Project"</b:Paragraph>
</b:Hero>
<b:PageHeader subtext=" "
ui:field="pageHeaderDataEntry"
addStyleNames="{style.sub-page-header}" visible="false">
</b:PageHeader>
</g:HTMLPanel>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel">
</g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage"></div>
<a href="#topPage">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</b:Tab>
<b:Tab icon="TABLE" heading="List of Projects"
ui:field="tabGetListOfProjects">
<g:FlowPanel>
<g:FlowPanel addStyleNames="move-sticky">
<b:NavPills>
<b:NavLink ui:field="navViewAsDocument"
title="View Document" icon="FILE">View Document</b:NavLink>
<b:NavLink ui:field="navViewAsJSON"
title="View Document as JSON" icon="CODE">View as JSON</b:NavLink>
<b:Divider addStyleNames="{style.divider-border-right}" />
<b:NavLink ui:field="navShowOnMap" title="Show on Map"
icon="MAP_MARKER">Show on Map</b:NavLink>
<b:NavLink ui:field="navShareLink" title="Get Shareable Link"
icon="SHARE">Get Shareable link</b:NavLink>
<b:Divider addStyleNames="{style.divider-border-right}" />
<b:NavLink ui:field="navShowReport"
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
<b:NavLink ui:field="navEditMode" title="Edit"
icon="PENCIL">Update</b:NavLink>
<b:NavLink ui:field="navDelete" title="Delete Project"
icon="TRASH">Delete Project</b:NavLink>
<b:Divider addStyleNames="{style.divider-border-right}" />
<b:NavLink ui:field="navCreateRelation"
title="Create Relation between two Projects" icon="LINK">Create
Relation</b:NavLink>
<b:NavLink ui:field="navViewRelations"
title="View the relations created for a Project" icon="LIST_ALT">View
Relations</b:NavLink>
</b:NavPills>
</g:FlowPanel>
<g:DockLayoutPanel ui:field="theDockLayoutPanel">
</g:DockLayoutPanel>
</g:FlowPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,58 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class GeonaNavigationBar extends Composite {
private static GeonaNavigationBarUiBinder uiBinder = GWT.create(GeonaNavigationBarUiBinder.class);
interface GeonaNavigationBarUiBinder extends UiBinder<Widget, GeonaNavigationBar> {
}
private EventBus eventBus;
public GeonaNavigationBar() {
initWidget(uiBinder.createAndBindUi(this));
}
private void bindEvents() {
// TODO Auto-generated method stub
}
@UiField
NavLink linkCreateNewProject;
private HandlerManager appManagerBus;
public GeonaNavigationBar(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
@UiHandler("linkCreateNewProject")
void onClick(ClickEvent e) {
appManagerBus.fireEvent(new CreateNewProjectEvent());
}
/**
* Sets the app manager bus.
*
* @param appManagerBus the new app manager bus
*/
public void setAppManagerBus(HandlerManager appManagerBus) {
this.appManagerBus = appManagerBus;
}
}

View File

@ -0,0 +1,366 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DEFAULT_DISPLAYING_COLUMN_NAME;
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.HasData;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.Range;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class GeonaRecordsPaginatedView.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/
public class GeonaRecordsPaginatedView {
private static final int ITEM_START_INDEX = 0;
private static final int ITEMS_PER_PAGE = ConstantsGeoPortalDataEntryApp.PAGINATION_SIZE;
private VerticalPanel vPanel = new VerticalPanel();
private FlowPanel pagerPanel = new FlowPanel();
private Boolean initClassFirstRangeChanged = false;
private ItemsTable<DocumentDV> itemsTable;
private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>();
protected Widget orginalLoadingIndicator = null;
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
private HandlerManager eventBus;
private SearchingFilter currentSearchingFilter;
private String profileID;
/**
* Instantiates a new geona records paginated view.
*
* @param eventBus the eventbus
* @param profileID the profile ID
* @param displayFields the display fields
* @param currentSearchingFilter the current searching filter
*/
public GeonaRecordsPaginatedView(HandlerManager eventBus, String profileID, List<ItemFieldDV> displayFields,
SearchingFilter currentSearchingFilter) {
this.profileID = profileID;
this.currentSearchingFilter = currentSearchingFilter;
this.initClassFirstRangeChanged = true;
this.eventBus = eventBus;
itemsTable = new ItemsTable<DocumentDV>(eventBus, displayFields);
itemsTable.initTable(null, null, dataProvider);
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
initPagination(ITEMS_PER_PAGE);
loadItemsForType(profileID);
}
/**
* Gets the table data provider.
*
* @return the table data provider
*/
public AsyncDataProvider<DocumentDV> getTableDataProvider() {
return (AsyncDataProvider<DocumentDV>) getCellTable().getDataProvider();
}
/**
* Gets the cell tale.
*
* @return the cell tale
*/
private SortedCellTable<DocumentDV> getCellTable() {
return itemsTable.getCellTable();
}
/**
* Inits the pagination.
*
* @param itemsPerPage the items per page
*/
public void initPagination(int itemsPerPage) {
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
pager.setDisplay(getCellTable());
pager.setPageSize(itemsPerPage);
pager.getElement().getStyle().setProperty("margin", "auto");
vPanel.add(loadingPanel);
vPanel.add(getCellTable());
vPanel.getElement().addClassName("vPanel");
pagerPanel.add(pager);
}
/**
* Load new page.
*
* @param profileID the profile ID
* @param startIdx the start idx
* @param limit the limit
* @param resetStore the reset store
* @param currentSearchFilter the current search filter
* @param invalidCache the invalid cache
*/
private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore,
final SearchingFilter currentSearchFilter, final boolean invalidCache) {
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
+ resetStore + "]");
int newStartIndex = startIdx;
if (resetStore) {
GWT.log("Cleaning all data...");
newStartIndex = 0;
GWT.log("Store reset performed start index is: " + newStartIndex);
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
}
loadProjects(profileID, newStartIndex, limit, currentSearchFilter, invalidCache);
}
/**
* Load items for type.
*
* @param profileID the profile ID
*/
private void loadItemsForType(String profileID) {
this.profileID = profileID;
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
loadNewPage(profileID, ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSearchingFilter, true);
}
/**
* Sets the new page result.
*
* @param result the new new page result
*/
private void setNewPageResult(ResultSetPaginatedData result) {
GWT.log("setNewPageResult: " + result);
// serverStartIndex = result.getServerEndIndex();
SelectionModel<? super DocumentDV> sm = getCellTable().getSelectionModel();
if (sm instanceof SingleSelectionModel) {
SingleSelectionModel<? super DocumentDV> ssm = (SingleSelectionModel<DocumentDV>) sm;
ssm.clear();
} else if (sm instanceof MultiSelectionModel) {
MultiSelectionModel<? super DocumentDV> msm = (MultiSelectionModel<DocumentDV>) sm;
msm.clear();
}
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
// TODO MUST USE PROJECT
getTableDataProvider().updateRowData(result.getClientStartIndex(), (List<DocumentDV>) result.getData());
if (result.getData().size() == 0) {
getCellTable().setLoadingIndicator(new Label("No data"));
} else {
getCellTable().setLoadingIndicator(orginalLoadingIndicator);
}
GWT.log("Updating row data startIndex: " + result.getClientStartIndex() + " children size: "
+ result.getData().size());
GWT.log("getAsycnDataProvider().getDataDisplays().size(): " + getCellTable().getRowCount());
if (result.isServerSearchFinished()) {
GWT.log("Search finished!!!");
getTableDataProvider().updateRowCount(getCellTable().getRowCount(), true);
}
// initFirstRangeChanged = false;
//printData((List<DocumentDV>) result.getData());
}
private void printData(List<DocumentDV> data) {
GWT.log("printData");
int i = 0;
for (DocumentDV documentDV : data) {
GWT.log(++i + ") json: " + documentDV.getDocumentAsJSON());
}
}
/**
* To list document DV.
*
* @param data the data
* @return the list
*/
private List<DocumentDV> toListDocumentDV(List<ProjectDV> data) {
if (data == null)
return null;
List<DocumentDV> listDocuments = new ArrayList<DocumentDV>(data.size());
for (ProjectDV projectDV : data) {
listDocuments.add(projectDV.getTheDocument());
}
return listDocuments;
}
/**
* Load projects.
*
* @param <T> the generic type
* @param theProfileID the the profile ID
* @param newStartIndex the new start index
* @param limit the limit
* @param searchFilter the search filter
* @param invalidCache the invalid cache
*/
private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter,
boolean invalidCache) {
showLoading(true);
GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: "
+ newStartIndex + ", limit: " + limit + ", searchFilter: " + searchFilter + "]");
GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit,
searchFilter, invalidCache, new AsyncCallback<ResultSetPaginatedData>() {
@Override
public void onFailure(Throwable caught) {
showLoading(false);
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(ResultSetPaginatedData result) {
showLoading(false);
setNewPageResult(result);
}
});
}
/**
* Select items.
*
* @param select the select
* @param limitToPage the limit to page
*/
public void selectItems(boolean select, boolean limitToPage) {
SortedCellTable<DocumentDV> table = getCellTable();
int rowSize = table.getVisibleItemCount();
for (int i = 0; i < rowSize; i++) {
DocumentDV item = table.getVisibleItem(i);
itemsTable.getSelectionModel().setSelected(item, select);
}
}
/**
* Removes the column.
*
* @param columnName the column name
*/
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
try {
itemsTable.removeColumn(columnName);
} catch (Exception e) {
// TODO: handle exception
}
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<DocumentDV> getSelectItems() {
return itemsTable.getSelectedItems();
}
/**
* A custom {@link AsyncDataProvider}.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 5, 2017
* @param <T> the generic type
*/
public class MyCustomDataProvider<T> extends AsyncDataProvider<T> {
/**
* {@link #onRangeChanged(HasData)} is called when the table requests a new
* range of data. You can push data back to the displays using
* {@link #updateRowData(int, List)}.
*
* @param display the display
*/
@Override
public void onRangeChanged(HasData<T> display) {
// Get the new range.
final Range range = display.getVisibleRange();
int start = range.getStart();
int length = range.getLength();
if (initClassFirstRangeChanged) {
GWT.log("initClassFirstRangeChanged is true.. returning");
initClassFirstRangeChanged = false;
return;
}
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
}
}
/**
* Gets the pager panel.
*
* @return the pager panel
*/
public VerticalPanel getCellPanel() {
return vPanel;
}
/**
* Set the panel in loading mode.
*
* @param show the show
*/
protected void showLoading(boolean show) {
loadingPanel.setVisible(show);
}
/**
* Gets the pager panel.
*
* @return the pager panel
*/
public FlowPanel getPagerPanel() {
return pagerPanel;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
}

View File

@ -0,0 +1,58 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.ModalFooter;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
public class ModalWindow {
private HorizontalPanel hp = new HorizontalPanel();
private Modal modal;
public ModalWindow(Image icon, String title, String msg, AlertType alertType) {
modal = new Modal(true,true);
modal.hide(false);
modal.setTitle(title);
modal.setCloseVisible(true);
Alert alert = new Alert();
alert.setType(alertType);
alert.setClose(false);
alert.setText(msg);
alert.getElement().getStyle().setMarginLeft(10, Unit.PX);
if (icon != null)
hp.add(icon);
hp.add(alert);
ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close");
modalFooter.add(buttClose);
buttClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
}
});
modal.add(hp);
modal.add(modalFooter);
}
public void show() {
modal.show();
}
}

View File

@ -0,0 +1,25 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import com.github.gwtbootstrap.client.ui.Button;
public class ActionDefButton {
private ActionDefinitionDV actionDefinitionDV;
private Button button;
public ActionDefButton(ActionDefinitionDV actionDefinitionDV, Button button) {
this.actionDefinitionDV = actionDefinitionDV;
this.button = button;
}
public ActionDefinitionDV getActionDefinitionDV() {
return actionDefinitionDV;
}
public Button getButton() {
return button;
}
}

View File

@ -0,0 +1,170 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.events.WorkflowActionOnSelectedItemEvent;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ButtonGroup;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class ActionListPanel extends Composite {
private static ActionListPanelUiBinder uiBinder = GWT.create(ActionListPanelUiBinder.class);
interface ActionListPanelUiBinder extends UiBinder<Widget, ActionListPanel> {
}
private String projectName;
private String profileID;
private List<ActionDefinitionDV> listActionDefinition;
private HandlerManager appManagerBus;
public ActionListPanel(HandlerManager appManagerBus, String projectName, String profileID,
List<ActionDefinitionDV> listActionDef) {
initWidget(uiBinder.createAndBindUi(this));
GWT.log("Adding list of actions: " + listActionDef);
this.appManagerBus = appManagerBus;
this.projectName = projectName;
this.profileID = profileID;
this.listActionDefinition = listActionDef;
initActions(listActionDefinition);
actionListBasePanel.setVisible(false);
}
@UiField
HTMLPanel actionListContainer;
@UiField
HTMLPanel actionListBasePanel;
private Map<String, List<ActionDefButton>> mapPhaseListButtons;
private void initActions(List<ActionDefinitionDV> listActionDef) {
if (listActionDef.size() > 0) {
// actionListBasePanel.setVisible(true);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.getElement().addClassName("actions-button-group");
mapPhaseListButtons = new LinkedHashMap<String, List<ActionDefButton>>();
for (ActionDefinitionDV actionDefinitionDV : listActionDef) {
// skipping the special workflow action
if (actionDefinitionDV.getId()
.equals(ConstantsGeoPortalDataEntryApp.WORKFLOW_ACTION_POST_CREATION_ACTION_ID)) {
continue;
}
Button butt = new Button();
butt.setText(actionDefinitionDV.getTitle());
butt.setTitle(actionDefinitionDV.getDescription());
butt.setType(ButtonType.INFO);
butt.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
appManagerBus
.fireEvent(new WorkflowActionOnSelectedItemEvent<ResultDocumentDV>(actionDefinitionDV));
}
});
String[] displayOnPhases = actionDefinitionDV.getDisplayOnPhase();
for (String displayOnPhase : displayOnPhases) {
List<ActionDefButton> mapPhase = mapPhaseListButtons.get(displayOnPhase);
if (mapPhase == null)
mapPhase = new ArrayList<ActionDefButton>();
mapPhase.add(new ActionDefButton(actionDefinitionDV, butt));
mapPhaseListButtons.put(displayOnPhase, mapPhase);
}
buttonGroup.add(butt);
}
actionListContainer.add(buttonGroup);
} else {
actionListBasePanel.setVisible(false);
}
}
public <T> void showActionsOnSelected(List<T> listSelected, GcubeUserRole userRole) {
setAllActionsVisible(false);
if (listSelected.size() == 1) {
for (T item : listSelected) {
if (item instanceof ResultDocumentDV) {
String itemPhase = ((ResultDocumentDV) item).getLifecycleInfo().getPhase();
List<ActionDefButton> listButtons = mapPhaseListButtons.get(itemPhase);
if (listButtons != null) {
for (ActionDefButton actionDefButton : listButtons) {
Set<String> roles = actionDefButton.getActionDefinitionDV().getRoles();
// No role/s defined means enable the action by default
if (roles.isEmpty()) {
actionDefButton.getButton().setVisible(true);
actionListBasePanel.setVisible(true);
} else {
// Checking if the userRole is matching the role defined in the ActionDefinition
boolean isRoleIntoActionDef = roles.stream()
.anyMatch(userRole.getName()::equalsIgnoreCase);
if (isRoleIntoActionDef) {
actionDefButton.getButton().setVisible(true);
actionListBasePanel.setVisible(true);
}
}
}
}
}
}
}
}
private void setAllActionsVisible(boolean bool) {
if (mapPhaseListButtons != null && mapPhaseListButtons.values().size() > 0) {
Iterator<List<ActionDefButton>> collIterator = mapPhaseListButtons.values().iterator();
if (collIterator != null) {
while (collIterator.hasNext()) {
List<ActionDefButton> listButton = collIterator.next();
for (ActionDefButton actionDefButton : listButton) {
actionDefButton.getButton().setVisible(bool);
}
}
}
}
}
}

View File

@ -0,0 +1,26 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.action-panel {
display: flex;
margin-left: 30px;
}
.action-title {
color: #777;
font-size: 14px;
text-shadow: 0 1px 0 #eee;
}
</ui:style>
<g:HTMLPanel ui:field="actionListBasePanel"
addStyleNames="{style.action-panel}">
<g:HTML addStyleNames="{style.action-title}">WORKFLOW ACTIONS</g:HTML>
<g:HTMLPanel ui:field="actionListContainer"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,60 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class DeleteViewPanel extends Composite {
private static DeleteViewPanelUiBinder uiBinder = GWT.create(DeleteViewPanelUiBinder.class);
interface DeleteViewPanelUiBinder extends UiBinder<Widget, DeleteViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
private ResultDocumentDV resultDocumentDV;
public DeleteViewPanel(ResultDocumentDV resultDocumentDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to permanently delete the:</p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>This operation cannot be undone. Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
}

View File

@ -0,0 +1,33 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80%;
height: 50px;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,72 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class StepViewPanel extends Composite {
private static StepViewPanelUiBinder uiBinder = GWT.create(StepViewPanelUiBinder.class);
interface StepViewPanelUiBinder extends UiBinder<Widget, StepViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
@UiField
TextArea txtOptionalMessage;
private ResultDocumentDV resultDocumentDV;
private ActionDefinitionDV actionDefinitionDV;
public StepViewPanel(ResultDocumentDV resultDocumentDV, ActionDefinitionDV actionDefinitionDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
this.actionDefinitionDV = actionDefinitionDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to perform the step/s <i><b>" + actionDefinitionDV.getCallSteps() + "</b></i> on the: </p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
public String getOptionalMessage() {
return txtOptionalMessage.getText();
}
}

View File

@ -0,0 +1,46 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80% !important;
height: 70px !important;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
<b:Form type="HORIZONTAL">
<b:Fieldset>
<b:ControlGroup>
<b:ControlLabel>Message</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextArea addStyleNames="{style.text-are-size}"
ui:field="txtOptionalMessage"></b:TextArea>
<b:HelpBlock>You can optionally add a message...</b:HelpBlock>
</b:Controls>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,32 +1,35 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.card; package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
public class GeoNaFormCardModel { public class GeoNaFormCardModel<T extends MetaDataProfileBean> {
private MetaDataProfileBean metadataProfileBean; private T metadataProfileBean;
private CreateMetadataForm metadataForm; private CreateMetadataForm metadataForm;
private ConcessioniFormCardTitle formCardTitle; //matching with metadata profile type private ProjectFormCard formCard; // matching with metadata profile
private GcubeProfileDV gcubeProfile;
public GeoNaFormCardModel() { public GeoNaFormCardModel() {
} }
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm, public GeoNaFormCardModel(T metadataProfileBean, CreateMetadataForm metadataForm, ProjectFormCard formCard,
ConcessioniFormCardTitle formCardTitle) { GcubeProfileDV gcubeProfile) {
super(); super();
this.metadataProfileBean = metadataProfileBean; this.metadataProfileBean = metadataProfileBean;
this.metadataForm = metadataForm; this.metadataForm = metadataForm;
this.formCardTitle = formCardTitle; this.formCard = formCard;
this.gcubeProfile = gcubeProfile;
} }
public MetaDataProfileBean getMetadataProfileBean() { public T getMetadataProfileBean() {
return metadataProfileBean; return metadataProfileBean;
} }
public void setMetadataProfileBean(MetaDataProfileBean metadataProfileBean) { public void setMetadataProfileBean(T metadataProfileBean) {
this.metadataProfileBean = metadataProfileBean; this.metadataProfileBean = metadataProfileBean;
} }
@ -38,18 +41,35 @@ public class GeoNaFormCardModel {
this.metadataForm = metadataForm; this.metadataForm = metadataForm;
} }
public ConcessioniFormCardTitle getFormCardTitle() { public ProjectFormCard getFormCard() {
return formCardTitle; return formCard;
} }
public void setFormCardTitle(ConcessioniFormCardTitle formCardTitle) { public void setFormCard(ProjectFormCard formCard) {
this.formCardTitle = formCardTitle; this.formCard = formCard;
}
public GcubeProfileDV getGcubeProfile() {
return gcubeProfile;
}
public void setGcubeProfile(GcubeProfileDV gcubeProfile) {
this.gcubeProfile = gcubeProfile;
} }
@Override @Override
public String toString() { public String toString() {
return "GeoNaForm [metadataProfileBean=" + metadataProfileBean + ", metadataForm=" + metadataForm StringBuilder builder = new StringBuilder();
+ ", formCardTitle=" + formCardTitle + "]"; builder.append("GeoNaFormCardModel [metadataProfileBean=");
builder.append(metadataProfileBean);
builder.append(", metadataForm=");
builder.append(metadataForm);
builder.append(", formCard=");
builder.append(formCard);
builder.append(", gcubeProfile=");
builder.append(gcubeProfile);
builder.append("]");
return builder.toString();
} }
} }

View File

@ -3,20 +3,25 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.AlertClosable;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean; import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Tab; import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.IconType; import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Image;
/** /**
* The Class MetadataFormCard. * The Class MetadataFormCard.
@ -51,6 +56,8 @@ public class MetadataFormCard {
private FlowPanel tabContainer = new FlowPanel(); private FlowPanel tabContainer = new FlowPanel();
private int minFormRepeatability;
/** /**
* The Class MetadataFormCardEventHandler. * The Class MetadataFormCardEventHandler.
* *
@ -114,9 +121,29 @@ public class MetadataFormCard {
this.tab = tab; this.tab = tab;
this.geonaFormModel = geonaFormModel; this.geonaFormModel = geonaFormModel;
this.appManagerBus = appManagerBus; this.appManagerBus = appManagerBus;
this.repeatible = geonaFormModel.getFormCardTitle().isInternalRepeatibleForm(); ProjectFormCard formCard = geonaFormModel.getFormCard();
this.maxFormRepeatability = geonaFormModel.getFormCardTitle().getMaxFormRepeatability()!=null?geonaFormModel.getFormCardTitle().getMaxFormRepeatability():Integer.MAX_VALUE; this.repeatible = formCard.isInternalRepeatibleForm();
this.buildCard(geonaFormModel.getMetadataForm()); this.minFormRepeatability = formCard.getMinFormRepeatability() != null
? geonaFormModel.getFormCard().getMinFormRepeatability()
: 1;
this.maxFormRepeatability = formCard.getMaxFormRepeatability() != null
? geonaFormModel.getFormCard().getMaxFormRepeatability()
: Integer.MAX_VALUE;
boolean repeatibleFormIsRemovable = true;
if (minFormRepeatability > 1) {
repeatibleFormIsRemovable = false;
for (int i = 1; i < minFormRepeatability; i++) {
CreateMetadataForm newForm = new CreateMetadataForm(
geonaFormModel.getMetadataForm().getMetadataProfiles(), appManagerBus,
CreateMetadataForm.OPERATION.UPDATE);
// newForm.addListener(formCardEventHandler);
// here removableForm is false because the min > 1 must be respected
addNewForm(newForm, repeatibleFormIsRemovable);
}
}
this.buildCard(geonaFormModel.getMetadataForm(), repeatibleFormIsRemovable);
// geonaFormModel.getMetadataForm().addListener(formCardEventHandler); // geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
} }
@ -125,7 +152,7 @@ public class MetadataFormCard {
* *
* @param createMetadataForm the create metadata form * @param createMetadataForm the create metadata form
*/ */
private void buildCard(final CreateMetadataForm createMetadataForm) { private void buildCard(final CreateMetadataForm createMetadataForm, boolean repeatibleFormIsRemovable) {
if (repeatible) { if (repeatible) {
Button buttonAddNew = new Button("Add New..."); Button buttonAddNew = new Button("Add New...");
@ -138,18 +165,21 @@ public class MetadataFormCard {
if (listForms.size() < maxFormRepeatability) { if (listForms.size() < maxFormRepeatability) {
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus); CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),
appManagerBus, CreateMetadataForm.OPERATION.UPDATE);
// newForm.addListener(formCardEventHandler); // newForm.addListener(formCardEventHandler);
addNewForm(newForm); addNewForm(newForm, true);
}else } else {
Window.alert("Maximun number of data reached for "+geonaFormModel.getFormCardTitle().getTitle()); DialogInform di = new DialogInform(new Image(Images.ICONS.accessDenied()), "Maximun reached",
//newForm.getCreateButton().setFocus(true); "Maximun number of data reached for " + geonaFormModel.getFormCard().getTitle());
di.center();
}
} }
}); });
} }
tab.add(tabContainer); tab.add(tabContainer);
addNewForm(createMetadataForm); addNewForm(createMetadataForm, repeatibleFormIsRemovable);
} }
/** /**
@ -157,11 +187,11 @@ public class MetadataFormCard {
* *
* @param newForm the new form * @param newForm the new form
*/ */
private void addNewForm(final CreateMetadataForm newForm) { private void addNewForm(final CreateMetadataForm newForm, boolean repeatibleFormIsRemovable) {
tabContainer.insert(newForm, 0); tabContainer.insert(newForm, 0);
listForms.add(newForm); listForms.add(newForm);
if(listForms.size()>1) { if (listForms.size() > 1 && repeatibleFormIsRemovable) {
final Button buttonRemoveLatestForm = new Button("Remove"); final Button buttonRemoveLatestForm = new Button("Remove");
buttonRemoveLatestForm.setIcon(IconType.TRASH); buttonRemoveLatestForm.setIcon(IconType.TRASH);
tabContainer.insert(buttonRemoveLatestForm, 1); tabContainer.insert(buttonRemoveLatestForm, 1);
@ -174,6 +204,15 @@ public class MetadataFormCard {
listForms.remove(newForm); listForms.remove(newForm);
tabContainer.remove(buttonRemoveLatestForm); tabContainer.remove(buttonRemoveLatestForm);
AlertClosable alertCloasable = new AlertClosable();
alertCloasable.setHTML("Data Entry form removed!");
alertCloasable.setAnimation(true);
alertCloasable.setType(AlertType.DEFAULT);
alertCloasable.setClose(true);
alertCloasable.closeAfter(3000);
alertCloasable.getElement().getStyle().setMarginTop(5, Unit.PX);
tabContainer.insert(alertCloasable,0);
} }
}); });
} }
@ -199,7 +238,6 @@ public class MetadataFormCard {
return heading; return heading;
} }
/** /**
* Validate form. * Validate form.
* *
@ -226,8 +264,7 @@ public class MetadataFormCard {
tab.setIcon(IconType.OK_SIGN); tab.setIcon(IconType.OK_SIGN);
tab.asWidget().getElement().removeClassName("red-text"); tab.asWidget().getElement().removeClassName("red-text");
tab.asWidget().getElement().addClassName("green-text"); tab.asWidget().getElement().addClassName("green-text");
} } else {
else {
tab.setIcon(IconType.MINUS_SIGN); tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().removeClassName("green-text"); tab.asWidget().getElement().removeClassName("green-text");
tab.asWidget().getElement().addClassName("red-text"); tab.asWidget().getElement().addClassName("red-text");
@ -244,8 +281,7 @@ public class MetadataFormCard {
tab.setIcon(IconType.OK_SIGN); tab.setIcon(IconType.OK_SIGN);
tab.asWidget().getElement().removeClassName("red-text"); tab.asWidget().getElement().removeClassName("red-text");
tab.asWidget().getElement().addClassName("green-text"); tab.asWidget().getElement().addClassName("green-text");
} } else {
else {
tab.setIcon(IconType.MINUS_SIGN); tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().removeClassName("red-text"); tab.asWidget().getElement().removeClassName("red-text");
tab.asWidget().getElement().addClassName("red-text"); tab.asWidget().getElement().addClassName("red-text");

View File

@ -0,0 +1,257 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.Arrays;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEventHandler;
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class EditModeRecord.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
public class EditModeRecord extends Composite {
private static EditModeRecordUiBinder uiBinder = GWT.create(EditModeRecordUiBinder.class);
@UiField
Tab tabRawUpdate;
@UiField
Tab tabUploadFiles;
@UiField
FlowPanel rawUpdatePanel;
@UiField
HTMLPanel filesUpdatePanel;
@UiField
Button buttonJSONUpdate;
private ResultDocumentDV selectedProject;
private JSONEditorWrapper jsEditor;
private HandlerManager appManagerBus;
private final HandlerManager editorManagerBus = new HandlerManager(null);
private int modalHeight;
/**
* The Interface EditModeRecordUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
interface EditModeRecordUiBinder extends UiBinder<Widget, EditModeRecord> {
}
public EditModeRecord(HandlerManager appManagerBus, ResultDocumentDV selectedProject, int modalHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.modalHeight = modalHeight;
this.selectedProject = selectedProject;
this.appManagerBus = appManagerBus;
this.filesUpdatePanel.setHeight((modalHeight - 50) + "px");
// filesUpdatePanel.getElement().modalHeight().setProperty("maxHeight",
// "550px");
// TODO Must be instanceUpdateFilesetEditor
tabUploadFiles.asWidget().getElement().getStyle().setVisibility(Visibility.HIDDEN);
instanceJSONEditor();
instanceUpdateFilesetEditor();
bindEvents();
}
private void instanceUpdateFilesetEditor() {
// Window.alert("instanceUpdateFilesetEditor must be revisited");
/*
* GeoPortalDataEntryApp.geoportalDataEntryService.readFileSetPaths(new
* AsyncCallback<FileSetPathsDV>() {
*
* @Override public void onFailure(Throwable caught) { // TODO Auto-generated
* method stub
*
* }
*
* @Override public void onSuccess(FileSetPathsDV fileSetPaths) { UpdateFileset
* updateFileset = new UpdateFileset(editorManagerBus, selectedProject,
* recordType, fileSetPaths.getFileSetPaths());
* filesUpdatePanel.add(updateFileset); } });
*/
}
public void noUpdateMode() {
buttonJSONUpdate.setVisible(false);
}
private void instanceJSONEditor() {
rawUpdatePanel.clear();
final HorizontalPanel hpLoader = new HorizontalPanel();
final LoaderIcon lc = new LoaderIcon("Loading Project... please wait");
hpLoader.add(lc);
rawUpdatePanel.add(hpLoader);
final FlowPanel fp = new FlowPanel();
fp.getElement().setId("jsoneditor" + Random.nextInt());
fp.setHeight((modalHeight - 160) + "px");
rawUpdatePanel.add(fp);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONDocumentInTheProject(
selectedProject.getProfileID(), selectedProject.getId(), new AsyncCallback<String>() {
@Override
public void onSuccess(String jsonData) {
hpLoader.clear();
GWT.log("Instance JSON Editor with: " + jsonData);
jsEditor = JSONEditorWrapper.init(fp.getElement().getId());
jsEditor.setName(selectedProject.getId());
jsEditor.set(jsonData);
new Timer() {
@Override
public void run() {
jsEditor.setMode("tree");
}
}.schedule(200);
}
@Override
public void onFailure(Throwable caught) {
rawUpdatePanel.clear();
Alert alert = new Alert(
"Sorry, I cannot show the source Project with id '" + selectedProject.getId()
+ "' Refresh an try again. Error: " + caught.getMessage(),
AlertType.ERROR);
alert.setClose(false);
rawUpdatePanel.add(alert);
}
});
};
});
}
/**
* Bind events.
*/
private void bindEvents() {
buttonJSONUpdate.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
rawUpdatePanel.getElement().addClassName("disable-div");
buttonJSONUpdate.setEnabled(false);
final LoaderIcon loader = new LoaderIcon("Updating the project...");
tabRawUpdate.add(loader);
GeoPortalDataEntryApp.geoportalDataEntryService.updateRecord(selectedProject.getProfileID(),
selectedProject.getId(), jsEditor.getText(), new AsyncCallback<ProjectDV>() {
@Override
public void onFailure(Throwable caught) {
buttonJSONUpdate.setEnabled(true);
try {
rawUpdatePanel.getElement().removeClassName("disable-div");
tabRawUpdate.remove(loader);
} catch (Exception e) {
// TODO: handle exception
}
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), Arrays.asList(selectedProject),
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
}
@Override
public void onSuccess(ProjectDV result) {
buttonJSONUpdate.setEnabled(true);
try {
rawUpdatePanel.getElement().removeClassName("disable-div");
tabRawUpdate.remove(loader);
} catch (Exception e) {
// TODO: handle exception
}
DialogInform di = new DialogInform(null, "Project updated!",
"Project ID '" + result.getId() + "' updated correctly");
di.setZIndex(100000);
di.center();
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), Arrays.asList(selectedProject),
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
}
});
}
});
editorManagerBus.addHandler(OperationPerformedOnItemEvent.TYPE, new OperationPerformedOnItemEventHandler() {
@Override
public <T extends DocumentDV> void onDoActionPerformedFired(
OperationPerformedOnItemEvent<T> actionPerformedOnItemEvent) {
ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction();
List<T> items = actionPerformedOnItemEvent.getSelectItems();
if (items != null) {
instanceJSONEditor();
appManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), (List<ResultDocumentDV>) items, action));
}
}
});
}
}

View File

@ -0,0 +1,74 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.button-save-style {
margin-top: 10px;
float: right;
}
.info-panel {
width: 100%;
word-break: break-word;
}
</ui:style>
<g:HTMLPanel>
<b:TabPanel tabPosition="left" ui:field="tabPanel">
<b:Tab icon="CODE" active="true" heading="Project"
ui:field="tabRawUpdate">
<b:Heading size="3">Source Project as JSON</b:Heading>
<b:Label type="INFO" visible="false">You can update the project by editing
the
model data displayed in the following editor.</b:Label>
<g:HTML visible="false" addStyleNames="{style.info-panel}">
<p style='color: #585858'>
Be careful not to change the
keys (e.g. nome, introduzione,
licenzaID and so
on..) reported in
<span style='color: black'>black.</span>
Update only their values
(e.g. "il nome
del
progetto",
"introduzione
del progetto") reported in
<span style='color: green'>green</span>
by the
Editor
<br />
<span>At the end of the changes press the "Update" button to make
them persistent on the service</span>
</p>
</g:HTML>
<g:FlowPanel ui:field="rawUpdatePanel">
</g:FlowPanel>
<b:Button icon="SAVE" type="INFO"
addStyleNames="{style.button-save-style}"
ui:field="buttonJSONUpdate" visible="false">UPDATE</b:Button>
</b:Tab>
<b:Tab icon="UPLOAD_ALT" heading="Manage File/s"
ui:field="tabUploadFiles">
<b:Heading size="3">Manage the file/s</b:Heading>
<b:Label type="INFO">You can choose a section (e.g. "piante") and
manage the existing file/s (by removing it/them) and uploading new one/s</b:Label>
<g:HTML addStyleNames="{style.info-panel}">
<p style='color: #585858'>
At the end of the changes press the "Update" button to
make
them persistent on the service
</p>
</g:HTML>
<g:HTMLPanel ui:field="filesUpdatePanel">
</g:HTMLPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,383 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.application.geoportaldatamapper.shared.MetaDataProfileBeanExt;
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
public class UpdateRecord extends Composite {
private static UpdateRecordUiBinder uiBinder = GWT.create(UpdateRecordUiBinder.class);
interface UpdateRecordUiBinder extends UiBinder<Widget, UpdateRecord> {
}
@UiField
ListBox listBoxSections;
@UiField
ScrollPanel scrollSectionContent;
@UiField
HTMLPanel htmlPanelContainer;
@UiField
HTMLPanel alertHTMLPanel;
@UiField
ControlGroup controlsControlGroup;
@UiField
Button buttonUpdate;
public static final String PLACEHOLDER_LIST_BOX = "Select section...";
private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections... please wait");
private GeoNaFormCardModel currentCardSelected;
private String profileID;
private String projectID;
private HashMap<String, List<FilePathDV>> sectionPathFilePaths = new HashMap<>();
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
private ProjectEdit projectEditDTO;
private HandlerManager appManagerBus;
public UpdateRecord(HandlerManager appManagerBus, String profileID, String projectID, int modalWidth, int modalHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
this.profileID = profileID;
this.projectID = projectID;
setUpdateButtonEnabled(false);
htmlPanelContainer.setVisible(false);
alertHTMLPanel.add(loaderProjectSections);
scrollSectionContent.setHeight((modalHeight-350)+"px");
listBoxSections.setWidth((modalWidth-50)+"px");
GeoportalDataEntryServiceAsync.Util.getInstance().getProjectEdit(profileID, projectID,
new AsyncCallback<ProjectEdit>() {
@Override
public void onSuccess(ProjectEdit result) {
projectEditDTO = result;
htmlPanelContainer.setVisible(true);
try {
alertHTMLPanel.remove(loaderProjectSections);
} catch (Exception e) {
}
listBoxSections.addItem(PLACEHOLDER_LIST_BOX, PLACEHOLDER_LIST_BOX);
listBoxSections.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled",
"disabled");
listBoxSections.setSelectedValue(PLACEHOLDER_LIST_BOX);
int sectionArray = 0;
for (final MetaDataProfileBeanExt profileBean : result.getTheProfileBeans()) {
GcubeProfileDV profileDV = profileBean.getGcubeProfileDV();
String sectionPath = profileDV.getParentName() != null ? profileDV.getParentName() : "";
sectionPath += profileDV.getSectionName();
// increment section stored as array
if (profileDV.getMaxOccurs() == 0 || profileDV.getMaxOccurs() > 1) {
sectionPath += "[" + sectionArray + "]";
sectionArray++;
} else {
sectionArray = 0;
}
List<FilePathDV> filePaths = profileDV.getFilePaths();
if (filePaths != null)
sectionPathFilePaths.put(sectionPath, filePaths);
GWT.log("Adding type: " + profileBean.getType() + ", in the section path: " + sectionPath);
listBoxSections.addItem(profileBean.getType(), sectionPath);
}
listBoxSections.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setUpdateButtonEnabled(false);
// -1 because the first element is the PLACEHOLDER "Select section..."
int selectedIndex = listBoxSections.getSelectedIndex() - 1;
MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans()
.get(selectedIndex);
GWT.log("Change handler fired " + selectedBean);
controlsControlGroup.setVisible(true);
scrollSectionContent.clear();
GcubeProfileDV gcubeProfile = selectedBean.getGcubeProfileDV();
currentCardSelected = GeoPortalDataEntryApp.buildNewFormCardModelFromProfile(
gcubeProfile, 1, selectedBean, OPERATION.UPDATE, appManagerBus);
currentCardSelected.getMetadataForm().addListener(formCardEventHandler);
scrollSectionContent.add(currentCardSelected.getMetadataForm());
}
});
}
@Override
public void onFailure(Throwable caught) {
projectEditDTO = null;
htmlPanelContainer.setVisible(true);
alertHTMLPanel.remove(loaderProjectSections);
String errorMsg = caught.getMessage();
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
alertHTMLPanel.remove(loaderProjectSections);
} catch (Exception e) {
}
alertHTMLPanel.add(alert);
Window.alert(errorMsg);
}
});
bindEvents();
}
private void setUpdateButtonEnabled(boolean bool) {
buttonUpdate.setEnabled(bool);
}
private void bindEvents() {
buttonUpdate.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
alertHTMLPanel.clear();
boolean isFormValid = currentCardSelected.getMetadataForm().isFormDataValid();
if (!isFormValid) {
Alert alert = new Alert("Error/s detected, please check your data entry...", AlertType.WARNING);
alert.setClose(true);
alertHTMLPanel.add(alert);
return;
}
GeoNaFormDataObject gfdo = new GeoNaFormDataObject(
Arrays.asList(currentCardSelected.getMetadataForm().getFormDataBean()),
currentCardSelected.getGcubeProfile());
String sectionPath = listBoxSections.getSelectedValue();
GWT.log("sectionPath is: " + sectionPath);
List<FilePathDV> listFilePaths = sectionPathFilePaths.get(sectionPath);
final Modal modal = new Modal(true, true);
DocumentDV theDocument = projectEditDTO.getTheProjectDV().getTheDocument();
modal.setTitle("Updating...");
final FlowPanel panelContainer = new FlowPanel();
LoaderIcon loader = new LoaderIcon("Operation in progress... please wait");
modal.add(loader);
String htmlMsg = "Updating the section <b>"+listBoxSections.getSelectedItemText()+"</b> of the project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + projectID + "</li>";
htmlMsg += "<li>" + theDocument.getFirstEntryOfMap().getKey() + ": "
+ theDocument.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
panelContainer.add(new HTML(htmlMsg));
panelContainer.add(loader);
panelContainer.add(new HTML("<br><br>"));
modal.add(panelContainer);
// modal3.setWidth(950);
// modal3.setHeight("700px");
modal.setCloseVisible(false);
GeoportalDataEntryServiceAsync.Util.getInstance().updateGeportalDataForm(profileID, projectID, gfdo,
sectionPath, listFilePaths, new AsyncCallback<CommitReport>() {
@Override
public void onFailure(Throwable caught) {
modal.setCloseVisible(true);
modal.setTitle("Error :-(");
panelContainer.clear();
String errorMsg = "Sorry, an error occurred when updating the project with id: "+projectID+". Please, try again. If the problem persists, please contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
modal.add(alert);
}
@Override
public void onSuccess(CommitReport result) {
modal.setCloseVisible(true);
modal.setTitle("Project updated!");
panelContainer.clear();
Alert alert = new Alert();
alert.setClose(false);
alert.setType(AlertType.SUCCESS);
String htmlMsg = "The project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + projectID + "</li>";
htmlMsg += "<li>" + theDocument.getFirstEntryOfMap().getKey() + ": "
+ theDocument.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
htmlMsg += "has been updated successfully!";
alert.setHTML(htmlMsg);
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("Project", result.getProjectAsJSON(),
false, false);
rtth2.showAsJSON(false);
panelContainer.add(alert);
panelContainer.add(rtth2);
appManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
profileID, null, ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
}
});
modal.show();
}
});
}
public void noUpdateMode() {
buttonUpdate.setVisible(false);
}
/**
* The Class MetadataFormCardEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 12, 2020
*/
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
/**
* On form data valid.
*
* @param genericDatasetBean the generic dataset bean
*/
@Override
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
setUpdateButtonEnabled(true);
//Disabling option not selected
int selectedIndex = listBoxSections.getSelectedIndex();
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
for (int i = 0; i < listBoxSections.getItemCount(); i++) {
if (i != selectedIndex) {
elementOption.getItem(i).setAttribute("disabled", "disabled");
}
}
}
/**
* On form data edit.
*/
@Override
public void onFormDataEdit() {
setUpdateButtonEnabled(false);
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
//i==0 is the PLACEHOLDER
for (int i = 1; i < listBoxSections.getItemCount(); i++) {
elementOption.getItem(i).removeAttribute("disabled");
}
}
/**
* On form aborted.
*/
@Override
public void onFormAborted() {
}
/**
* On validation error.
*
* @param throwable the throwable
* @param errorMsg the error msg
*/
@Override
public void onValidationError(Throwable throwable, String errorMsg) {
}
}
}

View File

@ -0,0 +1,70 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.button-save-style {
margin-top: 10px;
float: right;
}
.max-height-500 {
max-height: 450px;
}
.margin-top-10 {
margin-top: 10px;
}
.info-operation {
font-size: 12px;
color: gray;
}
</ui:style>
<g:HTMLPanel>
<g:HTMLPanel ui:field="alertHTMLPanel">
</g:HTMLPanel>
<g:HTMLPanel ui:field="htmlPanelContainer">
<b:Form type="INLINE">
<b:Fieldset addStyleNames="form-fieldset-edit">
<b:ControlGroup>
<b:Label type="INFO">Select the section of the document you want
to update...</b:Label>
<b:Controls>
<b:ListBox ui:field="listBoxSections"></b:ListBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="controlsControlGroup"
visible="false">
<b:Label type="INFO">Manage the content of</b:Label>
<b:Controls>
<g:ScrollPanel ui:field="scrollSectionContent"></g:ScrollPanel>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<g:ScrollPanel>
<g:HTMLPanel ui:field="uploadFileContainer"
addStyleNames="upload-file-container"></g:HTMLPanel>
</g:ScrollPanel>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
<g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.info-operation}">
To update the document:
"Select the Section you wish to update, update the metadata and/or
the
file/s and then confirm by clicking on "Create".
Finally select
"Update".
</g:HTMLPanel>
<b:Button icon="SAVE" type="INFO"
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate">UPDATE</b:Button>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,89 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor;
import com.google.gwt.core.client.JavaScriptObject;
/**
* The Class JSONEditorWrapper.
*
* Wrapper for https://github.com/josdejong/jsoneditor
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 27, 2021
*/
public class JSONEditorWrapper extends JavaScriptObject {
/**
* Instantiates a new JSON editor wrapper.
*/
protected JSONEditorWrapper() {
}
/**
* Inits the.
*
* @param divID the div ID
* @return the JSON editor wrapper
*/
public static native JSONEditorWrapper init(String divID) /*-{
var container = $doc.getElementById(divID);
var options = {
modes : ['code','tree'],
search: true,
onError : function(error) {
console.log("JSONEditorWrapper error: " + error)
}
};
//console.log("container is: " + container);
return new $wnd.JSONEditor(container, options);
}-*/;
/**
* Sets the.
*
* @param json the json
*/
public final native void set(String json) /*-{
var toJSONObject = JSON.parse(json);
// set json
//console.log("displayng JSON: " + toJSONObject);
this.set(toJSONObject);
this.refresh();
}-*/;
/**
* Gets the text.
*
* @return the text
*/
public final native String getText() /*-{
//console.log("this.get(): " +this.getText());
return this.getText();
}-*/;
/**
* On error.
*/
public final native void onError() /*-{
this.onError(error);
}-*/;
/**
* Sets the mode.
*
* @param mode the new mode
*/
public final native void setMode(String mode) /*-{
this.setMode(mode);
}-*/;
/**
* Sets the name.
*
* @param rootName the new name
*/
public final native void setName(String rootName) /*-{
this.setName(rootName);
}-*/;
}

View File

@ -0,0 +1,397 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.form;
import java.util.Arrays;
import java.util.LinkedHashMap;
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent.ACTION;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.MetadataFormCard;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.TreeItemPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.TreeVisitUtil;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.FormActions;
import com.github.gwtbootstrap.client.ui.NavList;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class GeonaDataEntryMainForm.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 4, 2022
*/
public class GeonaDataEntryMainForm extends Composite {
private static GeonaDataEntryMainFormUiBinder uiBinder = GWT.create(GeonaDataEntryMainFormUiBinder.class);
/**
* The Interface GeonaDataEntryMainFormUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 4, 2022
*/
interface GeonaDataEntryMainFormUiBinder extends UiBinder<Widget, GeonaDataEntryMainForm> {
}
private Tree_Node<GeoNaFormCardModel> nodes = new Tree_Node<GeoNaFormCardModel>();
@UiField
HTMLPanel mainHTMLPanel;
@UiField
ScrollPanel treePanel;
@UiField
NavList navbarTree;
@UiField
ScrollPanel inputPanel;
@UiField
AlertBlock alertFormAction;
@UiField
Button duplicateSelected;
@UiField
Button removeSelected;
@UiField
Button buttonSave;
@UiField
FormActions formActions;
private LinkedHashMap<String, MetadataFormCard> mapForms = new LinkedHashMap<String, MetadataFormCard>();
private HandlerManager appManagerBus;
private TreeItemPanel treeItemPanel;
private boolean canSave = true;
/**
* Instantiates a new geona data entry main form.
*
* @param appManagerBus the app manager bus
*/
public GeonaDataEntryMainForm(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
duplicateSelected.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
appManagerBus.fireEvent(new TreeItemEvent(null, ACTION.DUPLICATE));
}
});
removeSelected.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
appManagerBus.fireEvent(new TreeItemEvent(null, ACTION.DELETE));
}
});
}
/**
* Adds the tree.
*
* @param treeItemPanel the tree item panel
*/
public void addTree(TreeItemPanel treeItemPanel) {
this.treeItemPanel = treeItemPanel;
navbarTree.setVisible(true);
treePanel.add(treeItemPanel.getTree());
}
public void removeTree(TreeItemPanel treeItemPanel) {
try {
treePanel.remove(treeItemPanel.getTree());
} catch (Exception e) {
GWT.log("error: "+e.getMessage());
}
}
/**
* Gets the tree item panel.
*
* @return the tree item panel
*/
public TreeItemPanel getTreeItemPanel() {
return treeItemPanel;
}
/**
* Sets the selected form.
*
* @param form the new selected form
*/
public void setSelectedForm(CreateMetadataForm form) {
inputPanel.clear();
GWT.log("Showing form: " + form);
form.getElement().addClassName("gna-dataentry-form-fieldset");
inputPanel.add(form);
}
/**
* Reset.
*/
public void resetUI() {
navbarTree.setVisible(false);
mapForms.clear();
// mainHTMLPanel.clear();
inputPanel.clear();
//inputPanel = new ScrollPanel();
//removeTree(treeItemPanel);
treePanel.clear();
alertFormAction.clear();
alertFormAction.setVisible(false);
//treePanel = new ScrollPanel();
// treePanel = new ScrollPanel();
// listTabs.clear();
}
/**
* Reset.
*/
public void resetInputPanel() {
inputPanel.clear();
}
public void validateFormsIntoTree(TreeItem root) {
GWT.log("validateFormsIntoTree called");
if (root == null) {
return;
}
GWT.log("validateFormsIntoTree called for: " + root.getText());
for (int i = 0; i < root.getChildCount(); i++) {
TreeItem child = root.getChild(i);
validateFormsIntoTree(child);
}
NodeItem node = (NodeItem) root.getWidget();
GWT.log("validateFormsIntoTree called for: " + root.getText() + " node: " + node);
// Is root
if (node.isRoot()) {
return;
}
boolean isValid = node.validateForm();
GWT.log("validateFormsIntoTree called for: " + root.getText() + " is valid: " + isValid);
node.setValidCard(isValid);
if (!isValid) {
canSave = false;
}
}
/**
* Save data.
*
* @param e the e
*/
@UiHandler("buttonSave")
void saveData(ClickEvent e) {
canSave = true;
final TreeItem root = treeItemPanel.getRoot();
validateFormsIntoTree(root);
if (canSave) {
Tree_Node<GeoNaFormDataObject> treeNode = buildTree(root);
GWT.log("Tree node built correctly!");
// System.out.println(treeNode);
// for (String metadataType : mapForms.keySet()) {
// MetadataFormCard card = mapForms.get(metadataType);
// List<GenericDatasetBean> listGDB = new ArrayList<GenericDatasetBean>(card.getListForms().size());
// for (CreateMetadataForm form : card.getListForms()) {
// listGDB.add(form.getFormDataBean());
//
// }
// listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getGcubeProfile()));
// }
// appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(profileID, listGeonaFormObjects));
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(treeItemPanel.getProfileID(), treeNode));
TreeVisitUtil.preOrderVisit(treeNode);
//showAlertOnSaveAction("Andiamo a salvare", AlertType.INFO, true);
} else {
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
}
// Window.alert("I can save: "+listGeonaFormObjects);
}
public <T> void printTree(Tree_Node<T> node) {
if (node == null) {
return;
}
System.out.println(node);
for (Tree_Node<T> children : node.getChildren()) {
printTree(children);
}
}
private Tree_Node<GeoNaFormDataObject> buildTree(TreeItem root) {
GWT.log("buildTree called");
if (root == null) {
GWT.log("buildTree returns, node is null");
return null;
}
GWT.log("buildTree called on: " + root.getText());
// Cloning
NodeItem rootNodeItem = (NodeItem) root.getWidget();
GWT.log("buildTree called on: " + root.getText() + ", node json section: "
+ rootNodeItem.getJsonSectionFullPath());
Tree_Node<GeoNaFormDataObject> tNode;
// Children
if (!rootNodeItem.isRoot()) {
GeoNaFormCardModel nodeCard = rootNodeItem.getGeoNaFormCardModel();
GeoNaFormDataObject gfdo = new GeoNaFormDataObject(
Arrays.asList(nodeCard.getMetadataForm().getFormDataBean()), nodeCard.getGcubeProfile());
tNode = new Tree_Node<GeoNaFormDataObject>(nodeCard.getGcubeProfile().getSectionTitle(), gfdo);
} else {
// root of the tree
tNode = new Tree_Node<GeoNaFormDataObject>(root.getText(), null);
tNode.setRoot(true);
}
// Total children count
int total = root.getChildCount();
// All the children
for (int i = 0; i < total; i++) {
Tree_Node<GeoNaFormDataObject> childCloned = buildTree(root.getChild(i));
tNode.addChild(childCloned);
}
return tNode;
}
/**
* Show alert on save action.
*
* @param text the text
* @param type the type
* @param hideAfterAWhile the hide after A while
*/
public void showAlertOnSaveAction(String text, AlertType type, boolean hideAfterAWhile) {
// Window.alert("Called alertOnCreate");
alertFormAction.setText(text);
alertFormAction.setType(type);
alertFormAction.setVisible(true);
// goBackButtonSecondStep.setEnabled(true);
if (hideAfterAWhile) {
// hide after some seconds
Timer t = new Timer() {
@Override
public void run() {
alertFormAction.setVisible(false);
}
};
t.schedule(10000);
}
}
/**
* Enable button save.
*
* @param enabled the enabled
*/
public void enableButtonDuplicateSection(boolean enabled) {
duplicateSelected.setEnabled(enabled);
}
/**
* Enable button remove section.
*
* @param enabled the enabled
*/
public void enableButtonRemoveSection(boolean enabled) {
removeSelected.setEnabled(enabled);
}
/**
* Enable button save.
*
* @param enabled the enabled
*/
public void enableButtonSave(boolean enabled) {
buttonSave.setEnabled(enabled);
}
/**
* Sets the ative after.
*
* @param index the index
* @param bool the bool
*/
public void setAtiveAfter(int index, boolean bool) {
// if(listTabs.size()<index) {
// for (int i = index; i < listTabs.size(); i++) {
// listTabs.get(i).setEnabled(bool);
// }
// }
}
/**
* Sets the visible form actions.
*
* @param bool the new visible form actions
*/
public void setVisibleFormActions(boolean bool) {
formActions.setVisible(bool);
}
}

View File

@ -0,0 +1,60 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.wrapper {
display: flex;
width: 100%;
}
.w20 {
width: 20%;
}
.w80 {
width: 80%;
}
.section-toolbar {
width: 100%;
text-align: center;
padding-bottom: 5px;
}
.section-toolbar a {
margin-left: 5px;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel addStyleNames="{style.wrapper}">
<g:HTMLPanel addStyleNames="tree-panel">
<b:NavList visible=" false " ui:field="navbarTree">
<b:NavHeader>Sections</b:NavHeader>
<g:HTMLPanel addStyleNames="{style.section-toolbar}">
<b:Button text="Duplicate" ui:field="duplicateSelected"
icon="COPY">
</b:Button>
<b:Button text="Delete" ui:field="removeSelected"
icon="TRASH">
Delete</b:Button>
</g:HTMLPanel>
</b:NavList>
<g:ScrollPanel ui:field="treePanel">
</g:ScrollPanel>
</g:HTMLPanel>
<g:ScrollPanel ui:field="inputPanel"
addStyleNames="{style.w80}"></g:ScrollPanel>
</g:HTMLPanel>
<!-- <b:TabPanel ui:field="mainTabPanel" tabPosition="left"> </b:TabPanel> -->
<b:AlertBlock type="DEFAULT" visible="false"
close="false" ui:field="alertFormAction"></b:AlertBlock>
<b:FormActions ui:field="formActions" visible="false">
<b:Button type="PRIMARY" icon="SAVE" ui:field="buttonSave">Save</b:Button>
</b:FormActions>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,488 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.Hero;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ListOfProjectTablePanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
public class ListOfProjectTablePanel extends Composite {
@UiField
Dropdown dropdownSortBy;
@UiField
Dropdown dropdownSearchFor;
@UiField
Alert alertSortBy;
@UiField
Alert alertProjectType;
@UiField
Alert alertSearchFor;
@UiField
NavLink buttonReloadProjects;
@UiField
HTMLPanel geonaListOfRecordsPanel;
@UiField
HTMLPanel contTabGetListOfProjects;
@UiField
TextBox searchField;
@UiField
Button resetSearch;
@UiField
Dropdown ddProjectType;
@UiField
Hero noProjectSelectionMessage;
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
private SearchingFilter currentSearchingFilter;
private List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView;
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
private static final String LABEL_FILTER_SEPARATOR = " - ";
private HandlerManager appManagerBus;
private GeonaRecordsPaginatedView grpw;
private static ListOfProjectTablePanelUiBinder uiBinder = GWT.create(ListOfProjectTablePanelUiBinder.class);
/**
* The Interface ListOfProjectTablePanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
interface ListOfProjectTablePanelUiBinder extends UiBinder<Widget, ListOfProjectTablePanel> {
}
/**
* Instantiates a new list of project table panel.
*
* @param appManagerBus the app manager bus
*/
public ListOfProjectTablePanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
alertSortBy.setType(AlertType.INFO);
alertSortBy.setClose(false);
alertSearchFor.setType(AlertType.INFO);
alertSearchFor.setClose(false);
alertProjectType.setType(AlertType.INFO);
alertProjectType.setClose(false);
resetSearch.setIconSize(IconSize.TWO_TIMES);
resetSearch.setType(ButtonType.LINK);
bindEvents();
}
/**
* Bind events.
*/
private void bindEvents() {
buttonReloadProjects.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
UseCaseDescriptorDV singleUCD = getSelectProjectType();
if (singleUCD != null) {
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
getCurrentSearchingFilter(), true));
}
}
});
searchField.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
GWT.log("CHAR CODE: " + event.getCharCode());
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
GWT.log(searchField.getText());
doSearchEvent();
}
}
});
resetSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchField.setText("");
UseCaseDescriptorDV singleUCD = getSelectProjectType();
if (singleUCD != null) {
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
getCurrentSearchingFilter(), false));
}
resetSearch.setVisible(false);
}
});
}
/**
* Sets the filtering parameters.
*
* @param sfp the sfp
*/
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
GWT.log("ListOfProjectTablePanel setFilteringParameters called");
this.cacheSearchingFilterParameters = sfp;
List<ItemFieldDV> sortByFields = sfp.getOrderByFields();
List<ItemFieldDV> searchForFields = sfp.getSearchByFields();
// currentSearchingFilter = new SearchingFilter(sortByFields, null);
alertSearchFor.clear();
dropdownSearchFor.clear();
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
alertSortBy.setText(toLabelFilter((sortByFields.get(0)), SearchingFilter.ORDER.ASC));
for (final ItemFieldDV record_FIELD : searchForFields) {
final NavLink navSearch = new NavLink(record_FIELD.getDisplayName());
dropdownSearchFor.add(navSearch);
navSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Search for: " + record_FIELD.getDisplayName());
alertSearchFor.setText(record_FIELD.getDisplayName());
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
doSearchEvent();
}
}
});
}
dropdownSortBy.clear();
for (ItemFieldDV record_FIELD : sortByFields) {
// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
// continue;
// ASC
final String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
final NavLink nav = new NavLink(labelASC);
dropdownSortBy.add(nav);
nav.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Sort by: " + labelASC);
alertSortBy.setText(labelASC);
UseCaseDescriptorDV singleUCD = getSelectProjectType();
if (singleUCD != null) {
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
getCurrentSearchingFilter(), false));
}
}
});
// //DESC
final String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
final NavLink nav2 = new NavLink(labelDESC);
dropdownSortBy.add(nav2);
nav2.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Sort by: " + labelDESC);
alertSortBy.setText(labelDESC);
UseCaseDescriptorDV singleUCD = getSelectProjectType();
if (singleUCD != null) {
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
getCurrentSearchingFilter(), false));
}
}
});
}
}
/**
* To sort filter.
*
* @param labelFilter the label filter
* @return the searching filter
*/
private SearchingFilter toSortFilter(String labelFilter) {
GWT.log("ListOfProjectTablePanel toSortFilter for label " + labelFilter);
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
GWT.log("label filter: " + array[0]);
SearchingFilter sortFilter = null;
try {
ItemFieldDV recordField = null;
GWT.log("cacheSearchingFilterParameters.getOrderByFields() is: "
+ cacheSearchingFilterParameters.getOrderByFields());
for (ItemFieldDV value : cacheSearchingFilterParameters.getOrderByFields()) {
if (array[0].trim().compareTo(value.getDisplayName()) == 0) {
recordField = value;
break;
}
}
ORDER orderField = ORDER.valueOf(array[1].trim());
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
} catch (Exception e) {
}
GWT.log("toSortFilter got " + sortFilter);
return sortFilter;
}
/**
* Dirty solution. I created this one because I had problem on firing click
* event for Tab element
*
* @param ucdProjectTypesForListingDataView the ucd project types for listing
* data view
*/
public void instanceAndShowListOfProjects(List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView) {
GWT.log("ListOfProjectTablePanel instanceAndShowListOfProjects called");
this.ucdProjectTypesForListingDataView = ucdProjectTypesForListingDataView;
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
// noProjectSelectionMessage.setVisible(true);
// Selecting directly the unique UCD type.
if (ucdProjectTypesForListingDataView.size() == 1) {
// noProjectSelectionMessage.setVisible(false);
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
GetListOfRecordsEvent event = new GetListOfRecordsEvent(true, singleUCD.getProfileID(),
getCurrentSearchingFilter(), true);
setSearchTypeAndFire(singleUCD.getName(), event);
}
}
});
}
public void setSearchTypeAndFire(String ucdName, GetListOfRecordsEvent event) {
alertProjectType.setText(ucdName);
// if(event.getSearchingFilter().getProfileID()!=null && event.getSearchingFilter().getProjectID()) {
//
// }
//
appManagerBus.fireEvent(event);
}
/**
* Built searching filter.
*
* @return the searching filter
*/
public SearchingFilter builtSearchingFilter() {
SearchingFilter searchingFilter = toSortFilter(alertSortBy.getText());
String searchText = searchField.getText();
if (searchText != null && !searchText.isEmpty()) {
Map<String, Object> searchInto = new HashMap<String, Object>();
List<String> listOfSeachingFields = new ArrayList<String>();
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
listOfSeachingFields = recordField.getJsonFields();
continue;
}
}
for (String fieldname : listOfSeachingFields) {
searchInto.put(fieldname, searchText);
}
WhereClause where = new WhereClause();
where.setSearchInto(searchInto);
where.setOperator(LOGICAL_OP.OR);
searchingFilter.setConditions(Arrays.asList(where));
}
return searchingFilter;
}
/**
* Sets the internal height.
*
* @param height the new internal height
*/
public void setInternalHeight(int height) {
contTabGetListOfProjects.asWidget().setHeight(height + "px");
}
/**
* Gets the current sort filter.
*
* @return the current sort filter
*/
public SearchingFilter getCurrentSearchingFilter() {
currentSearchingFilter = builtSearchingFilter();
GWT.log("ListOfProjectTablePanel getCurrentSearchingFilter: " + currentSearchingFilter);
return currentSearchingFilter;
}
/**
* Gets the select project type.
*
* @return the select project type
*/
public UseCaseDescriptorDV getSelectProjectType() {
String projectName = alertProjectType.getText();
for (UseCaseDescriptorDV usdDV : ucdProjectTypesForListingDataView) {
if (usdDV.getName().compareTo(projectName) == 0) {
GWT.log("Selected project type is: " + usdDV);
return usdDV;
}
}
return null;
}
/**
* Do search event.
*/
private void doSearchEvent() {
String searchText = searchField.getText();
if (searchText.length() < MIN_LENGHT_SERCHING_STRING) {
Window.alert("Please enter at least " + MIN_LENGHT_SERCHING_STRING + " characters");
return;
}
resetSearch.setVisible(true);
UseCaseDescriptorDV singleUCD = getSelectProjectType();
if (singleUCD != null) {
appManagerBus.fireEvent(
new GetListOfRecordsEvent(false, singleUCD.getProfileID(), getCurrentSearchingFilter(), false));
}
}
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
GWT.log("showListOfProjectsView for: " + grpw);
this.grpw = grpw;
geonaListOfRecordsPanel.clear();
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.add(this.grpw.getCellPanel());
verticalPanel.add(this.grpw.getPagerPanel());
geonaListOfRecordsPanel.add(verticalPanel);
}
/**
* To label filter.
*
* @param itemField the item field
* @param direction the direction
* @return the string
*/
private String toLabelFilter(ItemFieldDV itemField, ORDER direction) {
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
return labelFilter;
}
/**
* Project type reset.
*/
public void projectTypeReset() {
ddProjectType.clear();
}
public void addProjectType(final UseCaseDescriptorDV ucd) {
NavLink link = new NavLink(ucd.getName());
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
alertProjectType.setText(ucd.getName());
appManagerBus
.fireEvent(new GetListOfRecordsEvent(false, ucd.getProfileID(), builtSearchingFilter(), true));
}
});
ddProjectType.add(link);
}
public String getSelectedProjectType() {
return alertProjectType.getText();
}
}

View File

@ -0,0 +1,92 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:m="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui"
xmlns:r="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui.utils">
<ui:style>
.important {
font-weight: bold;
}
.float-right {
display: block;
width: 100%;
font-size: 12px;
text-align: right;
}
.display-right {
float: right;
margin-right: 20px;
}
.max-height-300 {
max-height: auto;
}
.search-field {
padding-top: 6px;
margin-top: 2px;
}
</ui:style>
<g:ScrollPanel>
<g:HTMLPanel ui:field="contTabGetListOfProjects">
<b:Navbar addStyleNames="nav-toolbar-style">
<b:Brand>List of Projects</b:Brand>
<b:Nav>
<b:Dropdown text="Project Type" ui:field="ddProjectType"
icon="BUILDING">
</b:Dropdown>
</b:Nav>
<b:Nav>
<b:Alert ui:field="alertProjectType"
addStyleNames="alert_box_nav"></b:Alert>
</b:Nav>
<b:Nav>
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
</b:Dropdown>
</b:Nav>
<b:Nav>
<b:Alert ui:field="alertSortBy"
addStyleNames="alert_box_nav"></b:Alert>
</b:Nav>
<b:Nav>
<b:NavLink ui:field="buttonReloadProjects"
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
</b:Nav>
<g:HTMLPanel addStyleNames="{style.display-right}">
<b:Nav>
<b:Dropdown text="Search for"
ui:field="dropdownSearchFor">
</b:Dropdown>
</b:Nav>
<b:Nav>
<b:Alert ui:field="alertSearchFor"
addStyleNames="alert_box_nav"></b:Alert>
</b:Nav>
<b:TextBox ui:field="searchField"
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
<b:Button icon="REMOVE_CIRCLE" ui:field="resetSearch"
title="Reset the search" visible="false"></b:Button>
</g:HTMLPanel>
</b:Navbar>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage2"></div>
<a href="#bottomPage2">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfRecordsPanel">
<b:Hero ui:field="noProjectSelectionMessage">
<b:Paragraph>select "Project Type"</b:Paragraph>
</b:Hero>
</g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage2"></div>
<a href="#topPage2">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</ui:UiBinder>

View File

@ -0,0 +1,117 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.action.ActionListPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.UCD_Util;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ListOfProjectWorkflowActionsPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
public class ListOfProjectWorkflowActionsPanel extends Composite {
@UiField
FlowPanel actionListMainPanel;
private ActionListPanel actionListPanel;
private HandlerManager appManagerBus;
private static ListOfProjectWorkflowActionsPanelUiBinder uiBinder = GWT
.create(ListOfProjectWorkflowActionsPanelUiBinder.class);
/**
* The Interface ListOfProjectWorkflowActionsPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
interface ListOfProjectWorkflowActionsPanelUiBinder extends UiBinder<Widget, ListOfProjectWorkflowActionsPanel> {
}
/**
* Instantiates a new list of project workflow actions panel.
*
* @param appManagerBus the app manager bus
*/
public ListOfProjectWorkflowActionsPanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
}
/**
* Inits the action list panel.
*
* @param ucd the ucd
*/
public void initActionListPanel(UseCaseDescriptorDV ucd) {
GWT.log("Init ActionListPanel for UCD: " + ucd);
// Setting Project type having HANDLER WORKFLOW ACTION
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list);
if (dataListHandler != null) {
actionListMainPanel.setVisible(true);
actionListMainPanel.clear();
ConfigurationDV<?> config = dataListHandler.getConfiguration();
List<ActionDefinitionDV> listActionDef = toListActionDefinition(config);
actionListPanel = new ActionListPanel(appManagerBus, ucd.getName(), ucd.getProfileID(), listActionDef);
actionListMainPanel.add(actionListPanel);
} else {
actionListMainPanel.clear();
actionListMainPanel.setVisible(false);
}
}
/**
* To list action definition.
*
* @param config the config
* @return the list
*/
private List<ActionDefinitionDV> toListActionDefinition(ConfigurationDV<?> config) {
try {
return (List<ActionDefinitionDV>) config.getConfiguration();
} catch (Exception e) {
GWT.log("Error on casting " + ConfigurationDV.class.getName() + " to List of "
+ ActionDefinitionDV.class.getName());
}
return null;
}
/**
* Show actions on selected.
*
* @param <T> the generic type
* @param selectItems the select items
* @param userRole the user role
*/
public <T> void showActionsOnSelected(List<T> selectItems, GcubeUserRole userRole) {
actionListPanel.showActionsOnSelected(selectItems, userRole);
}
}

View File

@ -2,17 +2,14 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style> <ui:style>
.important { .important {
font-weight: bold; font-weight: bold;
} }
</ui:style> </ui:style>
<g:HTMLPanel> <g:FlowPanel>
<b:Navbar> <g:FlowPanel ui:field="actionListMainPanel"
<b:Nav> addStyleNames="action-list-main-panel"></g:FlowPanel>
<b:NavLink ui:field="linkCreateNewProject" </g:FlowPanel>
title="Create a new Project">Create new Project</b:NavLink>
</b:Nav>
</b:Navbar>
</g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder>

View File

@ -0,0 +1,284 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
public class CreateRelationProjectsPanel extends Composite {
private static CreateRelationProjectsPanelUiBinder uiBinder = GWT.create(CreateRelationProjectsPanelUiBinder.class);
interface CreateRelationProjectsPanelUiBinder extends UiBinder<Widget, CreateRelationProjectsPanel> {
}
@UiField
HTMLPanel firstPanelContainer;
@UiField
HTMLPanel panelTitle;
@UiField
HTMLPanel secondPanelContainer;
@UiField
Alert firstItemAlert;
@UiField
Alert secondItemAlert;
@UiField
Button buttFirtProjectReset;
@UiField
Button buttSecondProjectReset;
@UiField
FlowPanel firstProjectPanelContainer;
@UiField
FlowPanel secondProjectPanelContainer;
@UiField
ListBox listBoxRelationNames;
@UiField
Button closeButton;
@UiField
Button buttCreateRelation;
@UiField
Alert alertMessage;
private Map<String, RelationshipDefinitionDV> mapRelationsDefiniton = new HashMap<String, RelationshipDefinitionDV>();
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
private HandlerManager appManagerBus;
public CreateRelationProjectsPanel(HandlerManager appManagerBus, ResultDocumentDV project) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
}
});
listBoxRelationNames.setWidth("90%");
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipsDefinition(project.getProfileID(),
new AsyncCallback<List<RelationshipDefinitionDV>>() {
@Override
public void onSuccess(List<RelationshipDefinitionDV> relationshipNames) {
if (relationshipNames == null || relationshipNames.size() == 0) {
buttCreateRelation.setEnabled(false);
alertMessage
.setText("You cannot create a relationship. No configuration found in the UCD for: "
+ project.getProfileID());
alertMessage.setVisible(true);
return;
}
for (RelationshipDefinitionDV relDef : relationshipNames) {
listBoxRelationNames.addItem(relDef.getLabel(), relDef.getId());
mapRelationsDefiniton.put(relDef.getId(), relDef);
}
}
@Override
public void onFailure(Throwable caught) {
alertMessage.setText("Error on reading the relationship names. Error: " + caught.getMessage());
return;
}
});
firstItemAlert.add(new Image(Images.ICONS.oneFingerIcon()));
firstItemAlert.setClose(false);
secondItemAlert.add(new Image(Images.ICONS.oneFingerIcon()));
secondItemAlert.setClose(false);
buttFirtProjectReset.setType(ButtonType.LINK);
buttFirtProjectReset.setIcon(IconType.REMOVE_SIGN);
buttFirtProjectReset.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
selectedProjects.put(0, null);
firstItemAlert.setVisible(true);
firstProjectPanelContainer.clear();
}
});
buttSecondProjectReset.setType(ButtonType.LINK);
buttSecondProjectReset.setIcon(IconType.REMOVE_SIGN);
buttSecondProjectReset.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
selectedProjects.put(1, null);
secondItemAlert.setVisible(true);
secondProjectPanelContainer.clear();
}
});
buttCreateRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean isValidForm = checkFormPassed();
if (isValidForm) {
buttCreateRelation.setEnabled(false);
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton
.get(listBoxRelationNames.getSelectedValue());
appManagerBus.fireEvent(new RelationActionHandlerEvent(selectedProjects.get(0), relationSelected,
selectedProjects.get(1)));
}
}
});
selectedProject(project);
}
public boolean checkFormPassed() {
alertMessage.setVisible(false);
ResultDocumentDV first = selectedProjects.get(0);
if (first == null) {
alertMessage.setVisible(true);
alertMessage.setText("You must select the first project from the 'List of Project' Table");
return false;
}
ResultDocumentDV second = selectedProjects.get(1);
if (second == null) {
alertMessage.setVisible(true);
alertMessage.setText("You must select the second project from the 'List of Project' Table");
return false;
}
if (first.getId().compareTo(second.getId()) == 0) {
alertMessage.setVisible(true);
alertMessage.setText("First and Second project cannot be the same project");
return false;
}
return true;
}
public void selectedProject(ResultDocumentDV project) {
ResultDocumentDV first = selectedProjects.get(0);
String htmlMsg = "Selected: <b>" + project.getFirstEntryOfMap().getValue() + "</b> (id: " + project.getId()
+ ")";
if (first == null) {
firstItemAlert.setVisible(false);
selectedProjects.put(0, project);
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel temporalContainer = new FlowPanel();
flex.setWidget(1, 0, temporalContainer);
firstProjectPanelContainer.add(flex);
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
firstProjectPanelContainer.add(rtth);
return;
}
ResultDocumentDV second = selectedProjects.get(1);
if (second == null) {
secondItemAlert.setVisible(false);
selectedProjects.put(1, project);
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel temporalContainer = new FlowPanel();
flex.setWidget(1, 0, temporalContainer);
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
secondProjectPanelContainer.add(flex);
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
secondProjectPanelContainer.add(rtth);
}
}
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
new AsyncCallback<TemporalReferenceDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(TemporalReferenceDV result) {
if (result != null) {
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
}
}
});
}
}

View File

@ -0,0 +1,86 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.creation-rel-title {
font-size: 18px;
font-weight: bold;
text-align: center;
padding: 18px;
background: #eee;
}
.list-box-delimiter {
/*border-top: 1px solid #cdcdcd;*/
/*border-bottom: 1px solid #cdcdcd;*/
padding-top: 5px;
padding-bottom: 5px;
text-align: center;
margin-top: 10px;
}
.butt-create {
float: right;
margin-top: 10px;
}
.to-align-right {
position: absolute;
right: 5px;
}
.panel-style {
margin-top: 10px;
border: 1px solid #96a5b5;
border-radius: 5px;
padding: 5px;
}
.panel-style table {
margin-top: 0px !important;
}
.panel-container-style {
padding-left: 10px;
}
</ui:style>
<g:HTMLPanel>
<b:Button ui:field="closeButton"
addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="panelTitle"
addStyleNames="{style.creation-rel-title}">Create Relationship</g:HTMLPanel>
<g:HTMLPanel ui:field="firstPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>First Project</b:Label>
<b:Button ui:field="buttFirtProjectReset">Reset</b:Button>
</g:FlowPanel>
<b:Alert ui:field="firstItemAlert">Select project from the "List of
Projects"
Table</b:Alert>
<g:FlowPanel ui:field="firstProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.list-box-delimiter}">
<b:ListBox ui:field="listBoxRelationNames">
</b:ListBox>
</g:HTMLPanel>
<g:HTMLPanel ui:field="secondPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>Second Project</b:Label>
<b:Button ui:field="buttSecondProjectReset">Reset</b:Button>
</g:FlowPanel>
<b:Alert ui:field="secondItemAlert">Select project from the "List of
Projects"
Table</b:Alert>
<g:FlowPanel ui:field="secondProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
<b:Alert type="ERROR" ui:field="alertMessage" visible="false"></b:Alert>
<b:Button type="PRIMARY" ui:field="buttCreateRelation"
addStyleNames="{style.butt-create}">Create</b:Button>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,280 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
public class ViewRelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
}
private String profileID;
@UiField
HTMLPanel firstPanelContainer;
@UiField
HTMLPanel panelTitle;
@UiField
HTMLPanel secondPanelContainer;
@UiField
FlowPanel firstProjectPanelContainer;
@UiField
FlowPanel secondProjectPanelContainer;
@UiField
Button closeButton;
@UiField
Button buttonExpand;
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
private HandlerManager appManagerBus;
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
private ResultDocumentDV fromTheProject;
public ViewRelationshipPanel(HandlerManager appManagerBus, final ResultDocumentDV fromProject, boolean showExpand) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
this.fromTheProject = fromProject;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
}
});
buttonExpand.setType(ButtonType.LINK);
buttonExpand.setIcon(IconType.EXPAND);
buttonExpand.setTitle("Show this view in new Window");
buttonExpand.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Modal mw = new Modal(true, true);
mw.setTitle("Relationships");
mw.getElement().addClassName("no_modal_body_max_height");
int width = 0;
int heigth = 0;
try {
width = Window.getClientWidth() * 75 / 100;
heigth = Window.getClientHeight() * 75 / 100;
} catch (Exception e) {
// TODO: handle exception
}
if (width > 800) {
mw.setWidth(width);
}
if(heigth > 600) {
mw.setHeight(heigth+"px");
}
mw.add(new ViewRelationshipPanel(appManagerBus, fromTheProject, false));
mw.show();
}
});
if (!showExpand) {
buttonExpand.setVisible(false);
panelTitle.setVisible(false);
closeButton.setVisible(false);
}
showRelationsOf(fromProject);
}
public void showRelationsOf(ResultDocumentDV project) {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
this.fromTheProject = project;
Entry<String, Object> firstEntrySet = project.getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel fromTemporalContainer = new FlowPanel();
flex.setWidget(1, 0, fromTemporalContainer);
firstProjectPanelContainer.add(flex);
addTemportalReferenceToPanel(fromTemporalContainer, project.getProfileID(), project.getProjectID());
//firstProjectPanelContainer.add(new HTML(htmlMsg));
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
firstProjectPanelContainer.add(rtth);
HTML labelNoRelations = new HTML("No relationship/s found");
secondProjectPanelContainer.add(labelNoRelations);
if (project.getListRelationshipDV() != null && project.getListRelationshipDV().size() > 0) {
secondProjectPanelContainer.clear();
for (RelationshipDV relationDV : project.getListRelationshipDV()) {
final FlexTable flexTable = new FlexTable();
flexTable.getElement().addClassName("box-table-diplay-project");
Label label = new Label();
label.setType(LabelType.INFO);
label.setText(relationDV.getRelationshipName());
FlowPanel panelContainer = new FlowPanel();
Button deleteRelation = new Button("", IconType.TRASH);
deleteRelation.setTitle("Delete this relation");
deleteRelation.setType(ButtonType.LINK);
deleteRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// #24571
boolean isNotInDRAFT = false;
if (fromTheProject.getLifecycleInfo() != null) {
String phase = fromTheProject.getLifecycleInfo().getPhase();
// IF the project is not in DRAFT, showing an alert and the no Update Mode will
// be activated
if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) != 0) {
String msg = ConstantsGeoPortalDataEntryApp.ALERT_MESSAGE_DELETE_RELATION_FORBIDDEN;
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
"Forbidden: " + OPERATION_ON_ITEM.DELETE_RELATION, msg, AlertType.WARNING);
modalW.show();
isNotInDRAFT = true;
}
}
//If the project is in DRAFT, going to delete the releation after confirm
if(!isNotInDRAFT) {
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
appManagerBus.fireEvent(
new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
}
}
});
panelContainer.add(label);
panelContainer.add(deleteRelation);
flexTable.setWidget(0, 0, panelContainer);
flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(
relationDV.getTargetUCD(), relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
@Override
public void onFailure(Throwable caught) {
flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
}
@Override
public void onSuccess(ResultDocumentDV result) {
mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
+ "</b> (id: " + result.getId() + ")";
flexTable.setWidget(1, 0, new HTML(htmlMsg));
FlowPanel toTemporalContainer = new FlowPanel();
flexTable.setWidget(2, 0, toTemporalContainer);
addTemportalReferenceToPanel(toTemporalContainer, result.getProfileID(), result.getProjectID());
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
false, false);
rtth2.showAsJSON(false);
flexTable.setWidget(3, 0, rtth2);
}
});
secondProjectPanelContainer.add(flexTable);
}
}
}
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
new AsyncCallback<TemporalReferenceDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(TemporalReferenceDV result) {
if (result != null) {
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
}
}
});
}
}

View File

@ -0,0 +1,68 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.view-rel-title {
font-size: 18px;
font-weight: bold;
text-align: center;
padding: 18px;
background: #eee;
}
.butt-create {
float: right;
margin-top: 10px;
}
.to-align-right {
position: absolute;
right: 5px;
}
.panel-style {
margin-top: 10px;
padding: 5px;
}
.panel-style table {
margin-top: 0px !important;
}
.panel-container-style {
padding-left: 10px;
padding-top: 5px;
}
.float-right {
float: right;
}
</ui:style>
<g:HTMLPanel>
<b:Button ui:field="closeButton"
addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="panelTitle"
addStyleNames="{style.view-rel-title}">View Relations</g:HTMLPanel>
<b:Button ui:field="buttonExpand"
addStyleNames="{style.float-right}">Expand</b:Button>
<g:HTMLPanel ui:field="firstPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>From Project</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="firstProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
<g:HTMLPanel ui:field="secondPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>To Project/s</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="secondProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,111 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
/**
* The Class LifecycleInformationPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 1, 2022
*/
public class LifecycleInformationPanel extends FlowPanel {
/**
* Instantiates a new lifecycle information panel.
*
* @param projectID the project ID
* @param profileID the profile ID
* @param projectAsJSON the project as JSON
* @param lcDV the lc DV
* @param showGoToProject the show go to project
*/
public LifecycleInformationPanel(String projectID, String profileID, String projectAsJSON,
LifecycleInformationDV lcDV, boolean showGoToProject) {
add(new HTML("Project id: " + (projectID)));
HTML htmlPhase = new HTML();
htmlPhase.setHTML("Current phase: <b>" + lcDV.getPhase() + "</b>");
HTML htmlStep = new HTML();
htmlStep.setHTML("Last invoked step: <b>" + lcDV.getLastInvokedStep() + "</b>");
HTML lastOperationStatus = new HTML();
String lastOperationMsg = "Last operation status: ";
switch (lcDV.getLastOperationStatus()) {
case OK: {
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null,
lcDV.getLastOperationStatus().toString());
break;
}
case WARNING: {
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null,
lcDV.getLastOperationStatus().toString());
break;
}
case ERROR: {
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
lcDV.getLastOperationStatus().toString());
break;
}
default:
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
lcDV.getLastOperationStatus().toString());
break;
}
lastOperationStatus.setHTML(lastOperationMsg);
add(htmlPhase);
add(htmlStep);
add(lastOperationStatus);
HTML htmlEvent = new HTML();
htmlEvent.setHTML("Last event step: <b>" + lcDV.getLastEvent() + "</b>");
if (showGoToProject) {
final HorizontalPanel hpGetLink = new HorizontalPanel();
final LoaderIcon lc = new LoaderIcon("Get link...");
hpGetLink.add(lc);
add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(projectID, profileID, GeoportalItemReferences.SHARE_LINK_TO.DATA_VIEWER,
new AsyncCallback<GeoportalItemReferences>() {
@Override
public void onFailure(Throwable caught) {
hpGetLink.clear();
}
@Override
public void onSuccess(GeoportalItemReferences result) {
hpGetLink.clear();
String theURL = result.getRestrictedLink().getShortURL() != null
? result.getRestrictedLink().getShortURL()
: result.getRestrictedLink().getCompleteURL();
String htmlLink = "<div>Go to project on Map: <a href=" + theURL + " target=\"_blank\">"
+ theURL + "</a></div>";
HTML html = new HTML(htmlLink);
hpGetLink.add(html);
// modal.add(html);
}
});
}
if (projectAsJSON != null)
add(new ReportTemplateToHTML("Project", projectAsJSON, false));
if (lcDV.getAsJSONString() != null)
add(new ReportTemplateToHTML("Lifecycle Report", lcDV.getAsJSONString(), false));
}
}

View File

@ -1,9 +1,16 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.report; package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ExternalLib;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Paragraph; import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
import com.github.gwtbootstrap.client.ui.event.HiddenHandler;
import com.github.gwtbootstrap.client.ui.event.ShowEvent;
import com.github.gwtbootstrap.client.ui.event.ShowHandler;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue; import com.google.gwt.json.client.JSONValue;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
@ -13,7 +20,6 @@ import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
/** /**
* The Class ReportTemplateToHTML. * The Class ReportTemplateToHTML.
* *
@ -41,75 +47,196 @@ public class ReportTemplateToHTML extends Composite {
@UiField @UiField
VerticalPanel htmlContainer; VerticalPanel htmlContainer;
@UiField
AccordionGroup showReportAsJSON;
@UiField
AccordionGroup showReportAsTable;
@UiField @UiField
Paragraph reportJSON; Paragraph reportJSON;
@UiField
Paragraph reportTable;
@UiField
Label labelToReport;
boolean toJSONERROR = false; boolean toJSONERROR = false;
/** /**
* Instantiates a new report template to HTML. * Instantiates a new report template to HTML.
* *
* @param report the report * @param documentLabel the document label
* @param theJSONDocument the the JSON document
* @param openTableReport the open table report
* @param openJSONReport the open JSON report
*/ */
public ReportTemplateToHTML(String report) { public ReportTemplateToHTML(String documentLabel, String theJSONDocument, boolean openTableReport,
boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false); vpContainer.setVisible(false);
if (report != null) { vpContainer.setWidth("95%");
GWT.log("report is: " + report);
showReportAsJSON.setDefaultOpen(openJSONReport);
showReportAsTable.setDefaultOpen(openTableReport);
documentLabel = documentLabel == null ? "Document" : documentLabel;
labelToReport.setText(documentLabel);
// showReportAsJSON.setIconPosition(IconPosition.RIGHT);
if (openTableReport) {
showReportAsTable.setIcon(IconType.ARROW_DOWN);
} else {
showReportAsTable.setIcon(IconType.ARROW_RIGHT);
}
if (openJSONReport) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
} else {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
showReportAsTable.addShowHandler(new ShowHandler() {
@Override
public void onShow(ShowEvent showEvent) {
showReportAsTable.setIcon(IconType.ARROW_DOWN);
}
});
showReportAsTable.addHiddenHandler(new HiddenHandler() {
@Override
public void onHidden(HiddenEvent hiddenEvent) {
showReportAsTable.setIcon(IconType.ARROW_RIGHT);
}
});
showReportAsJSON.addShowHandler(new ShowHandler() {
@Override
public void onShow(ShowEvent showEvent) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
}
});
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
@Override
public void onHidden(HiddenEvent hiddenEvent) {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
});
if (theJSONDocument != null) {
GWT.log("report is: " + theJSONDocument);
vpContainer.setVisible(true); vpContainer.setVisible(true);
try { try {
JSONValue jsonObj = JSONParser.parse(report);
JSONObject json = (JSONObject) jsonObj;
JSONValue valueChildren = json.get("children");
JSONArray jsonChildren = (JSONArray) valueChildren;
/*JSONObject jsonChildrenObject = (JSONObject) jsonChildren.get(0);
if (jsonChildrenObject.containsKey("objectName")) { JSONValue jsonObj = JSONParser.parse(theJSONDocument);
JSONValue validationReportON = jsonChildrenObject.get("objectName"); String toTableHTML = jsonToHTML(jsonObj.toString());
String titleValue = HTMLUtil.getHTMLElement(HTML_TAG.div, 14, "000", "bold", validationReportON.toString()); GWT.log("HTML table: " + toTableHTML);
htmlContainer.add(new HTML(titleValue));
}
String toTableHTML = jsonToHTML(jsonChildrenObject.get("children").toString()); reportTable.add(new HTML(toTableHTML));
GWT.log("toJSONERROR is: " + toJSONERROR);
GWT.log("toTableHTML is: " + toTableHTML);
Set<String> keySet = jsonChildrenObject.keySet();*/
String toTableHTML = null;
for (int i=0; i<jsonChildren.size(); i++) {
JSONObject jsO = (JSONObject) jsonChildren.get(i);
if (jsO.containsKey("children")) {
/*if (jsO.containsKey("objectName")) {
JSONValue validationReportON = jsO.get("objectName");
String titleValue = HTMLUtil.getHTMLElement(HTML_TAG.div, 14, "000", "bold", validationReportON.toString());
htmlContainer.add(new HTML(titleValue));
}*/
toTableHTML = jsonToHTML(jsO.get("children").toString());
}else {
toTableHTML = jsonToHTML(jsO.toString());
}
htmlContainer.add(new HTML(toTableHTML));
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
GWT.log("error: " + e.getMessage()); GWT.log("error: " + e.getMessage());
showReportAsTable.setVisible(false);
} }
reportJSON.setText(report);
reportJSON.add(new HTML("<pre>" + ExternalLib.toPrettyPrintJSON(theJSONDocument) + "</pre>"));
} }
} }
/**
* Instantiates a new report template to HTML. Shows the JSON Document as Table
* HTML by default
*
* @param documentLabel the document label
* @param theJSONDocument the the JSON document
* @param openJSONReport the open JSON report
*/
public ReportTemplateToHTML(String documentLabel, String theJSONDocument, boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false);
showReportAsTable.setVisible(false);
showReportAsJSON.setDefaultOpen(openJSONReport);
documentLabel = documentLabel == null ? "Document" : documentLabel;
labelToReport.setText(documentLabel);
// showReportAsJSON.setIconPosition(IconPosition.RIGHT);
if (openJSONReport) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
} else {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
showReportAsJSON.addShowHandler(new ShowHandler() {
@Override
public void onShow(ShowEvent showEvent) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
}
});
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
@Override
public void onHidden(HiddenEvent hiddenEvent) {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
});
if (theJSONDocument != null) {
GWT.log("report is: " + theJSONDocument);
vpContainer.setVisible(true);
try {
JSONValue jsonObj = JSONParser.parse(theJSONDocument);
String toTableHTML = jsonToHTML(jsonObj.toString());
GWT.log("HTML table: " + toTableHTML);
htmlContainer.add(new HTML(toTableHTML));
} catch (Exception e) {
e.printStackTrace();
GWT.log("error: " + e.getMessage());
showReportAsTable.setVisible(false);
}
reportJSON.add(new HTML("<pre>" + ExternalLib.toPrettyPrintJSON(theJSONDocument) + "</pre>"));
}
}
public void showAsHTMLTable(boolean bool) {
showReportAsTable.setVisible(bool);
}
public void showAsJSON(boolean bool) {
showReportAsJSON.setVisible(bool);
}
/** /**
* Json to HTML. * Json to HTML.
* *
* @param jsonTxt the json txt * @param jsonTxt the json txt
* @return the string * @return the string
*/ */
public static native String jsonToHTML(String jsonTxt)/*-{ private static native String jsonToHTML(String jsonTxt)/*-{
try { try {
var jsonObj = JSON.parse(jsonTxt); var jsonObj = JSON.parse(jsonTxt);
@ -155,8 +282,7 @@ public class ReportTemplateToHTML extends Composite {
formattedValueArray += theValueArray + "<br>"; formattedValueArray += theValueArray + "<br>";
} }
tabCell.innerHTML = formattedValueArray; tabCell.innerHTML = formattedValueArray;
} } else {
else{
tabCell.innerHTML = theValue; tabCell.innerHTML = theValue;
} }
} }

View File

@ -10,13 +10,23 @@
.margin-top-10 { .margin-top-10 {
margin-top: 10px; margin-top: 10px;
} }
.table-style {
margin-top: 10px;
width: 95%;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<g:VerticalPanel ui:field="vpContainer" <g:VerticalPanel ui:field="vpContainer"
addStyleNames="{style.margin-top-10}"> addStyleNames="{style.table-style}">
<b:Label>Publication Report: </b:Label> <b:Label ui:field="labelToReport">Report: </b:Label>
<g:VerticalPanel ui:field="htmlContainer" addStyleNames="{style.margin-top-10}"></g:VerticalPanel> <g:VerticalPanel ui:field="htmlContainer"
<b:AccordionGroup heading="Show Report as JSON"> addStyleNames="{style.table-style}"></g:VerticalPanel>
<b:AccordionGroup heading="Show as Table"
ui:field="showReportAsTable">
<b:Paragraph ui:field="reportTable"></b:Paragraph>
</b:AccordionGroup>
<b:AccordionGroup heading="Show as JSON"
ui:field="showReportAsJSON">
<b:Paragraph ui:field="reportJSON"></b:Paragraph> <b:Paragraph ui:field="reportJSON"></b:Paragraph>
</b:AccordionGroup> </b:AccordionGroup>

View File

@ -0,0 +1,208 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.gcube.portlets.user.geoportaldataentry.client.events.ClickItemEvent;
import com.github.gwtbootstrap.client.ui.Pagination;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class AbstractItemsCellTable.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 11, 2017
* @param <T> the generic type
*/
public abstract class AbstractItemsCellTable<T> {
protected SortedCellTable<T> sortedCellTable;
protected T itemContextMenu = null;
protected boolean fireEventOnClick = true;
protected SelectionModel<T> theSelectionModel;
protected HandlerManager eventBus;
/**
* Inits the table.
*
* @param pager the pager
* @param pagination the pagination
* @param dataProvider the data provider
*/
public abstract void initTable(final SimplePager pager, final Pagination pagination,
AbstractDataProvider<T> dataProvider);
/**
* Inits the abstract table.
*
* @param eventBus the event bus
* @param fireOnClick the fire on click
* @param dataProvider the data provider
* @param selectionModel the selection model
* @param pageSize the page size
*/
protected void initAbstractTable(HandlerManager eventBus, boolean fireOnClick, AbstractDataProvider<T> dataProvider,
SelectionModel<T> selectionModel, int pageSize) {
this.eventBus = eventBus;
this.fireEventOnClick = fireOnClick;
this.theSelectionModel = selectionModel;
sortedCellTable = new SortedCellTable<T>(pageSize, dataProvider);
sortedCellTable.addStyleName("table-glor");
sortedCellTable.addStyleName("table-glor-vertical-middle");
//sortedCellTable.setStriped(true);
sortedCellTable.setCondensed(true);
sortedCellTable.setWidth("100%", true);
sortedCellTable.setAutoHeaderRefreshDisabled(true);
sortedCellTable.setAutoFooterRefreshDisabled(true);
// dataProvider.addDataDisplay(sortedCellTable);
// initTable(cellTable, null, null);
//sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
// DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager();
// sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager);
sortedCellTable.setSelectionModel(theSelectionModel);
theSelectionModel.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
if (theSelectionModel instanceof SingleSelectionModel) {
SingleSelectionModel<T> ssm = (SingleSelectionModel<T>) theSelectionModel;
final T selectedObject = ssm.getSelectedObject();
if (selectedObject != null) {
GWT.log("Clicked: " + selectedObject);
// selectedItem(selectedObject);
if (fireEventOnClick)
AbstractItemsCellTable.this.eventBus.fireEvent(new ClickItemEvent<T>(Arrays.asList(selectedObject)));
}
}else if (theSelectionModel instanceof MultiSelectionModel) {
Set<T> selected = ((MultiSelectionModel<T>) theSelectionModel).getSelectedSet();
GWT.log("Selected are:" +selected);
if (fireEventOnClick)
AbstractItemsCellTable.this.eventBus.fireEvent(new ClickItemEvent<T>(new ArrayList<T>(selected)));
}
}
});
sortedCellTable.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(final DoubleClickEvent event) {
if (theSelectionModel instanceof SingleSelectionModel) {
SingleSelectionModel<T> ssm = (SingleSelectionModel<T>) theSelectionModel;
T selected = ssm.getSelectedObject();
if (selected != null) {
GWT.log("Double Click: " + selected);
// AbstractItemsCellTable.this.eventBus.fireEvent(new
// org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent<T>(selected));
}
}
}
}, DoubleClickEvent.getType());
MenuBar options = new MenuBar(true);
ScheduledCommand openCommand = new ScheduledCommand() {
@Override
public void execute() {
GWT.log("Context menu shown: " + itemContextMenu);
// AbstractItemsCellTable.this.eventBus.fireEvent(new
// org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent<T>(itemContextMenu));
}
};
MenuItem openItem = new MenuItem("Open", openCommand);
options.addItem(openItem);
final DialogBox menuWrapper = new DialogBox(true);
menuWrapper.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
menuWrapper.getElement().getStyle().setZIndex(10000);
menuWrapper.add(options);
sortedCellTable.sinkEvents(Event.ONCONTEXTMENU);
sortedCellTable.addHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
}
}, ContextMenuEvent.getType());
}
/**
* Gets the cell tables.
*
* @return the cell tables
*/
public SortedCellTable<T> getCellTable() {
return sortedCellTable;
}
/**
* Checks if is fire event on click.
*
* @return the fireEventOnClick
*/
public boolean isFireEventOnClick() {
return fireEventOnClick;
}
/**
* Sets the fire event on click.
*
* @param fireEventOnClick the fireEventOnClick to set
*/
public void setFireEventOnClick(boolean fireEventOnClick) {
this.fireEventOnClick = fireEventOnClick;
}
/**
* Adds the items.
*
* @param items the items
*/
public void addItems(List<T> items) {
AbstractDataProvider<T> dataProvider = sortedCellTable.getDataProvider();
if (dataProvider instanceof ListDataProvider) {
List<T> ldp = ((ListDataProvider<T>) dataProvider).getList();
for (int i = 0; i < items.size(); i++) {
ldp.add(i, items.get(i));
}
sortedCellTable.setPageSize(items.size() + 1);
sortedCellTable.redraw();
} else if (dataProvider instanceof AsyncDataProvider) {
// TODO ???
}
}
}

View File

@ -0,0 +1,635 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
import com.github.gwtbootstrap.client.ui.ButtonCell;
import com.github.gwtbootstrap.client.ui.Pagination;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class ItemsTable.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
*/
public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T> {
private static final String CSS_CLASS_BACK_SYSTEM_CELL_B = "back-system-cell-b";
private static final String CSS_CLASS_BACK_SYSTEM_CELL_O = "back-system-cell-o";
private static final String CSS_CLASS_BACK_SYSTEM_CELL_Y = "back-system-cell-y";
private static final int MAX_TEXT_DIMENSION = 350;
private static final int ITEMS_PER_PAGE = 10;
private static final String NO_DATA = "No data";
public static DateTimeFormat dtformat = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
private AbstractDataProvider<T> dataProvider;
private List<ItemFieldDV> displayFields;
private boolean isAsyncronusTable;
private Map<DEFAULT_DISPLAYING_COLUMN_NAME, Column> mapColumns = new HashMap<DEFAULT_DISPLAYING_COLUMN_NAME, Column>();
public enum DEFAULT_DISPLAYING_COLUMN_NAME {
CREATED("Created"), CREATED_BY("Created by"), PHASE("Phase"), STATUS("Status"), RELATIONSHIPS("Relationships");
String title;
DEFAULT_DISPLAYING_COLUMN_NAME(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
}
/**
* Instantiates a new items table.
*
* @param eventBus the event bus
* @param displayFields the display fields
* @param startSortByColumn the start sort by column
*/
public ItemsTable(HandlerManager eventBus, List<ItemFieldDV> displayFields) {
this.eventBus = eventBus;
this.displayFields = displayFields;
}
/**
* Adds the items.
*
* @param items the items
*/
public void addItems(List<T> items) {
super.addItems(items);
}
class CellRender {
String tooltip;
String value;
public CellRender() {
}
public String getTooltip() {
return tooltip;
}
public String getValue() {
return value;
}
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}
public void setValue(String value) {
this.value = value;
}
}
public CellRender toCellRender(ItemFieldDV itemField, DocumentDV documentDV) {
StringBuilder tooltipBuilder = new StringBuilder();
StringBuilder valueBuilder = new StringBuilder();
String newLine = "<br>";
String newLineTxt = "\n";
String bullet = "&#8226; "; // it is the dot. As <li> rendered in the <ul> tag
String newBullet = newLine + bullet;
List<String> listJsonFields = itemField.getJsonFields();
int numberOfFields = listJsonFields.size();
if (numberOfFields > 1) {
valueBuilder.append(bullet);
}
for (String jsonKey : listJsonFields) {
try {
String objectToRender = "";
// removing the '_theDocument.' prefix for searching in the Document Map
String key = jsonKey.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
// GWT.log("key: "+key+" is instance of: "+value.getClass());
if (value == null)
continue;
GWT.log("value instance: " + value.getClass());
if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass() + " to return: "
+ toReturn);
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
objectToRender = StringUtil.ellipsize(value.toString(), MAX_TEXT_DIMENSION);
}
valueBuilder.append(objectToRender);
valueBuilder.append(newBullet);
if (numberOfFields > 1) {
tooltipBuilder.append("* " + key + newLineTxt);
}else {
tooltipBuilder.append(key);
}
} catch (Exception e) {
GWT.log("Error e: " + e);
}
}
CellRender cellRender = new CellRender();
String toRender = valueBuilder.toString();
cellRender.setValue(toRender.substring(0, toRender.length() - newBullet.length()));
String toTooltip = tooltipBuilder.toString();
toTooltip = numberOfFields > 1 ? toTooltip.substring(0, toTooltip.length() - newLineTxt.length())
: toTooltip;
cellRender.setTooltip(toTooltip);
return cellRender;
}
interface Templates extends SafeHtmlTemplates {
/**
* Start tool tip.
*
* @param toolTipText the tool tip text
* @return the safe html
*/
@Template("<span title=\"{0}\">")
SafeHtml startToolTip(String toolTipText);
/**
* End tool tip.
*
* @return the safe html
*/
@Template("</span>")
SafeHtml endToolTip();
}
/**
* Inits the table.
*
* @param pager the pager
* @param pagination the pagination
* @param dataProvider the data provider
*/
@Override
public void initTable(final SimplePager pager, final Pagination pagination, AbstractDataProvider<T> dataProvider) {
this.dataProvider = dataProvider;
this.theSelectionModel = new SingleSelectionModel<T>();
initAbstractTable(eventBus, fireEventOnClick, dataProvider, theSelectionModel, ITEMS_PER_PAGE);
this.dataProvider.addDataDisplay(sortedCellTable);
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
setEmptyTableMessage(NO_DATA);
int i = 1;
for (ItemFieldDV itemField : displayFields) {
if (i > ConstantsGeoPortalDataEntryApp.MAX_COLUMN_DISPLAYED_IN_THE_TABLE) {
break;
}
String displayName = itemField.getDisplayName();
TextColumn<T> col = new TextColumn<T>() {
@Override
public String getValue(T object) {
return "";
}
@Override
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
if (object == null)
return;
Templates TEMPLATES = GWT.create(Templates.class);
CellRender cellRender = toCellRender(itemField, object);
sb.append(TEMPLATES.startToolTip(cellRender.getTooltip()));
sb.appendHtmlConstant(cellRender.getValue());
sb.append(TEMPLATES.endToolTip());
};
};
sortedCellTable.addColumn(col, displayName, true);
i++;
}
// COL RELATIONS
TextColumn<T> colRelationship = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object;
String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV());
return htmlValue;
}
@Override
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
if (object == null)
return;
ResultDocumentDV documentDV = (ResultDocumentDV) object;
List<RelationshipDV> relations = documentDV.getListRelationshipDV();
String color = "#333";
if (relations == null || relations.isEmpty()) {
color = "#555";
}
sb.appendHtmlConstant("<span style='color:" + color + "; font-style: italic;'>");
super.render(context, object, sb);
sb.appendHtmlConstant("</span>");
};
};
colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_B);
sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship);
// COL CREATED
TextColumn<T> colCreated = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object;
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
String created = "N.A.";
try {
created = publicationInfoDV.getCreationInfo().getLocalDate();
} catch (Exception e) {
// TODO: handle exception
}
return created;
}
};
colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
sortedCellTable.addColumn(colCreated, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED.getTitle(), true);
sortedCellTable.setColumnWidth(colCreated, 130, Unit.PX);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED, colCreated);
// COL PUBLISHER
TextColumn<T> colPublisher = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object;
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
String username = "N.A.";
try {
username = publicationInfoDV.getCreationInfo().getUsername();
} catch (Exception e) {
// TODO: handle exception
}
return username;
}
};
colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
sortedCellTable.addColumn(colPublisher, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY.getTitle(), true);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY, colPublisher);
// COL PUBLICATION PHASE
TextColumn<T> colPublicationPhase = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object;
String phase = "N.A.";
try {
phase = documentDV.getLifecycleInfo().getPhase();
} catch (Exception e) {
// TODO: handle exception
}
return phase;
}
};
colPublicationPhase.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y);
sortedCellTable.addColumn(colPublicationPhase, DEFAULT_DISPLAYING_COLUMN_NAME.PHASE.getTitle(), true);
sortedCellTable.setColumnWidth(colPublicationPhase, 120, Unit.PX);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.PHASE, colPublicationPhase);
// COL OPERTION STATUS
TextColumn<T> colOperationStatus = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object;
String status = "N.A.";
try {
status = documentDV.getLifecycleInfo().getLastOperationStatus().toString();
} catch (Exception e) {
// TODO: handle exception
}
return status;
}
@Override
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
if (object == null)
return;
ResultDocumentDV documentDV = (ResultDocumentDV) object;
Status status = null;
try {
status = documentDV.getLifecycleInfo().getLastOperationStatus();
} catch (Exception e) {
}
String color = "#000";
if (status.equals(Status.OK)) {
color = "#32CD32";
} else if (status.equals(Status.WARNING)) {
color = "#FF8000";
} else if (status.equals(Status.ERROR)) {
color = "red";
}
sb.appendHtmlConstant("<span style='color:" + color + ";'>");
super.render(context, object, sb);
sb.appendHtmlConstant("</span>");
};
};
colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y);
sortedCellTable.addColumn(colOperationStatus, DEFAULT_DISPLAYING_COLUMN_NAME.STATUS.getTitle(), true);
sortedCellTable.setColumnWidth(colOperationStatus, 120, Unit.PX);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.STATUS, colOperationStatus);
}
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
try {
Column theColumn = mapColumns.get(columnName);
if (theColumn != null) {
sortedCellTable.removeColumn(theColumn);
}
} catch (Exception e) {
}
}
private String toDisplayClusterOfRelationships(List<RelationshipDV> listRelations) {
if (listRelations == null || listRelations.isEmpty()) {
return "None";
}
LinkedHashMap<String, Integer> mapclusterOfRelationships = new LinkedHashMap<String, Integer>(
listRelations.size());
for (RelationshipDV relationshipDV : listRelations) {
Integer count = mapclusterOfRelationships.get(relationshipDV.getRelationshipName());
if (count == null)
count = 0;
count++;
mapclusterOfRelationships.put(relationshipDV.getRelationshipName(), count);
}
String html = "";
for (String relationName : mapclusterOfRelationships.keySet()) {
html += mapclusterOfRelationships.get(relationName) + " - " + relationName + "; ";
}
return html;
}
/**
* To display authors.
*
* @param authors the authors
* @return the string
*/
private String toDisplayAuthors(List<String> authors) {
String toDisplay = "";
if (authors == null)
return toDisplay;
for (String author : authors) {
toDisplay += author + "; ";
}
return toDisplay;
}
/**
* Displays the appropriate sorted icon in the header of the column for the
* given index.
*
* @param columnIndex of the column to mark as sorted
* @param ascending <code>true</code> for ascending icon, <code>false</code>
* for descending icon
*/
public void setSortedColumn(int columnIndex, boolean ascending) {
GWT.log("Column index: " + columnIndex);
GWT.log("ascending: " + ascending);
Column<T, ?> column = sortedCellTable.getColumn(columnIndex);
if (column != null && column.isSortable()) {
ColumnSortInfo info = sortedCellTable.getColumnSortList().push(column);
// ColumnSortEvent.fire(cellTable, cellTable.getColumnSortList());
GWT.log("info.isAscending(): " + info.isAscending());
if (info.isAscending() != ascending) {
sortedCellTable.getColumnSortList().push(column);
ColumnSortEvent.fire(sortedCellTable, sortedCellTable.getColumnSortList());
}
}
}
// /**
// * Sets the display fields.
// *
// * @param fields the new display fields
// */
// public void setDisplayFields(List<ItemField> fields) {
// this.displayFields = fields != null && fields.size() > 0 ? Arrays.asList(fields)
// : Arrays.asList(RECORD_FIELD.values());
// }
/**
* Reset columns table.
*/
public void reInitColumnsTable() {
int count = sortedCellTable.getColumnCount();
for (int i = 0; i < count; i++) {
sortedCellTable.removeColumn(0);
}
initTable(null, null, dataProvider);
}
/**
* Gets the display fields.
*
* @return the displayFields
*/
public List<ItemFieldDV> getDisplayFields() {
return displayFields;
}
/**
* The Class ButtonImageCell.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 1, 2016
*/
public class ButtonImageCell extends ButtonCell {
/**
* Render.
*
* @param context the context
* @param value the value
* @param sb the sb
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.cell.client.AbstractSafeHtmlCell#render(com.google.gwt.cell.
* client.Cell.Context, java.lang.Object,
* com.google.gwt.safehtml.shared.SafeHtmlBuilder)
*/
@Override
public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
SafeHtml html = SafeHtmlUtils.fromTrustedString(new Image(value).toString());
sb.append(html);
}
}
/**
* Gets the selected item.
*
* @return the selected item
*/
public List<T> getSelectedItems() {
if (theSelectionModel instanceof SingleSelectionModel) {
T selected = ((SingleSelectionModel<T>) theSelectionModel).getSelectedObject();
if (selected != null) {
return Arrays.asList(selected);
}
} else if (theSelectionModel instanceof MultiSelectionModel) {
Set<T> selected = ((MultiSelectionModel<T>) theSelectionModel).getSelectedSet();
if (selected != null) {
return new ArrayList<T>(selected);
}
}
return null;
}
/**
* Sets the empty table message.
*
* @param msg the new empty table message
*/
public void setEmptyTableMessage(String msg) {
msg = msg != null ? msg : NO_DATA;
if (sortedCellTable != null)
sortedCellTable.setEmptyTableWidget(new Label(msg));
}
/**
* Gets the selection model.
*
* @return the selection model
*/
public SelectionModel<T> getSelectionModel() {
return theSelectionModel;
}
}

View File

@ -0,0 +1,82 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.Column;
/**
* The Class MyToolTipColumn.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
* @param <C> the generic type
*/
public abstract class MyToolTipColumn<T, C> extends Column<T, C> {
/**
* The Interface Templates.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
*/
interface Templates extends SafeHtmlTemplates {
/**
* Start tool tip.
*
* @param toolTipText the tool tip text
* @return the safe html
*/
@Template("<span title=\"{0}\">")
SafeHtml startToolTip(String toolTipText);
/**
* End tool tip.
*
* @return the safe html
*/
@Template("</span>")
SafeHtml endToolTip();
}
private static final Templates TEMPLATES = GWT.create(Templates.class);
private final String toolTipText;
/**
* Instantiates a new my tool tip column.
*
* @param cell the cell
* @param toolTipText the tool tip text
*/
public MyToolTipColumn(final Cell<C> cell, final String toolTipText) {
super(cell);
this.toolTipText = toolTipText;
}
/**
* Render.
*
* @param context the context
* @param object the object
* @param sb the sb
*/
@Override
public void render(final Context context, final T object, final SafeHtmlBuilder sb) {
sb.append(TEMPLATES.startToolTip(toolTipText));
super.render(context, object, sb);
sb.append(TEMPLATES.endToolTip());
}
}

View File

@ -0,0 +1,304 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataentry.client.resource.CellTableResources;
import com.github.gwtbootstrap.client.ui.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.ListDataProvider;
/**
* The Class SortedCellTable.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
*/
public class SortedCellTable<T> extends CellTable<T> {
/**
* To keep track of the currently sorted column
*/
private Column<T, ?> currentlySortedColumn;
/**
* Tells us which way to sort a column initially
*/
private Map<Column<T, ?>, Boolean> defaultSortOrderMap = new HashMap<Column<T, ?>, Boolean>();
/**
* Comparators associated with their columns
*/
private Map<Column<T, ?>, Comparator<T>> comparators = new HashMap<Column<T, ?>, Comparator<T>>();
/**
* Column to sort when the data provider's list is refreshed using
* {@link SortedCellTable#setList(List)}
*/
private Column<T, ?> initialSortColumn;
/**
* Data provider we will attach to this table
*/
private AbstractDataProvider<T> dataProvider;
/**
* Special column sorting handler that will allow us to do more controlled
* sorting
*/
private ColumnSortEvent.Handler columnSortHandler;
/**
* Instantiates a new sorted cell table.
*
* @param pageSize the page size
* @param dataProv the data prov
*/
public SortedCellTable(int pageSize, AbstractDataProvider<T> dataProv) {
super(pageSize, CellTableResources.INSTANCE);
this.dataProvider = dataProv;
if (this.dataProvider instanceof ListDataProvider) {
ListDataProvider<T> listDataProvider = (ListDataProvider<T>) this.dataProvider;
ListHandler<T> listSortHandler = new ListHandler<T>((listDataProvider).getList()) {
@Override
public void onColumnSort(ColumnSortEvent event) {
@SuppressWarnings("unchecked")
Column<T, ?> column = (Column<T, ?>) event.getColumn();
if (column == null) {
return;
}
if (column.equals(currentlySortedColumn)) {
// Default behavior
super.onColumnSort(event);
} else {
// Initial sort; look up which direction we need
final Comparator<T> comparator = comparators.get(column);
if (comparator == null) {
return;
}
Boolean ascending = defaultSortOrderMap.get(column);
if (ascending == null || ascending) {
// Default behavior
super.onColumnSort(event);
} else {
// Sort the column descending
Collections.sort(getList(), new Comparator<T>() {
public int compare(T o1, T o2) {
return -comparator.compare(o1, o2);
}
});
// Set the proper arrow in the header
getColumnSortList().push(new ColumnSortInfo(column, false));
}
currentlySortedColumn = column;
}
}
@Override
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
comparators.put(column, comparator);
super.setComparator(column, comparator);
}
};
addColumnSortHandler(listSortHandler);
columnSortHandler = listSortHandler;
} else if (this.dataProvider instanceof AsyncDataProvider) {
// AsyncDataProvider asyncDataProvider = ((AsyncDataProvider)
// this.dataProvider);
// asyncDataProvider.get
AsyncHandler asyncSortHandler = new AsyncHandler(this) {
@Override
public void onColumnSort(ColumnSortEvent event) {
@SuppressWarnings("unchecked")
Column<T, ?> column = (Column<T, ?>) event.getColumn();
if (column == null) {
return;
}
if (column.equals(currentlySortedColumn)) {
// Default behavior
super.onColumnSort(event);
} else {
// Initial sort; look up which direction we need
final Comparator<T> comparator = comparators.get(column);
if (comparator == null) {
return;
}
Boolean ascending = defaultSortOrderMap.get(column);
if (ascending == null || ascending) {
// Default behavior
super.onColumnSort(event);
} else {
// Sort the column descending
Collections.sort(getVisibleItems(), new Comparator<T>() {
public int compare(T o1, T o2) {
return -comparator.compare(o1, o2);
}
});
// Set the proper arrow in the header
getColumnSortList().push(new ColumnSortInfo(column, false));
}
currentlySortedColumn = column;
}
}
};
// addColumnSortHandler(asyncSortHandler);
// columnSortHandler = asyncSortHandler;
}
}
/**
* Adds a column to the table and sets its sortable state.
*
* @param column the column
* @param headerName the header name
* @param sortable the sortable
*/
public void addColumn(Column<T, ?> column, String headerName, boolean sortable) {
addColumn(column, headerName);
column.setSortable(sortable);
if (sortable) {
defaultSortOrderMap.put(column, true);
}
}
/**
* Adds the column.
*
* @param column the column
* @param headerName the header name
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.user.cellview.client.AbstractCellTable#addColumn(com.google.
* gwt.user.cellview.client.Column, java.lang.String)
*/
public void addColumn(Column<T, ?> column, String headerName) {
super.addColumn(column, headerName);
}
/**
* Adds a column to the table and sets its sortable state.
*
* @param column the column
* @param header the header
* @param sortable the sortable
*/
public void addColumn(Column<T, ?> column, Header<?> header, boolean sortable) {
addColumn(column, header);
column.setSortable(sortable);
if (sortable) {
defaultSortOrderMap.put(column, true);
}
}
/**
* Sets the column to sort when the data list is reset using
* {@link SortedCellTable#setList(List)}.
*
* @param column the column
*/
public void setInitialSortColumn(Column<T, ?> column) {
initialSortColumn = column;
}
/**
* Set the comparator used to sort the specified column in ascending order.
*
* @param column the {@link Column}
* @param comparator the {@link Comparator} to use for the {@link Column}
*/
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
comparators.put(column, comparator);
}
/**
* Sets the sort order to use when this column is clicked and it was not
* previously sorted.
*
* @param column the column
* @param ascending the ascending
*/
public void setDefaultSortOrder(Column<T, ?> column, boolean ascending) {
defaultSortOrderMap.put(column, ascending);
}
/**
* Sets the table's data provider list and sorts the table based on the column
* given in {@link SortedCellTable#setInitialSortColumn(Column)}.
*
* @param list the new list
*/
public void setList(List<T> list) {
if (dataProvider instanceof ListDataProvider) {
List<T> myData = ((ListDataProvider) dataProvider).getList();
myData.clear();
if (list != null) {
/*
* for (T t : list) { dataProvider.getList().add(t); }
*/
myData.addAll(list);
}
// Do a first-time sort based on which column was set in
// setInitialSortColumn()
if (initialSortColumn != null) {
Collections.sort(myData, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
return (defaultSortOrderMap.get(initialSortColumn) ? 1 : -1)
* comparators.get(initialSortColumn).compare(o1, o2);
}
});
// Might as well get the little arrow on the header to make it
// official
getColumnSortList()
.push(new ColumnSortInfo(initialSortColumn, defaultSortOrderMap.get(initialSortColumn)));
currentlySortedColumn = initialSortColumn;
}
}
}
/**
* Gets the data provider.
*
* @return the data provider
*/
public AbstractDataProvider<T> getDataProvider() {
return dataProvider;
}
}

View File

@ -0,0 +1,278 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.tree;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
public class NodeItem extends Composite {
private static NodeItemUiBinder uiBinder = GWT.create(NodeItemUiBinder.class);
interface NodeItemUiBinder extends UiBinder<Widget, NodeItem> {
}
@UiField
Icon iconField;
@UiField
HTML htmlNode;
@UiField
Button buttonAdd;
@UiField
Button buttonRemove;
private GeoNaFormCardModel geoNaFormCardModel;
private TreeItem parentTreeItem;
private String jsonSectionFullPath;
private boolean canBeDuplicated;
private boolean canBeDeleted;
private boolean isRoot = false;
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
private String nodeHTMLLabel;
public NodeItem(TreeItem parent, String nodeHTMLLabel, GeoNaFormCardModel geoNaFormCardModel,
boolean canBeDuplicated, boolean canBeDeleted, String jsonSectionFullPath) {
initWidget(uiBinder.createAndBindUi(this));
this.geoNaFormCardModel = geoNaFormCardModel;
this.parentTreeItem = parent;
this.jsonSectionFullPath = jsonSectionFullPath;
this.canBeDuplicated = canBeDuplicated;
this.canBeDeleted = canBeDeleted;
this.nodeHTMLLabel = nodeHTMLLabel;
htmlNode.setHTML(this.nodeHTMLLabel);
buttonAdd.setVisible(false);
buttonRemove.setVisible(false);
if (canBeDuplicated) {
buttonAdd.setIcon(IconType.COPY);
// buttonAdd.getElement().getStyle().setProperty("pointerEvents", "none");
buttonAdd.getElement().getStyle().setProperty("textDecoration", "none");
buttonAdd.getElement().getStyle().setColor("#555");
buttonAdd.setVisible(true);
}
if (canBeDeleted) {
buttonRemove.setIcon(IconType.TRASH);
// buttonRemove.getElement().getStyle().setProperty("pointerEvents", "none");
buttonRemove.getElement().getStyle().setProperty("textDecoration", "none");
buttonRemove.getElement().getStyle().setColor("#555");
buttonRemove.setVisible(true);
}
htmlNode.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
}
});
// Is not the root node
if (geoNaFormCardModel != null) {
geoNaFormCardModel.getMetadataForm().addListener(formCardEventHandler);
resetNodeStatus();
}
}
/**
* The Class MetadataFormCardEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 12, 2020
*/
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
/**
* On form data valid.
*
* @param genericDatasetBean the generic dataset bean
*/
@Override
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
setNodeStatus();
}
/**
* On form data edit.
*/
@Override
public void onFormDataEdit() {
resetNodeStatus();
}
/**
* On form aborted.
*/
@Override
public void onFormAborted() {
// TODO Auto-generated method stub
}
/**
* On validation error.
*
* @param throwable the throwable
* @param errorMsg the error msg
*/
@Override
public void onValidationError(Throwable throwable, String errorMsg) {
// TODO Auto-generated method stub
}
}
/**
* Validate form.
*
* @return true, if successful
*/
public boolean validateForm() {
if (isRoot) {
return true;
}
CreateMetadataForm createMetadataForm = geoNaFormCardModel.getMetadataForm();
boolean isFormDataValid = createMetadataForm.isFormDataValid();
GWT.log("Is form data valid: " + isFormDataValid);
if (!isFormDataValid) {
return false;
}
return true;
}
/**
* Sets the valid card.
*
* @param bool the new valid card
*/
public void setValidCard(boolean bool) {
if (bool) {
iconField.setIcon(IconType.OK_SIGN);
iconField.getElement().removeClassName("red-text");
iconField.getElement().addClassName("green-text");
htmlNode.getElement().removeClassName("red-text");
htmlNode.getElement().addClassName("green-text");
} else {
iconField.setIcon(IconType.MINUS_SIGN);
iconField.getElement().removeClassName("green-text");
iconField.getElement().addClassName("red-text");
htmlNode.getElement().removeClassName("green-text");
htmlNode.getElement().addClassName("red-text");
}
}
/**
* Sets the tab status.
*/
private void setNodeStatus() {
boolean isValid = validateForm();
if (isValid) {
iconField.setIcon(IconType.OK_SIGN);
iconField.getElement().removeClassName("red-text");
iconField.getElement().addClassName("green-text");
htmlNode.getElement().removeClassName("red-text");
htmlNode.getElement().addClassName("green-text");
} else {
iconField.setIcon(IconType.MINUS_SIGN);
iconField.getElement().removeClassName("green-text");
iconField.getElement().addClassName("red-text");
htmlNode.getElement().removeClassName("green-text");
htmlNode.getElement().addClassName("red-text");
}
}
public boolean isRoot() {
return isRoot;
}
public void setRoot(boolean isRoot) {
this.isRoot = isRoot;
}
private void resetNodeStatus() {
iconField.setIcon(null);
}
public TreeItem getParentTreeItem() {
return parentTreeItem;
}
public GeoNaFormCardModel getGeoNaFormCardModel() {
return geoNaFormCardModel;
}
/**
* Gets the json section full path.
*
* @return the json section full path
*/
public String getJsonSectionFullPath() {
return jsonSectionFullPath;
}
public boolean isCanBeDeleted() {
return canBeDeleted;
}
public boolean isCanBeDuplicated() {
return canBeDuplicated;
}
public HTML getHtmlNode() {
return htmlNode;
}
public String getNodeHTMLLabel() {
return nodeHTMLLabel;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("NodeItem [jsonSectionFullPath=");
builder.append(jsonSectionFullPath);
builder.append(", canBeDuplicated=");
builder.append(canBeDuplicated);
builder.append(", canBeDeleted=");
builder.append(canBeDeleted);
builder.append(", isRoot=");
builder.append(isRoot);
builder.append(", nodeHTMLLabel=");
builder.append(nodeHTMLLabel);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,29 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.margin-left-20 {
margin-left: 20px;
}
.margin-left-10 {
margin-left: 10px;
}
.padding-right-5 {
padding-right: 5px;
}
</ui:style>
<g:HorizontalPanel>
<g:HTMLPanel addStyleNames="{style.padding-right-5}">
<b:Icon type="OK_SIGN" ui:field="iconField"></b:Icon>
</g:HTMLPanel>
<g:HTML ui:field="htmlNode">Node</g:HTML>
<b:Button title="This section can be duplicated"
styleName="{style.margin-left-10}" ui:field="buttonAdd"></b:Button>
<b:Button title="This section can be removed"
styleName="{style.margin-left-10}" ui:field="buttonRemove"></b:Button>
</g:HorizontalPanel>
</ui:UiBinder>

View File

@ -0,0 +1,304 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.tree;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent.ACTION;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
/**
* The Class TreeItemPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 8, 2022
*/
public class TreeItemPanel {
private static final String JSON_ROOT_PATH = "$.";
private Tree tree = new Tree();
private final TreeItem root;
private HandlerManager appManagerBus;
private HashMap<String, List<TreeItem>> treeItemParents = new HashMap<String, List<TreeItem>>();
private String itemTypeTitle;
private String profileID;
/**
* Instantiates a new tree item panel.
*
* @param profileID the profile ID
* @param itemTypeTitle the item type title
* @param gnaCardsModels the gna cards models
* @param appManagerBus the app manager bus
*/
// Create a tree
public TreeItemPanel(String profileID, String itemTypeTitle, Collection<GeoNaFormCardModel> gnaCardsModels,
HandlerManager appManagerBus) {
this.appManagerBus = appManagerBus;
this.itemTypeTitle = itemTypeTitle;
this.profileID = profileID;
tree.setAnimationEnabled(true);
NodeItem rootNode = new NodeItem(null, itemTypeTitle, null, false, false, null);
rootNode.setRoot(true);
root = new TreeItem(rootNode);
treeItemParents.put(JSON_ROOT_PATH, Arrays.asList(root));
for (GeoNaFormCardModel geoNaFormCardModel : gnaCardsModels) {
GcubeProfileDV profile = geoNaFormCardModel.getGcubeProfile();
String parentName = profile.getParentName();
String jsonSectionFullPath = getJSONFullPathFromProfile(profile);
if (parentName == null || parentName.isEmpty()) {
parentName = JSON_ROOT_PATH;
}
GWT.log("tree getting jsonSectionFullPath: " + jsonSectionFullPath + " in " + treeItemParents.keySet());
List<TreeItem> listParent = treeItemParents.get(parentName);
GWT.log("tree jsonSection: " + jsonSectionFullPath + " parent " + parentName + " name: "
+ profile.getSectionName() + " title: " + profile.getSectionTitle());
boolean canBeDuplicated = geoNaFormCardModel.getFormCard().isInternalRepeatibleForm();
TreeItem child = createAndAddChild(listParent.get(0), profile.getSectionTitle(), geoNaFormCardModel, canBeDuplicated, false,
jsonSectionFullPath);
}
tree.addItem(root);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
TreeItem treeItem = event.getSelectedItem();
NodeItem nodeItem = (NodeItem) treeItem.getWidget();
GWT.log("TreeItem selected: " + nodeItem);
appManagerBus.fireEvent(new TreeItemEvent(treeItem, ACTION.SELECTED));
}
});
// expand the element
root.setState(true);
}
/**
* Gets the JSON full path from profile.
*
* @param profile the profile
* @return the JSON full path from profile
*/
private String getJSONFullPathFromProfile(GcubeProfileDV profile) {
String parentName = profile.getParentName();
GWT.log("finding parentName: " + parentName + " in " + treeItemParents.keySet());
String jsonSectionFullPath = null;
if (parentName == null || parentName.isEmpty()) {
GWT.log("tree parentName is null: " + parentName + " in " + treeItemParents.keySet());
parentName = JSON_ROOT_PATH;
jsonSectionFullPath = profile.getSectionName();
} else {
jsonSectionFullPath = parentName.endsWith(".") ? parentName + profile.getSectionName()
: parentName + "." + profile.getSectionName();
}
return jsonSectionFullPath;
}
/**
* Creates the and add child.
*
* @param parent the parent
* @param nodeHTML the node HTML
* @param geoNaFormCardModel the geo na form card model
* @param canBeDuplicated the can be duplicated
* @param canBeDeleted the can be deleted
* @param jsonSectionFullPath the json section full path
* @return the tree item
*/
public TreeItem createAndAddChild(TreeItem parent, String nodeHTML, GeoNaFormCardModel geoNaFormCardModel, boolean canBeDuplicated,
boolean canBeDeleted, String jsonSectionFullPath) {
GWT.log("Creating and adding child to parent: " + parent.getText() +", card is"+geoNaFormCardModel);
TreeItem newChild = new TreeItem(new NodeItem(parent, nodeHTML, geoNaFormCardModel, canBeDuplicated, canBeDeleted, jsonSectionFullPath));
parent.addItem(newChild);
fillItemParents(jsonSectionFullPath, newChild);
return newChild;
}
/**
* Adds the child.
*
* @param parent the parent
* @param nextSiblingIndex the index where the item will be inserted
* @param item the item
* @return the tree item
*/
public TreeItem addChild(TreeItem parent, int nextSiblingIndex, TreeItem item) {
GWT.log("Adding child "+item.getText()+" to parent: " + parent.getText());
if(nextSiblingIndex>=0) {
parent.insertItem(nextSiblingIndex, item);
}
else {
parent.addItem(item);
}
NodeItem nodeItem = (NodeItem) item.getWidget();
String jsonSectionFullPath = nodeItem.getJsonSectionFullPath();
fillItemParents(jsonSectionFullPath, item);
return item;
}
/**
* Fill item parents.
*
* @param jsonSectionFullPath the json section full path
* @param newChild the new child
*/
private void fillItemParents(String jsonSectionFullPath, TreeItem newChild) {
// if the path section is not the root
if (jsonSectionFullPath.compareTo(JSON_ROOT_PATH) != 0) {
List<TreeItem> listNodeParents = treeItemParents.get(jsonSectionFullPath);
if (listNodeParents == null) {
listNodeParents = new ArrayList<TreeItem>();
}
listNodeParents.add(newChild);
treeItemParents.put(jsonSectionFullPath, listNodeParents);
}
}
/**
* Removes the child.
*
* @param parent the parent
* @param item the item
* @param jsonSectionFullPath the json section full path
*/
public void removeChild(TreeItem parent, TreeItem item, String jsonSectionFullPath) {
GWT.log("Removing child to parent: " + parent.getText());
List<TreeItem> nodes = treeItemParents.get(jsonSectionFullPath);
if (nodes != null) {
nodes.remove(item);
treeItemParents.put(jsonSectionFullPath, nodes);
}
parent.removeItem(item);
}
/**
* Count node for full path.
*
* @param jsonSectionFullPath the json section full path
* @return the int
*/
public int countNodeForFullPath(String jsonSectionFullPath) {
List<TreeItem> nodes = treeItemParents.get(jsonSectionFullPath);
if (nodes != null)
return nodes.size();
return 0;
}
/**
* Gets the tree.
*
* @return the tree
*/
public Tree getTree() {
return tree;
}
/**
* Gets the root.
*
* @return the root
*/
public TreeItem getRoot() {
return root;
}
/**
* Gets the select item.
*
* @return the select item
*/
public TreeItem getSelectItem() {
return tree.getSelectedItem();
}
/**
* Gets the node index.
*
* @param parent the parent
* @param item the item
* @return the node index
*/
public int getNodeIndex(TreeItem parent, TreeItem item) {
return parent.getChildIndex(item);
}
/**
* Gets the item type title.
*
* @return the item type title
*/
public String getItemTypeTitle() {
return itemTypeTitle;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the tree item parents.
*
* @return the tree item parents
*/
public HashMap<String, List<TreeItem>> getTreeItemParents() {
return treeItemParents;
}
/**
* Select item.
*
* @param item the item
*/
public void selectItem(TreeItem item){
item.setSelected(true);
}
}

View File

@ -0,0 +1,40 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import com.github.gwtbootstrap.client.ui.Alert;
import com.google.gwt.user.client.Timer;
/**
* The Class AlertClosable.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 4, 2022
*/
public class AlertClosable extends Alert {
private AlertClosable instance = this;
/**
* Instantiates a new alert closable.
*/
public AlertClosable() {
}
/**
* Close after.
*
* @param depayMillis the depay millis
*/
public void closeAfter(int depayMillis) {
Timer timer = new Timer() {
@Override
public void run() {
instance.close();
}
};
timer.schedule(depayMillis);
}
}

View File

@ -0,0 +1,172 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class DialogInform.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 5, 2021
*/
public class DialogInform extends DialogBox implements ClickHandler {
private DockPanel dock = new DockPanel();
private Button okButton;
private VerticalPanel vpContainer = new VerticalPanel();
private ImageResource loading = Images.ICONS.loading();
private HorizontalPanel hpButtons = new HorizontalPanel();
private HorizontalPanel hpMask = new HorizontalPanel();
private DialogInform instance = this;
/**
* Instantiates a new dialog inform.
*
* @param img the img
* @param caption the caption
* @param msg the msg
*/
public DialogInform(Image img, String caption, String msg) {
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
dock.setWidth("100%");
setText(caption);
// setHeading(caption);
okButton = new Button("OK");
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.add(new HTML(msg));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
hpButtons.setSpacing(3);
okButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
hpButtons.add(okButton);
okButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
instance.hide();
}
});
dock.add(hpButtons, DockPanel.SOUTH);
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
if (img != null)
dock.add(img, DockPanel.WEST);
vpContainer.add(hpMask);
dock.add(vpContainer, DockPanel.CENTER);
setWidget(dock);
}
/**
* Sets the msg.
*
* @param msg the new msg
*/
public void setMsg(String msg) {
vpContainer.clear();
vpContainer.add(new HTML(msg));
hpButtons.setVisible(true);
}
/**
* On click.
*
* @param event the event
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
// hide();
}
/**
* Hide loader.
*/
public void hideLoader() {
hpMask.clear();
hpButtons.setVisible(true);
}
/**
* Loader.
*
* @param message the message
*/
public void showLoader(String message) {
try {
hpButtons.setVisible(false);
} catch (Exception e) {
}
hpMask.clear();
hpMask.add(new Image(loading));
HTML html = new HTML(message);
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
hpMask.add(html);
}
/**
* Adds the to center panel.
*
* @param w the w
*/
public void addToCenterPanel(Widget w) {
vpContainer.add(w);
}
/**
* Gets the dock.
*
* @return the dock
*/
public DockPanel getDock() {
return dock;
}
/**
* Gets the yes button.
*
* @return the yes button
*/
public Button getOKButton() {
return okButton;
}
/**
* Sets the z index.
*
* @param value the new z index
*/
public void setZIndex(int value) {
this.getElement().getStyle().setZIndex(value);
}
}

View File

@ -0,0 +1,132 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.event.HideEvent;
import com.github.gwtbootstrap.client.ui.event.HideHandler;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.Random;
/**
* The Class ExtModal.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Apr 29, 2021
*
* This Class extends the {{@link Modal} preventing the default close of
* the Modal Bootstrap when clicking outside of the modal Window
*/
public class ExtModal extends Modal {
private String elementId;
private String closeElementId;
private Boolean closeButtoClicked = false;
final private ExtModal INSTANCE = this;
/**
* Instantiates a new ext modal.
*/
public ExtModal() {
super();
setElementIds();
addDeferredCommandToPreventModalClose();
}
/**
* Creates an empty, hidden widget with specified show behavior.
*
* @param animated <code>true</code> if the widget should be animated.
*/
public ExtModal(boolean animated) {
super(animated, false);
setElementIds();
addDeferredCommandToPreventModalClose();
}
/**
* Creates an empty, hidden widget with specified show behavior.
*
* @param animated <code>true</code> if the widget should be animated.
* @param dynamicSafe <code>true</code> removes from RootPanel when hidden
*/
public ExtModal(boolean animated, boolean dynamicSafe) {
super(animated, dynamicSafe);
setElementIds();
addDeferredCommandToPreventModalClose();
}
private void addDeferredCommandToPreventModalClose() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
((Element) INSTANCE.getElement().getChildNodes().getItem(0)).getFirstChildElement()
.setId(closeElementId);
preventModalCloseWhenClickingOutside();
}
});
}
/**
* Sets the element id.
*/
private void setElementIds() {
this.elementId = "my-modal-publish-meta" + Random.nextInt();
this.getElement().setId(elementId);
this.closeElementId = "my-modal-close-button" + Random.nextInt();
}
/**
* Prevent modal close when clicking outside.
*/
private void preventModalCloseWhenClickingOutside() {
com.google.gwt.user.client.Element buttonCloseElement = DOM.getElementById(this.closeElementId);
if (buttonCloseElement != null) {
Event.sinkEvents(buttonCloseElement, Event.ONCLICK);
Event.setEventListener(buttonCloseElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
GWT.log("close event clicked");
closeButtoClicked = true;
}
}
});
} else {
GWT.log("button close element not found");
closeButtoClicked = true;
}
// hide any popup panel opened
this.addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent hideEvent) {
GWT.log("HideEvent on modal fired");
GWT.log(hideEvent.toDebugString());
GWT.log("CloseButtonClicked is: " + closeButtoClicked);
if (!closeButtoClicked) {
hideEvent.preventDefault();
hideEvent.stopPropagation();
}
}
});
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
/**
* The Class ExternalLib.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
public class ExternalLib {
/**
* To pretty print JSON. calls the externa js lib 'pretty-print-json'
*
* @param jsonData the json data
* @return the string
*/
public static native String toPrettyPrintJSON(String jsonData)/*-{
//console.log(jsonData);
var objJSON = JSON.parse(jsonData);
return $wnd.prettyPrintJson.toHtml(objJSON);
}-*/;
}

View File

@ -1,5 +1,8 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils; package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
/** /**
* The Class HTMLUtil. * The Class HTMLUtil.
* *
@ -78,4 +81,90 @@ public class HTMLUtil {
return "</" + tag.name() + ">"; return "</" + tag.name() + ">";
} }
/**
* Json to HTML.
*
* @param jsonTxt the json txt
* @param cssClassToTable the css class to table
* @return the element
*/
public static native String jsonToHTML(String jsonTxt, String cssClassToTable)/*-{
try {
var jsonObj = JSON.parse(jsonTxt);
//console.log(jsonObj.length)
if (jsonObj.length == undefined)
jsonObj = [ jsonObj ]
//console.log(jsonObj.length)
// EXTRACT VALUE FOR HTML HEADER.
var col = [];
for (var i = 0; i < jsonObj.length; i++) {
for ( var key in jsonObj[i]) {
//console.log('key json' +key)
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
var addDefaultCss = "json-to-html-table-column";
if (cssClassToTable) {
addDefaultCss = cssClassToTable;
}
try {
table.classList.add(addDefaultCss);
} catch (e) {
console.log('invalid css add', e);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < col.length; i++) {
tr = table.insertRow(-1);
var firstCell = tr.insertCell(-1);
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
firstCell.innerHTML = col[i];
for (var j = 0; j < jsonObj.length; j++) {
var tabCell = tr.insertCell(-1);
var theValue = jsonObj[j][col[i]];
tabCell.innerHTML = theValue;
}
}
return table.outerHTML;
} catch (e) {
console.log('invalid json', e);
}
}-*/;
public static String toHTMLCode(TemporalReferenceDV tempRef) {
String htmlCode = "<span class='display-date'>";
if (tempRef != null) {
String dateToString = "";
if (tempRef.getStart() != null) {
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getStart());
}
dateToString += " / ";
if (tempRef.getStart() != null) {
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getEnd());
}
htmlCode += dateToString;
}
htmlCode += "</span>";
return htmlCode;
}
} }

View File

@ -0,0 +1,163 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import com.github.gwtbootstrap.client.ui.Modal;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ModalConfirm.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 1, 2022
*/
public class ModalConfirm extends Modal implements ClickHandler {
private static final int modal_width = 800;
private DockPanel dock = new DockPanel();
private Button yesButton;
private VerticalPanel vpContainer;
private ImageResource loading = Images.ICONS.loading();
private HorizontalPanel hpButtons = new HorizontalPanel();
private Button noButton;
/**
* Instantiates a new dialog confirm.
*
* @param img the img
* @param caption the caption
* @param text the text
*/
public ModalConfirm(Image img, String caption, String text) {
setWidth(modal_width);
setAnimation(true);
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
dock.setWidth("100%");
setTitle(caption);
// setHeading(caption);
yesButton = new Button("Yes");
noButton = new Button("No", this);
noButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.setWidth((modal_width - 70) + "px");
if (text != null)
vpContainer.add(new HTML(text));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
hpButtons.setSpacing(3);
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
hpButtons.add(yesButton);
hpButtons.add(noButton);
dock.add(hpButtons, DockPanel.SOUTH);
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
if (img != null)
dock.add(img, DockPanel.WEST);
ScrollPanel scrollPanel = new ScrollPanel(vpContainer);
scrollPanel.getElement().getStyle().setProperty("maxHeight", "500px");
dock.add(new ScrollPanel(vpContainer), DockPanel.CENTER);
add(dock);
}
/**
* On click.
*
* @param event the event
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
// hide();
}
/**
* Loader.
*
* @param message the message
*/
public void loader(String message) {
try {
dock.remove(hpButtons);
} catch (Exception e) {
}
vpContainer.clear();
HorizontalPanel hpMask = new HorizontalPanel();
hpMask.add(new Image(loading));
HTML html = new HTML(message);
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
hpMask.add(html);
vpContainer.add(hpMask);
}
/**
* Adds the to center panel.
*
* @param w the w
*/
public void addToCenterPanel(Widget w) {
vpContainer.add(w);
}
/**
* Gets the dock.
*
* @return the dock
*/
public DockPanel getDock() {
return dock;
}
/**
* Gets the yes button.
*
* @return the yes button
*/
public Button getYesButton() {
return yesButton;
}
/**
* Gets the no button.
*
* @return the no button
*/
public Button getNoButton() {
return noButton;
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import com.google.gwt.core.client.JavaScriptObject;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Sep 4, 2013
*
*/
public final class NewBrowserWindow extends JavaScriptObject {
// All types that extend JavaScriptObject must have a protected,
// no-args constructor.
protected NewBrowserWindow() {
}
public static native NewBrowserWindow open(String url, String target, String options) /*-{
return $wnd.open(url, target, options)
}-*/;
public native void close() /*-{
this.close();
}-*/;
public native void setUrl(String url) /*-{
if (this.location) {
this.location = url;
}
}-*/;
}

View File

@ -0,0 +1,34 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
/**
* The Class StringUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 12, 2021
*/
public class StringUtil {
/**
* Ellipsize.
*
* @param input the input string that may be subjected to shortening
* @param maxCharacters the maximum characters that must be returned for the
* input string
* @return the string
*/
public static String ellipsize(String input, int maxCharacters) {
if (input == null)
return "";
if (input.length() < maxCharacters)
return input;
return input.substring(0, maxCharacters) + "...";
}
}

View File

@ -0,0 +1,54 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.TreeItem;
public class TreeVisitUtil {
public static <T> void preOrderVisit(Tree_Node<T> node) {
GWT.log("preOrderVisit called");
if (node == null)
return;
Tree_Node<T> parent = node.getParent();
String parentName = null;
if (parent != null) {
parentName = parent.getName();
}
GWT.log("preOrderVisit Node name: " + node + ", parent: " + parentName);
for (Tree_Node<T> child : node.getChildren()) {
preOrderVisit(child);
}
return;
}
// Function to print the postorder traversal
// of the n-ary tree
public static void postOrderVisit(TreeItem root) {
// GWT.log("postOrderVisit called");
if (root == null) {
// GWT.log("postOrderVisit returns, node is null");
return;
}
// GWT.log("postOrderVisit called on: " + root.getText());
// Total children count
int total = root.getChildCount();
for (int i = 0; i < total; i++) {
postOrderVisit(root.getChild(i));
}
String parentText = root.getParentItem() != null ? root.getParentItem().getText() : null;
GWT.log("PostOrderVisit: " + root.getText() + " with parent: " + parentText);
}
}

View File

@ -0,0 +1,50 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
public class UCD_Util {
public static HandlerDeclarationDV getHandlerDeclarationFor(List<UseCaseDescriptorDV> listUCDescriptors,
String profileID, GEOPORTAL_DATA_HANDLER dataHandler) {
for (UseCaseDescriptorDV useCaseDescriptor : listUCDescriptors) {
if (useCaseDescriptor.getProfileID().compareTo(profileID) == 0) {
for (HandlerDeclarationDV handler : useCaseDescriptor.getHandlers()) {
GEOPORTAL_DATA_HANDLER dataHandlerType = handler.getDataHandlerType();
if (dataHandlerType != null && dataHandlerType.equals(dataHandler)) {
return handler;
}
}
}
}
return null;
}
public static HandlerDeclarationDV getHandlerDeclarationFor(UseCaseDescriptorDV useCaseDescriptor,
GEOPORTAL_DATA_HANDLER dataHandler) {
if (useCaseDescriptor == null)
return null;
for (HandlerDeclarationDV handler : useCaseDescriptor.getHandlers()) {
GEOPORTAL_DATA_HANDLER dataHandlerType = handler.getDataHandlerType();
if (dataHandlerType != null && dataHandlerType.equals(dataHandler)) {
return handler;
}
}
return null;
}
}

View File

@ -0,0 +1,16 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
public class UUIDUtil {
public static String generateUUID() {
return nativeGenerateUUID();
}
// Usa una funzione JavaScript per generare un UUID
private static native String nativeGenerateUUID() /*-{
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}-*/;
}

View File

@ -8,6 +8,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy; import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.Concessione; import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione; import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
@ -19,7 +20,6 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The Class ConvertToServiceModel. * The Class ConvertToServiceModel.
* *
@ -44,7 +44,7 @@ public class ConvertToServiceModel {
* @param gdb the gdb * @param gdb the gdb
* @param user the user * @param user the user
* @return the concessione * @return the concessione
* @throws Exception * @throws Exception the exception
*/ */
public static Concessione toConcessione(GenericDatasetBean gdb, GCubeUser user) throws Exception { public static Concessione toConcessione(GenericDatasetBean gdb, GCubeUser user) throws Exception {
@ -52,7 +52,12 @@ public class ConvertToServiceModel {
Concessione concessione = new Concessione(); Concessione concessione = new Concessione();
List<String> authors = mapFields.get("Autore"); // List<String> authors = mapFields.get("Autore");
// if(authors!=null) {
// concessione.setAuthors(authors);
// }
List<String> authors = mapFields.get("Nome Autore, Email, Ruolo");
if (authors != null) { if (authors != null) {
concessione.setAuthors(authors); concessione.setAuthors(authors);
} }
@ -81,7 +86,6 @@ public class ConvertToServiceModel {
concessione.setDataFineProgetto(theLDT); concessione.setDataFineProgetto(theLDT);
} }
List<String> descrizioneLst = mapFields.get("Descrizione del contenuto"); List<String> descrizioneLst = mapFields.get("Descrizione del contenuto");
if (descrizioneLst != null && descrizioneLst.size() > 0) { if (descrizioneLst != null && descrizioneLst.size() > 0) {
concessione.setDescrizioneContenuto(descrizioneLst.get(0)); concessione.setDescrizioneContenuto(descrizioneLst.get(0));
@ -187,15 +191,14 @@ public class ConvertToServiceModel {
/** /**
* To relazione scavo. * To relazione scavo.
* *
* @param abstractRelazioneScavo the abstract relazione scavo
* @param gdb the gdb * @param gdb the gdb
* @return the relazione scavo * @return the relazione scavo
*/ */
public static RelazioneScavo toRelazioneScavo(RelazioneScavo abstractRelazioneScavo, GenericDatasetBean gdb){ public static RelazioneScavo toRelazioneScavo(GenericDatasetBean gdb) {
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields(); Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
RelazioneScavo relazioneScavo = abstractRelazioneScavo == null?new RelazioneScavo():abstractRelazioneScavo; RelazioneScavo relazioneScavo = new RelazioneScavo();
List<String> responsabiliLst = mapFields.get("Responsabile del documento"); List<String> responsabiliLst = mapFields.get("Responsabile del documento");
if (responsabiliLst != null) { if (responsabiliLst != null) {
@ -208,9 +211,11 @@ public class ConvertToServiceModel {
} }
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso"); List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
LOG.debug("Relazione di Scavo: Politica di accesso lst: "+politicaDiAccessoLst);
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) { if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
try { try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0)); AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
LOG.debug("Relazione di Scavo: AccessPolicy: "+ap);
relazioneScavo.setPolicy(ap); relazioneScavo.setPolicy(ap);
} catch (Exception e) { } catch (Exception e) {
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e); LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
@ -219,45 +224,64 @@ public class ConvertToServiceModel {
List<String> licenzaIdList = mapFields.get("ID Licenza"); List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) { if (licenzaIdList != null && licenzaIdList.size() > 0) {
LOG.debug("Relazione di Scavo: ID Licenza lst: "+licenzaIdList);
relazioneScavo.setLicenseID(licenzaIdList.get(0)); relazioneScavo.setLicenseID(licenzaIdList.get(0));
LOG.debug("Relazione di Scavo: ID Licenza: "+relazioneScavo.getLicenseID());
}
// TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if (periodoDiEmbargo != null && periodoDiEmbargo.size() > 0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
// TODO MUST BE INTENGRATED IN THE SERVICE
} }
return relazioneScavo; return relazioneScavo;
} }
public static RelazioneScavo toAbstractRelazioneScavo(GenericDatasetBean gdb) { /**
* To abstract relazione scavo.
*
* @param gdb the gdb
* @return the abstract relazione
*/
public static AbstractRelazione toAbstractRelazioneScavo(GenericDatasetBean gdb) {
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields(); Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
RelazioneScavo relazioneScavo = new RelazioneScavo(); AbstractRelazione abstractrelazione = new AbstractRelazione();
List<String> abstractLstIta = mapFields.get("Abstract in Italiano"); List<String> abstractLstIta = mapFields.get("Abstract in Italiano");
if (abstractLstIta != null && abstractLstIta.size() > 0) { if (abstractLstIta != null && abstractLstIta.size() > 0) {
relazioneScavo.setAbstractIta(abstractLstIta.get(0)); abstractrelazione.setAbstractIta(abstractLstIta.get(0));
} }
List<String> abstractLstEng = mapFields.get("Abstract in Inglese"); List<String> abstractLstEng = mapFields.get("Abstract in Inglese");
if (abstractLstEng != null && abstractLstEng.size() > 0) { if (abstractLstEng != null && abstractLstEng.size() > 0) {
relazioneScavo.setAbstractEng(abstractLstEng.get(0)); abstractrelazione.setAbstractEng(abstractLstEng.get(0));
} }
//TODO IN FUTURE WHEN THE MODEL WILL BE UPDATED // THIS SHOULD BE ALWAYS "OPEN"
/*List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso"); List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) { if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
try { try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0)); AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
relazioneScavo.setPolicy(ap); abstractrelazione.setPolicy(ap);
} catch (Exception e) { } catch (Exception e) {
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e); LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
} }
} }
// THIS SHOULD BE ALWAYS "CC-BY-4.0"
List<String> licenzaIdList = mapFields.get("ID Licenza"); List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) { if (licenzaIdList != null && licenzaIdList.size() > 0) {
relazioneScavo.setLicenseID(licenzaIdList.get(0)); abstractrelazione.setLicenseID(licenzaIdList.get(0));
}*/ }
return relazioneScavo; return abstractrelazione;
} }
/** /**
@ -354,6 +378,16 @@ public class ConvertToServiceModel {
layerConcessione.setScalaAcquisizione(scalaAcquisizioneLst.get(0)); layerConcessione.setScalaAcquisizione(scalaAcquisizioneLst.get(0));
} }
// TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if (periodoDiEmbargo != null && periodoDiEmbargo.size() > 0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
// TODO MUST BE INTENGRATED IN THE SERVICE
}
List<String> licenzaIdList = mapFields.get("ID Licenza"); List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) { if (licenzaIdList != null && licenzaIdList.size() > 0) {
layerConcessione.setLicenseID(licenzaIdList.get(0)); layerConcessione.setLicenseID(licenzaIdList.get(0));
@ -367,7 +401,6 @@ public class ConvertToServiceModel {
return layerConcessione; return layerConcessione;
} }
/** /**
* To local date time. * To local date time.
* *
@ -392,7 +425,6 @@ public class ConvertToServiceModel {
return theLocalDT; return theLocalDT;
} }
/** /**
* Convert to local date time via instant. * Convert to local date time via instant.
* *
@ -400,9 +432,7 @@ public class ConvertToServiceModel {
* @return the local date time * @return the local date time
*/ */
public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) { public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
return dateToConvert.toInstant() return dateToConvert.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
} }
} }

View File

@ -0,0 +1,49 @@
package org.gcube.portlets.user.geoportaldataentry.server;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
public class FileSetDataObject {
private FilePathDV filePathDV;
private List<File> files = new ArrayList<File>();
public FileSetDataObject() {
}
public void setFilePathDV(FilePathDV filePath) {
this.filePathDV = filePath;
}
public void addFile(File file) {
files.add(file);
}
public File[] getFileset() {
File[] arr = new File[files.size()];
arr = files.toArray(arr);
return arr;
}
public FilePathDV getFilePathDV() {
return filePathDV;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FileSetDataObject [filePathDV.getFieldName()=");
builder.append(filePathDV.getFieldName());
builder.append(", files size=");
builder.append(files.size());
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,298 @@
package org.gcube.portlets.user.geoportaldataentry.server;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The Class FormDataObjectToJSON.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
*/
public class FormDataObjectToJSON {
public static final String JSON_$_POINTER = "$";
private static final Logger LOG = LoggerFactory.getLogger(FormDataObjectToJSON.class);
/**
* Convert.
*
* @param tree_Node the tree node
* @param theRootDocument the the root document
* @return the JSON object
* @throws JSONException the JSON exception
*/
public JSONObject convert(Tree_Node<GeoNaFormDataObject> tree_Node, JSONObject theRootDocument)
throws JSONException {
if (tree_Node == null)
return theRootDocument;
// the root, instancing new json document
if (tree_Node.isRoot()) {
theRootDocument = JSONObjectOrdered.instance();
}
Configuration configuration = Configuration.builder().jsonProvider(new JsonOrgJsonProvider()).build();
for (Tree_Node<GeoNaFormDataObject> treeNodeChild : tree_Node.getChildren()) {
GeoNaFormDataObject gnaFO = treeNodeChild.getData();
// Reading data and profile
List<GenericDatasetBean> listGDB = gnaFO.getListGDB();
GcubeProfileDV profile = gnaFO.getGcubeProfileDV();
LOG.debug("The profile is: " + profile);
// Building JSON/section full PATH and section name
String sectionJSONPath = "";
String parentPathFromProfile = profile.getParentName() == null ? "" : profile.getParentName();
String theSectionName = profile.getSectionName();
if (theSectionName.compareTo(JSON_$_POINTER) == 0 || theSectionName.compareTo(JSON_$_POINTER + ".") == 0) {
sectionJSONPath = JSON_$_POINTER;
theSectionName = "";
} else {
sectionJSONPath = String.format("%s%s",
parentPathFromProfile.endsWith(".") ? parentPathFromProfile : parentPathFromProfile + ".", theSectionName);
}
LOG.debug("The sectionJSONPath is: " + sectionJSONPath);
LOG.info("Current document is: " + theRootDocument);
// Building Parent PATH
String parentPath = sectionJSONPath.compareTo(JSON_$_POINTER) == 0 ? JSON_$_POINTER
: sectionJSONPath.substring(0, sectionJSONPath.lastIndexOf("."));
JsonPath parentJSONPath = JsonPath.compile(parentPath);
LOG.info("Putting into parentJSONPath: " + parentJSONPath);
List<JSONObject> listJSONObject = toListJonObject(listGDB);
JSONObject jsonObject = listJSONObject.get(0);
// If the maxOccurs is not 1
if (profile.getMaxOccurs() == 0 || profile.getMaxOccurs() > 1) {
LOG.debug("maxOccurs is NOT 1");
// Must be an array
boolean pathExists = pathExists(theRootDocument, sectionJSONPath + "[*]");
LOG.debug(sectionJSONPath+ "exists? "+pathExists);
if (pathExists) {
theRootDocument = JsonPath.parse(theRootDocument, configuration).add(sectionJSONPath, jsonObject)
.json();
} else {
// Adding as array of object
JSONArray targetArray = JSONArrayOrdered.instance();
targetArray.put(jsonObject);
LOG.debug("JSON array created: " + targetArray);
theRootDocument = JsonPath.parse(theRootDocument, configuration)
.put(parentJSONPath, theSectionName, targetArray).json();
}
LOG.debug("theRootDocument as array is: " + theRootDocument);
} else {
LOG.debug("maxOccurs is 1");
// Merging as direct properties of the JSON root document
if (theSectionName == null || theSectionName.isEmpty()) {
deepMerge(jsonObject, theRootDocument);
} else {
// Putting as child of the JSON document
// theRootDocument.put(profile.getSectionName(), jsonObject);
theRootDocument = JsonPath.parse(theRootDocument, configuration)
.put(parentJSONPath, theSectionName, jsonObject).json();
}
LOG.debug("theRootDocument as single object is: " + theRootDocument);
}
// recursive call...
theRootDocument = convert(treeNodeChild, theRootDocument);
}
LOG.debug("Partial Root Document is: " + theRootDocument);
return theRootDocument;
}
/**
* Path exists.
*
* @param document the document
* @param pathExp the path exp
* @return true, if successful
*/
public static boolean pathExists(JSONObject document, String pathExp) {
LOG.debug("pathExists called");
try {
LOG.debug("pathExists finding: " + pathExp + " into node: " + document);
Object object = JsonPath.read(document.toString(), pathExp);
if (object != null) {
LOG.debug("pathExists returning true");
return true;
}
} catch (Exception e) {
LOG.error("pathExists error", e);
return false;
}
LOG.debug("pathExists returning false");
return false;
}
/**
* Generic dataset bean to JSON.
*
* @param gdb the gdb
* @return the JSON object
* @throws JSONException the JSON exception
*/
protected JSONObject genericDatasetBeanToJSON(GenericDatasetBean gdb) throws JSONException {
JSONObject sectJSONObject = JSONObjectOrdered.instance();
LinkedHashMap<String, List<String>> mapFields = gdb.getFormDataEntryFields();
LOG.debug("Map ordered: " + mapFields);
for (String key : mapFields.keySet()) {
List<String> listValues = mapFields.get(key);
if (listValues == null || listValues.isEmpty()) {
continue;
}
// key/value as string
if (listValues.size() == 1) {
sectJSONObject.put(key, listValues.get(0));
continue;
}
// value is a list
JSONArray array = new JSONArray();
for (String value : listValues) {
if(value!=null && !value.isEmpty()) {
array.put(value);
}
}
sectJSONObject.put(key, array);
}
return sectJSONObject;
}
/**
* To list jon object.
*
* @param listGDB the list GDB
* @return the list
* @throws JSONException the JSON exception
*/
private List<JSONObject> toListJonObject(List<GenericDatasetBean> listGDB) throws JSONException {
List<JSONObject> listJSONObject = new ArrayList<JSONObject>();
for (GenericDatasetBean gdb : listGDB) {
JSONObject jsonObject = genericDatasetBeanToJSON(gdb);
listJSONObject.add(jsonObject);
}
LOG.info("returning : " + listJSONObject);
return listJSONObject;
}
/**
* Merge "source" into "target". If fields have equal name, merge them
* recursively.
*
* @param source the source
* @param target the target
* @return the merged object (target).
* @throws JSONException the JSON exception
*/
public static JSONObject deepMerge(JSONObject source, JSONObject target) throws JSONException {
for (String key : JSONObject.getNames(source)) {
Object value = source.get(key);
if (!target.has(key)) {
// new value for "key":
target.put(key, value);
} else {
// existing value for "key" - recursively deep merge:
if (value instanceof JSONObject) {
JSONObject valueJson = (JSONObject) value;
deepMerge(valueJson, target.getJSONObject(key));
} else {
target.put(key, value);
}
}
}
return target;
}
/**
* The Class JSONObjecOrdered.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
*/
public static class JSONObjectOrdered {
/**
* Instance.
*
* @return the JSON object
*/
public static JSONObject instance() {
JSONObject jsonObject = new JSONObject();
try {
Field changeMap = jsonObject.getClass().getDeclaredField("map");
changeMap.setAccessible(true);
changeMap.set(jsonObject, new LinkedHashMap<>());
changeMap.setAccessible(false);
} catch (IllegalAccessException | NoSuchFieldException e) {
}
return jsonObject;
}
}
/**
* The Class JSONObjecOrdered.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
*/
public static class JSONArrayOrdered {
/**
* Instance.
*
* @return the JSON object
*/
public static JSONArray instance() {
JSONArray jsonArray = new JSONArray();
try {
Field changeMap = jsonArray.getClass().getDeclaredField("map");
changeMap.setAccessible(true);
changeMap.set(jsonArray, new LinkedHashMap<>());
changeMap.setAccessible(false);
} catch (IllegalAccessException | NoSuchFieldException e) {
}
return jsonArray;
}
}
}

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