BrightSide Workbench Full Report + Source Code
ContactField.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2013 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.contacts.control;
20 
21 import java.util.ArrayList;
22 import org.zkoss.zk.ui.HtmlBasedComponent;
23 
28 public class ContactField {
29 
30  private ContactFieldType type;
31  private boolean required;
32  private String fieldLabel, finalLabel;
33  private ArrayList<HtmlBasedComponent> editors = new ArrayList<HtmlBasedComponent>();
34 
35  public ContactField(ContactFieldType type, boolean required) {
36  this(type, required, null);
37  }
38 
39  public ContactField(ContactFieldType type, boolean required, String fieldLabel) {
40  this.type = type;
41  this.required = required;
42  this.fieldLabel = fieldLabel;
43  }
44 
46  return type;
47  }
48 
49  public boolean isRequired() {
50  return required;
51  }
52 
53  public String getFinalLabel() {
54  return finalLabel;
55  }
56 
57  public void setFinalLabel(String finalLabel) {
58  this.finalLabel = finalLabel;
59  }
60 
61  public String getFieldLabel() {
62  return fieldLabel;
63  }
64 
65  public HtmlBasedComponent getEditor() {
66  return editors.get(0);
67  }
68 
69  public void setEditor(HtmlBasedComponent editor) {
70  editors.clear();
71  addEditor(editor);
72  }
73 
74  public void addEditor(HtmlBasedComponent editor) {
75  editors.add(editor);
76  }
77 
78  public ArrayList<HtmlBasedComponent> getEditors() {
79  return editors;
80  }
81 
82  public HtmlBasedComponent getLastEditor() {
83  return editors.get(editors.size() - 1);
84  }
85 
86 }
void setFinalLabel(String finalLabel)
ContactField(ContactFieldType type, boolean required, String fieldLabel)
void setEditor(HtmlBasedComponent editor)
ContactField(ContactFieldType type, boolean required)
void addEditor(HtmlBasedComponent editor)
ArrayList< HtmlBasedComponent > getEditors()