private void assignedRoleSelectionChanged() {
   if (assignedRolesList.getSelectedObjects().size() > 0) {
     deleteRoleAssignmentBtn.setEnabled(true);
   } else {
     deleteRoleAssignmentBtn.setEnabled(false);
   }
 }
  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();
  }
  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;
  }