use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
the class FlexiTableElementImpl method setSortSettings.
@Override
public void setSortSettings(FlexiTableSortOptions options) {
this.sortOptions = options;
if (options.getDefaultOrderBy() != null) {
SortKey defaultOrder = options.getDefaultOrderBy();
orderBy = new SortKey[] { defaultOrder };
selectSortOption(defaultOrder.getKey(), defaultOrder.isAsc());
}
}
use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
the class MembersTableController method initColumns.
private SortKey initColumns(FlexiTableColumnModel columnsModel) {
int colPos = AbstractMemberListController.USER_PROPS_OFFSET;
SortKey defaultSortKey = null;
String rowAction = "vcard";
if (chatEnabled && editable) {
DefaultFlexiColumnModel chatCol = new DefaultFlexiColumnModel(Cols.online.i18n(), Cols.online.ordinal());
chatCol.setExportable(false);
columnsModel.addFlexiColumnModel(chatCol);
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(MembersDisplayRunController.USER_PROPS_LIST_ID, userPropertyHandler);
String emailRowAction = rowAction;
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName) || UserConstants.EMAIL.equals(propName)) {
// when email is enabled, the action will trigger email workflow
if (UserConstants.EMAIL.equals(propName) && canEmail) {
emailRowAction = "email";
}
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, emailRowAction, true, propName, new StaticFlexiCellRenderer(emailRowAction, new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
}
columnsModel.addFlexiColumnModel(col);
colPos++;
if (defaultSortKey == null) {
defaultSortKey = new SortKey(propName, true);
}
}
if (userLastTimeVisible) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.firstTime.i18n(), Cols.firstTime.ordinal(), true, Cols.firstTime.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.lastTime.i18n(), Cols.lastTime.ordinal(), true, Cols.lastTime.name()));
}
return defaultSortKey;
}
use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
the class MembersTableController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
SortKey defaultSortKey = initColumns(columnsModel);
membersModel = new MemberListTableModel(columnsModel, imModule.isOnlineStatusEnabled());
membersModel.setObjects(membersList);
membersTable = uifactory.addTableElement(getWindowControl(), "table", membersModel, pageSize, false, getTranslator(), formLayout);
membersTable.setEmtpyTableMessageKey("nomembers");
membersTable.setAndLoadPersistedPreferences(ureq, this.getClass().getSimpleName());
membersTable.setExportEnabled(false);
membersTable.setElementCssClass("o_sel_member_list");
if (defaultSortKey != null) {
FlexiTableSortOptions options = new FlexiTableSortOptions();
options.setDefaultOrderBy(defaultSortKey);
membersTable.setSortSettings(options);
}
}
use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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");
}
}
Aggregations