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);
}
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());
}
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);
}
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"));
}
}
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);
}
Aggregations