use of org.olat.core.gui.components.form.flexible.elements.SingleSelection in project OpenOLAT by OpenOLAT.
the class LicenseAdminConfigController method reloadDefaultLicenseTypeEl.
private void reloadDefaultLicenseTypeEl(LicenseHandler handler) {
SingleSelection defaultLicenseTypeEl = defaultLicenseTypeEls.get(handler.getType());
if (defaultLicenseTypeEl != null) {
List<LicenseType> activatedLicenseTypes = licenseService.loadActiveLicenseTypes(handler);
Collections.sort(activatedLicenseTypes);
String[] licenseTypeKeys = getLicenseTypeKeys(activatedLicenseTypes);
String[] licenseTypeValues = getLicenseTypeValues(activatedLicenseTypes);
defaultLicenseTypeEl.setKeysAndValues(licenseTypeKeys, licenseTypeValues, null);
String defaultLicenseTypeKey = licenseModule.getDefaultLicenseTypeKey(handler);
if (Arrays.asList(licenseTypeKeys).contains(defaultLicenseTypeKey)) {
defaultLicenseTypeEl.select(defaultLicenseTypeKey, true);
}
}
}
use of org.olat.core.gui.components.form.flexible.elements.SingleSelection in project OpenOLAT by OpenOLAT.
the class LicenseAdminConfigController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (enabledEl == source) {
doEnableHandlers();
} else if (addLicenseTypeButton == source) {
doAddLicenseType(ureq);
} else if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
LicenseTypeRow licenseTypeRow = dataModel.getObject(se.getIndex());
if (CMD_UP.equals(cmd)) {
doUp(se.getIndex());
} else if (CMD_DOWN.equals(cmd)) {
doDown(se.getIndex());
} else if (CMD_TRANSLATE.equals(cmd)) {
doOpenTranslator(ureq, licenseTypeRow.getLicenseType());
} else if (CMD_EDIT.equals(cmd)) {
doEditLicenseType(ureq, licenseTypeRow.getLicenseType());
}
}
} else if (source instanceof MultipleSelectionElement) {
MultipleSelectionElement multipleSelectionElement = (MultipleSelectionElement) source;
doActivateLicenseType(multipleSelectionElement);
} else if (source instanceof SingleSelection) {
SingleSelection singleSelection = (SingleSelection) source;
String name = singleSelection.getName();
if (name.startsWith(DEFAULT_LICENSE_TYPE_PREFIX)) {
doSetDefaultLicenceType(source, singleSelection);
} else if (name.startsWith(LICENSOR_CREATOR_TYPE_PREFIX)) {
doSetLicensorCreator(source, singleSelection);
}
} else if (source instanceof FormLink) {
Object userObject = source.getUserObject();
if (userObject instanceof LicenseHandler) {
LicenseHandler handler = (LicenseHandler) userObject;
doEditLicensorConstant(ureq, handler);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.SingleSelection in project OpenOLAT by OpenOLAT.
the class FormUIFactory method addDropdownSingleselect.
/**
* Add a drop down menu (also called pulldown menu).
* @param id The unique identifier of the selection box (can be null, will be auto generated)
* @param name
* @param labelKey i18n key for the label, may be <code>null</code> indicating no label.
* @param formLayout
* @param theKeys
* @param theValues
* @param theCssClasses
* @return
*/
public SingleSelection addDropdownSingleselect(final String id, final String name, final String i18nLabel, FormItemContainer formLayout, final String[] theKeys, final String[] theValues, final String[] theCssClasses) {
SingleSelection ss = new SelectboxSelectionImpl(id, name, formLayout.getTranslator().getLocale());
ss.setKeysAndValues(theKeys, theValues, theCssClasses);
setLabelIfNotNull(i18nLabel, ss);
formLayout.add(ss);
return ss;
}
use of org.olat.core.gui.components.form.flexible.elements.SingleSelection in project OpenOLAT by OpenOLAT.
the class SitesConfigurationController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == tableEl) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("up".equals(se.getCommand())) {
SiteDefRow row = model.getObject(se.getIndex());
moveUp(row);
doUpdateOrders();
tableEl.getComponent().setDirty(true);
} else if ("down".equals(se.getCommand())) {
SiteDefRow row = model.getObject(se.getIndex());
moveDown(row);
doUpdateOrders();
tableEl.getComponent().setDirty(true);
}
}
} else if (source instanceof SingleSelection) {
if (source.getName().startsWith("site.security.") && source.getUserObject() instanceof SiteDefRow) {
SiteDefRow row = (SiteDefRow) source.getUserObject();
String selectCallbackId = row.getSecurityCallbackEl().getSelectedKey();
boolean needAlt = (securityCallbacks.containsKey(selectCallbackId) && securityCallbacks.get(selectCallbackId) instanceof SiteViewSecurityCallback);
if (row.getAlternativeControllerEl().isVisible() != needAlt) {
row.getAlternativeControllerEl().setVisible(needAlt);
tableEl.reset();
}
}
doSaveSettings();
} else if (source instanceof MultipleSelectionElement || source instanceof SingleSelection) {
doSaveSettings();
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.SingleSelection in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof FlexiTableSearchEvent) {
FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
loadModel(ureq, se.getSearch());
} else if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("up".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doMoveUpAssignment(ureq, row);
}
} else if ("down".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doMoveDownAssignment(ureq, row);
}
}
}
} else if (timelineSwitchOnButton == source) {
doSwitchTimelineOff();
} else if (timelineSwitchOffButton == source) {
doSwitchTimelineOn();
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("open.full".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doOpenRow(ureq, row, false);
} else if ("comment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doComment(ureq, row.getPage());
} else if ("close.section".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmCloseSection(ureq, row);
} else if ("reopen.section".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmReopenSection(ureq, row);
} else if ("edit.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doEditAssignment(ureq, row);
} else if ("delete.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmDeleteAssignment(ureq, row);
} else if ("move.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveAssignment(ureq, row);
} else if ("start.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doStartAssignment(ureq, row);
} else if ("open.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doOpenAssignment(ureq, row);
} else if ("up.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveUpAssignment(ureq, row);
} else if ("down.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveDownAssignment(ureq, row);
}
} else if (source instanceof SingleSelection) {
SingleSelection startAssignment = (SingleSelection) source;
if (startAssignment.isOneSelected()) {
String selectedKey = startAssignment.getSelectedKey();
try {
Long key = Long.parseLong(selectedKey);
doStartAssignment(ureq, key);
} catch (Exception e) {
//
}
}
} else if (source == flc) {
if ("ONCLICK".equals(event.getCommand())) {
String category = ureq.getParameter("tag_select");
if (StringHelper.containsNonWhitespace(category)) {
tableEl.quickSearch(ureq, category);
}
}
}
super.formInnerEvent(ureq, source, event);
}
Aggregations