BrightSide Workbench Full Report + Source Code
MyDataItem.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2014 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.mydata;
20 
21 import org.turro.plugin.contacts.IContact;
22 import org.zkoss.zul.impl.InputElement;
23 
28 public class MyDataItem {
29 
30  private final MyDataItemType type;
31  private boolean required, readonly;
32  private String name, label, value;
33  private int cols;
34  private InputElement input;
35 
36  public MyDataItem(MyDataItemType type) {
37  this.type = type;
38  }
39 
41  return type;
42  }
43 
44  public boolean isReadonly() {
45  return readonly;
46  }
47 
48  public void setReadonly(boolean readonly) {
49  this.readonly = readonly;
50  }
51 
52  public boolean isRequired() {
53  return required;
54  }
55 
56  public void setRequired(boolean required) {
57  this.required = required;
58  }
59 
60  public String getName() {
61  return name;
62  }
63 
64  public void setName(String name) {
65  this.name = name;
66  }
67 
68  public String getLabel() {
69  return label;
70  }
71 
72  public void setLabel(String label) {
73  this.label = label;
74  }
75 
76  public String getValue() {
77  return value;
78  }
79 
80  public void setValue(String value) {
81  this.value = value;
82  }
83 
84  public int getCols() {
85  return cols;
86  }
87 
88  public void setCols(int cols) {
89  this.cols = cols;
90  }
91 
92  public InputElement getInput() {
93  return input;
94  }
95 
96  public void setInput(InputElement input) {
97  this.input = input;
98  }
99 
100  public void fillValue(IContact contact) {
101  if(null != type) switch (type) {
102  case MYDATA_NAME:
103  setValue(contact.getName());
104  break;
105  case MYDATA_GIF:
106  setValue(contact.getGlobalId());
107  break;
108  case MYDATA_CONNECTOR:
109  setValue(contact.getConnector(name));
110  break;
111  default:
112  break;
113  }
114  }
115 
116 }
void setInput(InputElement input)
Definition: MyDataItem.java:96
void fillValue(IContact contact)
void setRequired(boolean required)
Definition: MyDataItem.java:56
void setReadonly(boolean readonly)
Definition: MyDataItem.java:48