コード例 #1
0
 private void initOrUpdateTypeFlc(final int limit) {
   typeFlc.setLabel("filter.view", null);
   typeAllBtn = uifactory.addToggleButton("filter.all", null, typeFlc, null, null);
   typeAllBtn.toggleOff();
   final List<EPArtefactHandler<?>> handlers = portfolioModule.getAllAvailableArtefactHandlers();
   typeCmpList = new ArrayList<FormToggle>();
   int i = 0;
   final List<String> allActiveTypeToggles = new ArrayList<String>();
   for (final EPArtefactHandler<?> handler : handlers) {
     final String handlerClass =
         PortfolioFilterController.HANDLER_PREFIX
             + handler.getClass().getSimpleName()
             + HANDLER_TITLE_SUFFIX;
     FormToggle link = (FormToggle) typeFlc.getFormComponent(handlerClass);
     if (link == null) {
       final PackageTranslator handlerTrans = handler.getHandlerTranslator(getTranslator());
       typeFlc.setTranslator(handlerTrans);
       link = uifactory.addToggleButton(handlerClass, null, typeFlc, null, null);
       link.setUserObject(handler.getType());
     }
     if (selectedTypeList.contains(handler.getType())) {
       link.toggleOn();
       allActiveTypeToggles.add(handler.getType());
     } else {
       link.toggleOff();
     }
     typeCmpList.add(link);
     i++;
     if (i > limit) {
       break;
     }
   }
   typeFlc.contextPut("typeCmpList", typeCmpList);
   typeEditBtn = uifactory.addToggleButton("filter.edit", null, typeFlc, null, null);
   typeEditBtn.toggleOff();
   if (!allActiveTypeToggles.containsAll(selectedTypeList)) {
     typeEditBtn.toggleOn();
   }
   if (selectedTypeList.isEmpty()) {
     typeAllBtn.toggleOn();
   }
 }
コード例 #2
0
ファイル: EPTOCController.java プロジェクト: YaqubGhazi/olat
 private EPArtefactHandler<?> getArtefactHandler(final AbstractArtefact artefact) {
   final PortfolioAbstractHandler portfolioModule =
       (PortfolioAbstractHandler) CoreSpringFactory.getBean(PortfolioAbstractHandler.class);
   return portfolioModule.getArtefactHandler(artefact);
 }