BrightSide Workbench Full Report + Source Code
org.turro.contacts.zul.contact.CommentGrid Class Reference
Inheritance diagram for org.turro.contacts.zul.contact.CommentGrid:
Collaboration diagram for org.turro.contacts.zul.contact.CommentGrid:

Public Member Functions

 CommentGrid ()
 
void setContact (Contact contact)
 
void setAddToolbar (boolean addToolbar)
 
void addRows ()
 

Detailed Description

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

Definition at line 43 of file CommentGrid.java.

Constructor & Destructor Documentation

◆ CommentGrid()

org.turro.contacts.zul.contact.CommentGrid.CommentGrid ( )

Definition at line 50 of file CommentGrid.java.

50  {
51  rows = new Rows();
52  appendChild(rows);
53  }

Member Function Documentation

◆ addRows()

void org.turro.contacts.zul.contact.CommentGrid.addRows ( )

Definition at line 71 of file CommentGrid.java.

71  {
72  for(final Comment c : contact.getComments()) {
73  final Row row = new Row();
74  row.setValue(c);
75  rows.appendChild(row);
76 
77  Hbox hbox = new Hbox();
78  row.appendChild(hbox);
79 
80  final Textbox comment = new Textbox();
81  comment.setRows(8);
82  comment.setCols(80);
83  comment.setText(c.getComment());
84  comment.addEventListener(Events.ON_CHANGE, new EventListener() {
85  @Override
86  public void onEvent(Event event) throws Exception {
87  if(comment.getText().contains("#dir") && !Application.getApplication().isInRole("contact:file-ext")) {
88  comment.setText("");
89  }
90  c.setComment(comment.getText());
91  }
92  });
93  hbox.appendChild(comment);
94 
95  if(Application.getApplication().isInRole("contact-comment:delete")) {
96  hbox.appendChild(new Separator("vertical"));
97  Image img = new Image("/_zul/images/edit-delete.png");
98  img.setStyle("cursor:pointer");
99  img.addEventListener(Events.ON_CLICK, new EventListener() {
100  @Override
101  public void onEvent(Event event) throws Exception {
102  Messages.confirmDeletion().show(() -> {
103  contact.getComments().remove(c);
104  c.setContact(null);
105  row.detach();
106  });
107  }
108  });
109  hbox.appendChild(img);
110  }
111 
112  }
113  }
Set< Comment > getComments()
Definition: Contact.java:415
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAddToolbar()

void org.turro.contacts.zul.contact.CommentGrid.setAddToolbar ( boolean  addToolbar)

Definition at line 63 of file CommentGrid.java.

63  {
64  if(addToolbar) {
65  toolbar = new Toolbar();
66  getParent().appendChild(toolbar);
67  addToolbarButtons();
68  }
69  }

◆ setContact()

void org.turro.contacts.zul.contact.CommentGrid.setContact ( Contact  contact)

Definition at line 55 of file CommentGrid.java.

55  {
56  this.contact = contact;
57  rows.getChildren().clear();
58  if(contact != null) {
59  addRows();
60  }
61  }
Here is the call graph for this function:

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