Search in sources :

Example 16 with AccessListElement

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);
}
Also used : Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) AccessListElement(org.netxms.client.AccessListElement) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

AccessListElement (org.netxms.client.AccessListElement)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Button (org.eclipse.swt.widgets.Button)7 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)5 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)5 Composite (org.eclipse.swt.widgets.Composite)5 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)5 Iterator (java.util.Iterator)4 FillLayout (org.eclipse.swt.layout.FillLayout)4 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 AbstractUserObject (org.netxms.client.users.AbstractUserObject)4 SelectUserDialog (org.netxms.ui.eclipse.usermanager.dialogs.SelectUserDialog)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 RowLayout (org.eclipse.swt.layout.RowLayout)3 Group (org.eclipse.swt.widgets.Group)3 PartInitException (org.eclipse.ui.PartInitException)3