private final XUser[] getAllUsers() { List<XUser> users = new ArrayList<XUser>(); for (TableItem item : membersTable.getItems()) { users.add((XUser) item.getData(MEMBER_DATA)); } return users.toArray(new XUser[0]); }
private final XRole[] getSelectedRoles() { // collect all selected roles: List<XRole> roles = new ArrayList<XRole>(); for (TableItem item : rolesTable.getItems()) { boolean selected = false; Object colVal = item.getValue(0); if (colVal instanceof CheckBox) selected = ((CheckBox) colVal).getValue(); else if (colVal instanceof Boolean) selected = ((Boolean) colVal).booleanValue(); if (selected) roles.add((XRole) item.getData(ROLE_DATA)); } return roles.toArray(new XRole[0]); }
private final boolean isSelected(XUser user) { for (TableItem item : membersTable.getItems()) { XUser xu = (XUser) item.getData(MEMBER_DATA); if (xu.equals(user)) { boolean selected = false; Object colVal = item.getValue(0); if (colVal instanceof CheckBox) selected = ((CheckBox) colVal).getValue(); else if (colVal instanceof Boolean) selected = ((Boolean) colVal).booleanValue(); return selected; } } return false; }