use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class AbstractSelectBusinessGroupListController method initColumnModel.
@Override
protected FlexiTableColumnModel initColumnModel() {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
// mark
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.mark.i18n(), Cols.mark.ordinal(), true, Cols.mark.name()));
// group name
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.name.i18n(), Cols.name.ordinal(), TABLE_ACTION_LAUNCH, true, Cols.name.name(), new StaticFlexiCellRenderer(TABLE_ACTION_LAUNCH, new BusinessGroupNameCellRenderer())));
// id and reference
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18n(), Cols.key.ordinal(), true, Cols.key.name()));
if (groupModule.isManagedBusinessGroups()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18n(), Cols.externalId.ordinal(), true, Cols.externalId.name()));
}
// description
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.description.i18n(), Cols.description.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.antisamy)));
// courses
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.resources.i18n(), Cols.resources.ordinal(), true, Cols.resources.name(), FlexiColumnModel.ALIGNMENT_LEFT, new BGResourcesCellRenderer(flc)));
// stats
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.tutorsCount.i18n(), Cols.tutorsCount.ordinal(), true, Cols.tutorsCount.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.participantsCount.i18n(), Cols.participantsCount.ordinal(), true, Cols.participantsCount.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.freePlaces.i18n(), Cols.freePlaces.ordinal(), true, Cols.freePlaces.name(), FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.none)));
// free places = max participant - num of participant - num pending
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.waitingListCount.i18n(), Cols.waitingListCount.ordinal(), true, Cols.waitingListCount.name()));
// actions
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), TABLE_ACTION_SELECT));
return columnsModel;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class SharedPagesController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.bookmark));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.userInfosStatus, new SharedPageStatusCellRenderer(getTranslator())));
FlexiCellRenderer titleRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer("select", new PageTitleCellRenderer()), new PageTitleCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", SharePageCols.pageName.ordinal(), "select", true, SharePageCols.pageName.sortKey(), FlexiColumnModel.ALIGNMENT_LEFT, titleRenderer));
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(SharePageCols.lastChanges));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.pageStatus, new StatusCellRenderer(getTranslator())));
model = new SharedPagesDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setSearchEnabled(true);
tableEl.setCustomizeColumns(true);
tableEl.setElementCssClass("o_binder_shared_bookmark_pages_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setPageSize(24);
tableEl.setAndLoadPersistedPreferences(ureq, "shared-bookmark-pages");
if (filters != null && !filters.isEmpty()) {
List<FlexiTableFilter> tableFilters = new ArrayList<>(filters.size());
for (PageStatus status : filters) {
String label = translate(status.i18nKey());
tableFilters.add(new FlexiTableFilter(label, status.name(), "o_icon ".concat(status.cssClass())));
}
tableFilters.add(FlexiTableFilter.SPACER);
tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
tableEl.setFilters("Filters", tableFilters, true);
if (defaultFilter != null) {
tableEl.setSelectedFilterKey(defaultFilter.name());
}
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class SelectCourseNodeStepForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
ICourse course = CourseFactory.loadCourse(courseEntry);
CourseNode rootNode = course.getRunStructure().getRootNode();
List<Node> courseNodes = addManualTaskNodesAndParentsToList(0, rootNode);
tableModel = new NodeTableDataModel(courseNodes);
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, "table.header.node", Cols.node.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new CourseNodeRenderer()));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.action.select", Cols.assessable.ordinal(), "select", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.action.select"), "select"), null)));
tableModel.setTableColumnModel(tableColumnModel);
tableEl = uifactory.addTableElement(getWindowControl(), "nodeList", tableModel, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class CourseBusinessGroupListController method initColumnModel.
@Override
protected FlexiTableColumnModel initColumnModel() {
boolean managed = RepositoryEntryManagedFlag.isManaged(re, RepositoryEntryManagedFlag.groups);
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
// group name
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.name.i18n(), Cols.name.ordinal(), TABLE_ACTION_LAUNCH, true, Cols.name.name(), new StaticFlexiCellRenderer(TABLE_ACTION_LAUNCH, new BusinessGroupNameCellRenderer())));
// id and reference
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18n(), Cols.key.ordinal(), true, Cols.key.name()));
if (groupModule.isManagedBusinessGroups()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18n(), Cols.externalId.ordinal(), true, Cols.externalId.name()));
}
// description
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.description.i18n(), Cols.description.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.antisamy)));
// courses
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.resources.i18n(), Cols.resources.ordinal(), true, Cols.resources.name(), FlexiColumnModel.ALIGNMENT_LEFT, new BGResourcesCellRenderer(flc)));
// stats
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.tutorsCount.i18n(), Cols.tutorsCount.ordinal(), true, Cols.tutorsCount.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.participantsCount.i18n(), Cols.participantsCount.ordinal(), true, Cols.participantsCount.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.freePlaces.i18n(), Cols.freePlaces.ordinal(), true, Cols.freePlaces.name(), FlexiColumnModel.ALIGNMENT_LEFT, new TextFlexiCellRenderer(EscapeMode.none)));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.waitingListCount.i18n(), Cols.waitingListCount.ordinal(), true, Cols.waitingListCount.name()));
// access
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.accessTypes.i18n(), Cols.accessTypes.ordinal(), true, Cols.accessTypes.name(), FlexiColumnModel.ALIGNMENT_LEFT, new BGAccessControlledCellRenderer()));
if (!readOnly) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit", translate("table.header.edit"), TABLE_ACTION_EDIT));
}
if (!managed && !readOnly) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.remove", Cols.unlink.ordinal(), TABLE_ACTION_UNLINK, new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.header.remove"), TABLE_ACTION_UNLINK), null)));
}
return columnsModel;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class TeacherRollCallController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
StringBuilder sb = new StringBuilder();
List<Identity> teachers = lectureService.getTeachers(lectureBlock);
for (Identity teacher : teachers) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(teacher)));
}
Formatter formatter = Formatter.getInstance(getLocale());
String date = formatter.formatDate(lectureBlock.getStartDate());
String startTime = formatter.formatTimeShort(lectureBlock.getStartDate());
String endTime = formatter.formatTimeShort(lectureBlock.getEndDate());
String[] args = new String[] { // {0}
lectureBlock.getTitle(), // {1}
sb.toString(), // {2}
date, // {3}
startTime, // {4}
endTime };
layoutCont.contextPut("date", date);
layoutCont.contextPut("startTime", startTime);
layoutCont.contextPut("endTime", endTime);
layoutCont.contextPut("dateAndTime", translate("lecture.block.dateAndTime", args));
layoutCont.contextPut("teachers", sb.toString());
layoutCont.contextPut("lectureBlockTitle", StringHelper.escapeHtml(lectureBlock.getTitle()));
layoutCont.contextPut("lectureBlockExternalId", StringHelper.escapeHtml(lectureBlock.getExternalId()));
StringBuilder description = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getDescription()));
layoutCont.contextPut("lectureBlockDescription", StringHelper.xssScan(description));
StringBuilder preparation = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getPreparation()));
layoutCont.contextPut("lectureBlockPreparation", StringHelper.xssScan(preparation));
layoutCont.contextPut("lectureBlockLocation", StringHelper.escapeHtml(lectureBlock.getLocation()));
layoutCont.contextPut("lectureBlock", lectureBlock);
layoutCont.contextPut("lectureBlockOptional", !lectureBlock.isCompulsory());
layoutCont.setFormTitle(translate("lecture.block", args));
layoutCont.setFormDescription(StringHelper.escapeJavaScript(lectureBlock.getDescription()));
}
// table
FlexiTableSortOptions options = new FlexiTableSortOptions();
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.username));
options.setDefaultOrderBy(new SortKey(RollCols.username.sortKey(), true));
}
int colPos = USER_PROPS_OFFSET;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
columnsModel.addFlexiColumnModel(col);
colPos++;
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
if (lectureBlock.isCompulsory()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.status));
for (int i = 0; i < numOfLectures; i++) {
DefaultFlexiColumnModel col = new DefaultFlexiColumnModel("table.header.lecture." + (i + 1), i + CHECKBOX_OFFSET, true, "lecture." + (i + 1));
col.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(col);
}
// all button
DefaultFlexiColumnModel allCol = new DefaultFlexiColumnModel("all", RollCols.all.ordinal(), "all", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("all"), "all", null, null, translate("all.desc")), null));
allCol.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(allCol);
if (secCallback.canViewAuthorizedAbsences() || secCallback.canEditAuthorizedAbsences()) {
DefaultFlexiColumnModel authorizedCol = new DefaultFlexiColumnModel(RollCols.authorizedAbsence);
authorizedCol.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(authorizedCol);
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.comment));
tableModel = new TeacherRollCallDataModel(columnsModel, secCallback, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setCustomizeColumns(true);
tableEl.setSortSettings(options);
tableEl.setAndLoadPersistedPreferences(ureq, "teacher-roll-call");
// buttons
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
quickSaveButton = uifactory.addFormSubmitButton("save", "save.temporary", formLayout);
quickSaveButton.setElementCssClass("o_sel_lecture_quick_save");
closeLectureBlocksButton = uifactory.addFormLink("close.lecture.blocks", formLayout, Link.BUTTON);
closeLectureBlocksButton.setElementCssClass("o_sel_lecture_close");
if (lectureModule.isStatusCancelledEnabled()) {
cancelLectureBlockButton = uifactory.addFormLink("cancel.lecture.blocks", formLayout, Link.BUTTON);
}
reopenButton = uifactory.addFormLink("reopen.lecture.blocks", formLayout, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_lecture_reopen");
updateUI();
}
Aggregations