use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class MemberColumnProvider method addIdColumn.
public void addIdColumn(IsClickableCell authz, int width) {
// create column
Column<RichMember, RichMember> idColumn = JsonUtils.addColumn(new CustomClickableTextCellWithAuthz<RichMember>(authz, "id"), new JsonUtils.GetValue<RichMember, RichMember>() {
@Override
public RichMember getValue(RichMember object) {
return object;
}
}, fieldUpdater);
// add column only if extended info is visible
if (JsonUtils.isExtendedInfoVisible()) {
table.addColumn(idColumn, "Member Id");
if (width != 0) {
table.setColumnWidth(idColumn, width, Style.Unit.PX);
}
// sort column
idColumn.setSortable(true);
table.getColumnSortHandler().setComparator(idColumn, new RichMemberComparator(RichMemberComparator.Column.MEMBER_ID));
}
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class MemberColumnProvider method addUserIdColumn.
public void addUserIdColumn(IsClickableCell authz, int width) {
// create column
Column<RichMember, RichMember> idColumn = JsonUtils.addColumn(new CustomClickableTextCellWithAuthz<RichMember>(authz, "userId"), new JsonUtils.GetValue<RichMember, RichMember>() {
@Override
public RichMember getValue(RichMember object) {
return object;
}
}, fieldUpdater);
// add column only if extended info is visible
if (JsonUtils.isExtendedInfoVisible()) {
table.addColumn(idColumn, "User Id");
if (width != 0) {
table.setColumnWidth(idColumn, width, Style.Unit.PX);
}
// sort column
idColumn.setSortable(true);
table.getColumnSortHandler().setComparator(idColumn, new RichMemberComparator(RichMemberComparator.Column.USER_ID));
}
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class FindCompleteRichMembers method getEmptyTable.
/**
* Returns table with RichMembers
*
* @return CellTable widget
*/
public CellTable<RichMember> getEmptyTable() {
// Table data provider.
dataProvider = new ListDataProvider<RichMember>(list);
// Cell table
table = new PerunTable<RichMember>(list);
table.setHyperlinksAllowed(false);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<RichMember> columnSortHandler = new ListHandler<RichMember>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<RichMember>createCheckboxManager());
// set empty content & loader
table.setEmptyTableWidget(loaderImage);
loaderImage.setEmptyResultMessage("No member found.");
Column<RichMember, RichMember> checkBoxColumn = new Column<RichMember, RichMember>(new PerunCheckboxCell<RichMember>(true, false, indirectCheckable)) {
@Override
public RichMember getValue(RichMember object) {
// Get the value from the selection model.
object.setChecked(selectionModel.isSelected(object));
return object;
}
};
// updates the columns size
table.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);
// Add the columns
// Checkbox column header
CheckboxCell cb = new CheckboxCell();
Header<Boolean> checkBoxHeader = new Header<Boolean>(cb) {
public Boolean getValue() {
//return true to see a checked checkbox.
return false;
}
};
checkBoxHeader.setUpdater(new ValueUpdater<Boolean>() {
public void update(Boolean value) {
// sets selected to all, if value = true, unselect otherwise
for (RichMember obj : list) {
if (!"INDIRECT".equalsIgnoreCase(obj.getMembershipType())) {
selectionModel.setSelected(obj, value);
}
}
}
});
if (checkable) {
table.addColumn(checkBoxColumn, checkBoxHeader);
}
MemberColumnProvider columnProvider = new MemberColumnProvider(dataProvider, null, table, tableFieldUpdater);
IsClickableCell<RichMember> authz = new IsClickableCell<RichMember>() {
@Override
public boolean isClickable(RichMember object) {
return true;
}
@Override
public String linkUrl(RichMember object) {
return null;
}
};
columnProvider.addIdColumn(authz, 110);
columnProvider.addUserIdColumn(authz, 110);
columnProvider.addStatusColumn(authz, 20);
columnProvider.addNameColumn(authz);
columnProvider.addOrganizationColumn(authz);
columnProvider.addEmailColumn(authz);
columnProvider.addLoginsColumn(authz);
return table;
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class FindUsersInVo method onFinished.
/**
* Called, when operation finishes successfully.
*/
public void onFinished(JavaScriptObject jso) {
ArrayList<RichMember> list = JsonUtils.jsoAsList(jso);
for (RichMember m : list) {
User u = m.getUser();
if (hideService && u.isServiceUser()) {
// if service hidden, skip service users
} else if (hidePerson && !u.isServiceUser() && !u.isSponsoredUser()) {
// if person hidden, skip person
} else if (hideSponsored && !u.isSponsoredUser()) {
// if person hidden, skip person
} else {
addToTable(u);
}
}
sortTable();
loaderImage.loadingFinished();
session.getUiElements().setLogText("Users loaded: " + list.size());
events.onFinished(jso);
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class GetCompleteRichMembers method setList.
public void setList(ArrayList<RichMember> list) {
clearTable();
this.list.addAll(list);
for (RichMember m : list) {
oracle.add(m.getUser().getFullName());
}
dataProvider.flush();
dataProvider.refresh();
}
Aggregations