use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class ScormResultDetailsController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == summaryTableCtr) {
TableEvent tEvent = (TableEvent) event;
if (tEvent.getActionId().equals("sel")) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setPreferencesOffered(true, "scormAssessmentDetails");
removeAsListenerAndDispose(cmiTableCtr);
cmiTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(cmiTableCtr);
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.itemId", 0, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.translatedKey", 1, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.key", 2, null, ureq.getLocale()));
cmiTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("cmis.column.header.value", 3, null, ureq.getLocale()));
// <BPS-252> BPS-252_3
int rowId = tEvent.getRowId();
List<CmiData> data = ((SummaryTableDataModelMultiResults) summaryTableCtr.getTableDataModel()).getObject(rowId);
cmiTableCtr.setTableDataModel(new CmiTableDataModel(getTranslator(), data));
// </BPS-252> BPS-252_3
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), cmiTableCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
} else if (source == resetConfirmationBox) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// delete scorm
String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
ScormAssessmentManager.getInstance().deleteResults(username, courseEnv, node);
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class OrderDetailController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
backLink = uifactory.addFormLink("back", formLayout, Link.LINK_BACK);
FormLayoutContainer mainLayout = FormLayoutContainer.createDefaultFormLayout("mainCmp", getTranslator());
mainLayout.setRootForm(mainForm);
formLayout.add("mainCmp", mainLayout);
String orderNr = order.getOrderNr();
uifactory.addStaticTextElement("order-nr", "order.nr", orderNr, mainLayout);
Date creationDate = order.getCreationDate();
String creationDateStr = Formatter.getInstance(getLocale()).formatDateAndTime(creationDate);
uifactory.addStaticTextElement("creation-date", "order.creationDate", creationDateStr, mainLayout);
String orderTotal = PriceFormat.fullFormat(order.getTotal());
String orderTotalStr;
if (acModule.isVatEnabled()) {
BigDecimal vat = acModule.getVat();
String vatStr = vat == null ? "" : vat.setScale(3, BigDecimal.ROUND_HALF_EVEN).toPlainString();
orderTotalStr = translate("access.info.price.vat", new String[] { orderTotal, vatStr });
} else {
orderTotalStr = translate("access.info.price.noVat", new String[] { orderTotal });
}
uifactory.addStaticTextElement("order-total", "order.total", orderTotalStr, mainLayout);
OrderItemsDataModel tableModel = getOrderItemsDataModel();
if (tableModel.getRowCount() == 1) {
OrderItemWrapper wrapper = tableModel.getObject(0);
if (wrapper.getItem().getOffer().getResource() != null) {
// resource is null if the resource has been deleted
String linkName = StringHelper.escapeHtml(wrapper.getDisplayName());
selectResourceLink = uifactory.addFormLink("resource", linkName, translate("order.item"), mainLayout, Link.NONTRANSLATED);
selectResourceLink.setUserObject(wrapper);
selectResourceLink.setCustomEnabledLinkCSS("form-control-static");
}
}
User user = order.getDelivery().getUser();
String delivery = StringHelper.escapeHtml(userManager.getUserDisplayName(user));
uifactory.addStaticTextElement("delivery", "order.delivery", delivery, mainLayout);
if (formLayout instanceof FormLayoutContainer) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setDownloadOffered(false);
tableConfig.setTableEmptyMessage(translate("orders.empty"));
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), Collections.<ShortName>emptyList(), null, null, null, false, getTranslator());
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("order.item.name", 0, null, getLocale()));
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("order.part.payment", 1, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new AccessMethodRenderer(acModule)));
tableCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_SELECT, "table.order.details", getTranslator().translate("order.details")));
tableCtr.setTableDataModel(tableModel);
listenTo(tableCtr);
FormLayoutContainer layoutContainer = (FormLayoutContainer) formLayout;
layoutContainer.put("orderItemList", tableCtr.getInitialComponent());
}
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class CourseCalendarPeekViewController method init.
private void init(UserRequest ureq, CalCourseNode courseNode, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
CourseCalendars myCal = CourseCalendars.createCourseCalendarsWrapper(ureq, getWindowControl(), courseEnv, ne);
Date refDate;
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (CalEditController.getAutoDate(config)) {
refDate = new Date();
} else {
refDate = CalEditController.getStartDate(config);
if (refDate == null)
refDate = new Date();
}
List<KalendarEvent> nextEvents = new ArrayList<KalendarEvent>();
for (KalendarRenderWrapper calendar : myCal.getCalendars()) {
Kalendar cal = calendar.getKalendar();
Collection<KalendarEvent> events = cal.getEvents();
for (KalendarEvent event : events) {
if (refDate.compareTo(event.getBegin()) <= 0) {
nextEvents.add(event);
}
}
}
Collections.sort(nextEvents, new KalendarEventComparator());
List<KalendarEvent> nextThreeEvents = nextEvents.subList(0, Math.min(3, nextEvents.size()));
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
tableConfig.setDisplayTableHeader(false);
tableConfig.setCustomCssClass("o_portlet_table");
tableConfig.setDisplayRowCount(false);
tableConfig.setPageingEnabled(false);
tableConfig.setDownloadOffered(false);
tableConfig.setSortingEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableController);
// dummy header key, won't be used since setDisplayTableHeader is set to
// false
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.date", 0, null, ureq.getLocale()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.subject", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
tableController.setTableDataModel(new CourseCalendarPeekViewModel(nextThreeEvents, getTranslator()));
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class BGConfigResourcesStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
addResource = uifactory.addFormLink("cmd.addresource", formLayout, Link.BUTTON);
Translator resourceTrans = Util.createPackageTranslator(RepositoryTableModel.class, getLocale(), getTranslator());
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("config.resources.noresources"));
resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans);
listenTo(resourcesCtr);
repoTableModel = new RepositoryTableModel(getLocale());
repoTableModel.addColumnDescriptors(resourcesCtr, false, false, true, true);
resourcesCtr.setTableDataModel(repoTableModel);
((FormLayoutContainer) formLayout).put("resources", resourcesCtr.getInitialComponent());
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project openolat by klemens.
the class GroupController method init.
protected void init(UserRequest ureq, boolean mayModifyMembers, boolean enableTablePreferences, boolean enableUserSelection, boolean allowDownload) {
setTranslator(Util.createPackageTranslator(org.olat.admin.securitygroup.gui.GroupController.class, getLocale(), getTranslator()));
Roles roles = ureq.getUserSession().getRoles();
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
chatEnabled = imModule.isEnabled() && imModule.isPrivateEnabled();
// default group controller has no mail functionality
this.addUserMailDefaultTempl = null;
this.removeUserMailDefaultTempl = null;
groupmemberview = createVelocityContainer("index");
addUsersButton = LinkFactory.createButtonSmall("overview.addusers", groupmemberview, this);
addUsersButton.setElementCssClass("o_sel_group_import_users");
addUserButton = LinkFactory.createButtonSmall("overview.adduser", groupmemberview, this);
addUserButton.setElementCssClass("o_sel_group_add_user");
if (mayModifyMembers) {
groupmemberview.contextPut("mayadduser", Boolean.TRUE);
}
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setDownloadOffered(allowDownload);
if (enableTablePreferences) {
// save table preferences for each group seperatly
if (mayModifyMembers) {
tableConfig.setPreferencesOffered(true, "groupcontroller" + group.getKey());
} else {
// different rowcount...
tableConfig.setPreferencesOffered(true, "groupcontrollerreadonly" + group.getKey());
}
}
myTrans = userManager.getPropertyHandlerTranslator(getTranslator());
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myTrans);
listenTo(tableCtr);
initGroupTable(tableCtr, ureq, enableTablePreferences, enableUserSelection);
// set data model
reloadData();
groupmemberview.put("subjecttable", tableCtr.getInitialComponent());
putInitialPanel(groupmemberview);
}
Aggregations