BrightSide Workbench Full Report + Source Code
org.turro.zkoss.input.CollectionCheckbox< V > Class Template Referenceabstract
Inheritance diagram for org.turro.zkoss.input.CollectionCheckbox< V >:
Collaboration diagram for org.turro.zkoss.input.CollectionCheckbox< V >:

Public Member Functions

 CollectionCheckbox ()
 
 CollectionCheckbox (Collection< V > collection)
 
void updateCollection ()
 
void updateCollection (Collection< V > collection)
 
Collection< V > getCollection ()
 
void setCollection (Collection< V > collection)
 
void setObjectValues (Collection< V > collection)
 
Collection< V > getObjectValues ()
 
void afterCompose ()
 
void clear ()
 
- Public Member Functions inherited from org.turro.zkoss.layout.VboxH
 VboxH (int maxRows)
 
int getMaxRows ()
 
void setMaxRows (int maxRows)
 
void addComponent (Component comp)
 
List getRealChildren ()
 

Protected Member Functions

void populateList ()
 
boolean equals (V value, V obj)
 
abstract String convertToString (V v)
 

Protected Attributes

boolean populated = false
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 35 of file CollectionCheckbox.java.

Constructor & Destructor Documentation

◆ CollectionCheckbox() [1/2]

Definition at line 41 of file CollectionCheckbox.java.

41  {
42  super(0);
43  }

◆ CollectionCheckbox() [2/2]

org.turro.zkoss.input.CollectionCheckbox< V >.CollectionCheckbox ( Collection< V >  collection)

Definition at line 45 of file CollectionCheckbox.java.

45  {
46  super(0);
47  this.collection = collection;
48  }

Member Function Documentation

◆ afterCompose()

void org.turro.zkoss.input.CollectionCheckbox< V >.afterCompose ( )

Reimplemented in org.turro.financials.contract.ContractPreferencesCheckbox.

Definition at line 131 of file CollectionCheckbox.java.

131  {
132  if(!populated) {
133  populateList();
134  populated = true;
135  if (internalValues != null) {
136  setObjectValues(internalValues);
137  internalValues = null;
138  }
139  }
140  }
void setObjectValues(Collection< V > collection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

Reimplemented from org.turro.zkoss.layout.VboxH.

Definition at line 143 of file CollectionCheckbox.java.

143  {
144  super.clear();
145  populated = false;
146  }
Here is the caller graph for this function:

◆ convertToString()

abstract String org.turro.zkoss.input.CollectionCheckbox< V >.convertToString ( v)
abstractprotected
Here is the caller graph for this function:

◆ equals()

boolean org.turro.zkoss.input.CollectionCheckbox< V >.equals ( value,
obj 
)
protected

Definition at line 87 of file CollectionCheckbox.java.

87  {
88  String v1 = value == null ? null : convertToString(value);
89  String v2 = obj == null ? null : convertToString(obj);
90  return (v1 == null && v2 == null) ||
91  (v1 != null && v1.equals(v2));
92  }
Here is the call graph for this function:

◆ getCollection()

Collection<V> org.turro.zkoss.input.CollectionCheckbox< V >.getCollection ( )

Definition at line 62 of file CollectionCheckbox.java.

62  {
63  return collection;
64  }
Here is the caller graph for this function:

◆ getObjectValues()

Collection<V> org.turro.zkoss.input.CollectionCheckbox< V >.getObjectValues ( )

Definition at line 114 of file CollectionCheckbox.java.

114  {
115  if(!populated) {
116  return internalValues;
117  }
118  HashSet<V> set = new HashSet<V>();
119  for(Component c : (List<Component>) getRealChildren()) {
120  if(c instanceof Checkbox) {
121  Checkbox cb = (Checkbox) c;
122  if(cb.isChecked()) {
123  set.add((V) cb.getAttribute("obj"));
124  }
125  }
126  }
127  return set;
128  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateList()

void org.turro.zkoss.input.CollectionCheckbox< V >.populateList ( )
protected

Definition at line 70 of file CollectionCheckbox.java.

70  {
71  //setSizedByContent(true);
72  clear();
73  if(collection == null) return;
74  for(V v : collection) {
75  Checkbox cb = new Checkbox(convertToString(v));
76  cb.setAttribute("obj", v);
77  addComponent(cb);
78  cb.addEventListener(Events.ON_CHECK, new EventListener() {
79  @Override
80  public void onEvent(Event event) throws Exception {
81  Events.postEvent(new Event(Events.ON_CHECK, CollectionCheckbox.this));
82  }
83  });
84  }
85  }
void addComponent(Component comp)
Definition: VboxH.java:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCollection()

void org.turro.zkoss.input.CollectionCheckbox< V >.setCollection ( Collection< V >  collection)

Definition at line 66 of file CollectionCheckbox.java.

66  {
67  this.collection = collection;
68  }
Here is the caller graph for this function:

◆ setObjectValues()

void org.turro.zkoss.input.CollectionCheckbox< V >.setObjectValues ( Collection< V >  collection)

Definition at line 96 of file CollectionCheckbox.java.

96  {
97  if(!populated) {
98  internalValues = collection;
99  }
100  for(Component c : (List<Component>) getRealChildren()) {
101  if(c instanceof Checkbox) {
102  Checkbox cb = (Checkbox) c;
103  cb.setChecked(false);
104  for(V v : collection) {
105  if(cb.getLabel().equals(convertToString(v))) {
106  cb.setChecked(true);
107  break;
108  }
109  }
110  }
111  }
112  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCollection() [1/2]

void org.turro.zkoss.input.CollectionCheckbox< V >.updateCollection ( )

Definition at line 50 of file CollectionCheckbox.java.

50  {
51  clear();
52  setCollection(collection);
53  afterCompose();
54  }
void setCollection(Collection< V > collection)
Here is the call graph for this function:

◆ updateCollection() [2/2]

void org.turro.zkoss.input.CollectionCheckbox< V >.updateCollection ( Collection< V >  collection)

Definition at line 56 of file CollectionCheckbox.java.

56  {
57  clear();
58  setCollection(collection);
59  afterCompose();
60  }
Here is the call graph for this function:

Member Data Documentation

◆ populated

boolean org.turro.zkoss.input.CollectionCheckbox< V >.populated = false
protected

Definition at line 38 of file CollectionCheckbox.java.


The documentation for this class was generated from the following file: