Search in sources :

Example 1 with PercentCellRenderer

use of org.olat.modules.taxonomy.ui.component.PercentCellRenderer in project openolat by klemens.

the class TaxonomyLevelCompetenceController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    boolean multiSelect = false;
    if (!TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.manageCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.teachCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.haveCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.targetCompetence)) {
        addCompetencesButton = uifactory.addFormLink("add.competences", formLayout, Link.BUTTON);
        removeCompetencesButton = uifactory.addFormLink("delete", formLayout, Link.BUTTON);
        multiSelect = true;
    }
    // table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, CompetenceCols.key));
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.username));
    }
    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 = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
        columnsModel.addFlexiColumnModel(col);
        colPos++;
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.type, new TaxonomyCompetenceTypeRenderer(getTranslator())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.achievement, new PercentCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.reliability, new PercentCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.expiration, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    tableModel = new TaxonomyLevelCompetenceTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(true);
    tableEl.setEmtpyTableMessageKey("table.competence.empty");
    tableEl.setMultiSelect(multiSelect);
    tableEl.setAndLoadPersistedPreferences(ureq, "tax-level-competences");
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) TaxonomyCompetenceTypeRenderer(org.olat.modules.taxonomy.ui.component.TaxonomyCompetenceTypeRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) PercentCellRenderer(org.olat.modules.taxonomy.ui.component.PercentCellRenderer)

Example 2 with PercentCellRenderer

use of org.olat.modules.taxonomy.ui.component.PercentCellRenderer in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelCompetenceController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    boolean multiSelect = false;
    if (!TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.manageCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.teachCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.haveCompetence) || !TaxonomyLevelManagedFlag.isManaged(taxonomyLevel, TaxonomyLevelManagedFlag.targetCompetence)) {
        addCompetencesButton = uifactory.addFormLink("add.competences", formLayout, Link.BUTTON);
        removeCompetencesButton = uifactory.addFormLink("delete", formLayout, Link.BUTTON);
        multiSelect = true;
    }
    // table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, CompetenceCols.key));
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.username));
    }
    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 = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
        columnsModel.addFlexiColumnModel(col);
        colPos++;
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.type, new TaxonomyCompetenceTypeRenderer(getTranslator())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.achievement, new PercentCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.reliability, new PercentCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CompetenceCols.expiration, new DateFlexiCellRenderer(getLocale())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    tableModel = new TaxonomyLevelCompetenceTableModel(columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(true);
    tableEl.setEmtpyTableMessageKey("table.competence.empty");
    tableEl.setMultiSelect(multiSelect);
    tableEl.setAndLoadPersistedPreferences(ureq, "tax-level-competences");
}
Also used : DateFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer) TaxonomyCompetenceTypeRenderer(org.olat.modules.taxonomy.ui.component.TaxonomyCompetenceTypeRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) PercentCellRenderer(org.olat.modules.taxonomy.ui.component.PercentCellRenderer)

Aggregations

DateFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.DateFlexiCellRenderer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 PercentCellRenderer (org.olat.modules.taxonomy.ui.component.PercentCellRenderer)2 TaxonomyCompetenceTypeRenderer (org.olat.modules.taxonomy.ui.component.TaxonomyCompetenceTypeRenderer)2 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)2