Search in sources :

Example 31 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class TaxonomyTreeTableController method getFilters.

private List<FlexiTableFilter> getFilters() {
    List<TaxonomyLevelType> types = taxonomyService.getTaxonomyLevelTypes(taxonomy);
    List<FlexiTableFilter> resources = new ArrayList<>(types.size() + 1);
    for (TaxonomyLevelType type : types) {
        resources.add(new FlexiTableFilter(type.getDisplayName(), type.getKey().toString()));
    }
    resources.add(new FlexiTableFilter(translate("filter.no.level.type"), "-"));
    resources.add(FlexiTableFilter.SPACER);
    resources.add(new FlexiTableFilter(translate("show.all"), "all", true));
    return resources;
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) ArrayList(java.util.ArrayList)

Example 32 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class OrdersController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.status, new OrderStatusRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.orderNr));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.creationDate));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.summary));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.methods, new AccessMethodRenderer(acModule)));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.total));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.order.details", translate("select"), CMD_SELECT));
    dataSource = new OrdersDataSource(acService, null, identity, null);
    dataModel = new OrdersDataModel(dataSource, getLocale(), userManager, columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "orderList", dataModel, 25, true, getTranslator(), formLayout);
    tableEl.setExportEnabled(true);
    tableEl.setEmtpyTableMessageKey("table.order.empty");
    List<FlexiTableFilter> filters = new ArrayList<>();
    filters.add(new FlexiTableFilter(translate("order.status.payed"), OrderStatus.PAYED.name()));
    filters.add(new FlexiTableFilter(translate("order.status.error"), OrderStatus.ERROR.name()));
    tableEl.setFilters("", filters, false);
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("title", translate("orders.my"));
        layoutCont.contextPut("description", translate("orders.my.desc"));
    }
}
Also used : FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) ArrayList(java.util.ArrayList) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 33 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class AuthorListController method getFilters.

private List<FlexiTableFilter> getFilters() {
    List<OrderedRepositoryHandler> supportedHandlers = repositoryHandlerFactory.getOrderRepositoryHandlers();
    List<FlexiTableFilter> resources = new ArrayList<>(supportedHandlers.size() + 1);
    int lastGroup = 0;
    for (OrderedRepositoryHandler handler : supportedHandlers) {
        // for each 10-group, crate a separator
        int group = handler.getOrder() / 10;
        if (group > lastGroup) {
            resources.add(FlexiTableFilter.SPACER);
            lastGroup = group;
        }
        String type = handler.getHandler().getSupportedType();
        String inconLeftCss = RepositoyUIFactory.getIconCssClass(type);
        resources.add(new FlexiTableFilter(translate(type), type, inconLeftCss));
    }
    return resources;
}
Also used : FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) ArrayList(java.util.ArrayList) OrderedRepositoryHandler(org.olat.repository.handlers.RepositoryHandlerFactory.OrderedRepositoryHandler)

Example 34 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class AbstractFlexiTableRenderer method renderFilterDropdown.

protected String renderFilterDropdown(StringOutput sb, FlexiTableElementImpl ftE, List<FlexiTableFilter> filters) {
    Form theForm = ftE.getRootForm();
    String dispatchId = ftE.getFormDispatchId();
    StringBuilder selected = new StringBuilder(256);
    sb.append("<div class='btn-group'>").append("<button id='table-button-filters-").append(dispatchId).append("' type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown'>").append("<i class='o_icon o_icon_filter o_icon-lg'> </i> <b class='caret'></b></button>").append("<div id='table-filters-").append(dispatchId).append("' class='hide'><ul class='o_dropdown list-unstyled' role='menu'>");
    for (FlexiTableFilter filter : filters) {
        if (FlexiTableFilter.SPACER.equals(filter)) {
            sb.append("<li class='divider'></li>");
        } else {
            sb.append("<li><a href=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, true, new NameValuePair("filter", filter.getFilter()))).append("\">").append("<i class='o_icon o_icon_check o_icon-fw'> </i> ", filter.isSelected());
            if (filter.getIconLeftCSS() != null) {
                sb.append("<i class='o_icon ").append(filter.getIconLeftCSS()).append("'> </i> ");
            }
            if (filter.getIconRenderer() != null) {
                filter.getIconRenderer().render(sb, filter, ftE.getComponent(), ftE.getTranslator());
            }
            sb.append(filter.getLabel()).append("</a></li>");
            if (filter.isSelected() && !filter.isShowAll()) {
                if (selected.length() > 0)
                    selected.append(", ");
                selected.append(filter.getLabel());
            }
        }
    }
    sb.append("</ul></div></div> ").append("<script type='text/javascript'>\n").append("/* <![CDATA[ */\n").append("jQuery(function() { o_popover('table-button-filters-").append(dispatchId).append("','table-filters-").append(dispatchId).append("'); });\n").append("/* ]]> */\n").append("</script>");
    return selected.toString();
}
Also used : NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)

Example 35 with FlexiTableFilter

use of org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter in project OpenOLAT by OpenOLAT.

the class FlexiTableElementImpl method setSelectedExtendedFilters.

@Override
public void setSelectedExtendedFilters(List<FlexiTableFilter> filters) {
    if (extendedFilters != null && extendedFilters.size() > 0) {
        for (FlexiTableFilter extendedFilter : extendedFilters) {
            boolean selected = false;
            for (FlexiTableFilter filter : filters) {
                if (filter.getFilter() != null && filter.getFilter().equals(extendedFilter.getFilter())) {
                    selected = true;
                }
            }
            extendedFilter.setSelected(selected);
        }
    }
}
Also used : FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)

Aggregations

FlexiTableFilter (org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter)52 ArrayList (java.util.ArrayList)40 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)24 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)24 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)18 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)16 SortKey (org.olat.core.commons.persistence.SortKey)14 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)12 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)10 BusinessGroup (org.olat.group.BusinessGroup)10 PassedCellRenderer (org.olat.course.assessment.bulk.PassedCellRenderer)8 Component (org.olat.core.gui.components.Component)6 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)6 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)6 BooleanCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer)6 Controller (org.olat.core.gui.control.Controller)6 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)6 SearchAssessedIdentityParams (org.olat.course.assessment.model.SearchAssessedIdentityParams)6 AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)6 Collections (java.util.Collections)4