use of org.netxms.client.AccessListElement in project netxms by netxms.
the class PredefinedGraph method createAccessCheck.
/**
* Create access control check box.
*
* @param parent Parent composite
* @param name Name of the access right
* @param bitMask Bit mask for access right
*/
private void createAccessCheck(final Composite parent, final String name, final Integer bitMask) {
final Button check = new Button(parent, SWT.CHECK);
check.setText(name);
check.setEnabled(false);
check.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection sel = (IStructuredSelection) userList.getSelection();
AccessListElement element = (AccessListElement) sel.getFirstElement();
int rights = element.getAccessRights();
if (check.getSelection())
rights |= bitMask;
else
rights &= ~bitMask;
element.setAccessRights(rights);
userList.update(element, null);
}
});
accessChecks.put(bitMask, check);
}
Aggregations