use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel in project OpenOLAT by OpenOLAT.
the class CheckListAssessmentController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormDescription("coach.desc");
setFormContextHelp("Assessment#_checklist_manage");
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
if (dueDate != null) {
layoutCont.contextPut("dueDate", dueDate);
}
}
FlexiTableSortOptions options = new FlexiTableSortOptions();
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
options.setDefaultOrderBy(new SortKey(Cols.username.name(), true));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.username.i18nKey(), Cols.username.ordinal(), true, Cols.username.name()));
}
int i = 0;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
int colIndex = CheckListAssessmentDataModel.USER_PROPS_OFFSET + i++;
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
if (visible) {
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(true, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
}
columnsModel.addFlexiColumnModel(col);
if (options.getDefaultOrderBy() == null) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
}
int numOfCheckbox = checkboxList.getNumOfCheckbox();
List<Checkbox> boxList = checkboxList.getList();
int j = 0;
for (Checkbox box : boxList) {
int colIndex = CheckListAssessmentDataModel.CHECKBOX_OFFSET + j++;
String colName = "checkbox_" + colIndex;
DefaultFlexiColumnModel column = new DefaultFlexiColumnModel(true, colName, colIndex, true, colName);
column.setHeaderLabel(StringHelper.escapeHtml(box.getTitle()));
columnsModel.addFlexiColumnModel(column);
}
if (withScore) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.totalPoints.i18nKey(), Cols.totalPoints.ordinal(), true, "points"));
}
if (coachCourseEnv.isCourseReadOnly()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.view.checkbox", translate("table.header.view.checkbox"), "view"));
} else {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.header.edit.checkbox", translate("table.header.edit.checkbox"), "edit"));
}
model = new CheckListAssessmentDataModel(checkboxList, new ArrayList<>(), columnsModel, getLocale());
table = uifactory.addTableElement(getWindowControl(), "checkbox-list", model, getTranslator(), formLayout);
if (coachCourseEnv instanceof UserCourseEnvironmentImpl) {
UserCourseEnvironmentImpl env = (UserCourseEnvironmentImpl) coachCourseEnv;
List<BusinessGroup> coachedGroups = env.getCoachedGroups();
List<FlexiTableFilter> filters = new ArrayList<>(coachedGroups.size() + 1);
filters.add(new FlexiTableFilter(translate("filter.all"), "all"));
for (int k = 0; k < coachedGroups.size(); k++) {
BusinessGroup group = coachedGroups.get(k);
String groupName = StringHelper.escapeHtml(group.getName());
filters.add(new FlexiTableFilter(groupName, group.getKey().toString()));
}
table.setFilters("participants", filters, false);
}
table.setExportEnabled(true);
table.setCustomizeColumns(true);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
table.setSortSettings(sortOptions);
table.setAndLoadPersistedPreferences(ureq, "checklist-assessment");
pdfExportButton = uifactory.addFormLink("pdf.export", formLayout, Link.BUTTON);
pdfExportButton.setEnabled(numOfCheckbox > 0);
checkedPdfExportButton = uifactory.addFormLink("pdf.export.checked", formLayout, Link.BUTTON);
checkedPdfExportButton.setEnabled(numOfCheckbox > 0);
editButton = uifactory.addFormLink("edit", formLayout, Link.BUTTON);
editButton.setEnabled(numOfCheckbox > 0);
editButton.setVisible(!coachCourseEnv.isCourseReadOnly());
saveButton = uifactory.addFormSubmitButton("save", formLayout);
saveButton.getComponent().setSpanAsDomReplaceable(true);
saveButton.setVisible(false);
cancelButton = uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
cancelButton.setVisible(false);
boxAssessmentButton = uifactory.addFormLink("box.assessment", formLayout, Link.BUTTON);
boxAssessmentButton.setEnabled(numOfCheckbox > 0);
boxAssessmentButton.setVisible(!coachCourseEnv.isCourseReadOnly());
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel in project OpenOLAT by OpenOLAT.
the class PaypalTransactionsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
backLink = uifactory.addFormLink("back", formLayout, Link.LINK_BACK);
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.status, new PaypalTransactionStatusRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.orderNr));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.payResponseDate));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.payAmount));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.ipnTransactionId));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.ipnTransactionStatus));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.ipnSenderTransactionId));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.ipnSenderTransactionStatus));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.ipnPendingReason));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.ipnSender));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.payAck));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Columns.payPaymentExecStatus));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Columns.olatStatus));
DefaultFlexiColumnModel selectColumns = new DefaultFlexiColumnModel("select", translate("select"), CMD_SELECT);
selectColumns.setExportable(false);
selectColumns.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(selectColumns);
dataModel = new PaypalTransactionDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "results", dataModel, 25, false, getTranslator(), formLayout);
tableEl.setEmtpyTableMessageKey("paypal.transactions.empty");
tableEl.setCustomizeColumns(true);
tableEl.setExportEnabled(true);
tableEl.setSearchEnabled(true);
FlexiTableSortOptions options = new FlexiTableSortOptions();
options.setDefaultOrderBy(new SortKey(Columns.payResponseDate.name(), false));
options.setFromColumnModel(true);
tableEl.setSortSettings(options);
List<FlexiTableFilter> filters = new ArrayList<>();
filters.add(new FlexiTableFilter(translate("show.all"), "showAll"));
filters.add(FlexiTableFilter.SPACER);
for (PaypalMergedState state : PaypalMergedState.values()) {
filters.add(new FlexiTableFilter(translate("filter.".concat(state.name())), state.name()));
}
tableEl.setFilters("", filters, false);
;
tableEl.setAndLoadPersistedPreferences(ureq, "FPaypalTransaction");
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel in project OpenOLAT by OpenOLAT.
the class OrdersAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.status, new OrderStatusRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.orderNr));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.creationDate));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.summary));
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.username));
}
int i = 0;
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 = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
columnsModel.addFlexiColumnModel(col);
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.methods, new AccessMethodRenderer(acModule)));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(OrderCol.total));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.order.details", translate("select"), CMD_SELECT));
dataSource = new OrdersDataSource(acService, resource, null, userPropertyHandlers);
if (resource == null) {
searchForm = new OrdersSearchForm(ureq, getWindowControl(), mainForm);
listenTo(searchForm);
formLayout.add("searchForm", searchForm.getInitialFormItem());
Calendar cal = CalendarUtils.getStartOfDayCalendar(getLocale());
cal.add(Calendar.MONTH, -1);
searchForm.setFrom(cal.getTime());
dataSource.setFrom(cal.getTime());
}
dataModel = new OrdersDataModel(dataSource, getLocale(), userManager, columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "orderList", dataModel, 25, true, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
List<FlexiTableFilter> filters = new ArrayList<>();
filters.add(new FlexiTableFilter(translate("order.status.new"), OrderStatus.NEW.name()));
filters.add(new FlexiTableFilter(translate("order.status.prepayment"), OrderStatus.PREPAYMENT.name()));
filters.add(new FlexiTableFilter(translate("order.status.payed"), OrderStatus.PAYED.name()));
filters.add(new FlexiTableFilter(translate("order.status.canceled"), OrderStatus.CANCELED.name()));
filters.add(new FlexiTableFilter(translate("order.status.error"), OrderStatus.ERROR.name()));
tableEl.setFilters("", filters, false);
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("title", translate("orders.admin.my"));
layoutCont.contextPut("description", translate("orders.admin.my.desc"));
}
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel in project OpenOLAT by OpenOLAT.
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.FlexiTableColumnModel in project OpenOLAT by OpenOLAT.
the class ForumPseudonymsAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("admin.pseudonyms.title");
newPseudonymButton = uifactory.addFormLink("new.pseudonym", formLayout, Link.BUTTON);
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PseudoCols.pseudonym));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PseudoCols.creationDate));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(PseudoCols.numOfMessages));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
model = new ForumPseudonymsDataModel(columnsModel);
tableEl = uifactory.addTableElement(getWindowControl(), "pseudonyms", model, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
tableEl.setElementCssClass("o_forum");
tableEl.setEmtpyTableMessageKey("forum.emtpy");
tableEl.setSearchEnabled(true);
}
Aggregations