Search in sources :

Example 1 with SingleKeyTranslatorController

use of org.olat.core.util.i18n.ui.SingleKeyTranslatorController in project OpenOLAT by OpenOLAT.

the class QEducationalContextsAdminController method doOpenTranslationTool.

private void doOpenTranslationTool(UserRequest ureq, QEducationalContext row) {
    String key2Translate = "item.level." + row.getLevel().toLowerCase();
    String[] keys2Translate = { key2Translate };
    singleKeyTrnsCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), keys2Translate, QuestionsController.class);
    listenTo(singleKeyTrnsCtrl);
    removeAsListenerAndDispose(cmc);
    cmc = new CloseableModalController(getWindowControl(), "close", singleKeyTrnsCtrl.getInitialComponent(), true, translate("translation"));
    listenTo(cmc);
    cmc.activate();
}
Also used : SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) QuestionsController(org.olat.modules.qpool.ui.QuestionsController)

Example 2 with SingleKeyTranslatorController

use of org.olat.core.util.i18n.ui.SingleKeyTranslatorController in project OpenOLAT by OpenOLAT.

the class GenericSelectionPropertyHandlerController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    // save the data to config
    boolean m = modeRadio.isSelected(1);
    handler.setMultiSelect(m);
    List<String> selectionKeys = new ArrayList<String>();
    for (int i = 0; i < optionFieldNames.size(); i++) {
        TextElement te = (TextElement) hcFlc.getFormComponent(OPTFIELD_PREFIX + optionFieldNames.get(i));
        String textValue = te.getValue();
        if (StringHelper.containsNonWhitespace(textValue))
            selectionKeys.add(textValue);
    }
    String[] selectionKeysArray = new String[selectionKeys.size()];
    handler.setSelectionKeys(selectionKeys.toArray(selectionKeysArray));
    handler.saveConfig();
    // remove i18nKeys that are no longer used (prevent orphans)
    if (singleKeyTrsCtrl == null) {
        singleKeyTrsCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), "", GenericSelectionPropertyHandler.class);
    }
    for (String key : i18nKeysToDelete) {
        singleKeyTrsCtrl.deleteI18nKey(key);
    }
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) ArrayList(java.util.ArrayList)

Example 3 with SingleKeyTranslatorController

use of org.olat.core.util.i18n.ui.SingleKeyTranslatorController in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method doOpenTranslator.

private void doOpenTranslator(UserRequest ureq, LicenseType licenseType) {
    String i18nKey = LicenseUIFactory.LICENSE_TYPE_TRANS + licenseType.getName().toLowerCase();
    String[] keys2Translate = { i18nKey };
    translatorCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), keys2Translate, LicenseAdminController.class);
    listenTo(translatorCtrl);
    removeAsListenerAndDispose(cmc);
    cmc = new CloseableModalController(getWindowControl(), "close", translatorCtrl.getInitialComponent(), true, translate("admin.translate"));
    listenTo(cmc);
    cmc.activate();
}
Also used : SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 4 with SingleKeyTranslatorController

use of org.olat.core.util.i18n.ui.SingleKeyTranslatorController in project openolat by klemens.

the class LicenseAdminConfigController method doOpenTranslator.

private void doOpenTranslator(UserRequest ureq, LicenseType licenseType) {
    String i18nKey = LicenseUIFactory.LICENSE_TYPE_TRANS + licenseType.getName().toLowerCase();
    String[] keys2Translate = { i18nKey };
    translatorCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), keys2Translate, LicenseAdminController.class);
    listenTo(translatorCtrl);
    removeAsListenerAndDispose(cmc);
    cmc = new CloseableModalController(getWindowControl(), "close", translatorCtrl.getInitialComponent(), true, translate("admin.translate"));
    listenTo(cmc);
    cmc.activate();
}
Also used : SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 5 with SingleKeyTranslatorController

use of org.olat.core.util.i18n.ui.SingleKeyTranslatorController in project openolat by klemens.

the class QEducationalContextsAdminController method doOpenTranslationTool.

private void doOpenTranslationTool(UserRequest ureq, QEducationalContext row) {
    String key2Translate = "item.level." + row.getLevel().toLowerCase();
    String[] keys2Translate = { key2Translate };
    singleKeyTrnsCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), keys2Translate, QuestionsController.class);
    listenTo(singleKeyTrnsCtrl);
    removeAsListenerAndDispose(cmc);
    cmc = new CloseableModalController(getWindowControl(), "close", singleKeyTrnsCtrl.getInitialComponent(), true, translate("translation"));
    listenTo(cmc);
    cmc.activate();
}
Also used : SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) QuestionsController(org.olat.modules.qpool.ui.QuestionsController)

Aggregations

SingleKeyTranslatorController (org.olat.core.util.i18n.ui.SingleKeyTranslatorController)12 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)4 QuestionsController (org.olat.modules.qpool.ui.QuestionsController)4 ArrayList (java.util.ArrayList)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 FormToggle (org.olat.core.gui.components.form.flexible.elements.FormToggle)2 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)2 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)2 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)2