use of org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class AbstractMemberListController method initColumns.
private SortKey initColumns(FlexiTableColumnModel columnsModel) {
SortKey defaultSortKey = null;
String editAction = readOnly ? null : TABLE_ACTION_EDIT;
if (chatEnabled) {
DefaultFlexiColumnModel chatCol = new DefaultFlexiColumnModel(Cols.online.i18n(), Cols.online.ordinal());
chatCol.setExportable(false);
columnsModel.addFlexiColumnModel(chatCol);
}
if (isAdministrativeUser) {
FlexiCellRenderer renderer = new StaticFlexiCellRenderer(editAction, new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18n(), Cols.username.ordinal(), editAction, true, Cols.username.name(), renderer));
defaultSortKey = new SortKey(Cols.username.name(), 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;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, editAction, true, propName, new StaticFlexiCellRenderer(editAction, new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
}
columnsModel.addFlexiColumnModel(col);
colPos++;
if (defaultSortKey == null) {
defaultSortKey = new SortKey(propName, true);
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.firstTime.i18n(), Cols.firstTime.ordinal(), true, Cols.firstTime.name()));
if (isLastVisitVisible) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.lastTime.i18n(), Cols.lastTime.ordinal(), true, Cols.lastTime.name()));
}
CourseRoleCellRenderer roleRenderer = new CourseRoleCellRenderer(getLocale());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.role.i18n(), Cols.role.ordinal(), true, Cols.role.name(), roleRenderer));
if (repoEntry != null) {
GroupCellRenderer groupRenderer = new GroupCellRenderer();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.groups.i18n(), Cols.groups.ordinal(), true, Cols.groups.name(), groupRenderer));
}
DefaultFlexiColumnModel toolsCol = new DefaultFlexiColumnModel(Cols.tools.i18n(), Cols.tools.ordinal());
toolsCol.setExportable(false);
toolsCol.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(toolsCol);
return defaultSortKey;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer in project openolat by klemens.
the class LicenseAdminConfigController method initLicenseTypesTable.
private void initLicenseTypesTable() {
addLicenseTypeButton = uifactory.addFormLink("add.license.type", flc, Link.BUTTON);
addLicenseTypeButton.setIconLeftCSS("o_icon o_icon_lic_add");
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.up, CMD_UP, new BooleanCellRenderer(new StaticFlexiCellRenderer("", CMD_UP, "o_icon o_icon-lg o_icon_move_up"), null)));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.down, CMD_DOWN, new BooleanCellRenderer(new StaticFlexiCellRenderer("", CMD_DOWN, "o_icon o_icon-lg o_icon_move_down"), null)));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.name));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.nameTranslation, CMD_TRANSLATE, new StaticFlexiCellRenderer(CMD_TRANSLATE, new TextFlexiCellRenderer())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.text));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.cssClass));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(LicenseTypeCols.edit, CMD_EDIT, new BooleanCellRenderer(null, new StaticFlexiCellRenderer("", CMD_EDIT, "o_icon o_icon-lg o_icon_edit"))));
// add a checkbox for every enabled license handler
int index = LicenseTypeCols.values().length;
for (LicenseHandler handler : licenseHandlers) {
boolean handlerEnabled = licenseModule.isEnabled(handler);
if (handlerEnabled) {
DefaultFlexiColumnModel columnModel = new DefaultFlexiColumnModel(handler.getType(), index++);
columnModel.setHeaderLabel(handler.getTitle(getLocale()));
columnsModel.addFlexiColumnModel(columnModel);
}
}
dataModel = new LicenseTypeDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "license.types", dataModel, getTranslator(), flc);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer 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.TextFlexiCellRenderer in project openolat by klemens.
the class CatalogNodeManagerController method getCatalogFlexiTableColumnModel.
private FlexiTableColumnModel getCatalogFlexiTableColumnModel(String cmdPrefix) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18nKey(), Cols.key.ordinal(), true, OrderBy.key.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.type.i18nKey(), Cols.type.ordinal(), true, OrderBy.type.name(), FlexiColumnModel.ALIGNMENT_LEFT, new TypeRenderer()));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer(cmdPrefix + "select", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.displayName.i18nKey(), Cols.displayName.ordinal(), cmdPrefix + "select", true, OrderBy.displayname.name(), renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.authors.i18nKey(), Cols.authors.ordinal(), true, OrderBy.authors.name()));
if (repositoryModule.isManagedRepositoryEntries()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18nKey(), Cols.externalId.ordinal(), true, OrderBy.externalId.name()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalRef.i18nKey(), Cols.externalRef.ordinal(), true, OrderBy.externalRef.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lifecycleLabel.i18nKey(), Cols.lifecycleLabel.ordinal(), true, OrderBy.lifecycleLabel.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lifecycleSoftkey.i18nKey(), Cols.lifecycleSoftkey.ordinal(), true, OrderBy.lifecycleSoftkey.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.lifecycleStart.i18nKey(), Cols.lifecycleStart.ordinal(), true, OrderBy.lifecycleStart.name(), FlexiColumnModel.ALIGNMENT_LEFT, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.lifecycleEnd.i18nKey(), Cols.lifecycleEnd.ordinal(), true, OrderBy.lifecycleEnd.name(), FlexiColumnModel.ALIGNMENT_LEFT, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.access.i18nKey(), Cols.access.ordinal(), true, OrderBy.access.name(), FlexiColumnModel.ALIGNMENT_LEFT, new AccessRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.ac.i18nKey(), Cols.ac.ordinal(), true, OrderBy.ac.name(), FlexiColumnModel.ALIGNMENT_LEFT, new ACRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.creationDate.i18nKey(), Cols.creationDate.ordinal(), true, OrderBy.creationDate.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.delete.i18nKey(), translate(Cols.delete.i18nKey()), cmdPrefix + "delete"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.move.i18nKey(), translate(Cols.move.i18nKey()), cmdPrefix + "move"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.detailsSupported.i18nKey(), Cols.detailsSupported.ordinal(), cmdPrefix + "details", new StaticFlexiCellRenderer("", cmdPrefix + "details", "o_icon o_icon-lg o_icon_details", translate("details"))));
return columnsModel;
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer in project openolat by klemens.
the class AuthorListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// search form
if (withSearch) {
setFormDescription("table.search.author.desc");
searchCtrl = new AuthorSearchController(ureq, getWindowControl(), true, mainForm);
searchCtrl.setEnabled(false);
listenTo(searchCtrl);
}
if (withClosedfilter) {
String[] statusValues = new String[] { translate("cif.resources.status.all"), translate("cif.resources.status.active"), translate("cif.resources.status.closed") };
closedEl = uifactory.addRadiosHorizontal("cif_status", "cif.resources.status", formLayout, statusKeys, statusValues);
closedEl.addActionListener(FormEvent.ONCHANGE);
closedEl.setDomReplacementWrapperRequired(false);
closedEl.select(statusKeys[1], true);
searchParams.setClosed(Boolean.FALSE);
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18nKey(), Cols.key.ordinal(), true, OrderBy.key.name()));
DefaultFlexiColumnModel markColumn = new DefaultFlexiColumnModel(true, Cols.mark.i18nKey(), Cols.mark.ordinal(), true, OrderBy.favorit.name());
markColumn.setExportable(false);
columnsModel.addFlexiColumnModel(markColumn);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.type.i18nKey(), Cols.type.ordinal(), true, OrderBy.type.name(), FlexiColumnModel.ALIGNMENT_LEFT, new TypeRenderer()));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("select", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.displayName.i18nKey(), Cols.displayName.ordinal(), "select", true, OrderBy.displayname.name(), renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.authors.i18nKey(), Cols.authors.ordinal(), true, OrderBy.authors.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.location.i18nKey(), Cols.location.ordinal(), true, OrderBy.location.name()));
if (repositoryModule.isManagedRepositoryEntries()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18nKey(), Cols.externalId.ordinal(), true, OrderBy.externalId.name()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalRef.i18nKey(), Cols.externalRef.ordinal(), true, OrderBy.externalRef.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lifecycleLabel.i18nKey(), Cols.lifecycleLabel.ordinal(), true, OrderBy.lifecycleLabel.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lifecycleSoftkey.i18nKey(), Cols.lifecycleSoftkey.ordinal(), true, OrderBy.lifecycleSoftkey.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.lifecycleStart.i18nKey(), Cols.lifecycleStart.ordinal(), true, OrderBy.lifecycleStart.name(), FlexiColumnModel.ALIGNMENT_LEFT, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.lifecycleEnd.i18nKey(), Cols.lifecycleEnd.ordinal(), true, OrderBy.lifecycleEnd.name(), FlexiColumnModel.ALIGNMENT_LEFT, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.author.i18nKey(), Cols.author.ordinal(), true, OrderBy.author.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.access.i18nKey(), Cols.access.ordinal(), true, OrderBy.access.name(), FlexiColumnModel.ALIGNMENT_LEFT, new AccessRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.ac.i18nKey(), Cols.ac.ordinal(), true, OrderBy.ac.name(), FlexiColumnModel.ALIGNMENT_LEFT, new ACRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.creationDate.i18nKey(), Cols.creationDate.ordinal(), true, OrderBy.creationDate.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lastUsage.i18nKey(), Cols.lastUsage.ordinal(), true, OrderBy.lastUsage.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.references.i18nKey(), Cols.references.ordinal(), true, OrderBy.references.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()))));
}
initActionsColumns(columnsModel);
model = new AuthoringEntryDataModel(dataSource, columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setSearchEnabled(withSearch);
tableEl.setCssDelegate(this);
tableEl.setExportEnabled(true);
tableEl.setExtendedSearch(searchCtrl);
tableEl.setCustomizeColumns(true);
tableEl.setElementCssClass("o_coursetable");
tableEl.setShowAllRowsEnabled(true);
tableEl.setMultiSelect(true);
tableEl.setSelectAllEnable(true);
tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
tableEl.setSortSettings(new FlexiTableSortOptions(true, new SortKey(OrderBy.displayname.name(), true)));
tableEl.setAndLoadPersistedPreferences(ureq, "authors-list-" + i18nName);
if (!withSearch) {
tableEl.reloadData();
tableEl.setFilters(null, getFilters(), false);
}
initBatchButtons(formLayout);
}
Aggregations