Search in sources :

Example 1 with RichMember

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());
        }
    }
}
Also used : Candidate(cz.metacentrum.perun.webgui.model.Candidate) User(cz.metacentrum.perun.webgui.model.User) RichMember(cz.metacentrum.perun.webgui.model.RichMember)

Example 2 with RichMember

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);
        }
    }
}
Also used : Member(cz.metacentrum.perun.webgui.model.Member) RichMember(cz.metacentrum.perun.webgui.model.RichMember)

Example 3 with RichMember

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));
}
Also used : JsonUtils(cz.metacentrum.perun.webgui.json.JsonUtils) RichMemberComparator(cz.metacentrum.perun.webgui.json.comparators.RichMemberComparator) RichMember(cz.metacentrum.perun.webgui.model.RichMember)

Example 4 with RichMember

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));
}
Also used : JsonUtils(cz.metacentrum.perun.webgui.json.JsonUtils) RichMemberComparator(cz.metacentrum.perun.webgui.json.comparators.RichMemberComparator) RichMember(cz.metacentrum.perun.webgui.model.RichMember)

Example 5 with RichMember

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();
}
Also used : RichMember(cz.metacentrum.perun.webgui.model.RichMember)

Aggregations

RichMember (cz.metacentrum.perun.webgui.model.RichMember)20 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)7 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)6 RichMemberComparator (cz.metacentrum.perun.webgui.json.comparators.RichMemberComparator)6 JsonUtils (cz.metacentrum.perun.webgui.json.JsonUtils)5 PerunError (cz.metacentrum.perun.webgui.model.PerunError)5 Column (com.google.gwt.user.cellview.client.Column)4 Member (cz.metacentrum.perun.webgui.model.Member)4 User (cz.metacentrum.perun.webgui.model.User)4 AjaxLoaderImage (cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage)4 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)4 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)4 ArrayList (java.util.ArrayList)4 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)3 FindCompleteRichMembers (cz.metacentrum.perun.webgui.json.membersManager.FindCompleteRichMembers)3 GetCompleteRichMembers (cz.metacentrum.perun.webgui.json.membersManager.GetCompleteRichMembers)3 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)3 CheckboxCell (com.google.gwt.cell.client.CheckboxCell)2