use of org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel in project openolat by klemens.
the class PFCoachController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
OLATResource course = courseEnv.getCourseGroupManager().getCourseResource();
String businessPath = getWindowControl().getBusinessControl().getAsString();
SubscriptionContext subsContext = new SubscriptionContext(course, pfNode.getIdent());
PublisherData publisherData = new PublisherData(OresHelper.calculateTypeName(PFCourseNode.class), String.valueOf(course.getResourceableId()), businessPath);
contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
listenTo(contextualSubscriptionCtr);
layoutCont.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
backLink = LinkFactory.createLinkBack(layoutCont.getFormItemComponent(), this);
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
int i = 0;
FlexiTableSortOptions options = new FlexiTableSortOptions();
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
int colIndex = USER_PROPS_OFFSET + i++;
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
}
columnsModel.addFlexiColumnModel(col);
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
if (pfNode.hasParticipantBoxConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFiles, "drop.box"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdate));
}
if (pfNode.hasCoachBoxConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFilesReturn, "return.box"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdateReturn));
}
StaticFlexiCellRenderer openCellRenderer = new StaticFlexiCellRenderer(translate("open.box"), "open.box");
openCellRenderer.setIconRightCSS("o_icon_start o_icon-fw");
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.openbox, "open.box", openCellRenderer));
tableModel = new DropBoxTableModel(columnsModel, getTranslator());
dropboxTable = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
dropboxTable.setMultiSelect(true);
dropboxTable.setSelectAllEnable(true);
dropboxTable.setExportEnabled(true);
dropboxTable.setSortSettings(options);
dropboxTable.setAndLoadPersistedPreferences(ureq, "participant-folder_coach_" + pfView.name());
dropboxTable.setEmtpyTableMessageKey("table.empty");
FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonGroupLayout.setElementCssClass("o_button_group");
formLayout.add(buttonGroupLayout);
downloadLink = uifactory.addFormLink("download.link", buttonGroupLayout, Link.BUTTON);
uploadAllLink = uifactory.addFormLink("upload.link", buttonGroupLayout, Link.BUTTON);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel in project openolat by klemens.
the class OverviewQuestionController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.hasError.i18nHeaderKey(), Cols.hasError.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new BooleanCellRenderer(new CSSIconFlexiCellRenderer("o_icon_failed"), new CSSIconFlexiCellRenderer("o_icon_accept"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.type));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.title));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.points));
ItemsTableDataModel model = new ItemsTableDataModel(importedItems.getItems(), columnsModel);
uifactory.addTableElement(getWindowControl(), "overviewTable", model, getTranslator(), formLayout);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel in project openolat by klemens.
the class BinderListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, PortfolioCols.key, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PortfolioCols.title, "select"));
model = new BindersDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom);
tableEl.setRendererType(FlexiTableRendererType.custom);
tableEl.setSearchEnabled(false);
tableEl.setCustomizeColumns(false);
tableEl.setElementCssClass("o_portfolio_listing");
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setNumOfRowsEnabled(false);
tableEl.setPageSize(24);
VelocityContainer row = createVelocityContainer("binder_row");
// sets its own DOM id in velocity container
row.setDomReplacementWrapperRequired(false);
tableEl.setRowRenderer(row, this);
tableEl.setCssDelegate(new BinderCssDelegate());
tableEl.setAndLoadPersistedPreferences(ureq, getTableId());
mapperThumbnailUrl = registerCacheableMapper(ureq, "binder-list", new ImageMapper(model));
row.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
if (!portfolioModule.isLearnerCanCreateBinders() && !portfolioModule.isCanCreateBindersFromTemplate() && portfolioModule.isCanCreateBindersFromCourse()) {
newBinderFromCourseButton = uifactory.addFormLink("create.binder.from.course", "create.empty.binder.from.course", null, formLayout, Link.BUTTON);
row.put("createBinderFromCourse", newBinderFromCourseButton.getComponent());
} else if (portfolioModule.isLearnerCanCreateBinders() || portfolioModule.isCanCreateBindersFromTemplate() || portfolioModule.isCanCreateBindersFromCourse()) {
newBinderDropdown = uifactory.addFormLink("create.binders", "create.new.binder", null, formLayout, Link.BUTTON);
int count = (portfolioModule.isLearnerCanCreateBinders() ? 1 : 0) + (portfolioModule.isCanCreateBindersFromTemplate() ? 1 : 0) + (portfolioModule.isCanCreateBindersFromCourse() ? 1 : 0);
if (count > 1) {
newBinderDropdown.setIconRightCSS("o_icon o_icon_caret");
}
row.put("createDropdown", newBinderDropdown.getComponent());
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel in project openolat by klemens.
the class DeletedBinderController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
super.initForm(formLayout, listener, ureq);
model.getTableColumnModel().addFlexiColumnModel(new DefaultFlexiColumnModel("restore.binder", translate("restore.binder"), "restore"));
tableEl.setElementCssClass("o_portfolio_listing o_portfolio_deleted_listing");
tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
tableEl.setMultiSelect(true);
deleteButton = uifactory.addFormLink("delete.binder", "delete.binder", null, formLayout, Link.BUTTON);
deleteButton.setVisible(tableEl.getRendererType() == FlexiTableRendererType.classic);
tableEl.setSelectAllEnable(tableEl.getRendererType() == FlexiTableRendererType.classic);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel in project openolat by klemens.
the class MediaCenterController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (select) {
newMediaCallout = uifactory.addFormLink("new.medias", formLayout, Link.BUTTON);
newMediaCallout.setIconRightCSS("o_icon o_icon_caret o_icon-fw");
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, MediaCols.key, "select"));
Map<String, MediaHandler> handlersMap = portfolioService.getMediaHandlers().stream().collect(Collectors.toMap(h -> h.getType(), h -> h));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.type, new MediaTypeCellRenderer(handlersMap)));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.title, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.collectionDate, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(MediaCols.categories, new CategoriesCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
model = new MediaDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setAvailableRendererTypes(FlexiTableRendererType.custom, FlexiTableRendererType.classic);
tableEl.setRendererType(FlexiTableRendererType.custom);
tableEl.setSearchEnabled(true);
tableEl.setCustomizeColumns(true);
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setPageSize(24);
VelocityContainer row = createVelocityContainer("media_row");
// sets its own DOM id in velocity container
row.setDomReplacementWrapperRequired(false);
tableEl.setRowRenderer(row, this);
tableEl.setCssDelegate(new MediaCssDelegate());
tableEl.setAndLoadPersistedPreferences(ureq, "media-list");
initSorters(tableEl);
initFilters(tableEl);
mapperThumbnailUrl = registerCacheableMapper(ureq, "media-thumbnail", new ThumbnailMapper(model));
row.contextPut("mapperThumbnailUrl", mapperThumbnailUrl);
}
Aggregations