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.gwt.shared; 029 030import java.util.ArrayList; 031import java.util.Collections; 032import java.util.List; 033 034import com.google.gwt.user.client.rpc.IsSerializable; 035 036/** 037 * Data needed by the dialog for creating new list elements. 038 */ 039public class CmsListElementCreationDialogData implements IsSerializable { 040 041 /** The dialog caption. */ 042 private String m_caption; 043 044 /** The resource info bean to display on top. */ 045 private CmsListInfoBean m_listInfo; 046 047 /** The error message to display. */ 048 private String m_message; 049 050 /** The list of options (types). */ 051 private List<CmsListElementCreationOption> m_options = new ArrayList<>(); 052 053 /** The post-create handler to use. */ 054 private String m_postCreateHandler; 055 056 /** The upload folder. */ 057 private String m_uploadFolder; 058 059 /** 060 * Creates a new instance. 061 */ 062 public CmsListElementCreationDialogData() {} 063 064 /** 065 * Adds an option. 066 * 067 * @param option the option to add 068 */ 069 public void add(CmsListElementCreationOption option) { 070 071 m_options.add(option); 072 } 073 074 /** 075 * Gets the caption. 076 * 077 * @return the caption 078 */ 079 public String getCaption() { 080 081 return m_caption; 082 } 083 084 /** 085 * Gets the resource list info for the element to display on top of the dialog. 086 * 087 * @return the list info 088 */ 089 public CmsListInfoBean getListInfo() { 090 091 return m_listInfo; 092 } 093 094 /** 095 * Gets the message. 096 * 097 * @return the message 098 */ 099 public String getMessage() { 100 101 return m_message; 102 } 103 104 /** 105 * Gets the options. 106 * 107 * @return the options 108 */ 109 public List<CmsListElementCreationOption> getOptions() { 110 111 return Collections.unmodifiableList(m_options); 112 } 113 114 /** 115 * Gets the post create handler. 116 * 117 * @return the post create handler 118 */ 119 public String getPostCreateHandler() { 120 121 return m_postCreateHandler; 122 } 123 124 /** 125 * Gets the upload folder. 126 * 127 * @return the upload folder 128 */ 129 public String getUploadFolder() { 130 131 return m_uploadFolder; 132 } 133 134 /** 135 * Checks if adding to the list should trigger upload mode. 136 * 137 * @return true if this requires upload mode 138 */ 139 public boolean isUpload() { 140 141 return m_uploadFolder != null; 142 } 143 144 /** 145 * Sets the caption. 146 * 147 * @param caption the new caption 148 */ 149 public void setCaption(String caption) { 150 151 m_caption = caption; 152 } 153 154 /** 155 * Sets the list info. 156 * 157 * @param listInfo the new list info 158 */ 159 public void setListInfo(CmsListInfoBean listInfo) { 160 161 m_listInfo = listInfo; 162 } 163 164 /** 165 * Sets the message. 166 * 167 * @param message the new message 168 */ 169 public void setMessage(String message) { 170 171 m_message = message; 172 } 173 174 /** 175 * Sets the post create handler. 176 * 177 * @param postCreateHandler the new post create handler 178 */ 179 public void setPostCreateHandler(String postCreateHandler) { 180 181 m_postCreateHandler = postCreateHandler; 182 } 183 184 /** 185 * Sets the upload folder. 186 * 187 * @param uploadFolder the upload folder 188 */ 189 public void setUploadFolder(String uploadFolder) { 190 191 m_uploadFolder = uploadFolder; 192 } 193 194}