001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.galleries.shared; 029 030import org.opencms.gwt.shared.CmsListInfoBean; 031import org.opencms.gwt.shared.sort.I_CmsHasPath; 032 033import java.util.ArrayList; 034 035/** 036 * Represents a gallery folder.<p> 037 * 038 * @since 8.0.0 039 */ 040public class CmsGalleryFolderBean extends CmsListInfoBean implements I_CmsHasPath { 041 042 /** A list with content types corresponding to this gallery type. */ 043 private ArrayList<String> m_contentTypes; 044 045 /** Flag to indicate if the user has write permissions to the gallery folder. */ 046 private boolean m_editable; 047 048 /** The folder site-path. */ 049 private String m_path; 050 051 /** 052 * Returns the content types which can be used within this gallery type.<p> 053 * 054 * @return the contentTypes 055 */ 056 public ArrayList<String> getContentTypes() { 057 058 return m_contentTypes; 059 } 060 061 /** 062 * Returns the description.<p> 063 * 064 * @return the description 065 */ 066 public String getPath() { 067 068 return m_path; 069 } 070 071 /** 072 * @see org.opencms.gwt.shared.CmsListInfoBean#getSubTitle() 073 */ 074 @Override 075 public String getSubTitle() { 076 077 return getPath(); 078 } 079 080 /** 081 * Returns the editable flag. Indicate if the user has write permissions to the gallery folder.<p> 082 * 083 * @return the editable flag 084 */ 085 public boolean isEditable() { 086 087 return m_editable; 088 } 089 090 /** 091 * Returns if the gallery matches the given filter.<p> 092 * 093 * @param filter the filter to match 094 * 095 * @return <code>true</code> if the gallery matches the given filter.<p> 096 */ 097 public boolean matchesFilter(String filter) { 098 099 filter = filter.toLowerCase(); 100 return getTitle().toLowerCase().contains(filter) || m_path.toLowerCase().contains(filter); 101 } 102 103 /** 104 * Sets the content types which can be used within this gallery type.<p> 105 * 106 * @param contentTypes the contentTypes to set 107 */ 108 public void setContentTypes(ArrayList<String> contentTypes) { 109 110 m_contentTypes = contentTypes; 111 } 112 113 /** 114 * Sets if the user has write permissions to the gallery folder.<p> 115 * 116 * @param editable <code>true</code> if the user has write permissions to the gallery folder 117 */ 118 public void setEditable(boolean editable) { 119 120 m_editable = editable; 121 } 122 123 /** 124 * Sets the description.<p> 125 * 126 * @param path the description to set 127 */ 128 public void setPath(String path) { 129 130 m_path = path; 131 } 132}