27
27
import org .roda .wui .client .disposal .association .DisposalPolicyAssociationTab ;
28
28
29
29
import com .google .gwt .safehtml .shared .SafeHtmlUtils ;
30
+ import com .google .gwt .user .client .ui .Widget ;
30
31
31
32
/**
32
33
*
@@ -36,52 +37,75 @@ public class BrowseAIPTabs extends Tabs {
36
37
public void init (IndexedAIP aip , BrowseAIPResponse browseAIPResponse ,
37
38
DescriptiveMetadataInfos descriptiveMetadataInfos ) {
38
39
boolean justActive = AIPState .ACTIVE .equals (aip .getState ());
39
-
40
- // TODO: These tabs should be lazy loading
41
-
42
40
// Descriptive metadata
43
- AIPDescriptiveMetadataTabs aipDescriptiveMetadataTabs = new AIPDescriptiveMetadataTabs ();
44
- aipDescriptiveMetadataTabs .init (aip , descriptiveMetadataInfos );
45
- aipDescriptiveMetadataTabs .setStyleName ("descriptiveMetadataTabs" );
46
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .descriptiveMetadataTab ()), aipDescriptiveMetadataTabs );
41
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .descriptiveMetadataTab ()), new TabContentBuilder () {
42
+ @ Override
43
+ public Widget buildTabWidget () {
44
+ AIPDescriptiveMetadataTabs aipDescriptiveMetadataTabs = new AIPDescriptiveMetadataTabs ();
45
+ aipDescriptiveMetadataTabs .init (aip , descriptiveMetadataInfos );
46
+ aipDescriptiveMetadataTabs .setStyleName ("descriptiveMetadataTabs" );
47
+ return aipDescriptiveMetadataTabs ;
48
+ }
49
+ });
47
50
48
51
// Preservation events
49
- Filter eventFilter = new Filter (new AllFilterParameter ());
50
- eventFilter .add (new SimpleFilterParameter (RodaConstants .PRESERVATION_EVENT_AIP_ID , aip .getId ()));
51
- SearchWrapper preservationEvents = new SearchWrapper (false )
52
- .createListAndSearchPanel (new ListBuilder <>(() -> new PreservationEventList (),
53
- new AsyncTableCellOptions <>(IndexedPreservationEvent .class , "BrowseAIP_preservationEvents" )
54
- .withFilter (eventFilter ).withSummary (messages .searchResults ()).bindOpener ()
55
- .withActionable (PreservationEventActions .get (aip .getId (), null , null ))));
56
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .preservationEventsTab ()), preservationEvents );
52
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .preservationEventsTab ()), new TabContentBuilder () {
53
+ @ Override
54
+ public Widget buildTabWidget () {
55
+ Filter eventFilter = new Filter (new AllFilterParameter ());
56
+ eventFilter .add (new SimpleFilterParameter (RodaConstants .PRESERVATION_EVENT_AIP_ID , aip .getId ()));
57
+ return new SearchWrapper (false )
58
+ .createListAndSearchPanel (new ListBuilder <>(() -> new PreservationEventList (),
59
+ new AsyncTableCellOptions <>(IndexedPreservationEvent .class , "BrowseAIP_preservationEvents" )
60
+ .withFilter (eventFilter ).withSummary (messages .searchResults ()).bindOpener ()
61
+ .withActionable (PreservationEventActions .get (aip .getId (), null , null ))));
62
+ }
63
+ });
57
64
58
65
// Logs
59
- SearchWrapper auditLogs = new SearchWrapper (false );
60
- auditLogs .createListAndSearchPanel (new ListBuilder <>(() -> new LogEntryList (),
61
- new AsyncTableCellOptions <>(LogEntry .class , "BrowseAIP_auditLogs" )
62
- .withFilter (new Filter (new SimpleFilterParameter (RodaConstants .LOG_RELATED_OBJECT_ID , aip .getId ())))
63
- .withJustActive (justActive ).bindOpener ()));
64
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .auditLogsTab ()), auditLogs );
66
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .auditLogsTab ()), new TabContentBuilder () {
67
+ @ Override
68
+ public Widget buildTabWidget () {
69
+ SearchWrapper auditLogs = new SearchWrapper (false );
70
+ auditLogs .createListAndSearchPanel (new ListBuilder <>(() -> new LogEntryList (),
71
+ new AsyncTableCellOptions <>(LogEntry .class , "BrowseAIP_auditLogs" )
72
+ .withFilter (new Filter (new SimpleFilterParameter (RodaConstants .LOG_RELATED_OBJECT_ID , aip .getId ())))
73
+ .withJustActive (justActive ).bindOpener ()));
74
+ return auditLogs ;
75
+ }
76
+ });
65
77
66
78
// Risk incidences
67
- SearchWrapper riskIncidences = new SearchWrapper (false );
68
- riskIncidences .createListAndSearchPanel (new ListBuilder <>(() -> new RiskIncidenceList (),
69
- new AsyncTableCellOptions <>(RiskIncidence .class , "BrowseAIP_riskIncidences" )
70
- .withFilter (new Filter (new SimpleFilterParameter (RodaConstants .RISK_INCIDENCE_AIP_ID , aip .getId ())))
71
- .withJustActive (justActive ).bindOpener ()));
72
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .risksTab ()), riskIncidences );
79
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .risksTab ()), new TabContentBuilder () {
80
+ @ Override
81
+ public Widget buildTabWidget () {
82
+ SearchWrapper riskIncidences = new SearchWrapper (false );
83
+ riskIncidences .createListAndSearchPanel (new ListBuilder <>(() -> new RiskIncidenceList (),
84
+ new AsyncTableCellOptions <>(RiskIncidence .class , "BrowseAIP_riskIncidences" )
85
+ .withFilter (new Filter (new SimpleFilterParameter (RodaConstants .RISK_INCIDENCE_AIP_ID , aip .getId ())))
86
+ .withJustActive (justActive ).bindOpener ()));
87
+ return riskIncidences ;
88
+ }
89
+ });
73
90
74
91
// Disposal
75
- DisposalPolicyAssociationTab disposalPolicyAssociationPanel = new DisposalPolicyAssociationTab (browseAIPResponse );
76
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .disposalTab ()), disposalPolicyAssociationPanel );
92
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .disposalTab ()), new TabContentBuilder () {
93
+ @ Override
94
+ public Widget buildTabWidget () {
95
+ return new DisposalPolicyAssociationTab (browseAIPResponse );
96
+ }
97
+ });
77
98
78
99
// Permissions
79
- AIPToolbarActions aipToolbarActions = AIPToolbarActions .get (aip .getId (), aip .getState (), aip .getPermissions ());
80
- EditPermissionsTab permissionsTab = new EditPermissionsTab (new ActionableWidgetBuilder <>(aipToolbarActions )
81
- .buildGroupedListWithObjects (new ActionableObject <>(aip ), List .of (AIPToolbarActions .AIPAction .UPDATE_PERMISSIONS ),
82
- List .of (AIPToolbarActions .AIPAction .UPDATE_PERMISSIONS )),
83
- IndexedAIP .class .getName (), aip );
84
- createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .permissionsTab ()), permissionsTab );
100
+ createAndAddTab (SafeHtmlUtils .fromSafeConstant (messages .permissionsTab ()), new TabContentBuilder () {
101
+ @ Override
102
+ public Widget buildTabWidget () {
103
+ AIPToolbarActions aipToolbarActions = AIPToolbarActions .get (aip .getId (), aip .getState (), aip .getPermissions ());
104
+ return new EditPermissionsTab (new ActionableWidgetBuilder <>(aipToolbarActions ).buildGroupedListWithObjects (
105
+ new ActionableObject <>(aip ), List .of (AIPToolbarActions .AIPAction .UPDATE_PERMISSIONS ),
106
+ List .of (AIPToolbarActions .AIPAction .UPDATE_PERMISSIONS )), IndexedAIP .class .getName (), aip );
107
+ }
108
+ });
85
109
86
110
}
87
111
}
0 commit comments