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

Public Member Functions

 RoleGrid ()
 
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 52 of file RoleGrid.java.

Constructor & Destructor Documentation

◆ RoleGrid()

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

Definition at line 59 of file RoleGrid.java.

59  {
60  rows = new Rows();
61  appendChild(rows);
62  }

Member Function Documentation

◆ addRows()

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

Definition at line 80 of file RoleGrid.java.

80  {
81  for(final Role r : contact.getRoles()) {
82  final Row row = new Row();
83  row.setValue(r);
84  rows.appendChild(row);
85 
86  Hbox hbox = new Hbox();
87  row.appendChild(hbox);
88 
89  final Listbox roles = new Listbox();
90  roles.setMold("select");
91  try {
92  for (String rs : (List<String>) ProfileMap.getRoleNames()) {
93  if(r.getName() == null) {
94  r.setName(rs);
95  }
96  Listitem li = new Listitem(rs);
97  li.setSelected(rs.equals(r.getName()));
98  roles.appendChild(li);
99  }
100  } catch (IOException ex) {
101  Logger.getLogger(RoleGrid.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
102  }
103  roles.addEventListener(Events.ON_SELECT, new EventListener() {
104  @Override
105  public void onEvent(Event event) throws Exception {
106  r.setName(roles.getSelectedItem().getLabel());
107  }
108  });
109  hbox.appendChild(roles);
110 
111  if(Application.getApplication().isInRole("contact-role:delete")) {
112  hbox.appendChild(new Separator("vertical"));
113  Image img = new Image("/_zul/images/edit-delete.png");
114  img.setStyle("cursor:pointer");
115  img.addEventListener(Events.ON_CLICK, new EventListener() {
116  @Override
117  public void onEvent(Event event) throws Exception {
118  ZkossUtils.confirmDeletion(null, new Command() {
119  @Override
120  public Object execute(Context context) {
121  contact.getRoles().remove(r);
122  r.setContact(null);
123  row.detach();
124  return true;
125  }
126  });
127  }
128  });
129  hbox.appendChild(img);
130  }
131 
132  }
133  }
Set< Role > getRoles()
Definition: Contact.java:406
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAddToolbar()

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

Definition at line 72 of file RoleGrid.java.

72  {
73  if(addToolbar) {
74  toolbar = new Toolbar();
75  getParent().appendChild(toolbar);
76  addToolbarButtons();
77  }
78  }

◆ setContact()

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

Definition at line 64 of file RoleGrid.java.

64  {
65  this.contact = contact;
66  rows.getChildren().clear();
67  if(contact != null) {
68  addRows();
69  }
70  }
Here is the call graph for this function:

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