use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.
the class SitesConfigurationController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
this.formLayout = formLayout;
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SiteCols.enabled.i18nKey(), SiteCols.enabled.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SiteCols.title.i18nKey(), SiteCols.title.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, SiteCols.type.i18nKey(), SiteCols.type.ordinal(), false, null));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SiteCols.secCallback.i18nKey(), SiteCols.secCallback.ordinal()));
if (needAlternative) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SiteCols.altController.i18nKey(), SiteCols.altController.ordinal()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, SiteCols.defaultOrder.i18nKey(), SiteCols.defaultOrder.ordinal(), false, null));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("up", SiteCols.up.ordinal(), "up", new StaticFlexiCellRenderer("", "up", "o_icon o_icon-lg o_icon_move_up", translate("up"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("down", SiteCols.down.ordinal(), "down", new StaticFlexiCellRenderer("", "down", "o_icon o_icon-lg o_icon_move_down", translate("down"))));
model = new SiteDefModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "sitesTable", model, getTranslator(), formLayout);
tableEl.setRendererType(FlexiTableRendererType.classic);
tableEl.setCustomizeColumns(true);
tableEl.setAndLoadPersistedPreferences(ureq, "sites-admin");
reload();
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.
the class LandingPagesAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("landingpages.title");
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.position.i18nKey(), RCols.position.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.role.i18nKey(), RCols.role.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeKey.i18nKey(), RCols.userAttributeKey.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeValue.i18nKey(), RCols.userAttributeValue.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPage.i18nKey(), RCols.landingPage.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPageChooser.i18nKey(), RCols.landingPageChooser.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("up", -1, "up", new StaticFlexiCellRenderer("", "up", "o_icon o_icon-lg o_icon_move_up", translate("up"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("down", -1, "down", new StaticFlexiCellRenderer("", "down", "o_icon o_icon-lg o_icon_move_down", translate("down"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("add", translate("add"), "add"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
// pack the rules
Rules rules = lpModule.getRules();
List<Rule> ruleList = new ArrayList<>(rules.getRules());
if (ruleList.isEmpty()) {
ruleList.add(new Rule());
}
List<RuleWrapper> wrappers = new ArrayList<>();
int i = 0;
for (Rule rule : ruleList) {
wrappers.add(initRuleWrapper(++i, rule, formLayout));
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("rules", wrappers);
}
model = new RulesDataModel(columnsModel, wrappers);
tableEl = uifactory.addTableElement(getWindowControl(), "rules", model, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
tableEl.setRendererType(FlexiTableRendererType.classic);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add("buttons", buttonLayout);
saveButton = uifactory.addFormSubmitButton("save", buttonLayout);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project openolat by klemens.
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.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
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.StaticFlexiCellRenderer in project OpenOLAT by OpenOLAT.
the class AssessmentModeAdminListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// search form
FormLayoutContainer searchLeftForm = FormLayoutContainer.createDefaultFormLayout("left_1", getTranslator());
searchLeftForm.setRootForm(mainForm);
formLayout.add("left_1", searchLeftForm);
idAndRefsEl = uifactory.addTextElement("mode.id", "assessment.mode.id", 128, null, searchLeftForm);
nameEl = uifactory.addTextElement("mode.name", "assessment.mode.name", 128, null, searchLeftForm);
FormLayoutContainer searchRightForm = FormLayoutContainer.createDefaultFormLayout("right_1", getTranslator());
searchRightForm.setRootForm(mainForm);
formLayout.add("right_1", searchRightForm);
dateEl = uifactory.addDateChooser("assessment.mode.date", null, searchRightForm);
dateEl.setDateChooserTimeEnabled(true);
// search button
FormLayoutContainer searchButtons = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
searchButtons.setRootForm(mainForm);
formLayout.add("button_layout", searchButtons);
searchButton = uifactory.addFormLink("search", searchButtons, Link.BUTTON);
searchButton.setPrimary(true);
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.status.i18nKey(), Cols.status.ordinal(), true, Cols.status.name(), new ModeStatusCellRenderer()));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("select", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.course.i18nKey(), Cols.course.ordinal(), "select", true, Cols.course.name(), renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalId.i18nKey(), Cols.externalId.ordinal(), true, Cols.externalId.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.externalRef.i18nKey(), Cols.externalRef.ordinal(), true, Cols.externalRef.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.name.i18nKey(), Cols.name.ordinal(), true, Cols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.begin.i18nKey(), Cols.begin.ordinal(), true, Cols.begin.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.end.i18nKey(), Cols.end.ordinal(), true, Cols.end.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.leadTime.i18nKey(), Cols.leadTime.ordinal(), true, Cols.leadTime.name(), new TimeCellRenderer(getTranslator())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.followupTime.i18nKey(), Cols.followupTime.ordinal(), true, Cols.followupTime.name(), new TimeCellRenderer(getTranslator())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.target.i18nKey(), Cols.target.ordinal(), true, Cols.target.name(), new TargetAudienceCellRenderer(getTranslator())));
model = new AssessmentModeListModel(columnsModel, getTranslator(), assessmentModeCoordinationService);
tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
tableEl.setMultiSelect(false);
tableEl.setAndLoadPersistedPreferences(ureq, "assessment-mode-admin");
}
Aggregations