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