Search in sources :

Example 11 with RichMember

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));
    }
}
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 12 with RichMember

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));
    }
}
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 13 with RichMember

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;
}
Also used : ListHandler(com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler) MemberColumnProvider(cz.metacentrum.perun.webgui.json.columnProviders.MemberColumnProvider) RichMember(cz.metacentrum.perun.webgui.model.RichMember) Header(com.google.gwt.user.cellview.client.Header) Column(com.google.gwt.user.cellview.client.Column) IsClickableCell(cz.metacentrum.perun.webgui.json.columnProviders.IsClickableCell) CheckboxCell(com.google.gwt.cell.client.CheckboxCell) PerunCheckboxCell(cz.metacentrum.perun.webgui.widgets.cells.PerunCheckboxCell)

Example 14 with RichMember

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

Example 15 with RichMember

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();
}
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