private void userSelectionChanged() {
    List<ProxyPentahoUser> selectedUsers = usersList.getSelectedObjects();
    if (selectedUsers.size() == 1) {
      userDetailsPanel.setUser(selectedUsers.get(0));
      List<ProxyPentahoRole> roleList =
          Arrays.asList(UserAndRoleMgmtService.instance().getRoles(selectedUsers.get(0)));
      assignedRolesList.setObjects(roleList);
    } else {
      userDetailsPanel.setUser(null);
      List<ProxyPentahoRole> emptyRoleList = Collections.emptyList();
      assignedRolesList.setObjects(emptyRoleList);
    }
    userDetailsPanel.setEnabled(selectedUsers.size() == 1);
    updateUserBtn.setEnabled(selectedUsers.size() == 1);

    if (selectedUsers.size() > 0) {
      deleteUserBtn.setEnabled(true);
    } else {
      deleteUserBtn.setEnabled(false);
    }

    if (selectedUsers.size() == 1) {
      addRoleAssignmentBtn.setEnabled(true);
    } else {
      addRoleAssignmentBtn.setEnabled(false);
    }

    userDetailsPanel.getUserNameTextBox().setEnabled(false);
    assignedRoleSelectionChanged();
  }
 private void assignedRoleSelectionChanged() {
   if (assignedRolesList.getSelectedObjects().size() > 0) {
     deleteRoleAssignmentBtn.setEnabled(true);
   } else {
     deleteRoleAssignmentBtn.setEnabled(false);
   }
 }
  public VerticalPanel buildUsersListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteUserBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); // $NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addUserBtn, DockPanel.EAST);
    Label label = new Label("Users"); // $NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$
    VerticalPanel userListPanel = new VerticalPanel();
    userListPanel.add(headerDockPanel);
    userListPanel.add(usersList);
    userListPanel.add(new Label(Messages.getString("filter"))); // $NON-NLS-1$
    userListPanel.add(filterTextBox);

    userListPanel.setCellHeight(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setCellWidth(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setHeight("100%"); // $NON-NLS-1$
    userListPanel.setWidth("100%"); // $NON-NLS-1$
    usersList.setHeight("100%"); // $NON-NLS-1$
    usersList.setWidth("100%"); // $NON-NLS-1$
    filterTextBox.setWidth("100%"); // $NON-NLS-1$
    deleteUserBtn.setEnabled(false);

    filterTextBox.addKeyboardListener(this);
    usersList.addChangeListener(this);
    addUserBtn.addClickListener(this);
    deleteUserBtn.addClickListener(this);
    return userListPanel;
  }
  public VerticalPanel buildAssignedRolesPanel() {
    DockPanel headerDockPanel = new DockPanel();

    VerticalPanel fieldsetPanel = new VerticalPanel();

    Label label = new Label(Messages.getString("assignedRoles")); // $NON-NLS-1$
    Label spacer = new Label(""); // $NON-NLS-1$

    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$
    headerDockPanel.add(deleteRoleAssignmentBtn, DockPanel.EAST);
    VerticalPanel spacer2 = new VerticalPanel();
    spacer2.setWidth("2"); // $NON-NLS-1$
    headerDockPanel.add(spacer2, DockPanel.EAST);
    headerDockPanel.add(addRoleAssignmentBtn, DockPanel.EAST);

    headerDockPanel.add(spacer, DockPanel.WEST);
    headerDockPanel.setCellWidth(spacer, "100%"); // $NON-NLS-1$

    DockPanel assignedRolesPanel = new DockPanel();
    assignedRolesPanel.add(headerDockPanel, DockPanel.NORTH);
    assignedRolesPanel.add(assignedRolesList, DockPanel.CENTER);
    assignedRolesPanel.setCellHeight(assignedRolesList, "100%"); // $NON-NLS-1$
    assignedRolesPanel.setCellWidth(assignedRolesList, "100%"); // $NON-NLS-1$
    assignedRolesList.setHeight("100%"); // $NON-NLS-1$
    assignedRolesList.setWidth("100%"); // $NON-NLS-1$

    assignedRolesList.addChangeListener(this);
    deleteRoleAssignmentBtn.addClickListener(this);
    addRoleAssignmentBtn.addClickListener(this);

    fieldsetPanel.add(assignedRolesPanel);
    assignedRolesPanel.setWidth("100%"); // $NON-NLS-1$
    assignedRolesPanel.setHeight("100%"); // $NON-NLS-1$
    return fieldsetPanel;
  }