BrightSide Workbench Full Report + Source Code
org.turro.alliance.model.CategoriesVM Class Reference

Public Member Functions

boolean isNeedsSave ()
 
void setNeedsSave (boolean needsSave)
 
void add ()
 
void save ()
 
List< AxCategorygetModel ()
 

Detailed Description

Member Function Documentation

◆ add()

void org.turro.alliance.model.CategoriesVM.add ( )

Definition at line 51 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/model/CategoriesVM.java.

51  {
52  Dialogs.title(I_.get("Add category"))
53  .width("400px")
54  .height("200px")
55  .addField(DialogField.field("Name"))
56  .onOk((dialogs) -> {
57  String domain = dialogs.<Textbox>getEditor("Name").getValue();
58  AxCategory category = new AxCategory();
59  category.setName(domain);
60  model.add(category);
61  needsSave = true;
62  BindUtils.postNotifyChange(null, null, CategoriesVM.this, "model");
63  })
64  .emptyCancel()
65  .show();
66  }
Here is the call graph for this function:

◆ getModel()

List<AxCategory> org.turro.alliance.model.CategoriesVM.getModel ( )

Definition at line 84 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/model/CategoriesVM.java.

84  {
85  if(model == null) {
86  model = SqlClause.select("c").from("AxCategory c")
87  .orderBy("c.uniquePath")
88  .dao(dao.get())
89  .resultList(AxCategory.class);
90  }
91  return model;
92  }

◆ isNeedsSave()

boolean org.turro.alliance.model.CategoriesVM.isNeedsSave ( )

Definition at line 41 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/model/CategoriesVM.java.

41  {
42  return needsSave;
43  }

◆ save()

void org.turro.alliance.model.CategoriesVM.save ( )

Definition at line 70 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/model/CategoriesVM.java.

70  {
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);
75  needsSave = false;
76  }

◆ setNeedsSave()

void org.turro.alliance.model.CategoriesVM.setNeedsSave ( boolean  needsSave)

Definition at line 45 of file Elephant/elephant-alliance/src/main/java/org/turro/alliance/model/CategoriesVM.java.

45  {
46  this.needsSave = needsSave;
47  }

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