001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Anahide Tchertchian 018 */ 019package org.nuxeo.ecm.platform.contentview.jsf; 020 021import org.nuxeo.common.xmap.annotation.XNode; 022import org.nuxeo.common.xmap.annotation.XObject; 023 024/** 025 * @author Anahide Tchertchian 026 * @since 5.4 027 */ 028@XObject("layout") 029public class ContentViewLayoutImpl implements ContentViewLayout { 030 031 private static final long serialVersionUID = 1L; 032 033 @XNode("@name") 034 protected String name; 035 036 @XNode("@title") 037 protected String title; 038 039 @XNode("@translateTitle") 040 protected boolean translateTitle; 041 042 @XNode("@iconPath") 043 protected String iconPath; 044 045 @XNode("@showCSVExport") 046 protected boolean showCSVExport = false; 047 048 @XNode("@showPDFExport") 049 protected boolean showPDFExport = false; 050 051 @XNode("@showSyndicationLinks") 052 protected boolean showSyndicationLinks = false; 053 054 /** 055 * @since 6.0 056 */ 057 @XNode("@showSlideshow") 058 protected boolean showSlideshow = false; 059 060 /** 061 * @since 6.0 062 */ 063 @XNode("@showEditColumns") 064 protected boolean showEditColumns = false; 065 066 /** 067 * @since 6.0 068 */ 069 @XNode("@showEditRows") 070 protected boolean showEditRows = false; 071 072 /** 073 * @since 6.0 074 */ 075 @XNode("@showSpreadsheet") 076 protected boolean showSpreadsheet = false; 077 078 @XNode("@filterDisplayType") 079 protected String filterDisplayType; 080 081 /** 082 * @since 5.7.2, see {@link #isFilterUnfolded()} 083 */ 084 @XNode("@filterUnfolded") 085 protected boolean filterUnfolded = false; 086 087 public ContentViewLayoutImpl() { 088 } 089 090 public ContentViewLayoutImpl(String name, String title, boolean translateTitle, String iconPath, 091 boolean showCSVExport) { 092 this.name = name; 093 this.title = title; 094 this.translateTitle = translateTitle; 095 this.iconPath = iconPath; 096 this.showCSVExport = showCSVExport; 097 } 098 099 @Override 100 public String getIconPath() { 101 return iconPath; 102 } 103 104 @Override 105 public String getName() { 106 return name; 107 } 108 109 @Override 110 public String getTitle() { 111 return title; 112 } 113 114 @Override 115 public boolean getTranslateTitle() { 116 return translateTitle; 117 } 118 119 @Override 120 public boolean getShowCSVExport() { 121 return showCSVExport; 122 } 123 124 @Override 125 public boolean getShowPDFExport() { 126 return showPDFExport; 127 } 128 129 @Override 130 public boolean getShowSyndicationLinks() { 131 return showSyndicationLinks; 132 } 133 134 @Override 135 public boolean getShowSlideshow() { 136 return showSlideshow; 137 } 138 139 @Override 140 public boolean getShowEditColumns() { 141 return showEditColumns; 142 } 143 144 @Override 145 public boolean getShowEditRows() { 146 return showEditRows; 147 } 148 149 @Override 150 public boolean getShowSpreadsheet() { 151 return showSpreadsheet; 152 } 153 154 @Override 155 public String getFilterDisplayType() { 156 return filterDisplayType; 157 } 158 159 @Override 160 public boolean isFilterUnfolded() { 161 return filterUnfolded; 162 } 163 164 @Override 165 public String toString() { 166 final StringBuilder buf = new StringBuilder(); 167 buf.append("ContentViewLayoutImpl") 168 .append(" {") 169 .append(" name=") 170 .append(name) 171 .append(", title=") 172 .append(title) 173 .append(", translateTitle=") 174 .append(translateTitle) 175 .append(", iconPath=") 176 .append(iconPath) 177 .append('}'); 178 return buf.toString(); 179 } 180 181 @Override 182 public ContentViewLayoutImpl clone() { 183 ContentViewLayoutImpl clone = new ContentViewLayoutImpl(); 184 clone.name = getName(); 185 clone.title = getTitle(); 186 clone.translateTitle = getTranslateTitle(); 187 clone.iconPath = getIconPath(); 188 clone.showCSVExport = getShowCSVExport(); 189 clone.showPDFExport = getShowPDFExport(); 190 clone.showSyndicationLinks = getShowSyndicationLinks(); 191 clone.showSlideshow = getShowSlideshow(); 192 clone.showSpreadsheet = getShowSpreadsheet(); 193 clone.showEditColumns = getShowEditColumns(); 194 clone.showEditRows = getShowEditRows(); 195 clone.filterDisplayType = getFilterDisplayType(); 196 clone.filterUnfolded = isFilterUnfolded(); 197 return clone; 198 } 199 200}