001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
016 *
017 * $Id: Layouts.java 26053 2007-10-16 01:45:43Z atchertchian $
018 */
019
020package org.nuxeo.ecm.platform.types;
021
022import java.io.Serializable;
023
024import org.nuxeo.common.xmap.annotation.XNode;
025import org.nuxeo.common.xmap.annotation.XNodeList;
026import org.nuxeo.common.xmap.annotation.XObject;
027
028/**
029 * Layout list descriptor
030 *
031 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
032 */
033@XObject("layouts")
034public class Layouts implements Serializable {
035
036    private static final long serialVersionUID = 1L;
037
038    @XNode("@append")
039    boolean append;
040
041    @XNodeList(value = "layout", type = String[].class, componentType = String.class)
042    String[] layouts = new String[0];
043
044    public String[] getLayouts() {
045        return layouts;
046    }
047
048    public boolean getAppend() {
049        return append;
050    }
051
052    /**
053     * Clone to handle hot reload
054     *
055     * @since 5.6
056     */
057    @Override
058    protected Layouts clone() {
059        Layouts clone = new Layouts();
060        clone.append = getAppend();
061        String[] layouts = getLayouts();
062        if (layouts != null) {
063            clone.layouts = layouts.clone();
064        }
065        return clone;
066    }
067
068}