Search in sources :

Example 11 with TableGuiConfiguration

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);
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 12 with TableGuiConfiguration

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());
    }
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) User(org.olat.core.id.User) TableController(org.olat.core.gui.components.table.TableController) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) ShortName(org.olat.core.gui.ShortName) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) Date(java.util.Date) BigDecimal(java.math.BigDecimal) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 13 with TableGuiConfiguration

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()));
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) TableController(org.olat.core.gui.components.table.TableController) ArrayList(java.util.ArrayList) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) Date(java.util.Date) Kalendar(org.olat.commons.calendar.model.Kalendar) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 14 with TableGuiConfiguration

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());
}
Also used : RepositoryTableModel(org.olat.repository.ui.RepositoryTableModel) Translator(org.olat.core.gui.translator.Translator) TableController(org.olat.core.gui.components.table.TableController) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Example 15 with TableGuiConfiguration

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);
}
Also used : TableController(org.olat.core.gui.components.table.TableController) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) Roles(org.olat.core.id.Roles) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Aggregations

TableController (org.olat.core.gui.components.table.TableController)60 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)60 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)38 StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)14 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)12 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 Identity (org.olat.core.id.Identity)8 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)6 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 Roles (org.olat.core.id.Roles)4 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)4 RepositoryTableModel (org.olat.repository.ui.RepositoryTableModel)4 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Properties (java.util.Properties)2