Package org.olat.core.gui.translator

Examples of org.olat.core.gui.translator.Translator


  public void add(String name, FormItem formComp) {
    if(!hasRootForm){
      throw new AssertionError("first ensure that the layout container knows about its rootform!!");
    }
    // set the formtranslator, and parent
    Translator itemTranslator = formComp.getTranslator();
    if(formComp.getTranslator()!=null && itemTranslator instanceof PackageTranslator){
      //let the FormItem provide a more specialized translator
      PackageTranslator itemPt = (PackageTranslator)itemTranslator;
      itemTranslator = itemPt.cascadeTranslators(itemPt, translator);
    }else{
View Full Code Here


  public void register(FormItem formComp) {
    if(!hasRootForm){
      throw new AssertionError("first ensure that the layout container knows about its rootform!!");
    }
    // set the formtranslator, and parent
    Translator itemTranslator = formComp.getTranslator();
    if(formComp.getTranslator()!=null && itemTranslator instanceof PackageTranslator){
      //let the FormItem provide a more specialized translator
      PackageTranslator itemPt = (PackageTranslator)itemTranslator;
      itemTranslator = itemPt.cascadeTranslators(itemPt, translator);
    }else{
View Full Code Here

    formLayoutContainer.remove(toBeReplaced.getExampleC());
    formLayoutContainer.remove(toBeReplaced.getLabelC());
   
   
  // set the formtranslator, and parent
    Translator itemTranslator = with.getTranslator();
    if(with.getTranslator()!=null && itemTranslator instanceof PackageTranslator){
      //let the FormItem provide a more specialized translator
      PackageTranslator itemPt = (PackageTranslator)itemTranslator;
      itemTranslator = itemPt.cascadeTranslators(itemPt, translator);
    }else{
View Full Code Here

    form.formLayout.setRootForm(form);
    form.formListeners = new ArrayList<FormBasicController>();
    if(listener instanceof FormBasicController){
      form.formListeners.add((FormBasicController)listener);
    }
    Translator translator = formLayout.getTranslator();
    if (translator == null) { throw new AssertException("please provide a translator in the FormItemContainer <" + formLayout.getName()
        + ">"); }
    // renders header + <formLayout> + footer of html form
    form.formWrapperComponent = new FormWrapperContainer(name, translator, form);
    form.formWrapperComponent.addListener(listener);
View Full Code Here

    //TODO remove the below warn again once OLAT-5715 has been resolved - or it turns out that below warn is too verbose
    // the idea is that at this stage the throwable still contains a stacktrace but passed into the OLATRuntimeException
    // below as the cause it somehow gets lost. If this does not turn out to be true then the line below can be removed.
    // in any case, it is just a log.warn
    Tracing.logWarn("ExceptionWindowController<init>: Throwable occurred, logging the full stacktrace:", th, getClass());
    Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
    Formatter formatter = Formatter.getInstance(ureq.getLocale());
    msg = new VelocityContainer("olatmain", VELOCITY_ROOT + "/exception_page.html", trans, this);
    // disallow wrapping of divs around the panel and the main velocity page
    // (since it contains the "<html><head... intro of the html page,
    // and thus has better to be replaced as a whole (new page load) instead of
    // a dom replacement)
    msg.setDomReplaceable(false);
   
    Version v = (Version) CoreSpringFactory.getBean("org.olat.core.Version");
    msg.contextPut("buildversion", v.getVersion());

    OLATRuntimeException o3e;
   
    if (th == null){
      o3e = new OLATRuntimeException("Error Screen with a Throwable == null", null);
    } else if (!(th instanceof OLATRuntimeException)) {
      o3e = new OLATRuntimeException(th.getMessage(), th);
    } else {
      o3e = (OLATRuntimeException) th;
    }

    String detailedmessage = null;
    // translate user message if available
    if (o3e.getUsrMsgKey() != null && o3e.getUsrMsgPackage() != null) {
      PackageTranslator usrMsgTrans = new PackageTranslator(o3e.getUsrMsgPackage(), ureq.getLocale());
      if (o3e.getUsrMsgArgs() == null) {
        detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey());
      } else {
        detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey(), o3e.getUsrMsgArgs());
      }
    }
    // fix detailed message
    if (detailedmessage == null) {
      if (o3e instanceof StaleObjectRuntimeException) {
        StaleObjectRuntimeException soe = (StaleObjectRuntimeException) o3e;
        detailedmessage = trans.translate("error.staleobjectexception") + "<br />(" + soe.getKey() + " : " + soe.getPersClassName() + ")";
      }
      else detailedmessage = "-";
    }

    // fetch more info
View Full Code Here

    boolean forceDebugDivs = gset.isIdDivsForced();

    if (source.isVisible()) {
      int lev = renderResult.getNestedLevel();
      if (lev > 42) throw new AssertException("components were nested more than 42 times, assuming endless loop bug: latest comp name: "+source.getComponentName());
      Translator componentTranslator = source.getTranslator();
     
      // for ajax mode: render surrounding divs or spans as a positional
      // identifier for dom replacement
      if (domReplaceable && (ajaxon || forceDebugDivs)) {
        if (useSpan) {
View Full Code Here

   * @param wControl
   */
  public JavaScriptTracingController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);
    // dummy translator, empty
    Translator trans = Util.createPackageTranslator(
        JavaScriptTracingController.class, ureq.getLocale());
    // dummy velocity container, empty
    VelocityContainer mainVC = new VelocityContainer("JSTracing", Util
        .getPackageVelocityRoot(JavaScriptTracingController.class)
        + "/JSTracing.html", trans, this);
View Full Code Here

   *      java.lang.String)
   */
  public void activate(UserRequest ureq, String viewIdentifier) {
    // viewIdentifier contains key of tab to be activated
    TabbedPane myTabbedPane = getTabbedPane();
    Translator translator = getTranslator();
    String[] paneKeys = getPaneKeys();

    if (myTabbedPane == null) { throw new OLATRuntimeException("tabs not yet added!", new IllegalStateException()); }
    boolean foundKey = false;
    if (paneKeys.length > 0) {
      int i = 0;
      while (!foundKey && i<paneKeys.length) {
        foundKey = viewIdentifier.equals(paneKeys[i]);
        i++;
      }
    }
    if (foundKey) {
      // it is a tab which we know
      myTabbedPane.setSelectedPane(translator.translate(viewIdentifier));
    } else {
      // it may be a tab of our children
      ActivateableTabbableDefaultController[] children = getChildren();
      for (int j = 0; j < children.length; j++) {
        children[j].activate(ureq, viewIdentifier);
View Full Code Here

      //show message
      if(disposedMessageController != null && wrapperPanel != null){
        wrapperPanel.setContent(disposedMessageController.getInitialComponent());
      }else if(wrapperPanel != null){
        // place disposed message
        Translator pT = Util.createPackageTranslator(DefaultController.class, locale);
        Component dispMsgVC = new VelocityContainer(DEFAULTDISPOSED_PAGE,DefaultController.class,DEFAULTDISPOSED_PAGE,pT,null);
        wrapperPanel.pushContent(dispMsgVC);
      }
    }
  }
View Full Code Here

      }else if(wrapperPanel != null){
        if (locale == null) {
          locale = ureq.getLocale();
        }
        // place disposed message
        Translator pT = Util.createPackageTranslator(DefaultController.class, locale);
        Component dispMsgVC = new VelocityContainer(DEFAULTDISPOSED_PAGE, DefaultController.class,DEFAULTDISPOSED_PAGE, pT, null);
        wrapperPanel.pushContent(dispMsgVC);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.translator.Translator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.