use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class AddMemberToGroupTabItem method rebuildAlreadyAddedWidget.
/**
* Rebuild already added widget based on already added members
*/
private void rebuildAlreadyAddedWidget() {
alreadyAdded.setStyleName("alreadyAdded");
alreadyAdded.setVisible(!alreadyAddedList.isEmpty());
alreadyAdded.setWidget(new HTML("<strong>Already added: </strong>"));
for (int i = 0; i < alreadyAddedList.size(); i++) {
if (alreadyAddedList.get(i).getObjectType().equals("Candidate")) {
Candidate c = alreadyAddedList.get(i).cast();
alreadyAdded.getWidget().getElement().setInnerHTML(alreadyAdded.getWidget().getElement().getInnerHTML() + ((i != 0) ? ", " : "") + c.getFullName());
} else if (alreadyAddedList.get(i).getObjectType().equals("User") || alreadyAddedList.get(i).getObjectType().equals("RichUser")) {
User u = alreadyAddedList.get(i).cast();
alreadyAdded.getWidget().getElement().setInnerHTML(alreadyAdded.getWidget().getElement().getInnerHTML() + ((i != 0) ? ", " : "") + u.getFullName());
} else {
RichMember m = alreadyAddedList.get(i).cast();
alreadyAdded.getWidget().getElement().setInnerHTML(alreadyAdded.getWidget().getElement().getInnerHTML() + ((i != 0) ? ", " : "") + m.getUser().getFullName());
}
}
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class PerunStatusWidget method build.
/**
* Builds the widget
*/
private void build() {
statusWidget.clear(true);
statusWidget.setStyleName("member-status");
statusWidget.setCellSpacing(0);
statusWidget.setCellPadding(0);
// image
statusWidget.setWidget(0, 0, getImage());
statusWidget.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
// text
HTML stat = new HTML(object.getStatus());
statusWidget.setWidget(0, 1, stat);
statusWidget.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
// if a callback set
if (events != null) {
// FIXME better usage
if (object.getObjectType().equals("Member") || object.getObjectType().equals("RichMember")) {
Member m = object.cast();
if (PerunWebSession.getInstance().isVoAdmin(m.getVoId())) {
// change button
statusWidget.setWidget(0, 2, getChangeStatusButton());
statusWidget.getFlexCellFormatter().setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE);
}
} else {
// change button
statusWidget.setWidget(0, 2, getChangeStatusButton());
statusWidget.getFlexCellFormatter().setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE);
}
}
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class MemberColumnProvider method addNameColumn.
public void addNameColumn(IsClickableCell authz, int width) {
// create column
Column<RichMember, RichMember> nameColumn = JsonUtils.addColumn(new CustomClickableTextCellWithAuthz<RichMember>(authz, "name"), new JsonUtils.GetValue<RichMember, RichMember>() {
@Override
public RichMember getValue(RichMember object) {
return object;
}
}, fieldUpdater);
// add column
table.addColumn(nameColumn, "Name");
if (width != 0) {
table.setColumnWidth(nameColumn, width, Style.Unit.PX);
}
// sort column
nameColumn.setSortable(true);
table.getColumnSortHandler().setComparator(nameColumn, new RichMemberComparator(RichMemberComparator.Column.USER_FULL_NAME));
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class MemberColumnProvider method addEmailColumn.
public void addEmailColumn(IsClickableCell authz, int width) {
// create column
Column<RichMember, RichMember> emailColumn = JsonUtils.addColumn(new CustomClickableTextCellWithAuthz<RichMember>(authz, "email"), new JsonUtils.GetValue<RichMember, RichMember>() {
@Override
public RichMember getValue(RichMember object) {
return object;
}
}, fieldUpdater);
// add column
table.addColumn(emailColumn, "Email");
if (width != 0) {
table.setColumnWidth(emailColumn, width, Style.Unit.PX);
}
// sort column
emailColumn.setSortable(true);
table.getColumnSortHandler().setComparator(emailColumn, new RichMemberComparator(RichMemberComparator.Column.EMAIL));
}
use of cz.metacentrum.perun.webgui.model.RichMember in project perun by CESNET.
the class GetCompleteRichMembers method filterTable.
@Override
public void filterTable(String filter) {
// save backup for the first time
if (backupList.isEmpty() || backupList == null) {
backupList.addAll(list);
}
// always clear selected items
selectionModel.clear();
list.clear();
// filter table content
if (filter.equalsIgnoreCase("")) {
list.addAll(backupList);
} else {
for (RichMember m : backupList) {
// store member by filter
if (m.getUser().getFullName().toLowerCase().startsWith(filter.toLowerCase())) {
list.add(m);
}
}
}
if (list.isEmpty() && !filter.isEmpty()) {
loaderImage.setEmptyResultMessage("No member matching '" + filter + "' found.");
} else {
if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity)) {
loaderImage.setEmptyResultMessage("VO has no members.");
} else {
loaderImage.setEmptyResultMessage("Group has no members.");
}
}
dataProvider.flush();
dataProvider.refresh();
loaderImage.loadingFinished();
}
Aggregations