View Javadoc
1   /**
2    * This file Copyright (c) 2010-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  /**
37   * Field definition for a rich-text field.
38   */
39  public class RichTextFieldDefinition extends ConfiguredFieldDefinition {
40  
41      private boolean alignment;
42      private boolean images;
43      private boolean lists = true;
44      private boolean source;
45      private boolean tables;
46  
47      private long height;
48  
49      private String colors;
50      private String fonts;
51      private String fontSizes;
52  
53      private String configJsFile;
54  
55      /**
56       * Defines whether text alignment (left, center, right, justify) is allowed in this rich-text field.
57       *
58       * @return <code>true</code> if alignment is enabled, <code>false</code> otherwise. Defaults to <code>false</code>.
59       */
60      public boolean isAlignment() {
61          return alignment;
62      }
63  
64      public void setAlignment(boolean alignment) {
65          this.alignment = alignment;
66      }
67  
68      /**
69       * Defines whether images are allowed in this rich-text field.
70       *
71       * @return <code>true</code> if images are enabled, <code>false</code> otherwise. Defaults to <code>false</code>.
72       */
73      public boolean isImages() {
74          return images;
75      }
76  
77      public void setImages(boolean images) {
78          this.images = images;
79      }
80  
81      /**
82       * Defines whether lists are allowed in this rich-text field.
83       *
84       * @return <code>true</code> if lists are enabled, <code>false</code> otherwise. Defaults to <code>true</code>.
85       */
86      public boolean isLists() {
87          return lists;
88      }
89  
90      public void setLists(boolean lists) {
91          this.lists = lists;
92      }
93  
94      /**
95       * Defines whether source mode is allowed in this rich-text field.
96       *
97       * @return <code>true</code> if source mode is enabled, <code>false</code> otherwise. Defaults to <code>false</code>.
98       */
99      public boolean isSource() {
100         return source;
101     }
102 
103     public void setSource(boolean source) {
104         this.source = source;
105     }
106 
107     /**
108      * Defines whether tables are allowed in this rich-text field.
109      *
110      * @return <code>true</code> if tables are enabled, <code>false</code> otherwise. Defaults to <code>true</code>.
111      */
112     public boolean isTables() {
113         return tables;
114     }
115 
116     public void setTables(boolean tables) {
117         this.tables = tables;
118     }
119 
120     /**
121      * Defines the height of this rich-text field, in pixels.
122      */
123     public long getHeight() {
124         return height;
125     }
126 
127     public void setHeight(long height) {
128         this.height = height;
129     }
130 
131     /**
132      * Defines the text colors that are allowed in this rich-text field.
133      *
134      * @return a comma separated list of colors, as per CKEditor documentation (hexadecimal codes, without leading hash).
135      * @see <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-colorButton_colors">http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-colorButton_colors</a>
136      */
137     public String getColors() {
138         return colors;
139     }
140 
141     public void setColors(String colors) {
142         this.colors = colors;
143     }
144 
145     /**
146      * Defines the font families that are allowed in this rich-text field.
147      *
148      * @return a semi-colon separated list of font names, as per CKEditor documentation.
149      * @see <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-font_names">http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-font_names</a>
150      */
151     public String getFonts() {
152         return fonts;
153     }
154 
155     public void setFonts(String fonts) {
156         this.fonts = fonts;
157     }
158 
159     /**
160      * Defines the font sizes that are allowed in this rich-text field.
161      *
162      * @return a semi-colon separated list of font sizes, as per CKEditor documentation (including CSS unit).
163      * @see <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fontSize_sizes">http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fontSize_sizes</a>
164      */
165     public String getFontSizes() {
166         return fontSizes;
167     }
168 
169     public void setFontSizes(String fontSizes) {
170         this.fontSizes = fontSizes;
171     }
172 
173     /**
174      * Defines the custom configuration file for this rich-text field.
175      *
176      * @return a path to the config JavaScript file, relative to context path.
177      */
178     public String getConfigJsFile() {
179         return configJsFile;
180     }
181 
182     public void setConfigJsFile(String configJsFile) {
183         this.configJsFile = configJsFile;
184     }
185 }