use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class TitleEditorController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
List<String> headingFormatLinkNames = new ArrayList<>();
for (int i = 1; i <= 6; i++) {
FormLink headingFormatLink = uifactory.addFormLink("h" + i, "h" + i, "h" + i, null, formLayout, Link.LINK);
headingFormatLinkNames.add(headingFormatLink.getComponent().getComponentName());
}
flc.getFormItemComponent().contextPut("headingFormatLinkNames", headingFormatLinkNames);
String cmpId = "title-" + CodeHelper.getRAMUniqueID() + "h";
String content = title.getContent();
titleItem = uifactory.addRichTextElementForStringDataCompact(cmpId, null, content, 8, 80, null, formLayout, ureq.getUserSession(), getWindowControl());
titleItem.getEditorConfiguration().setSendOnBlur(true);
titleItem.getEditorConfiguration().disableMenuAndMenuBar();
staticItem = uifactory.addStaticTextElement(cmpId + "_static", content, formLayout);
flc.getFormItemComponent().contextPut("cmpId", cmpId);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class SharedPagesController method loadModel.
private void loadModel(boolean resetPage, boolean resetInternal) {
searchParams.setSearchString(tableEl.getQuickSearchString());
List<AssessedPage> sharedItems = portfolioService.searchSharedPagesWith(getIdentity(), searchParams);
List<SharedPageRow> rows = new ArrayList<>(sharedItems.size());
for (AssessedPage sharedItem : sharedItems) {
SharedPageRow row = new SharedPageRow(sharedItem.getOwner(), userPropertyHandlers, getLocale());
row.setPageKey(sharedItem.getPageKey());
row.setPageTitle(sharedItem.getPageTitle());
row.setStatus(sharedItem.getPageStatus());
row.setMark(sharedItem.isMarked());
row.setUserStatus(sharedItem.getUserStatus());
row.setLastChanges(sharedItem.getLastModified());
FormLink markLink = uifactory.addFormLink("mark_" + (counter++), "mark", "", null, flc, Link.NONTRANSLATED);
markLink.setIconLeftCSS(sharedItem.isMarked() ? Mark.MARK_CSS_LARGE : Mark.MARK_ADD_CSS_LARGE);
markLink.setTitle(translate(sharedItem.isMarked() ? "details.bookmark.remove" : "details.bookmark"));
markLink.setUserObject(row);
row.setBookmarkLink(markLink);
rows.add(row);
}
model.setObjects(rows);
tableEl.reset(resetPage, resetInternal, true);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class EPViewModeController method formInnerEvent.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formInnerEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.components.form.flexible.FormItem, org.olat.core.gui.components.form.flexible.impl.FormEvent)
*/
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == tableLink || source == detailsLink) {
FormLink link = (FormLink) source;
if (!link.getCmd().equals(userPrefsMode)) {
String newUserPrefsMode = link.getCmd();
ePFMgr.setUsersPreferedArtefactViewMode(getIdentity(), newUserPrefsMode, context);
userPrefsMode = newUserPrefsMode;
fireEvent(ureq, new Event(VIEWMODE_CHANGED_EVENT_CMD));
}
}
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class GenericSelectionPropertyHandlerController method addOptionField.
/**
* adds an option field to the form (one row in the table)
*
* @param val
*/
private void addOptionField(String val) {
int teNumber = optionFieldNames.size() + 1;
TextElement te = uifactory.addTextElement(OPTFIELD_PREFIX + teNumber, null, 10, "", hcFlc);
te.setValue(val);
if (StringHelper.containsNonWhitespace(val)) {
uifactory.addStaticTextElement(OPTFIELD_TRSLBL_PREFIX + teNumber, null, "(" + translate(val) + ")", hcFlc);
}
FormLink tl = uifactory.addFormLink(OPTFIELD_TRS_PREFIX + teNumber, "gsphc.translate", "label", hcFlc, Link.LINK);
FormLink re = uifactory.addFormLink(OPTFIELD_RMV_PREFIX + teNumber, "gsphc.remove", "label", hcFlc, Link.BUTTON_XSMALL);
re.setUserObject(te);
tl.setUserObject(te);
optionFieldNames.add(String.valueOf(teNumber));
hcFlc.contextPut("optionfields", optionFieldNames);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class UsrPropCfgTableController method buildPropertyHandlerTable.
/**
* builds the userPropertyHandler-Table
*/
private void buildPropertyHandlerTable() {
List<UserPropertyHandler> myHandlerList = usrPropCfgMng.getUserPropertiesConfigObject().getPropertyHandlers();
// first search for all group-values in the propertyHandlers
List<String> allGroupValues = new ArrayList<>();
for (UserPropertyHandler handler : myHandlerList) {
String group = handler.getGroup();
if (!allGroupValues.contains(group))
allGroupValues.add(group);
}
// take the defaults
for (int k = 0; k < GROUP_KEYS.length; k++) {
String group = GROUP_KEYS[k];
if (!allGroupValues.contains(group))
allGroupValues.add(group);
}
final String[] selectableGroups = allGroupValues.toArray(new String[0]);
// the table-rows
String handlerName;
SingleSelection groupDropdown;
FormToggle fi;
FormLink translateLink;
FormLink handlerLink;
String translatedName;
for (UserPropertyHandler handler : myHandlerList) {
handlerName = handler.getName();
// the group field
groupDropdown = uifactory.addDropdownSingleselect(FT_NAME_PREFIX_GRPN + handlerName, propTableFlc, selectableGroups, selectableGroups, null);
if (Arrays.asList(selectableGroups).contains(handler.getGroup())) {
groupDropdown.select(handler.getGroup(), true);
} else {
logWarn("could not set group-select to " + handler.getGroup() + " (" + handler.getName() + ")", null);
}
groupDropdown.setUserObject(handler);
groupDropdown.showLabel(false);
groupDropdown.addActionListener(FormEvent.ONCHANGE);
// the "active"-toggle button
fi = uifactory.addToggleButton(FT_NAME_PREFIX_TGL + handlerName, " ", propTableFlc, null, null);
if (usrPropCfgMng.getUserPropertiesConfigObject().isActiveHandler(handler))
fi.toggleOn();
else
fi.toggleOff();
if (!UsrPropCfgManager.canBeDeactivated(handler))
fi.setEnabled(false);
fi.setUserObject(handler);
rowToggleButtonsMap.put(handlerName, fi);
// the "translate" link
if (isPropertyHandlerTranslated(handler)) {
translateLink = uifactory.addFormLink(FT_NAME_PREFIX_TRANSL + handlerName, "upc.edittranslate", "label", propTableFlc, Link.LINK);
} else {
translateLink = uifactory.addFormLink(FT_NAME_PREFIX_TRANSL + handlerName, "upc.translate", "label", propTableFlc, Link.LINK);
translateLink.setCustomEnabledLinkCSS("o_ochre");
}
translateLink.setUserObject(handler);
// the "handler-config" link
if (handlerConfigCtrlFactory.hasConfig(handler)) {
handlerLink = uifactory.addFormLink(FT_NAME_PREFIX_HDNL + handlerName, "upc.hndlconfig", "label", propTableFlc, Link.LINK);
handlerLink.setUserObject(handler);
}
// put the translation (in the current language) for the property
translatedName = I18nManager.getInstance().getLocalizedString(UserPropertyHandler.class.getPackage().getName(), handler.i18nFormElementLabelKey(), null, getLocale(), true, true);
uifactory.addStaticTextElement(FT_NAME_PREFIX_TRANSNAME + handlerName, (translatedName == null ? "-" : translatedName), propTableFlc);
}
propTableFlc.contextPut("rows", myHandlerList);
}
Aggregations