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.contentapp.definition;
35  
36  import info.magnolia.ui.dialog.actionarea.definition.ConfiguredEditorActionAreaDefinition;
37  import info.magnolia.ui.dialog.actionarea.definition.EditorActionAreaDefinition;
38  import info.magnolia.ui.dialog.actionarea.definition.FormActionItemDefinition;
39  import info.magnolia.ui.form.definition.FormDefinition;
40  import info.magnolia.ui.vaadin.integration.contentconnector.NodeTypeDefinition;
41  
42  import java.util.List;
43  
44  /**
45   * Simple implementation of {@link EditorDefinition}.
46   *
47   * @see EditorDefinition
48   */
49  public class ConfiguredEditorDefinition implements EditorDefinition {
50  
51      private FormDefinition form;
52  
53      private String label;
54  
55      private String i18nBasename;
56  
57      private String description;
58  
59      private NodeTypeDefinition nodeType;
60  
61      private EditorActionAreaDefinition actionArea = new ConfiguredEditorActionAreaDefinition();
62  
63      private List<FormActionItemDefinition> actions;
64  
65      private boolean isWide = false;
66  
67      @Override
68      public String getLabel() {
69          return label;
70      }
71  
72      @Override
73      public String getI18nBasename() {
74          return i18nBasename;
75      }
76  
77      @Override
78      public String getDescription() {
79          return description;
80      }
81  
82      @Override
83      public NodeTypeDefinition getNodeType() {
84          return nodeType;
85      }
86  
87      @Override
88      public FormDefinition getForm() {
89          return form;
90      }
91  
92      public void setLabel(String label) {
93          this.label = label;
94      }
95  
96      public void setI18nBasename(String i18nBasename) {
97          this.i18nBasename = i18nBasename;
98      }
99  
100     public void setDescription(String description) {
101         this.description = description;
102     }
103 
104     public void setForm(FormDefinition form) {
105         this.form = form;
106     }
107 
108     public void setNodeType(NodeTypeDefinition nodeType) {
109         this.nodeType = nodeType;
110     }
111 
112     @Override
113     public EditorActionAreaDefinition getActionArea() {
114         return actionArea;
115     }
116 
117     public void setActionArea(EditorActionAreaDefinition editorActionAreaDefinition) {
118         this.actionArea = editorActionAreaDefinition;
119     }
120 
121     @Override
122     public List<FormActionItemDefinition> getActions() {
123         return actions;
124     }
125 
126     public void setActions(List<FormActionItemDefinition> actions) {
127         this.actions = actions;
128     }
129 
130     /**
131      * @return Whether the editor should be displayed in a wide mode by default.
132      */
133     @Override
134     public boolean isWide() {
135         return isWide;
136     }
137 
138     public void setWide(boolean isWide){
139         this.isWide = isWide;
140     }
141 }