Skip to content

Package: DefaultStructureExplorerPresentationControl$AjcClosure1

DefaultStructureExplorerPresentationControl$AjcClosure1

nameinstructionbranchcomplexitylinemethod
DefaultStructureExplorerPresentationControl.AjcClosure1(Object[])
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
run(Object[])
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone git@bitbucket.org:tidalwave/northernwind-rca-src.git
7: * %%
8: * Copyright (C) 2013 - 2021 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.rca.ui.structureexplorer.impl;
28:
29: import javax.annotation.Nonnull;
30: import it.tidalwave.dci.annotation.DciContext;
31: import it.tidalwave.messagebus.MessageBus;
32: import it.tidalwave.messagebus.annotation.ListensTo;
33: import it.tidalwave.messagebus.annotation.SimpleMessageSubscriber;
34: import it.tidalwave.northernwind.core.model.ModelFactory;
35: import it.tidalwave.northernwind.core.model.ResourceFile;
36: import it.tidalwave.northernwind.core.model.Site;
37: import it.tidalwave.northernwind.core.model.SiteNode;
38: import it.tidalwave.northernwind.rca.ui.event.OpenSiteEvent;
39: import it.tidalwave.northernwind.rca.ui.structureexplorer.StructureExplorerPresentation;
40: import it.tidalwave.northernwind.rca.ui.structureexplorer.StructureExplorerPresentationControl;
41: import it.tidalwave.role.ui.PresentationModel;
42: import it.tidalwave.util.annotation.VisibleForTesting;
43: import lombok.RequiredArgsConstructor;
44: import lombok.extern.slf4j.Slf4j;
45: import static it.tidalwave.northernwind.rca.ui.event.SiteNodeSelectedEvent.emptySelectionEvent;
46:
47: /***********************************************************************************************************************
48: *
49: * The default implementation for {@link StructureExplorerPresentationControl}.
50: *
51: * @stereotype Control
52: * @author Fabrizio Giudici
53: *
54: **********************************************************************************************************************/
55: @DciContext(autoThreadBinding = true) @RequiredArgsConstructor @SimpleMessageSubscriber @Slf4j
56: public class DefaultStructureExplorerPresentationControl implements StructureExplorerPresentationControl
57: {
58: /* package */ static final String ROOT_SITE_NODE_PATH = "/structure";
59:
60: @Nonnull
61: private final ModelFactory modelFactory;
62:
63: @Nonnull
64: private final Site site;
65:
66: @Nonnull
67: private final MessageBus messageBus;
68:
69: @Nonnull
70: private final StructureExplorerPresentation presentation;
71:
72: @VisibleForTesting void onOpenSite (@ListensTo @Nonnull final OpenSiteEvent event)
73: {
74: log.debug("onOpenSite({})", event);
75: final ResourceFile root = event.getFileSystem().findFileByPath(ROOT_SITE_NODE_PATH);
76: final SiteNode rootSiteNode = modelFactory.createSiteNode(site, root);
77: presentation.populate(PresentationModel.ofMaybePresentable(rootSiteNode));
78: presentation.expandFirstLevel();
79: messageBus.publish(emptySelectionEvent());
80: }
81: }