001/*
002 * (C) Copyright 2010 Nuxeo SA (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 *     Anahide Tchertchian
016 */
017package org.nuxeo.ecm.platform.contentview.jsf;
018
019import org.nuxeo.common.xmap.annotation.XNode;
020import org.nuxeo.common.xmap.annotation.XObject;
021
022/**
023 * @author Anahide Tchertchian
024 * @since 5.4
025 */
026@XObject("layout")
027public class ContentViewLayoutImpl implements ContentViewLayout {
028
029    private static final long serialVersionUID = 1L;
030
031    @XNode("@name")
032    protected String name;
033
034    @XNode("@title")
035    protected String title;
036
037    @XNode("@translateTitle")
038    protected boolean translateTitle;
039
040    @XNode("@iconPath")
041    protected String iconPath;
042
043    @XNode("@showCSVExport")
044    protected boolean showCSVExport = false;
045
046    @XNode("@showPDFExport")
047    protected boolean showPDFExport = false;
048
049    @XNode("@showSyndicationLinks")
050    protected boolean showSyndicationLinks = false;
051
052    /**
053     * @since 6.0
054     */
055    @XNode("@showSlideshow")
056    protected boolean showSlideshow = false;
057
058    /**
059     * @since 6.0
060     */
061    @XNode("@showEditColumns")
062    protected boolean showEditColumns = false;
063
064    /**
065     * @since 6.0
066     */
067    @XNode("@showEditRows")
068    protected boolean showEditRows = false;
069
070    /**
071     * @since 6.0
072     */
073    @XNode("@showSpreadsheet")
074    protected boolean showSpreadsheet = false;
075
076    @XNode("@filterDisplayType")
077    protected String filterDisplayType;
078
079    /**
080     * @since 5.7.2, see {@link #isFilterUnfolded()}
081     */
082    @XNode("@filterUnfolded")
083    protected boolean filterUnfolded = false;
084
085    public ContentViewLayoutImpl() {
086    }
087
088    public ContentViewLayoutImpl(String name, String title, boolean translateTitle, String iconPath,
089            boolean showCSVExport) {
090        this.name = name;
091        this.title = title;
092        this.translateTitle = translateTitle;
093        this.iconPath = iconPath;
094        this.showCSVExport = showCSVExport;
095    }
096
097    @Override
098    public String getIconPath() {
099        return iconPath;
100    }
101
102    @Override
103    public String getName() {
104        return name;
105    }
106
107    @Override
108    public String getTitle() {
109        return title;
110    }
111
112    @Override
113    public boolean getTranslateTitle() {
114        return translateTitle;
115    }
116
117    @Override
118    public boolean getShowCSVExport() {
119        return showCSVExport;
120    }
121
122    @Override
123    public boolean getShowPDFExport() {
124        return showPDFExport;
125    }
126
127    @Override
128    public boolean getShowSyndicationLinks() {
129        return showSyndicationLinks;
130    }
131
132    @Override
133    public boolean getShowSlideshow() {
134        return showSlideshow;
135    }
136
137    @Override
138    public boolean getShowEditColumns() {
139        return showEditColumns;
140    }
141
142    @Override
143    public boolean getShowEditRows() {
144        return showEditRows;
145    }
146
147    @Override
148    public boolean getShowSpreadsheet() {
149        return showSpreadsheet;
150    }
151
152    @Override
153    public String getFilterDisplayType() {
154        return filterDisplayType;
155    }
156
157    @Override
158    public boolean isFilterUnfolded() {
159        return filterUnfolded;
160    }
161
162    @Override
163    public String toString() {
164        return String.format("ContentViewLayoutImpl [name=%s, title=%s, "
165                + "translateTitle=%s, iconPath=%s, showCSVExport=%s]", name, title, Boolean.valueOf(translateTitle),
166                iconPath, new Boolean(showCSVExport));
167    }
168
169    @Override
170    public ContentViewLayoutImpl clone() {
171        ContentViewLayoutImpl clone = new ContentViewLayoutImpl();
172        clone.name = getName();
173        clone.title = getTitle();
174        clone.translateTitle = getTranslateTitle();
175        clone.iconPath = getIconPath();
176        clone.showCSVExport = getShowCSVExport();
177        clone.showPDFExport = getShowPDFExport();
178        clone.showSyndicationLinks = getShowSyndicationLinks();
179        clone.showSlideshow = getShowSlideshow();
180        clone.showSpreadsheet = getShowSpreadsheet();
181        clone.showEditColumns = getShowEditColumns();
182        clone.showEditRows = getShowEditRows();
183        clone.filterDisplayType = getFilterDisplayType();
184        clone.filterUnfolded = isFilterUnfolded();
185        return clone;
186    }
187
188}