use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class BinderPageListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
super.initForm(formLayout, listener, ureq);
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
StringBuilder ownerSb = new StringBuilder();
for (Identity owner : owners) {
if (ownerSb.length() > 0)
ownerSb.append(", ");
ownerSb.append(userManager.getUserDisplayName(owner));
}
layoutCont.contextPut("owners", ownerSb.toString());
layoutCont.contextPut("binderKey", binder.getKey());
layoutCont.contextPut("binderTitle", StringHelper.escapeHtml(binder.getTitle()));
}
FlexiTableSortOptions options = new FlexiTableSortOptions();
options.setFromColumnModel(false);
options.setDefaultOrderBy(new SortKey(null, false));
tableEl.setSortSettings(options);
previousSectionLink = uifactory.addFormLink("section.paging.previous", formLayout, Link.BUTTON | Link.NONTRANSLATED);
previousSectionLink.setVisible(false);
previousSectionLink.setIconLeftCSS("o_icon o_icon_move_left");
nextSectionLink = uifactory.addFormLink("section.paging.next", formLayout, Link.BUTTON | Link.NONTRANSLATED);
nextSectionLink.setVisible(false);
nextSectionLink.setIconRightCSS("o_icon o_icon_move_right");
showAllSectionsLink = uifactory.addFormLink("section.paging.all", formLayout, Link.BUTTON);
showAllSectionsLink.setVisible(false);
if (secCallback.canAddSection()) {
newSectionButton = uifactory.addFormLink("create.new.section", formLayout, Link.BUTTON);
newSectionButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_section");
}
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class BinderPageListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof FlexiTableRenderEvent) {
FlexiTableRenderEvent re = (FlexiTableRenderEvent) event;
if (re.getRendererType() == FlexiTableRendererType.custom) {
tableEl.sort(new SortKey(null, false));
}
} else if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select-page".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doStartAssignment(ureq, row);
} else {
doOpenRow(ureq, row, false);
}
}
}
} else if (previousSectionLink == source) {
Section previousSection = (Section) previousSectionLink.getUserObject();
doFilterSection(previousSection);
} else if (nextSectionLink == source) {
Section nextSection = (Section) nextSectionLink.getUserObject();
doFilterSection(nextSection);
} else if (showAllSectionsLink == source) {
doShowAll();
} else if (newSectionButton == source) {
doCreateNewSection(ureq);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("new.entry".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doCreateNewPage(ureq, row.getSection());
} else if ("new.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doCreateNewAssignment(ureq, row.getSection());
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class MySharedItemsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("my.shared.items");
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, MySharedItemCols.binderKey, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MySharedItemCols.binderName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MySharedItemCols.courseName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MySharedItemCols.lastModified));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
model = new MySharedItemsDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setSearchEnabled(true);
tableEl.setCustomizeColumns(true);
tableEl.setElementCssClass("o_binder_shared_items_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setPageSize(24);
tableEl.setAndLoadPersistedPreferences(ureq, "my-shared-items");
FlexiTableSortOptions options = new FlexiTableSortOptions();
options.setDefaultOrderBy(new SortKey(MySharedItemCols.binderName.name(), true));
tableEl.setSortSettings(options);
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class SharedBindersController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.binderKey, "select"));
SortKey defaultSortKey = null;
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.username));
defaultSortKey = new SortKey(Cols.username.name(), true);
}
// followed by the users fields
int colPos = USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
String propName = userPropertyHandler.getName();
if (defaultSortKey == null && i == 0) {
defaultSortKey = new SortKey(propName, true);
} else if (UserConstants.LASTNAME.equals(propName) && !isAdministrativeUser) {
defaultSortKey = new SortKey(propName, true);
}
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName));
colPos++;
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.binderName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.courseName, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.lastModified));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.recentLaunch));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.openSections, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.selectSections, new SelectSectionsCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.newlyPublishedPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.draftPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.inRevisionPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, ShareItemCols.closedPage));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.grading, new AssessmentEntryCellRenderer(getTranslator())));
StaticFlexiCellRenderer selectRenderer = new StaticFlexiCellRenderer(translate("select"), "select");
selectRenderer.setIconRightCSS("o_icon-sw o_icon_start");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", -1, "select", false, null, FlexiColumnModel.ALIGNMENT_LEFT, selectRenderer));
StaticFlexiCellRenderer leaveRenderer = new StaticFlexiCellRenderer(translate("leave"), "leave");
leaveRenderer.setIconRightCSS("o_icon-sw o_icon_delete");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, false, "leave", -2, "leave", false, null, FlexiColumnModel.ALIGNMENT_LEFT, leaveRenderer));
model = new SharedBindersDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setSearchEnabled(true);
tableEl.setCustomizeColumns(true);
tableEl.setElementCssClass("o_binder_shared_items_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setPageSize(24);
tableEl.setAndLoadPersistedPreferences(ureq, "shared-items");
FlexiTableSortOptions options = new FlexiTableSortOptions();
if (defaultSortKey != null) {
options.setDefaultOrderBy(defaultSortKey);
}
tableEl.setSortSettings(options);
List<FlexiTableFilter> tableFilters = new ArrayList<>();
tableFilters.add(new FlexiTableFilter(translate("filter.sections.empty"), SharedBindersDataModel.EMPTY_SECTIONS, true));
tableFilters.add(FlexiTableFilter.SPACER);
tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
tableEl.setFilters("Filters", tableFilters, false);
tableEl.setSelectedFilterKey(SharedBindersDataModel.EMPTY_SECTIONS);
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class GoToMeetingsEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (!readOnly) {
addTrainingButton = uifactory.addFormLink("add.training", formLayout, Link.BUTTON);
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.name.i18nHeaderKey(), MeetingsCols.name.ordinal(), true, MeetingsCols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.start.i18nHeaderKey(), MeetingsCols.start.ordinal(), true, MeetingsCols.start.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.end.i18nHeaderKey(), MeetingsCols.end.ordinal(), true, MeetingsCols.end.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MeetingsCols.organizer.i18nHeaderKey(), MeetingsCols.organizer.ordinal(), true, MeetingsCols.organizer.name()));
if (!readOnly) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("edit", translate("edit"), "edit"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
}
tableModel = new GoToMeetingTableModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "meetings", tableModel, getTranslator(), formLayout);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(MeetingsCols.start.name(), false));
tableEl.setSortSettings(sortOptions);
updateModel();
}
Aggregations