View Javadoc
1   /**
2    * This file Copyright (c) 2013-2018 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.ui.form.field.definition;
35  
36  import info.magnolia.ui.form.field.transformer.Transformer;
37  import info.magnolia.ui.form.field.transformer.item.FileTransformer;
38  
39  /**
40   * Field definition for a the basic upload field.
41   */
42  public class BasicUploadFieldDefinition extends ConfiguredFieldDefinition {
43  
44      // Define the upload Binary Node name.
45      private String binaryNodeName = "binaryNodeName";
46      // Define the maximum file size in bite.
47      private long maxUploadSize = Long.MAX_VALUE;
48      // Define allowed uploadMimeType
49      private String allowedMimeTypePattern = ".*";
50      // Define if the File Name can be edited
51      private boolean editFileName = false;
52      // Define if the File Format can be edited
53      private boolean editFileFormat = false;
54  
55      // Define the Captions
56      private String selectNewCaption = "field.upload.basic.select.new";
57      private String selectAnotherCaption = "field.upload.basic.select.another";
58      private String deleteCaption = "field.upload.basic.select.delete";
59      private String dropZoneCaption = "field.upload.basic.drop.hint";
60      private String inProgressCaption = "field.upload.basic.uploading.file";
61      private String inProgressRatioCaption = "field.upload.basic.uploaded.file";
62      private String fileDetailHeaderCaption = "field.upload.basic.file.detail.header";
63      private String fileDetailNameCaption = "field.upload.basic.file.detail.name";
64      private String fileDetailSizeCaption = "field.upload.basic.file.detail.size";
65      private String fileDetailFormatCaption = "field.upload.basic.file.detail.format";
66      private String fileDetailSourceCaption = "field.upload.basic.file.detail.source";
67      private String successNoteCaption = "field.upload.basic.note.success";
68      private String warningNoteCaption = "field.upload.basic.note.warning";
69      private String errorNoteCaption = "field.upload.basic.note.error";
70      private String sizeInterruption = "field.upload.interupted.size";
71      private String typeInterruption = "field.upload.interupted.type";
72      private String userInterruption = "field.upload.interupted.user";
73  
74      public BasicUploadFieldDefinition() {
75          setTransformerClass((Class<? extends Transformer<?>>) (Object) FileTransformer.class);
76      }
77  
78      public String getBinaryNodeName() {
79          return binaryNodeName;
80      }
81  
82      public void setBinaryNodeName(String binaryNodeName) {
83          this.binaryNodeName = binaryNodeName;
84      }
85  
86      public long getMaxUploadSize() {
87          return maxUploadSize;
88      }
89  
90      public void setMaxUploadSize(long maxUploadSize) {
91          this.maxUploadSize = maxUploadSize;
92      }
93  
94      public String getAllowedMimeTypePattern() {
95          return allowedMimeTypePattern;
96      }
97  
98      public void setAllowedMimeTypePattern(String allowedMimeTypePattern) {
99          this.allowedMimeTypePattern = allowedMimeTypePattern;
100     }
101 
102     public String getSelectNewCaption() {
103         return selectNewCaption;
104     }
105 
106     public void setSelectNewCaption(String selectNewCaption) {
107         this.selectNewCaption = selectNewCaption;
108     }
109 
110     public String getSelectAnotherCaption() {
111         return selectAnotherCaption;
112     }
113 
114     public void setSelectAnotherCaption(String selectAnotherCaption) {
115         this.selectAnotherCaption = selectAnotherCaption;
116     }
117 
118     public String getDropZoneCaption() {
119         return dropZoneCaption;
120     }
121 
122     public void setDropZoneCaption(String dropZoneCaption) {
123         this.dropZoneCaption = dropZoneCaption;
124     }
125 
126     public String getInProgressCaption() {
127         return inProgressCaption;
128     }
129 
130     public void setInProgressCaption(String inProgressCaption) {
131         this.inProgressCaption = inProgressCaption;
132     }
133 
134     public String getInProgressRatioCaption() {
135         return inProgressRatioCaption;
136     }
137 
138     public void setInProgressRatioCaption(String inProgressRatioCaption) {
139         this.inProgressRatioCaption = inProgressRatioCaption;
140     }
141 
142     public String getFileDetailHeaderCaption() {
143         return fileDetailHeaderCaption;
144     }
145 
146     public void setFileDetailHeaderCaption(String fileDetailHeaderCaption) {
147         this.fileDetailHeaderCaption = fileDetailHeaderCaption;
148     }
149 
150     public String getFileDetailNameCaption() {
151         return fileDetailNameCaption;
152     }
153 
154     public void setFileDetailNameCaption(String fileDetailNameCaption) {
155         this.fileDetailNameCaption = fileDetailNameCaption;
156     }
157 
158     public String getFileDetailSizeCaption() {
159         return fileDetailSizeCaption;
160     }
161 
162     public void setFileDetailSizeCaption(String fileDetailSizeCaption) {
163         this.fileDetailSizeCaption = fileDetailSizeCaption;
164     }
165 
166     public String getFileDetailFormatCaption() {
167         return fileDetailFormatCaption;
168     }
169 
170     public void setFileDetailFormatCaption(String fileDetailFormatCaption) {
171         this.fileDetailFormatCaption = fileDetailFormatCaption;
172     }
173 
174     public String getFileDetailSourceCaption() {
175         return fileDetailSourceCaption;
176     }
177 
178     public void setFileDetailSourceCaption(String fileDetailSourceCaption) {
179         this.fileDetailSourceCaption = fileDetailSourceCaption;
180     }
181 
182     public String getSuccessNoteCaption() {
183         return successNoteCaption;
184     }
185 
186     public void setSuccessNoteCaption(String successNoteCaption) {
187         this.successNoteCaption = successNoteCaption;
188     }
189 
190     public String getWarningNoteCaption() {
191         return warningNoteCaption;
192     }
193 
194     public void setWarningNoteCaption(String warningNoteCaption) {
195         this.warningNoteCaption = warningNoteCaption;
196     }
197 
198     public String getErrorNoteCaption() {
199         return errorNoteCaption;
200     }
201 
202     public void setErrorNoteCaption(String errorNoteCaption) {
203         this.errorNoteCaption = errorNoteCaption;
204     }
205 
206     public String getDeleteCaption() {
207         return deleteCaption;
208     }
209 
210     public void setDeleteCaption(String deleteCaption) {
211         this.deleteCaption = deleteCaption;
212     }
213 
214     public boolean isEditFileName() {
215         return editFileName;
216     }
217 
218     public void setEditFileName(boolean editFileName) {
219         this.editFileName = editFileName;
220     }
221 
222     public boolean isEditFileFormat() {
223         return editFileFormat;
224     }
225 
226     public void setEditFileFormat(boolean editFileFormat) {
227         this.editFileFormat = editFileFormat;
228     }
229 
230     public String getSizeInterruption() {
231         return sizeInterruption;
232     }
233 
234     public void setSizeInterruption(String sizeInterruption) {
235         this.sizeInterruption = sizeInterruption;
236     }
237 
238     public String getTypeInterruption() {
239         return typeInterruption;
240     }
241 
242     public void setTypeInterruption(String typeInterruption) {
243         this.typeInterruption = typeInterruption;
244     }
245 
246     public String getUserInterruption() {
247         return userInterruption;
248     }
249 
250     public void setUserInterruption(String userInterruption) {
251         this.userInterruption = userInterruption;
252     }
253 }