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

Public Member Functions

 JpaListbox ()
 
 JpaListbox (Dao dao, String query, boolean checkmark, boolean autoSave)
 
boolean isAutoSave ()
 
void setAutoSave (boolean autoSave)
 
Dao getDao ()
 
void setDao (Dao dao)
 
String getQuery ()
 
void setQuery (String query)
 
abstract String convertToString (V v)
 
abstract boolean getChecked (V v)
 
abstract void setChecked (V v, boolean checked)
 
boolean isAllowNull ()
 
void setAllowNull (boolean allowNull)
 
String getNullLabel ()
 
void setNullLabel (String nullLabel)
 
- Public Member Functions inherited from org.turro.zkoss.input.GenericListbox< V >
 GenericListbox ()
 
void setDisabled (boolean value)
 
void afterCompose ()
 
void clearItems ()
 
void setObjectValue (V value)
 
void setObjectValues (Collection< V > collection)
 
getObjectValue ()
 
Collection< V > getObjectValues ()
 
Collection< V > getDeselectedObjectValues ()
 
boolean isSelectFirst ()
 
void setSelectFirst (boolean selectFirst)
 
Set getDeselectedItems ()
 
void sort ()
 
Object getRelatedEntity ()
 
void setRelatedEntity (Object relatedEntity)
 

Protected Member Functions

void populateList ()
 
boolean equals (V value, V obj)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.zkoss.input.GenericListbox< V >
boolean populated = false
 

Detailed Description

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

Definition at line 33 of file JpaListbox.java.

Constructor & Destructor Documentation

◆ JpaListbox() [1/2]

Definition at line 41 of file JpaListbox.java.

41  {
42  }

◆ JpaListbox() [2/2]

org.turro.jpa.input.JpaListbox< V >.JpaListbox ( Dao  dao,
String  query,
boolean  checkmark,
boolean  autoSave 
)

Definition at line 44 of file JpaListbox.java.

44  {
45  this.dao = dao;
46  this.query = query;
47  this.autoSave = autoSave;
48  setCheckmark(checkmark);
49  }

Member Function Documentation

◆ convertToString()

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

◆ equals()

boolean org.turro.jpa.input.JpaListbox< V >.equals ( value,
obj 
)
protected

Reimplemented from org.turro.zkoss.input.GenericListbox< V >.

Definition at line 125 of file JpaListbox.java.

125  {
126  String v1 = value == null ? null : convertToString(value);
127  String v2 = obj == null ? null : convertToString(obj);
128  return (v1 == null && v2 == null) ||
129  (v1 != null && v1.equals(v2));
130  }
abstract String convertToString(V v)
Here is the call graph for this function:

◆ getChecked()

abstract boolean org.turro.jpa.input.JpaListbox< V >.getChecked ( v)
abstract
Here is the caller graph for this function:

◆ getDao()

Definition at line 59 of file JpaListbox.java.

59  {
60  return dao;
61  }

◆ getNullLabel()

String org.turro.jpa.input.JpaListbox< V >.getNullLabel ( )

Definition at line 116 of file JpaListbox.java.

116  {
117  return nullLabel;
118  }

◆ getQuery()

String org.turro.jpa.input.JpaListbox< V >.getQuery ( )

Definition at line 67 of file JpaListbox.java.

67  {
68  return query;
69  }

◆ isAllowNull()

boolean org.turro.jpa.input.JpaListbox< V >.isAllowNull ( )

Definition at line 108 of file JpaListbox.java.

108  {
109  return allowNull;
110  }

◆ isAutoSave()

boolean org.turro.jpa.input.JpaListbox< V >.isAutoSave ( )

Definition at line 51 of file JpaListbox.java.

51  {
52  return autoSave;
53  }

◆ populateList()

void org.turro.jpa.input.JpaListbox< V >.populateList ( )
protected

Reimplemented from org.turro.zkoss.input.GenericListbox< V >.

Reimplemented in org.turro.publication.zul.www.CategoryListbox.

Definition at line 76 of file JpaListbox.java.

76  {
77  if(dao == null) return;
78  if(allowNull) {
79  Listitem li = new Listitem(I_.get(nullLabel), null);
80  appendChild(li);
81  }
82  for(Object o : dao.getResultList(query)) {
83  Listitem li = new Listitem(convertToString((V) o), o);
84  if(isCheckmark()) {
85  li.setSelected(getChecked((V) o));
86  }
87  appendChild(li);
88  }
89  addEventListener(Events.ON_SELECT, new EventListener() {
90  @Override
91  public void onEvent(Event event) throws Exception {
92  for(Listitem li : (List<Listitem>) getItems()) {
93  if(getChecked((V) li.getValue()) != li.isSelected()) {
94  setChecked((V) li.getValue(), li.isSelected());
95  if(autoSave) {
96  dao.saveObject(li.getValue());
97  }
98  }
99  }
100  }
101  });
102  }
abstract void setChecked(V v, boolean checked)
abstract boolean getChecked(V v)
Here is the call graph for this function:

◆ setAllowNull()

void org.turro.jpa.input.JpaListbox< V >.setAllowNull ( boolean  allowNull)

Definition at line 112 of file JpaListbox.java.

112  {
113  this.allowNull = allowNull;
114  }

◆ setAutoSave()

void org.turro.jpa.input.JpaListbox< V >.setAutoSave ( boolean  autoSave)

Definition at line 55 of file JpaListbox.java.

55  {
56  this.autoSave = autoSave;
57  }
Here is the caller graph for this function:

◆ setChecked()

abstract void org.turro.jpa.input.JpaListbox< V >.setChecked ( v,
boolean  checked 
)
abstract
Here is the caller graph for this function:

◆ setDao()

void org.turro.jpa.input.JpaListbox< V >.setDao ( Dao  dao)

Definition at line 63 of file JpaListbox.java.

63  {
64  this.dao = dao;
65  }
Here is the caller graph for this function:

◆ setNullLabel()

void org.turro.jpa.input.JpaListbox< V >.setNullLabel ( String  nullLabel)

Definition at line 120 of file JpaListbox.java.

120  {
121  this.nullLabel = nullLabel;
122  }
Here is the caller graph for this function:

◆ setQuery()

void org.turro.jpa.input.JpaListbox< V >.setQuery ( String  query)

Definition at line 71 of file JpaListbox.java.

71  {
72  this.query = query;
73  }
Here is the caller graph for this function:

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