Examples of DTabs


Examples of org.olat.core.gui.control.generic.dtabs.DTabs

      resName = BusinessGroupManagerImpl.getInstance().loadBusinessGroup(pub.getResId(), true).getResourceableTypeName();
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(resName, resId);
    String title = NotificationsManager.getInstance().getNotificationsHandler(sub.getPublisher()).createTitleInfo(sub, ureq.getLocale());
    // Launch in dtab
    DTabs dts = (DTabs) Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
    DTab dt = dts.getDTab(ores);
    if (dt == null) {
      // Does not yet exist -> create and add
      dt = dts.createDTab(ores, title);
      if (dt == null) {
        // huh, no tabs available? don't know what to do here
        return;
      }
      Controller launchController = ControllerFactory.createLaunchController(ores, subidentifier, ureq, dt.getWindowControl(), false);
      // Try with the new factory controller too
      boolean newFactory = false;
      if (launchController == null) {
        try {
          String resourceUrl = "[" + resName + ":0][notifications]";
          BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
          WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, windowControl);
          NewControllerFactory.getInstance().launch(ureq, bwControl);
          newFactory = true;
        } catch (Exception ex) {
          // fail silently
        }
      }
      if (newFactory) {
        // hourra
      } else if (launchController == null) { // not possible to launch anymore
        Translator trans = Util.createPackageTranslator(NotificationUIFactory.class, ureq.getLocale());
        windowControl.setWarning(trans.translate("warn.nolaunch"));
      } else {
        dt.setController(launchController);
        dts.addDTab(dt);
        dts.activate(ureq, dt, null); // null: do not reactivate to a
        // certain view here, this
        // happened in
        // ControllerFactory.createLaunchController
      }
    } else {
      dts.activate(ureq, dt, subidentifier);
    }
  }
View Full Code Here

Examples of org.olat.core.gui.control.generic.dtabs.DTabs

  }

  public void event(UserRequest ureq, Component source, Event event) {
    if (source == quickstartVC) {
      String cmd = event.getCommand();
      DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
      if (cmd.equals("cmd.repo.course")) {
        //was brasato:: getWindowControl().getDTabs().activateStatic(ureq, RepositorySite.class.getName(), "search.course");
        dts.activateStatic(ureq, RepositorySite.class.getName(), "search.course");
      } else if (cmd.equals("cmd.repo.catalog")) {
        //was brasato:: getWindowControl().getDTabs().activateStatic(ureq, RepositorySite.class.getName(), "search.catalog");
        dts.activateStatic(ureq, RepositorySite.class.getName(), "search.catalog");
      } else if (cmd.equals("cmd.settings")) {
        //was brasato:: getWindowControl().getDTabs().activateStatic(ureq, HomeSite.class.getName(), "mysettings");
        dts.activateStatic(ureq, HomeSite.class.getName(), "mysettings");
      else if (cmd.equals("cmd.buddygroup.new")) {
        //was brasato:: getWindowControl().getDTabs().activateStatic(ureq, GroupsSite.class.getName(), "addBuddyGroup");
        dts.activateStatic(ureq, GroupsSite.class.getName(), "addBuddyGroup");
      }
    } else if (source == helpLink) {
      ControllerCreator ctrlCreator = new ControllerCreator() {
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
          return CourseFactory.createHelpCourseLaunchController(lureq, lwControl);
View Full Code Here

Examples of org.olat.core.gui.control.generic.dtabs.DTabs

    if (window == null) {
      logDebug("Found no window for jumpin => take WindowBackOffice", null);
      window = wControl.getWindowBackOffice().getWindow();
    }
    DTabs dts = (DTabs) window.getAttribute("DTabs");
    DTab dt = dts.getDTab(ores);
    if (dt != null) {
      // tab already open => close it
      dts.removeDTab(dt);// disposes also dt and controllers
    }

    String firstType = mainCe.getOLATResourceable().getResourceableTypeName();
    // String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup
    ContextEntryControllerCreator typeHandler = contextEntryControllerCreators.get(firstType);
    if (typeHandler == null) throw new AssertException("Unable to get a handler for the type: " + firstType);

    String siteClassName = typeHandler.getSiteClassName(mainCe);
    // open in existing site
    if (siteClassName != null) {
      // use special activation key to trigger the activate method
      String viewIdentifyer = null;
      if (bc.hasContextEntry()) {
        ContextEntry subContext = bc.popLauncherContextEntry();
        if (subContext != null) {
          OLATResourceable subResource = subContext.getOLATResourceable();
          if (subResource != null) {
            viewIdentifyer = subResource.getResourceableTypeName();
            if (subResource.getResourceableId() != null) {
              // add resource instance id if available. The ':' is a common
              // separator in the activatable interface
              viewIdentifyer = viewIdentifyer + ":" + subResource.getResourceableId();
            }
          }
        }
      } else if (!ceConsumed) {
        //the olatresourceable is not in a dynamic tab but in a fix one
        if(ores != null) {
          viewIdentifyer = ores.getResourceableTypeName();
          if (ores.getResourceableId() != null) {
            // add resource instance id if available. The ':' is a common
            // separator in the activatable interface
            viewIdentifyer = viewIdentifyer + ":" + ores.getResourceableId();
          }
        }
      }
      dts.activateStatic(ureq, siteClassName, viewIdentifyer);
    } else {
      // or create new tab
      String tabName = typeHandler.getTabName(mainCe);
      // create and add Tab
      dt = dts.createDTab(ores, tabName);
      if (dt == null) {
        // tabs are full: TODO
        // user error message is generated in BaseFullWebappController, nothing
        // to do here
      } else {

        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, dt.getWindowControl());
        Controller launchC = typeHandler.createController(mainCe, ureq, bwControl);

        dt.setController(launchC);
        dts.addDTab(dt);
      }

      dts.activate(ureq, dt, null); // null: do not activate to a certain view
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.