Package org.olat.core.gui.components

Examples of org.olat.core.gui.components.Window


   
    //more debug information: OLAT-3529
    if (ajaxEnabled) myContent.contextPut("isAdmin", Boolean.valueOf(ureq.getUserSession().getRoles().isOLATAdmin()));
   
    // create a mapper to not block main traffic when polling (or vica versa)
    final Window window = wboImpl.getWindow();
    m = new Mapper() {
      public MediaResource handle(String relPath, HttpServletRequest request) {
        pollCount++;
        // check for dirty components now.
        wboImpl.fireCycleEvent(Window.BEFORE_INLINE_RENDERING);
        Command updateDirtyCom = window.handleDirties();
        wboImpl.fireCycleEvent(Window.AFTER_INLINE_RENDERING);
        if (updateDirtyCom != null) {
          synchronized (windowcommands) { //o_clusterOK by:fj
            windowcommands.add(new WindowCommand(wboImpl, updateDirtyCom));
          }
View Full Code Here


    mainvc.contextPut("jsMathEnabled", Boolean.valueOf(jsMathEnabled));
    mainPanel.setContent(mainvc);

    WindowManager winman = Windows.getWindows(ureq).getWindowManager();
    wbo  = winman.createWindowBackOffice("basechiefwindow", this);
    Window w = wbo.getWindow();
   
    // part that builds the css and javascript lib includes (<script src="..."> and <rel link
    // e.g.
    // <script type="text/javascript" src="/demo/g/2/js/jscalendar/calendar.js"></script>

    mainvc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader())
   
    // control part for ajax-communication. returns an empty panel if ajax is not enabled, so that ajax can be turned on on the fly for development mode
    jsServerC = wbo.createAJAXController(ureq);
    mainvc.put("jsServer", jsServerC.getInitialComponent())
   
    // init with no bookmark (=empty bc)
    mainvc.contextPut("o_bc", "");
   
    // the current language; used e.g. by screenreaders
    mainvc.contextPut("lang", ureq.getLocale().toString());

    // the current GUI theme and the global settings that contains the
    // font-size. both are pushed as objects so that window.dirty always reads
    // out the correct value
    mainvc.contextPut("theme", w.getGuiTheme());   
    mainvc.contextPut("globalSettings", winman.getGlobalSettings());   
   
    // content panel
    contentPanel = new Panel("olatContentPanel");
    mainvc.put("olatContentPanel", contentPanel);
    mainvc.contextPut("o_winid", Long.valueOf(w.getDispatchID()));
    Version v = (Version) CoreSpringFactory.getBean("org.olat.core.Version");
    mainvc.contextPut("buildversion", v.getVersion());
   
    WindowControl wControl = new WindowControl() {
      private WindowControlInfo wci;

      {
        wci = new WindowControlInfoImpl(BaseChiefController.this, null);
      }

      /**
       * @see org.olat.core.gui.control.WindowControl#pushToMainArea(org.olat.core.gui.components.Component)
       */
      public void pushToMainArea(Component newMainArea) {
        currentGuiStack.pushContent(newMainArea);
      }

      /**
       * @see org.olat.core.gui.control.WindowControl#pushAsModalDialog(java.lang.String,
       *      org.olat.core.gui.components.Component)
       */
      public void pushAsModalDialog(Component newModalDialog) {
        currentGuiStack.pushModalDialog(newModalDialog);
      }

      /**
       * @see org.olat.core.gui.control.WindowControl#pop()
       */
      public void pop() {
        // reactivate latest dialog from stack, dumping current one
        currentGuiStack.popContent();
      }
     
     
      /**
       * @see org.olat.core.gui.control.WindowControl#setInfo(java.lang.String)
       */
      public void setInfo(String info) {
        throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
      }

      /**
       * @see org.olat.core.gui.control.WindowControl#setError(java.lang.String)
       */
      public void setError(String error) {
        throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
      }

      /**
       * @see org.olat.core.gui.control.WindowControl#setWarning(java.lang.String)
       */
      public void setWarning(String warning) {
        throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
      }

      public WindowControlInfo getWindowControlInfo() {
        return wci;
      }

      public void makeFlat() {
        throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
      }

      public BusinessControl getBusinessControl() {
        return BusinessControlFactory.getInstance().getEmptyBusinessControl();
      }

      public WindowBackOffice getWindowBackOffice() {
        return wbo;
      }

    };
    super.setWindowControl(wControl);

    if (wbo.isDebuging()) {
      debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
      mainvc.put("guidebug", debugC.getInitialComponent());
    }   
   
    // Inline translation interceptor. when the translation tool is enabled it
    // will start the translation tool in translation mode, if the overlay
    // feature is enabled it will start in customizing mode
    if (ureq.getUserSession().isAuthenticated() && ureq.getUserSession().getRoles().isOLATAdmin() && (I18nModule.isTransToolEnabled() || I18nModule.isOverlayEnabled())) {
      inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
      Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
      Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
      I18nManager.getInstance().setMarkLocalizedStringsEnabled(ureq.getUserSession(), isInlineTranslationEnabled);     
      mainvc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
    }   

    // debug info if debugging
    if (wbo.isDebuging()) {
      developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
      mainvc.put("development", developmentC.getInitialComponent());
    }
   
    // attach AJAX javascript console
    jsLoggerC = new JavaScriptTracingController(ureq, getWindowControl());
    // the js logger provides only a header element, nevertheless we need to
    // put it into the main velocity container.
    mainvc.put("jsLoggerC", jsLoggerC.getInitialComponent());
   
    //put the globals path like "/olat/classpath/61x/" into the main win, used for some dynamic injected js libs like jsMath
    String resourcePath = getWindowControl().getWindowBackOffice().getWindowManager().getMapPathFor(this.getClass());
    mainvc.contextPut("classPathStaticBaseURI", resourcePath.substring(0, resourcePath.indexOf("org.olat")));

    // put the global js translator mapper path into the main window
    mainvc.contextPut("jsTranslationMapperPath", jsTranslationMapperPath);
   
    // master window
    w.addListener(this); // to be able to report "browser reload" to the user
    w.setContentPane(mainPanel);
    setWindow(w);

  }
View Full Code Here

      }
    }
  }

  private void updateComponentTree() {
    Window win = wboImpl.getWindow();
    StringOutput sb = new StringOutput();
    renderDebugInfo(win.getContentPane(), sb, true);
    myContent.contextPut("compdump", sb.toString());
  }
View Full Code Here

   */
  WindowBackOfficeImpl(final WindowManagerImpl winmgrImpl, String windowName, ChiefController windowOwner, int wboId) {
    this.winmgrImpl = winmgrImpl;
    this.windowOwner = windowOwner;
    this.iframeName = "oaa"+wboId;
    window = new Window(windowName, this);
   
   
    // TODO make simpler, we do only need to support one intercept handler at a time!
    linkedInterceptHandler = new InterceptHandler() {
      public InterceptHandlerInstance createInterceptHandlerInstance() {
View Full Code Here

    // fetch more info
    // get the latest window which caused this exception
    String componentListenerInfo = "";
    Windows ws = Windows.getWindows(ureq);
   
    Window window = ws.getWindow(ureq);
    if (window != null) {
      Component target = window.getAndClearLatestDispatchedComponent();
      if (target != null) {
        // there was a component id given, and a matching target could be found
        componentListenerInfo = "<dispatchinfo>\n\t<componentinfo>\n\t\t<compname>" + target.getComponentName() + "</compname>\n\t\t<compclass>"
            + target.getClass().getName() + "</compclass>\n\t\t<extendedinfo>" + target.getExtendedDebugInfo()
            + "</extendedinfo>\n\t\t<event>";
        Event latestEv = target.getAndClearLatestFiredEvent();
        if (latestEv != null) {
          componentListenerInfo += "\n\t\t\t<class>"+latestEv.getClass().getName()+"</class>\n\t\t\t<command>"+latestEv.getCommand()+"</command>\n\t\t\t<tostring>"+latestEv+"</tostring>";
        }
        componentListenerInfo += "\n\t\t</event>\n\t</componentinfo>\n\t<controllerinfo>";
        Controller c = target.getLatestDispatchedController();
        if (c != null) {
          // can be null if the error occured in the component itself
          // componentListenerInfo += c.toString();
          //WindowControl control = c.getWindowControl();
          // sorry, getting windowcontrol on a controller which does not have one (all should have one, legacy) throws an exception
          try {
           
            WindowControlInfo wci = c.getWindowControlForDebug().getWindowControlInfo();
            while (wci != null) {
              String cName = wci.getControllerClassName();
              componentListenerInfo += "\n\t\t<controllername>" + cName + "</controllername>";
              wci = wci.getParentWindowControlInfo();
            }
          } catch (Exception e) {
            componentListenerInfo += "no info, probably no windowcontrol set: "+e.getClass().getName()+", "+e.getMessage();
          }
        }
        componentListenerInfo += "\n\t</controllerinfo>\n</dispatchinfo>";
      }
    }

    if(o3e instanceof KnownIssueException){
      KnownIssueException kie = (KnownIssueException)o3e;
      msg.contextPut("knownissuelink", kie.getJiraLink());
    }
   
    // TODO: DB.getInstance().hasTransaction() TODO: log db transaction id if in
    // transaction
    long refNum = Tracing.logError("**RedScreen** "+o3e.getLogMsg() + " ::_::" + componentListenerInfo + " ::_::", o3e, o3e.getThrowingClazz());
    // only if debug
    if (Settings.isDebuging()) {
      msg.contextPut("debug", Boolean.TRUE);
    } else {
      msg.contextPut("debug", Boolean.FALSE);     
    }
    msg.contextPut("listenerInfo", Formatter.escWithBR(componentListenerInfo).toString());     
    msg.contextPut("stacktrace", OLATRuntimeException.throwableToHtml(th));     
   
    Identity curIdent = ureq.getIdentity();
    msg.contextPut("username", curIdent == null? "n/a" : curIdent.getName());
    msg.contextPut("allowBackButton", Boolean.valueOf(allowBackButton));
    msg.contextPut("detailedmessage", detailedmessage);
    // Cluster NodeId + E-Nr
    msg.contextPut("errnum", "N" + CoordinatorManager.getCoordinator().getNodeId() + "-E"+ refNum);
    msg.contextPut("supportaddress", WebappHelper.getMailConfig("mailSupport"));
    msg.contextPut("time", formatter.formatDateAndTime(new Date()));

    WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("errormessagewindow", this);
    Window w = wbo.getWindow();
   
    msg.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());   
    // the current GUI theme and the global settings that contains the
    // font-size. both are pushed as objects so that window.dirty always reads
    // out the correct value
    msg.contextPut("theme", w.getGuiTheme());   
    msg.contextPut("globalSettings", ws.getWindowManager().getGlobalSettings());   

   
    w.setContentPane(msg);
    setWindow(w);
  }
View Full Code Here

      // close window (a html page which calls Window.close onLoad
      ureq.getDispatchResult().setResultingMediaResource(
          new RedirectMediaResource(StaticMediaDispatcher.createStaticURIFor("closewindow.html")));
      // release all resources and close window
      WindowBackOffice wbo = getWindowControl().getWindowBackOffice();
      Window w = wbo.getWindow();
      Windows.getWindows(ureq).deregisterWindow(w);
      wbo.dispose();

    } else if (source == langSelection) {
      String langKey = langSelection.getSelectedKey();
View Full Code Here

    else if (event.equals(Window.BEFORE_INLINE_RENDERING)){
      // Set the custom CSS URL that is used by the current tab or site if
      // available. The reason why we do this here and not in the constructor is
      // that during the constructing phase this property is not yet set on the
      // window.
      Window myWindow = getWindowControl().getWindowBackOffice().getWindow();
      CustomCSS currentCustomCSS = (CustomCSS) myWindow.getAttribute(BaseFullWebappController.CURRENT_CUSTOM_CSS_KEY);
      if (currentCustomCSS != nullcustomCssURL = currentCustomCSS.getCSSURL();
      // done, remove us as listener
      getWindowControl().getWindowBackOffice().removeCycleListener(this);
    }
  }
View Full Code Here

      }

      ChiefController cc = (ChiefController) Windows.getWindows(ureq.getUserSession()).getAttribute(CONTEXTHELPCHIEFCONTROLLER)
      // reuse existing chief controller for this user
      if (cc != null) {       
        Window currentWindow = cc.getWindow();
        // Check if this is a start URL or a framework URL
        if (ureq.isValidDispatchURI()) {
          // A standard framework request, dispatch by component
          currentWindow.dispatchRequest(ureq, false);
          return;
        } else {         
          // If path contains complete URL, dispose and start from scratch
          Windows.getWindows(ureq).deregisterWindow(currentWindow);
          cc.dispose();         
        }
      }
     
      // Creator code to create
      // 1) the chief controller
      // 2) the layout controller
      // 3) the context help main controller
      ControllerCreator cHelpPopupWindowControllerCreator = new ControllerCreator() {
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
          ControllerCreator cHelpMainControllerCreator = new ControllerCreator() {
            public Controller createController(UserRequest lureq, WindowControl lwControl) {
              // create the context help controller and wrapp it using the layout controller
              ContextHelpMainController helpCtr =  new ContextHelpMainController(lureq, lwControl);
              LayoutMain3ColsController layoutCtr =  new LayoutMain3ColsController(lureq, lwControl, null, null, helpCtr.getInitialComponent(), null);
              layoutCtr.addDisposableChildController(helpCtr);
              return layoutCtr;
            }
          };
          ContextHelpLayoutControllerCreator cHelpPopupLayoutCreator = new ContextHelpLayoutControllerCreator(cHelpMainControllerCreator);
          return new BaseFullWebappPopupBrowserWindow(lureq, lwControl, cHelpPopupLayoutCreator.getFullWebappParts());
        }
      };

      BaseChiefControllerCreator bbc = new BaseChiefControllerCreator();
      bbc.setContentControllerCreator(cHelpPopupWindowControllerCreator);     
      cc = bbc.createChiefController(ureq);   
      // add to user session for cleanup on user logout
      Windows.getWindows(ureq.getUserSession()).setAttribute(CONTEXTHELPCHIEFCONTROLLER, cc);     
      Window currentWindow = cc.getWindow();
      currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + PATH_CHELP);
      Windows.getWindows(ureq).registerWindow(currentWindow);
      // finally dispatch the initial request
      currentWindow.dispatchRequest(ureq, true);
     
    } catch (Throwable th) {
      try {
        ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, th);
        // the controller's window must be failsafe also
View Full Code Here

   *
   * @param windowID
   * @return null if the window is not existing (here in windows)
   */
  private Window getWindow(String windowID) {
    Window w = (Window) windows.get(windowID);
    return w;
  }
View Full Code Here

        sb.append(" - ");
      }
      sb.append("<br />");
      Windows ws = Windows.getWindows(usess);
      for (Iterator iterator = ws.getWindowIterator(); iterator.hasNext(); ) {
        Window window = (Window) iterator.next();
        sb.append("- window ").append(window.getDispatchID()).append(" ").append(window.getLatestDispatchComponentInfo()).append("<br />");
      }
      sb.append("<br />");
    }
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.Window

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.