<?xml version="1.0" encoding="UTF-8"?><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"lang="en"><head><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"/><linkrel="stylesheet"href="../../jacoco-resources/report.css"type="text/css"/><linkrel="shortcut icon"href="../../jacoco-resources/report.gif"type="image/gif"/><title>Layout.java</title><linkrel="stylesheet"href="../../jacoco-resources/prettify.css"type="text/css"/><scripttype="text/javascript"src="../../jacoco-resources/prettify.js"></script></head><bodyonload="window['PR_TAB_WIDTH']=4;prettyPrint()"><divclass="breadcrumb"id="breadcrumb"><spanclass="info"><ahref="../../jacoco-sessions.html"class="el_session">Sessions</a></span><ahref="../../index.html"class="el_report">NorthernWind :: Frontend :: Media</a>><ahref="../index.html"class="el_bundle">it-tidalwave-northernwind-core</a>><ahref="index.source.html"class="el_package">it.tidalwave.northernwind.frontend.ui</a>><spanclass="el_source">Layout.java</span></div><h1>Layout.java</h1><preclass="source lang-java linenums">/*
* #%L
* *********************************************************************************************************************
*
* NorthernWind - lightweight CMS
* http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
* %%
* Copyright (C) 2011 - 2023 Tidalwave s.a.s. (http://tidalwave.it)
* %%
* *********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* *********************************************************************************************************************
*
*
* *********************************************************************************************************************
* #L%
*/
package it.tidalwave.northernwind.frontend.ui;
import javax.annotation.Nonnull;
import java.util.Optional;
import it.tidalwave.util.As;
import it.tidalwave.util.Id;
import it.tidalwave.util.NotFoundException;
import it.tidalwave.role.Composite;
import it.tidalwave.role.Identifiable;
import it.tidalwave.northernwind.core.model.HttpStatusException;
import it.tidalwave.northernwind.core.model.ModelFactory;
import it.tidalwave.northernwind.core.model.SiteNode;
import it.tidalwave.northernwind.frontend.ui.ViewFactory.ViewAndController;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.With;
/***********************************************************************************************************************
*
* A {@code Layout} contains the description of the visual structure of a {@link SiteNode}.
*
* @author Fabrizio Giudici
*
**********************************************************************************************************************/
public interface Layout extends As, Identifiable, Composite<Layout, LayoutFinder>
{
/*******************************************************************************************************************
*
* A builder of a {@link Layout}.
*
******************************************************************************************************************/
<spanclass="fc"id="L61"> @AllArgsConstructor(access = AccessLevel.PRIVATE) @RequiredArgsConstructor</span><spanclass="nc"id="L62"> @Getter @ToString(exclude = "callBack")</span>
public final class Builder
{
// Workaround for a Lombok limitation with Wither and subclasses
@FunctionalInterface
public static interface CallBack
{
@Nonnull
public Layout build (@Nonnull Builder builder);
}
@Nonnull
<spanclass="nc"id="L74"> private final ModelFactory modelFactory;</span>
@Nonnull
<spanclass="nc"id="L77"> private final CallBack callBack;</span><spanclass="pc bpc"id="L79"title="1 of 2 branches missed."> @With</span><spanclass="nc"id="L80"> private Id id;</span><spanclass="pc bpc"id="L82"title="1 of 2 branches missed."> @With</span><spanclass="fc"id="L83"> private String type;</span>
@Nonnull
public Layout build()
{
<spanclass="fc"id="L88"> return callBack.build(this);</span>
}
}
/*******************************************************************************************************************
*
* Returns the type URI for this layout.
*
* @return the type URI
*
******************************************************************************************************************/
@Nonnull
public String getTypeUri(); // FIXME: perhaps String should be a LayoutType wrapper? Or an Id?
perhaps String should be a LayoutType wrapper? Or an Id?
/*******************************************************************************************************************
*
* Creates a clone with another {@code Layout} as a child.
*
* @param child the child {@code Layout}
* @return the clone with the new child
*
******************************************************************************************************************/
@Nonnull
public Layout withChild (@Nonnull Layout child);
/*******************************************************************************************************************
*
* Creates a clone with another {@code Layout} overriding some parts.
*
* @param override the overriding {@code Layout}
* @return the clone with the override in effect
*
******************************************************************************************************************/
@Nonnull
public Layout withOverride (@Nonnull Layout override);
/*******************************************************************************************************************
*
* Accepts a {@link Visitor} to walk inside the structure and returns the (optional) computation product of the
* {@code Visitor}.
*
* @param visitor the {@code Visitor}
* @return the {@code Visitor} result
*
******************************************************************************************************************/
@Nonnull // TODO: push up to Composite
public <T> Optional<T> accept (@Nonnull Visitor<? super Layout, T> visitor);
/*******************************************************************************************************************
*
* Creates a new {@link View} with its {@link Controller} for the given {@link SiteNode}, typically because
* something needs to render it in response of a request.
*
* @param siteNode the {@code SiteNode}
* @return the {@code View} and its {@code Controller} within a {@link ViewAndController}
* @throws NotFoundException if no view component is found
* @throws HttpStatusException if a component asked to return a specific HTTP status
*
******************************************************************************************************************/
@Nonnull
public ViewAndController createViewAndController (@Nonnull SiteNode siteNode)
throws NotFoundException, HttpStatusException;
}
</pre><divclass="footer"><spanclass="right">Created with <ahref="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.9.202303310957</span></div></body></html>