Content of file PropertyBinder.java.html

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>PropertyBinder.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Zephyr - UI Content Editor</a> &gt; <a href="index.source.html" class="el_package">it.tidalwave.northernwind.rca.ui.contenteditor.spi</a> &gt; <span class="el_source">PropertyBinder.java</span></div><h1>PropertyBinder.java</h1><pre class="source lang-java linenums">/*
 * #%L
 * *********************************************************************************************************************
 *
 * NorthernWind - lightweight CMS
 * http://northernwind.tidalwave.it - git clone git@bitbucket.org:tidalwave/northernwind-rca-src.git
 * %%
 * Copyright (C) 2013 - 2021 Tidalwave s.a.s. (http://tidalwave.it)
 * %%
 * *********************************************************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); 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 &quot;AS IS&quot; 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.rca.ui.contenteditor.spi;

import javax.annotation.Nonnull;
import it.tidalwave.util.Key;
import it.tidalwave.role.ui.BoundProperty;
import it.tidalwave.northernwind.core.model.ResourceProperties;
import it.tidalwave.northernwind.rca.embeddedserver.EmbeddedServer.Document;

/***********************************************************************************************************************
 *
 * A role that allows to bind items of {@link ResourceProperties} to other objects, typically for managing a User
 * Interface.
 *
 * @stereotype role
 *
 * @author  Fabrizio Giudici
 *
 **********************************************************************************************************************/
public interface PropertyBinder
  {
<span class="fc" id="L47">    public static final Class&lt;PropertyBinder&gt; _PropertyBinder_ = PropertyBinder.class;</span>

    /*******************************************************************************************************************
     *
     * A callback that notifies when an item has been updated. Any change to bound objects will cause the creation of
     * a new instance of {@link ResourceProperties} with the updated values, notified through this callback.
     *
     ******************************************************************************************************************/
    @FunctionalInterface
    public static interface UpdateCallback
      {
        public void notify (@Nonnull ResourceProperties properties);
      }

    /*******************************************************************************************************************
     *
     * Binds a given property to a {@link BoundProperty}. This is useful for any kind of property types, with the
     * exception of HTML documents.
     *
     * @param  propertyName   the property name in {@link ResourceProperties}
     * @param  boundProperty  the object to bind
     * @param  callback       the callback that will notify updates
     *
     ******************************************************************************************************************/
    public &lt;T&gt; void bind (@Nonnull Key&lt;T&gt; propertyName,
                          @Nonnull BoundProperty&lt;T&gt; boundProperty,
                          @Nonnull UpdateCallback callback);

    /*******************************************************************************************************************
     *
     * Creates a Document bound to the given property. This is useful for HTML documents, since they undergo a special
     * processing for being edited in a HTML viewer (CSS and JavaScript resources are inserted in the head).
     *
     * FIXME: I don't like the asymmetry with bind(), that accepts a BoundProperty. This is due to the fact that
I don't like the asymmetry with bind(), that accepts a BoundProperty. This is due to the fact that
* BoundProperty is mutable, while Document is immutable. Actually, a mutable Document would be acceptable. * * @param propertyName the property name in {@link ResourceProperties} * @param callback the callback that will notify updates * @return the bound document * ******************************************************************************************************************/ @Nonnull public Document createBoundDocument (@Nonnull Key&lt;String&gt; propertyName, @Nonnull UpdateCallback callback); } </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html>