19 package org.turro.alliance.model;
21 import java.util.List;
22 import org.turro.alliance.db.AlliancePU;
23 import org.turro.alliance.db.entities.AxTalentCategory;
24 import org.turro.i18n.I_;
25 import org.turro.jpa.Dao;
26 import org.turro.sql.SqlClause;
27 import org.turro.util.Cached;
28 import org.turro.zkoss.dialog.DialogField;
29 import org.turro.zkoss.dialog.Dialogs;
30 import org.zkoss.bind.BindUtils;
31 import org.zkoss.bind.annotation.Command;
32 import org.zkoss.bind.annotation.NotifyChange;
33 import org.zkoss.zul.Textbox;
46 this.needsSave = needsSave;
49 @NotifyChange(
"model")
57 String domain = dialogs.<Textbox>getEditor(
"Name").getValue();
68 @NotifyChange(
"model")
71 model.stream().filter(category -> category.isEmpty() && !category.isNew())
72 .forEach(category -> dao.get().deleteEntity(category));
73 model.removeIf(category -> category.isEmpty());
74 dao.get().saveEntities(model);
80 private boolean needsSave;
82 private List<AxTalentCategory> model;
86 model = SqlClause.select(
"c").from(
"AxTalentCategory c")
87 .orderBy(
"c.categoryId")
96 private final Cached<Dao> dao = Cached.instance(() ->
new AlliancePU());
void setName(String name)
void setNeedsSave(boolean needsSave)
List< AxTalentCategory > getModel()
static String get(String msg)
static DialogField field(String label)
Dialogs width(String width)
Dialogs height(String height)
Dialogs onOk(Consumer< Dialogs > onOk)
static Dialogs title(String title)
Dialogs addField(DialogField field)