use of org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer in project openolat by klemens.
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();
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer in project openolat by klemens.
the class AbstractItemListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("quickview", "<i class='o_icon o_icon_quickview'> </i>", "quick-view"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.mark.i18nKey(), Cols.mark.ordinal(), true, OrderBy.marks.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.editable.i18nKey(), Cols.editable.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new BooleanCellRenderer(new CSSIconFlexiCellRenderer(CSS_ICON_READWRITE), new CSSIconFlexiCellRenderer(CSS_ICON_READONLY))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18nKey(), Cols.key.ordinal(), true, OrderBy.key.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.identifier.i18nKey(), Cols.identifier.ordinal(), true, OrderBy.identifier.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.title.i18nKey(), Cols.title.ordinal(), true, OrderBy.title.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.topic.i18nKey(), Cols.topic.ordinal(), true, OrderBy.topic.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.creationDate.i18nKey(), Cols.creationDate.ordinal(), true, OrderBy.creationDate.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lastModified.i18nKey(), Cols.lastModified.ordinal(), true, OrderBy.lastModified.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.keywords.i18nKey(), Cols.keywords.ordinal(), true, OrderBy.keywords.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.coverage.i18nKey(), Cols.coverage.ordinal(), true, OrderBy.coverage.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.additionalInfos.i18nKey(), Cols.additionalInfos.ordinal(), true, OrderBy.additionalInformations.name()));
if (getSecurityCallback().canUseTaxonomy()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxnonomyLevel.i18nKey(), Cols.taxnonomyLevel.ordinal(), true, OrderBy.taxonomyLevel.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxnonomyPath.i18nKey(), Cols.taxnonomyPath.ordinal(), true, OrderBy.taxonomyPath.name()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.difficulty.i18nKey(), Cols.difficulty.ordinal(), true, OrderBy.difficulty.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.stdevDifficulty.i18nKey(), Cols.stdevDifficulty.ordinal(), true, OrderBy.stdevDifficulty.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.differentiation.i18nKey(), Cols.differentiation.ordinal(), true, OrderBy.differentiation.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.numOfAnswerAlternatives.i18nKey(), Cols.numOfAnswerAlternatives.ordinal(), true, OrderBy.numOfAnswerAlternatives.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.usage.i18nKey(), Cols.usage.ordinal(), true, OrderBy.usage.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.type.i18nKey(), Cols.type.ordinal(), true, OrderBy.itemType.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.format.i18nKey(), Cols.format.ordinal(), true, OrderBy.format.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.rating.i18nKey(), Cols.rating.ordinal(), true, OrderBy.rating.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.numberOfRatings.i18nKey(), Cols.numberOfRatings.ordinal(), true, OrderBy.numberOfRatings.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.itemVersion.i18nKey(), Cols.itemVersion.ordinal(), true, OrderBy.itemVersion.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.status.i18nKey(), Cols.status.ordinal(), true, OrderBy.status.name(), new QuestionStatusCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.statusLastModified.i18nKey(), Cols.statusLastModified.ordinal(), true, OrderBy.statusLastModified.name()));
if (licenseModule.isEnabled(licenseHandler)) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, false, Cols.license.i18nKey(), Cols.license.ordinal(), "license", false, null, FlexiColumnModel.ALIGNMENT_LEFT, new StaticFlexiCellRenderer("license", new LicenseRenderer(getLocale()))));
}
initActionColumns(columnsModel);
model = new QuestionItemDataModel(columnsModel, this, getTranslator());
itemsTable = uifactory.addTableElement(getWindowControl(), "items", model, 50, false, getTranslator(), formLayout);
itemsTable.setWrapperSelector("qitems");
itemsTable.setSelectAllEnable(true);
itemsTable.setMultiSelect(true);
itemsTable.setSearchEnabled(true);
itemsTable.setSortSettings(new FlexiTableSortOptions(true));
itemsTable.setExtendedSearch(extendedSearchCtrl);
itemsTable.setColumnIndexForDragAndDropLabel(Cols.title.ordinal());
itemsTable.setAndLoadPersistedPreferences(ureq, "qpool-list-" + prefsKey);
listenTo(extendedSearchCtrl);
VelocityContainer detailsVC = createVelocityContainer("item_list_details");
itemsTable.setDetailsRenderer(detailsVC, this);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(OrderBy.title.name(), true));
itemsTable.setSortSettings(sortOptions);
initButtons(ureq, formLayout);
itemsTable.reloadData();
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer in project openolat by klemens.
the class QEducationalContextsAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.id.i18nKey(), Cols.id.ordinal(), true, "key"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.level.i18nKey(), Cols.level.ordinal(), true, "level"));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("translate", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.levelI18n.i18nKey(), Cols.levelI18n.ordinal(), "translate", renderer));
FlexiCellRenderer delRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("delete"), "delete-level"), null);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", Cols.deletable.ordinal(), "delete-level", delRenderer));
model = new LevelDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "levels", model, getTranslator(), formLayout);
tableEl.setRendererType(FlexiTableRendererType.classic);
tableEl.setCustomizeColumns(false);
createType = uifactory.addFormLink("create.level", formLayout, Link.BUTTON);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer in project openolat by klemens.
the class QItemTypesAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.id.i18nKey(), Cols.id.ordinal(), true, "key"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.type.i18nKey(), Cols.type.ordinal(), true, "name"));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("translate", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.typeI18n.i18nKey(), Cols.typeI18n.ordinal(), "translate", renderer));
FlexiCellRenderer delRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("delete"), "delete-type"), null);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", Cols.deletable.ordinal(), "delete-type", delRenderer));
model = new QItemTypeDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "types", model, getTranslator(), formLayout);
tableEl.setRendererType(FlexiTableRendererType.classic);
tableEl.setCustomizeColumns(false);
createType = uifactory.addFormLink("create.type", formLayout, Link.BUTTON);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer in project openolat by klemens.
the class GoToOrganizerListAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
addOrganizerButton = uifactory.addFormLink("add.organizer", formLayout, Link.BUTTON);
addOrganizerButton.setDomReplacementWrapperRequired(false);
addOrganizerButton.setIconLeftCSS("o_icon o_icon-fw o_icon_add");
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.key.i18nHeaderKey(), OrganizerCols.key.ordinal(), true, OrganizerCols.key.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.firstName.i18nHeaderKey(), OrganizerCols.firstName.ordinal(), true, OrganizerCols.firstName.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.lastName.i18nHeaderKey(), OrganizerCols.lastName.ordinal(), true, OrganizerCols.lastName.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.email.i18nHeaderKey(), OrganizerCols.email.ordinal(), true, OrganizerCols.email.name()));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("owner", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.owner.i18nHeaderKey(), OrganizerCols.owner.ordinal(), "owner", true, OrganizerCols.owner.name(), renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.renewDate.i18nHeaderKey(), OrganizerCols.renewDate.ordinal(), true, OrganizerCols.renewDate.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("renew.organizer", translate("renew.organizer"), "renew"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrganizerCols.remove.i18nHeaderKey(), OrganizerCols.remove.ordinal(), "remove", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("remove"), "remove"), null)));
tableModel = new GoToOrganizerTableModel(columnsModel, userManager);
tableEl = uifactory.addTableElement(getWindowControl(), "organizerList", tableModel, getTranslator(), formLayout);
updateModel();
}
Aggregations