BrightSide Workbench Full Report + Source Code
All Classes Namespaces Files Functions Variables Pages
org.turro.web.funnel.model.FunnelGoalsVM Class Reference

Public Member Functions

WebGoal getSelected ()
 
void setSelected (WebGoal selected)
 
boolean isShowForm ()
 
void addGoal ()
 
void save ()
 
void delete ()
 
List< WebGoalgetModel ()
 

Detailed Description

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

Definition at line 41 of file FunnelGoalsVM.java.

Member Function Documentation

◆ addGoal()

void org.turro.web.funnel.model.FunnelGoalsVM.addGoal ( )

Definition at line 57 of file FunnelGoalsVM.java.

57  {
58  Dialogs.title(I_.get("Add"))
59  .width("400px")
60  .height("250px")
61  .addField(DialogField.field("GoalAction"))
62  .onOk((dialogs) -> {
63  String goalAction = dialogs.<Textbox>getEditor("GoalAction").getValue();
64  if(notInModel(goalAction)) {
65  WebGoal wi = new WebGoal();
66  wi.setGoalAction(goalAction);
67  if(wi.isValid()) {
68  model.add(wi);
69  selected = wi;
70  BindUtils.postNotifyChange(null, null, FunnelGoalsVM.this,
71  "model", "selected", "showForm");
72  } else {
73  Toasts.message("GoalActions should not include spaces or punctuation characters.").show();
74  }
75  } else {
76  Toasts.message("GoalAction already in the model.").show();
77  }
78  })
79  .emptyCancel()
80  .show();
81  }
Here is the call graph for this function:

◆ delete()

void org.turro.web.funnel.model.FunnelGoalsVM.delete ( )

Definition at line 93 of file FunnelGoalsVM.java.

93  {
94  Messages.confirmDeletion().add(selected.getItemLabel()).show(() -> {
95  dao.get().deleteObject(selected);
96  Executions.getCurrent().sendRedirect("");
97  });
98  }
Here is the call graph for this function:

◆ getModel()

List<WebGoal> org.turro.web.funnel.model.FunnelGoalsVM.getModel ( )

Definition at line 112 of file FunnelGoalsVM.java.

112  {
113  if(model == null) {
114  model = SqlClause.select("wg").from("WebGoal wg")
115  .orderBy("ordering, goalAction")
116  .dao(dao.get())
117  .resultList(WebGoal.class);
118  }
119  return model;
120  }

◆ getSelected()

WebGoal org.turro.web.funnel.model.FunnelGoalsVM.getSelected ( )

Definition at line 43 of file FunnelGoalsVM.java.

43  {
44  return selected;
45  }

◆ isShowForm()

boolean org.turro.web.funnel.model.FunnelGoalsVM.isShowForm ( )

Definition at line 53 of file FunnelGoalsVM.java.

53  {
54  return selected != null;
55  }

◆ save()

void org.turro.web.funnel.model.FunnelGoalsVM.save ( )

Definition at line 84 of file FunnelGoalsVM.java.

84  {
85  model.stream().filter(wi -> wi.isEmpty() && !wi.isNew())
86  .forEach(wi -> dao.get().deleteEntity(wi));
87  model.removeIf(wi -> wi.isEmpty());
88  model.forEach(wi -> wi.compose());
89  dao.get().saveEntities(model);
90  Executions.getCurrent().sendRedirect("");
91  }

◆ setSelected()

void org.turro.web.funnel.model.FunnelGoalsVM.setSelected ( WebGoal  selected)

Definition at line 47 of file FunnelGoalsVM.java.

47  {
48  this.selected = selected;
49  BindUtils.postNotifyChange(null, null, FunnelGoalsVM.this,
50  "selected", "showForm", "nextsModel");
51  }

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