Search in sources :

Example 11 with Application

use of cz.metacentrum.perun.webgui.model.Application in project perun by CESNET.

the class GetApplicationsForUser method setList.

public void setList(ArrayList<Application> list) {
    clearTable();
    this.list.addAll(list);
    for (Application a : list) {
        if (a.getVo() != null) {
            oracle.add(a.getVo().getName());
        }
        if (a.getGroup() != null) {
            oracle.add(a.getGroup().getName());
        }
    }
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : Application(cz.metacentrum.perun.webgui.model.Application)

Example 12 with Application

use of cz.metacentrum.perun.webgui.model.Application in project perun by CESNET.

the class GetApplicationsForUser method filterTable.

@Override
public void filterTable(String filter) {
    if (backupList == null || backupList.isEmpty()) {
        backupList.addAll(getList());
    }
    // always clear selected items
    selectionModel.clear();
    list.clear();
    if (filter.equalsIgnoreCase("")) {
        list.addAll(backupList);
    } else {
        for (Application a : backupList) {
            // store app by filter
            if (a.getVo() != null && a.getGroup() == null) {
                if (a.getVo().getName().toLowerCase().startsWith(filter.toLowerCase())) {
                    list.add(a);
                }
            } else if (a.getVo() != null && a.getGroup() != null) {
                if (a.getVo().getName().toLowerCase().startsWith(filter.toLowerCase()) || a.getGroup().getName().toLowerCase().startsWith(filter.toLowerCase())) {
                    list.add(a);
                }
            }
        }
    }
    if (list.isEmpty() && !filter.isEmpty()) {
        loaderImage.setEmptyResultMessage("You have no applications submitted for VO/group matching '" + filter + "'.");
    }
    loaderImage.loadingFinished();
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : Application(cz.metacentrum.perun.webgui.model.Application)

Example 13 with Application

use of cz.metacentrum.perun.webgui.model.Application in project perun by CESNET.

the class GetApplicationsForUserForAppFormGui method getTable.

/**
	 * Returns just the celltable
	 * @return
	 */
public CellTable<Application> getTable() {
    // retrieve data
    retrieveData();
    // Table data provider.
    dataProvider = new ListDataProvider<Application>(list);
    // Cell table
    table = new PerunTable<Application>(list);
    table.removeRowCountChangeHandler();
    // Connect the table to the data provider.
    dataProvider.addDataDisplay(table);
    // Sorting
    ListHandler<Application> columnSortHandler = new ListHandler<Application>(dataProvider.getList());
    table.addColumnSortHandler(columnSortHandler);
    // table selection
    table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Application>createCheckboxManager());
    // set empty content & loader
    table.setEmptyTableWidget(loaderImage);
    // columns
    if (checkable) {
        table.addCheckBoxColumn();
    }
    table.addIdColumn("App ID", tableFieldUpdater, 100);
    // DATE COLUMN
    Column<Application, String> dateColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Application, String>() {

        public String getValue(Application object) {
            // return only day
            return object.getCreatedAt().split(" ")[0];
        }
    }, tableFieldUpdater);
    dateColumn.setSortable(true);
    columnSortHandler.setComparator(dateColumn, new Comparator<Application>() {

        public int compare(Application arg0, Application arg1) {
            return arg0.getCreatedAt().compareToIgnoreCase(arg1.getCreatedAt());
        }
    });
    table.addColumn(dateColumn, ApplicationMessages.INSTANCE.createdDate());
    table.setColumnWidth(dateColumn, "150px");
    // Type column
    Column<Application, String> typeColumn = new Column<Application, String>(new CustomClickableTextCell()) {

        @Override
        public String getValue(Application object) {
            return object.getTranslatedType(object.getType());
        }

        @Override
        public String getCellStyleNames(Cell.Context context, Application object) {
            if (tableFieldUpdater != null) {
                return super.getCellStyleNames(context, object) + " pointer";
            } else {
                return super.getCellStyleNames(context, object);
            }
        }
    };
    typeColumn.setFieldUpdater(tableFieldUpdater);
    typeColumn.setSortable(true);
    columnSortHandler.setComparator(typeColumn, new Comparator<Application>() {

        public int compare(Application arg0, Application arg1) {
            return (arg0.getType()).compareToIgnoreCase(arg1.getType());
        }
    });
    table.addColumn(typeColumn, ApplicationMessages.INSTANCE.type());
    table.setColumnWidth(typeColumn, "60px");
    // State column
    Column<Application, String> stateColumn = new Column<Application, String>(new CustomClickableTextCell()) {

        @Override
        public String getValue(Application object) {
            return object.getTranslatedState(object.getState());
        }

        @Override
        public String getCellStyleNames(Cell.Context context, Application object) {
            if (tableFieldUpdater != null) {
                return super.getCellStyleNames(context, object) + " pointer";
            } else {
                return super.getCellStyleNames(context, object);
            }
        }
    };
    stateColumn.setFieldUpdater(tableFieldUpdater);
    stateColumn.setSortable(true);
    columnSortHandler.setComparator(stateColumn, new Comparator<Application>() {

        public int compare(Application arg0, Application arg1) {
            return (arg0.getTranslatedState(arg0.getState())).compareToIgnoreCase(arg1.getTranslatedState(arg1.getState()));
        }
    });
    table.addColumn(stateColumn, ApplicationMessages.INSTANCE.state());
    table.setColumnWidth(stateColumn, "120px");
    // VO COLUMN
    Column<Application, String> voColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Application, String>() {

        public String getValue(Application object) {
            return object.getVo().getName();
        }
    }, tableFieldUpdater);
    voColumn.setSortable(true);
    columnSortHandler.setComparator(voColumn, new Comparator<Application>() {

        public int compare(Application arg0, Application arg1) {
            return (arg0.getVo().getName()).compareToIgnoreCase(arg1.getVo().getName());
        }
    });
    table.addColumn(voColumn, ApplicationMessages.INSTANCE.virtualOrganization());
    // GROUP COLUMN
    Column<Application, String> groupColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Application, String>() {

        public String getValue(Application object) {
            if (object.getGroup() != null) {
                return object.getGroup().getName();
            } else {
                return "---";
            }
        }
    }, tableFieldUpdater);
    groupColumn.setSortable(true);
    columnSortHandler.setComparator(groupColumn, new Comparator<Application>() {

        public int compare(Application arg0, Application arg1) {
            String name1 = "";
            String name2 = "";
            if (arg0.getGroup() != null) {
                name1 = arg0.getGroup().getName();
            } else {
                name1 = "---";
            }
            if (arg1.getGroup() != null) {
                name2 = arg1.getGroup().getName();
            } else {
                name2 = "---";
            }
            return (name1).compareToIgnoreCase(name2);
        }
    });
    table.addColumn(groupColumn, ApplicationMessages.INSTANCE.group());
    table.setRowStyles(new RowStyles<Application>() {

        public String getStyleNames(Application application, int i) {
            if ("NEW".equalsIgnoreCase(application.getState())) {
                return "rowgreen";
            } else if ("VERIFIED".equalsIgnoreCase(application.getState())) {
                return "rowyellow";
            } else if ("APPROVED".equalsIgnoreCase(application.getState())) {
                return "rowdarkgreen";
            } else if ("REJECTED".equalsIgnoreCase(application.getState())) {
                return "rowred";
            }
            return "";
        }
    });
    return table;
}
Also used : CustomClickableTextCell(cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell) ListHandler(com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler) Column(com.google.gwt.user.cellview.client.Column) Application(cz.metacentrum.perun.webgui.model.Application)

Example 14 with Application

use of cz.metacentrum.perun.webgui.model.Application in project perun by CESNET.

the class GetApplicationsForUserForAppFormGui method setList.

public void setList(ArrayList<Application> list) {
    clearTable();
    this.list.addAll(list);
    for (Application a : list) {
        if (a.getVo() != null) {
            oracle.add(a.getVo().getName());
        }
        if (a.getGroup() != null) {
            oracle.add(a.getGroup().getName());
        }
    }
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : Application(cz.metacentrum.perun.webgui.model.Application)

Example 15 with Application

use of cz.metacentrum.perun.webgui.model.Application in project perun by CESNET.

the class GetApplicationsForUserForAppFormGui method filterTable.

@Override
public void filterTable(String filter) {
    if (backupList == null || backupList.isEmpty()) {
        backupList.addAll(getList());
    }
    // always clear selected items
    selectionModel.clear();
    list.clear();
    if (filter.equalsIgnoreCase("")) {
        list.addAll(backupList);
    } else {
        for (Application a : backupList) {
            // store app by filter
            if (a.getVo() != null && a.getGroup() == null) {
                if (a.getVo().getName().toLowerCase().startsWith(filter.toLowerCase())) {
                    list.add(a);
                }
            } else if (a.getVo() != null && a.getGroup() != null) {
                if (a.getVo().getName().toLowerCase().startsWith(filter.toLowerCase()) || a.getGroup().getName().toLowerCase().startsWith(filter.toLowerCase())) {
                    list.add(a);
                }
            }
        }
    }
    loaderImage.loadingFinished();
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : Application(cz.metacentrum.perun.webgui.model.Application)

Aggregations

Application (cz.metacentrum.perun.webgui.model.Application)20 Column (com.google.gwt.user.cellview.client.Column)5 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)5 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)5 CustomClickableTextCell (cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell)5 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)4 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)4 Cell (com.google.gwt.cell.client.Cell)3 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)3 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 HandleApplication (cz.metacentrum.perun.webgui.json.registrarManager.HandleApplication)3 ApplicationDetailTabItem (cz.metacentrum.perun.webgui.tabs.registrartabs.ApplicationDetailTabItem)3 PerunAppTypeCell (cz.metacentrum.perun.webgui.widgets.cells.PerunAppTypeCell)3 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1