use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class MultiSelectColumnDescriptor method getHeaderKey.
public String getHeaderKey() {
// render as checkbox icon to minimize used space for header
Translator trans = (table != null ? table.getTranslator() : null);
String choice = (trans != null ? trans.translate("table.header.multiselect") : "");
return "<i class='o_icon o_icon_checkbox_checked o_icon-lg' title=\"" + choice + "\"> </i>";
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class FolderHelper method extractFileType.
/**
* Extract the type of file based on suffix.
*
* @param filePath
* @param locale
* @return File type based on file extension.
*/
public static String extractFileType(String filePath, Locale locale) {
int lastDot = filePath.lastIndexOf('.');
if (lastDot > 0) {
if (lastDot < filePath.length())
return filePath.substring(lastDot + 1).toLowerCase();
}
Translator translator = Util.createPackageTranslator(FolderHelper.class, locale);
return translator.translate("UnknownFile");
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class DialogBoxUIFactory method createYesNoDialog.
/**
* The Yes-No dialog has two buttons. the following events are fired:
* <ul>
* <li>yes -> ButtonClickedEvent with position 0</li>
* <li>no -> ButtonClickedEvent with position 1</li>
* <li>Event.CANCELLED_EVENT: when user clicks the close icon in the window bar</li>
* </ul>
* <p>
* Initial Date: 26.11.2007<br>
*
* @author Florian Gnaegi, frentix GmbH, http://www.frentix.com
*/
public static DialogBoxController createYesNoDialog(UserRequest ureq, WindowControl wControl, String title, String text) {
Translator trans = Util.createPackageTranslator(DialogBoxUIFactory.class, ureq.getLocale());
List<String> yesNoButtons = new ArrayList<String>();
yesNoButtons.add(trans.translate("yes"));
yesNoButtons.add(trans.translate("no"));
DialogBoxController dialogCtr = new DialogBoxController(ureq, wControl, title, text, yesNoButtons);
return dialogCtr;
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class DialogBoxUIFactory method createResourceLockedMessage.
/**
* create the default info message shown for an unsuccessfully acquired lock - must not be called if lock was successfully acquired!
* @param ureq
* @param wControl
* @param lockEntry must be not null
* @param i18nLockMsgKey must be not null and valid key in the given translator
* @param translator must be not null
* @return DialogController
*/
public static DialogBoxController createResourceLockedMessage(UserRequest ureq, WindowControl wControl, LockResult lockEntry, String i18nLockMsgKey, Translator translator) {
if (lockEntry.isSuccess()) {
throw new AssertException("do not create a 'is locked message' if lock was succesfull! concerns lock:" + lockEntry.getOwner());
}
String fullName = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(lockEntry.getOwner());
String[] i18nParams = new String[] { StringHelper.escapeHtml(fullName), Formatter.getInstance(ureq.getLocale()).formatTime(new Date(lockEntry.getLockAquiredTime())) };
String lockMsg = translator.translate(i18nLockMsgKey, i18nParams);
Translator trans = Util.createPackageTranslator(DialogBoxUIFactory.class, ureq.getLocale());
List<String> okButton = new ArrayList<String>();
okButton.add(trans.translate("ok"));
DialogBoxController ctrl = new DialogBoxController(ureq, wControl, null, lockMsg, okButton);
ctrl.setCssClass("o_warning");
return ctrl;
}
use of org.olat.core.gui.translator.Translator in project OpenOLAT by OpenOLAT.
the class Renderer method render.
/**
* used by the renderer, and also by the panel and tabbedpane renderer to delegate rendering
* @param sb
* @param source
* @param args
*/
public void render(StringOutput sb, Component source, String[] args) {
GlobalSettings gset = getGlobalSettings();
boolean ajaxon = gset.getAjaxFlags().isIframePostEnabled();
// wrap with div's so javascript can replace this component by doing a document.getElementById(cid).innerHTML and so on.
boolean domReplaceable = source.isDomReplaceable();
boolean useSpan = source.getSpanAsDomReplaceable();
boolean domReplacementWrapperRequired = source.isDomReplacementWrapperRequired();
boolean forceDebugDivs = gset.isIdDivsForced();
if (source.isVisible()) {
int lev = renderResult.getNestedLevel();
if (lev > 60)
throw new AssertException("components were nested more than 60 times, assuming endless loop bug: latest comp name: " + source.getComponentName());
Translator componentTranslator = source.getTranslator();
// identifier for dom replacement
if (domReplaceable && domReplacementWrapperRequired && (ajaxon || forceDebugDivs)) {
if (useSpan) {
sb.append("<span id='o_c").append(source.getDispatchID());
} else {
sb.append("<div id='o_c").append(source.getDispatchID());
}
if (Settings.isDebuging()) {
// sb.append("' title='").append(source.getComponentName());
}
sb.append("'>");
}
ComponentRenderer cr = findComponentRenderer(source);
URLBuilder cubu = urlBuilder.createCopyFor(source);
renderResult.incNestedLevel();
// ---- for gui debug mode, direct the rendering to a special componentrenderer
InterceptHandlerInstance dhi = renderResult.getInterceptHandlerInstance();
if (dhi != null) {
cr = dhi.createInterceptComponentRenderer(cr);
}
try {
int preRenderLength = sb.length();
cr.render(this, sb, source, cubu, componentTranslator, renderResult, args);
if (preRenderLength == sb.length()) {
// Add bugfix for IE min-height on empty div problem: min-height does
// not get applied when div contains an empty comment.
// Affects IE6, IE7
sb.append("<!-- empty -->");
}
source.setDirty(false);
} catch (Exception e) {
// in order to produce a decent error msg, we need to postpone the
// exception
renderResult.setRenderExceptionInfo("exception while rendering component '" + source.getComponentName() + "' (" + source.getClass().getName() + ") " + source.getListenerInfo() + "<br />Message of exception: " + e.getMessage(), e);
}
renderResult.decNestedLevel();
if (ajaxon && domReplaceable && domReplacementWrapperRequired) {
if (useSpan) {
sb.append("</span>");
} else {
sb.append("</div>");
}
}
} else {
// not visible
if (domReplaceable && (ajaxon || forceDebugDivs)) {
// browser dom tree
if (useSpan) {
sb.append("<span id=\"o_c").append(source.getDispatchID()).append("\"></span>");
} else {
// Add bugfix for IE min-height on empty div problem: min-height does
// not get applied when div contains an empty comment.
// Affects IE6, IE7
sb.append("<div id=\"o_c").append(source.getDispatchID()).append("\"><!-- empty --></div>");
}
}
}
}
Aggregations