Search in sources :

Example 96 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class EditTaxonomyLevelController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (level == null || level.getKey() == null) {
        String[] pathKeys;
        String[] pathValues;
        if (parentLevel == null) {
            List<String> pathKeyList = new ArrayList<>();
            List<String> pathValueList = new ArrayList<>();
            buildPathKeysAndValues(pathKeyList, pathValueList);
            pathKeys = pathKeyList.toArray(new String[pathKeyList.size()]);
            pathValues = pathValueList.toArray(new String[pathValueList.size()]);
        } else {
            pathKeys = new String[] { parentLevel.getKey().toString() };
            pathValues = new String[] { parentLevel.getMaterializedPathIdentifiers() };
        }
        pathEl = uifactory.addDropdownSingleselect("level.path", "taxonomy.level.path", formLayout, pathKeys, pathValues, null);
        pathEl.setEnabled(parentLevel == null);
    }
    String identifier = level == null ? "" : level.getIdentifier();
    identifierEl = uifactory.addTextElement("level.identifier", "level.identifier", 255, identifier, formLayout);
    identifierEl.setEnabled(!TaxonomyLevelManagedFlag.isManaged(level, TaxonomyLevelManagedFlag.identifier));
    identifierEl.setMandatory(true);
    String displayName = level == null ? "" : level.getDisplayName();
    displayNameEl = uifactory.addTextElement("level.displayname", "level.displayname", 255, displayName, formLayout);
    displayNameEl.setMandatory(true);
    displayNameEl.setEnabled(!TaxonomyLevelManagedFlag.isManaged(level, TaxonomyLevelManagedFlag.displayName));
    if (!StringHelper.containsNonWhitespace(displayName)) {
        displayNameEl.setFocus(true);
    }
    List<TaxonomyLevelType> types = getTypes();
    String[] typeKeys = new String[types.size() + 1];
    String[] typeValues = new String[types.size() + 1];
    typeKeys[0] = "";
    typeValues[0] = "-";
    for (int i = types.size(); i-- > 0; ) {
        typeKeys[i + 1] = types.get(i).getKey().toString();
        typeValues[i + 1] = types.get(i).getDisplayName();
    }
    taxonomyLevelTypeEl = uifactory.addDropdownSingleselect("level.type", "level.type", formLayout, typeKeys, typeValues, null);
    taxonomyLevelTypeEl.setEnabled(!TaxonomyLevelManagedFlag.isManaged(level, TaxonomyLevelManagedFlag.type));
    boolean typeFound = false;
    if (level != null && level.getType() != null) {
        String selectedTypeKey = level.getType().getKey().toString();
        for (String typeKey : typeKeys) {
            if (typeKey.equals(selectedTypeKey)) {
                taxonomyLevelTypeEl.select(selectedTypeKey, true);
                typeFound = true;
                break;
            }
        }
    }
    if (!typeFound) {
        taxonomyLevelTypeEl.select(typeKeys[0], true);
    }
    String sortOrder = level == null || level.getSortOrder() == null ? "" : level.getSortOrder().toString();
    sortOrderEl = uifactory.addTextElement("level.sort.order", "level.sort.order", 255, sortOrder, formLayout);
    sortOrderEl.setEnabled(!TaxonomyLevelManagedFlag.isManaged(level, TaxonomyLevelManagedFlag.displayName));
    String description = level == null ? "" : level.getDescription();
    descriptionEl = uifactory.addRichTextElementForStringDataCompact("level.description", "level.description", description, 10, 60, null, formLayout, ureq.getUserSession(), getWindowControl());
    descriptionEl.setEnabled(!TaxonomyLevelManagedFlag.isManaged(level, TaxonomyLevelManagedFlag.description));
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
    uifactory.addFormSubmitButton("save", buttonsCont);
}
Also used : TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 97 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class AbstractConfigurationMethodController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
    buttonGroupLayout.setRootForm(mainForm);
    formLayout.add(buttonGroupLayout);
    if (edit) {
        uifactory.addFormSubmitButton("save", buttonGroupLayout);
    } else {
        uifactory.addFormSubmitButton("create", buttonGroupLayout);
    }
    uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 98 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class FreeAccessController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("access.free.title");
    setFormDescription("access.free.desc");
    setFormTitleIconCss("o_icon o_icon-fw " + FreeAccessHandler.METHOD_CSS_CLASS + "_icon");
    String description = link.getOffer().getDescription();
    if (StringHelper.containsNonWhitespace(description)) {
        description = StringHelper.xssScan(description);
        uifactory.addStaticTextElement("offer.description", description, formLayout);
    }
    final FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonLayout", getTranslator());
    buttonGroupLayout.setRootForm(mainForm);
    formLayout.add(buttonGroupLayout);
    uifactory.addFormSubmitButton("access.button", buttonGroupLayout);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 99 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer 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"));
    }
}
Also used : DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) 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)

Example 100 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class OrdersSearchForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    refNoEl = uifactory.addTextElement("order.nr", "order.nr", 32, "", formLayout);
    fromEl = uifactory.addDateChooser("order.from", null, formLayout);
    toEl = uifactory.addDateChooser("order.to", null, formLayout);
    FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("searchLayout", getTranslator());
    buttonCont.setRootForm(mainForm);
    formLayout.add(buttonCont);
    uifactory.addFormSubmitButton("search", "search", buttonCont);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)844 ArrayList (java.util.ArrayList)96 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)76 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)76 Date (java.util.Date)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)56 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)42 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)40 FormItem (org.olat.core.gui.components.form.flexible.FormItem)38 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)32 Translator (org.olat.core.gui.translator.Translator)30 Identity (org.olat.core.id.Identity)30 VFSContainer (org.olat.core.util.vfs.VFSContainer)28 File (java.io.File)26 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)26 BusinessGroup (org.olat.group.BusinessGroup)26 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)22 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)22 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)20