BrightSide Workbench Full Report + Source Code
org.turro.zul.acceptance.AcceptanceListbox Class Reference
Inheritance diagram for org.turro.zul.acceptance.AcceptanceListbox:
Collaboration diagram for org.turro.zul.acceptance.AcceptanceListbox:

Public Member Functions

String getPath ()
 
void setPath (String path)
 
void refreshStatus ()
 
boolean isAcceptable ()
 
boolean isPetitioner ()
 
boolean isEraser ()
 
void petition ()
 
void accept ()
 
void delete ()
 

Detailed Description

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

Definition at line 48 of file AcceptanceListbox.java.

Member Function Documentation

◆ accept()

void org.turro.zul.acceptance.AcceptanceListbox.accept ( )

Definition at line 128 of file AcceptanceListbox.java.

128  {
129  IContact logged = Authentication.getIContact();
130  for(Listitem li : (Collection<Listitem>) getSelectedItems()) {
131  if(li.getValue() instanceof Acceptance) {
132  Acceptance acceptance = li.getValue();
133  if(Authentication.isAdministrator() || acceptance.getContact().getId().equals(logged.getId())) {
134  new AcceptanceMail(
135  AcceptanceUtil.accept(acceptance)
136  ).sendMail();
137  }
138  }
139  }
140  }
Here is the call graph for this function:

◆ delete()

void org.turro.zul.acceptance.AcceptanceListbox.delete ( )

Definition at line 142 of file AcceptanceListbox.java.

142  {
143  Dao dao = new ContactsPU();
144  for(Listitem li : (Collection<Listitem>) getSelectedItems()) {
145  if(li.getValue() instanceof Acceptance) {
146  dao.deleteObject(li.getValue());
147  }
148  }
149  refreshItems();
150  }
Here is the call graph for this function:

◆ getPath()

String org.turro.zul.acceptance.AcceptanceListbox.getPath ( )

Definition at line 53 of file AcceptanceListbox.java.

53  {
54  return path;
55  }

◆ isAcceptable()

boolean org.turro.zul.acceptance.AcceptanceListbox.isAcceptable ( )

Definition at line 69 of file AcceptanceListbox.java.

69  {
70  if(Authentication.isAdministrator()) return true;
71  IContact logged = Authentication.getIContact();
72  for(Acceptance a : list) {
73  if(a.getContact().getId().equals(logged.getId()) && a.getDateAcceptance() == null) {
74  return true;
75  }
76  }
77  return false;
78  }
Here is the call graph for this function:

◆ isEraser()

boolean org.turro.zul.acceptance.AcceptanceListbox.isEraser ( )

Definition at line 84 of file AcceptanceListbox.java.

84  {
85  return Application.getApplication().isInRole("acceptance:delete");
86  }
Here is the call graph for this function:

◆ isPetitioner()

boolean org.turro.zul.acceptance.AcceptanceListbox.isPetitioner ( )

Definition at line 80 of file AcceptanceListbox.java.

80  {
81  return Application.getApplication().isInRole("acceptance:petition");
82  }
Here is the call graph for this function:

◆ petition()

void org.turro.zul.acceptance.AcceptanceListbox.petition ( )

Definition at line 88 of file AcceptanceListbox.java.

88  {
89  final ContactCombobox contactInput = new ContactCombobox();
90  InputDialog.getInput(
91  getPage(),
92  I_.get("Petition"),
93  new InputField[] {
94  new InputField("Contact", null, null, 0) {
95  @Override
96  protected HtmlBasedComponent createEditor() {
97  return contactInput;
98  }
99  },
100  new InputField("Comment", null, null, 3)
101  }, new Command() {
102 
103  @Override
104  public Object execute(Context context) {
105  InputField[] fields = (InputField[]) context.get("fields");
106  if(fields.length > 0) {
107  Contact contact = null;
108  String comment = null;
109  for(InputField f : fields) {
110  if("Contact".equals(f.getLabel())) {
111  contact = contactInput.getContact();
112  } else if("Comment".equals(f.getLabel())) {
113  comment = (String) f.getValue();
114  }
115  }
116  if(contact != null) {
117  new AcceptanceMail(
118  AcceptanceUtil.request((Contact) Authentication.getIContact().getContact(), contact, path, comment)
119  ).sendMail();
120  refreshItems();
121  }
122  }
123  return null;
124  }
125  });
126  }
Here is the call graph for this function:

◆ refreshStatus()

void org.turro.zul.acceptance.AcceptanceListbox.refreshStatus ( )

Definition at line 65 of file AcceptanceListbox.java.

65  {
66  refreshItems();
67  }

◆ setPath()

void org.turro.zul.acceptance.AcceptanceListbox.setPath ( String  path)

Definition at line 57 of file AcceptanceListbox.java.

57  {
58  this.path = path;
59  addHeaders();
60  refreshItems();
61  setCheckmark(true);
62  setMultiple(true);
63  }

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