Package org.olat.core.gui.components.table

Examples of org.olat.core.gui.components.table.DefaultColumnDescriptor


    if(editChecklistTable != null) {
      editChecklistTable.dispose();
      editChecklistTable = null;
    }
    editChecklistTable = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), this);
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.title", 0, null, ureq.getLocale()));
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.description", 1, null, ureq.getLocale()));
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.mode", 2, null, ureq.getLocale()));
    editChecklistTable.setMultiSelect(true);
    editChecklistTable.addMultiSelectAction("cl.close", "close");
    editChecklistTable.addMultiSelectAction("cl.save.close", "save");
    editChecklistTable.setTableDataModel(editTableData);
   
View Full Code Here


      TableGuiConfiguration tableConfig = new TableGuiConfiguration();
      tableConfig.setTableEmptyMessage(translate("contextlist.no.contexts"));
      // init group list filter controller
      this.contextListCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);

      this.contextListCtr.addColumnDescriptor(new DefaultColumnDescriptor("contextlist.table.name", 0, CMD_CONTEXT_RUN, ureq.getLocale()));
      this.contextListCtr.addColumnDescriptor(new DefaultColumnDescriptor("contextlist.table.desc", 1, null, ureq.getLocale()));
      this.contextListCtr.addColumnDescriptor(new DefaultColumnDescriptor("contextlist.table.type", 2, null, ureq.getLocale()));
      this.contextListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_CONTEXT_EDIT, "contextlist.table.edit",
          translate(CMD_CONTEXT_EDIT)));
      this.contextListCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_CONTEXT_DELETE, "contextlist.table.delete",
          translate(CMD_CONTEXT_DELETE)));
      this.contextListVC.put("contextlist", this.contextListCtr.getInitialComponent());
View Full Code Here

    //disable the default sorting for this table
    tableConfig.setSortingEnabled(false);
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), trans, this);
    // dummy header key, won't be used since setDisplayTableHeader is set to
    // false
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("groupsPortlet.bgname", 0, CMD_LAUNCH, trans.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("groupsPortlet.type", 1, null, trans.getLocale(),
        ColumnDescriptor.ALIGNMENT_RIGHT));
   
    this.sortingCriteria = getPersistentSortingConfiguration(ureq);
    reloadModel(this.sortingCriteria);
    
View Full Code Here

    removeAsListenerAndDispose(groupListCtr);
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("groupchoose.nogroups"));
    groupListCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
    listenTo(groupListCtr);
    groupListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.group.name", 0, CMD_CHOOSE_GROUP, ureq.getLocale()));
    groupListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.group.desc", 1, null, ureq.getLocale()));
    CourseGroupManager gm = course.getCourseEnvironment().getCourseGroupManager();
    if (gm.getLearningGroupContexts().size() > 1) {
    // show groupcontext row only if multiple contexts are found
      groupListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.group.context", 2, null, ureq.getLocale()));
    }
   
    Translator defaultContextTranslator = new PackageTranslator(Util.getPackageName(BGContextTableModel.class), ureq.getLocale());
    // loop over all groups to filter depending on condition
    List<BusinessGroup> currentGroups = new ArrayList<BusinessGroup>();
View Full Code Here

    nodeListCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
    listenTo(nodeListCtr);
    // table columns   
    nodeListCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.node", 0,
        null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new IndentedNodeRenderer()));
    nodeListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.action.select", 1,
        CMD_SELECT_NODE, ureq.getLocale()));
   
    // get list of course node data and populate table data model
    CourseNode rootNode = course.getRunStructure().getRootNode();   
    List<Map<String, Object>> nodesTableObjectArrayList = addAssessableNodesAndParentsToList(0, rootNode);
View Full Code Here

   * @param tableCtr
   * @param actionCommand command fired when the login name is clicked or NULL when no command is used
   */
  public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
    // first column is the username
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 0, actionCommand, getLocale()));
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler  = userPropertyHandlers.get(i);
      boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer , userPropertyHandler);
      tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i+1, null, getLocale()));           
    }
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.lastlogin", getColumnCount()-2, actionCommand, getLocale()));
  }
View Full Code Here

   * @param actionCommand
   * @param deleteEmailKey
   */
  public void addColumnDescriptors(TableController tableCtr, String actionCommand, String deleteEmailKey) {
    addColumnDescriptors(tableCtr, actionCommand);
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor(deleteEmailKey, getColumnCount()-1, actionCommand, getLocale()));
  }
View Full Code Here

    if(runChecklistTable != null) {
      runChecklistTable.dispose();
      runChecklistTable = null;
    }
    runChecklistTable = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), this);
    runChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.title", 0, null, ureq.getLocale()));
    runChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.description", 1, null, ureq.getLocale()));
    runChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.mode", 2, null, ureq.getLocale()));
    runChecklistTable.setMultiSelect(true);
    runChecklistTable.addMultiSelectAction("cl.table.run.action", "save");
    runChecklistTable.setTableDataModel(runTableData);
   
    for(int i = 0; i < visibleCheckpoints.size(); i++) {
View Full Code Here

    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
    listenTo (tableCtr);

    quotaTableModel = new QuotaTableModel();
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.path", 0, null, getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.quota", 1, null, getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.limit", 2, null, getLocale()));
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor("qf.edit", "table.action", translate("edit")));
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor("qf.del", "table.action", translate("delete")));
    tableCtr.setTableDataModel(quotaTableModel);
   
    myContent.put("quotatable", tableCtr.getInitialComponent());
View Full Code Here

        tableConfig.setSortingEnabled(false);
        tableConfig.setColumnMovingOffered(false);
        hcTranslator = new HeaderColumnTranslator(getTranslator());
        dataTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        for(int i = 0;i < numOfValPerLine; i++){
          dataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("ccc"+(i+1), i, null, ureq.getLocale()));
          // add every name of a column to a list deployed as pulldown to the user for matching column with olat key
          columnNames.add(getTranslator().translate("column", new String[]{""+(i+1)}));
        }
       
        step4VC = createVelocityContainer("bulkstep4");
        step4VC.contextPut("bulkActionDisplayName", bulkActionDisplayName);
        step4VC.contextPut("currentNodeShortTitle", currentNodeShortTitle);
       
        back4 = LinkFactory.createLinkBack(step4VC, this);
       
        dataModel = new GenericObjectArrayTableDataModel(rows, numOfLines);
        // the data model already contains the column for the feedback,
        // which is used at step 6 and not yet shown to the user
        dataTableCtr.setTableDataModel(dataModel);
        step4VC.put("dataTable", dataTableCtr.getInitialComponent());
       
        olatKeys = new ArrayList();
        // adding order is relevant for the "if-else if"-statement below at events from step 5
        olatKeys.add(translate("username"));
        olatKeys.add(translate("form.name.email"));
       
        removeAsListenerAndDispose(bulkStep4Form);
        bulkStep4Form = new BulkStep4Form(ureq, getWindowControl(), olatKeys,columnNames);
        listenTo(bulkStep4Form);
       
        step4VC.put("step4Form", bulkStep4Form.getInitialComponent());
       
        wc.setWizardTitle(translate("wizard.step4.title"));
        wc.setNextWizardStep(translate("wizard.step4.howto"), step4VC);
     
    }
    // events from step 4, preparing step 5
    else if (source == bulkStep4Form && event == Event.DONE_EVENT) {

        selectedColForOlatKey = Integer.parseInt(bulkStep4Form.getSelectedColumn());
        selectedOlatKey = Integer.parseInt(bulkStep4Form.getSelectedOlatKey());
        selectedValueOfOlatKey = (String) olatKeys.get(selectedOlatKey);
       
        step5VC = createVelocityContainer("bulkstep5");
        step5VC.contextPut("bulkActionDisplayName", bulkActionDisplayName);
        step5VC.contextPut("currentNodeShortTitle", currentNodeShortTitle);
       
        back5 = LinkFactory.createLinkBack(step5VC, this);
       
        dataTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        columnNames = null;
        columnNames = new ArrayList();
        for(int i = 0;i < numOfValPerLine; i++){
          if (i != selectedColForOlatKey){
            dataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("ccc"+(i+1), i, null, ureq.getLocale()));
            // add every name of a column to a list deployed as pulldown to the user for matching column with bulk action
            columnNames.add(getTranslator().translate("column", new String[]{""+(i+1)}));
          }else{
            dataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + selectedValueOfOlatKey, i, null, ureq.getLocale()));
          }
        }
       
        dataTableCtr.setTableDataModel(dataModel);
        step5VC.put("dataTable", dataTableCtr.getInitialComponent());
       
        removeAsListenerAndDispose(bulkStep5Form);
        bulkStep5Form = new BulkStep5Form(ureq, getWindowControl(), columnNames, bulkActions);
        listenTo(bulkStep5Form);
       
        step5VC.put("step5Form", bulkStep5Form.getInitialComponent());
       
        wc.setWizardTitle(translate("wizard.step5.title"));
        wc.setNextWizardStep(translate("wizard.step5.howto"), step5VC);
    }
    // events from step 5, preparing step 6
    else if (source == bulkStep5Form && event == Event.DONE_EVENT) { // user clicked 'next'-button !!!!!!!
        List rowsFeedbackStep = new ArrayList(rows.size());
        for (Iterator iter = rows.iterator(); iter.hasNext();) {
          Object[] values = (Object[]) iter.next();
          rowsFeedbackStep.add(values.clone());
        }
        String selectedColForBulk = bulkStep5Form.getSelectedColumn();
        int colForBulk = Integer.parseInt(selectedColForBulk);
        // While the user is matching the olatKey with a table column the relation between
        // table indices and pulldown menu indices is ok, but now while matching the bulkaction
        // with a table column the indices are only ok in certain cases, because the user choosen
        // column for the olatKey is not more shown in the second pulldown menu. It means by example
        // if the user choose pulldown index [1] for the olatKey, it really meets the table index[1],
        // then in the next step the pulldown has not more as many indices as before.
        // If the user is now choosing the pulldown index[1] for the bulkaction he would meet the before selected
        // column for the olatKey, if the system id not adding 1 to the index count.
        if (selectedColForOlatKey <= colForBulk) colForBulk++;

        step6VC = createVelocityContainer("bulkstep6");
        finishedButton = LinkFactory.createButtonSmall("finished", step6VC, this);
        step6VC.put("finishedButton", finishedButton);
       
        step6VC.contextPut("bulkActionDisplayName", bulkActionDisplayName);
        step6VC.contextPut("currentNodeShortTitle", currentNodeShortTitle);
       
        back6 = LinkFactory.createLinkBack(step6VC, this);
       
        GenericObjectArrayTableDataModel feedbackDataModel = new GenericObjectArrayTableDataModel(rowsFeedbackStep, numOfLines);
       
        UserManager um = UserManager.getInstance();
        Manager secMgr = ManagerFactory.getManager();
       
        BulkActionModule bam = new BulkActionModule();
        BulkAction ba = (BulkAction) bulkActions.get(bulkType);

        // TODO: as:b may be add additional class hierarchy (ask pb !!!)
        if ((ba instanceof BulkActionSetNodeScore)){
          ((BulkActionSetNodeScore) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodePassed)){
          ((BulkActionSetNodePassed) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodeUserComment)){
          ((BulkActionSetNodeUserComment) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }
       
        List identitiesAndTheirAssessments = new ArrayList(feedbackDataModel.getRowCount());
        // read values from the column which the user has defined as olat key (e.g. username)
        // and add them to a list.
        for(int i = 0; i < feedbackDataModel.getRowCount(); i ++ ){
          String val = (String) feedbackDataModel.getValueAt(i, selectedColForOlatKey);
          val = val.trim();
          String assessment = (String) feedbackDataModel.getValueAt(i, colForBulk);
          Identity identity = null;

          if (selectedOlatKey == 0){ // username
              identity = secMgr.findIdentityByName(val);
          }else if (selectedOlatKey == 1) { // email
            identity = um.findIdentityByEmail(val);
          }
          identitiesAndTheirAssessments.add(new Object[]{identity,assessment});
        }
        List bulkResults = bam.apply(identitiesAndTheirAssessments, ba);
       
        // add the bulk results to the data model
        for(int i = 0; i < feedbackDataModel.getRowCount(); i++ ){           
          Object[] feedback = (Object[]) bulkResults.get(i);
          feedbackDataModel.setValueAt(feedback[2],i, numOfValPerLine);
        }
       
        tableConfig.setDownloadOffered(true);
       
        feedbackDataTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        columnNames = null;
        columnNames = new ArrayList();
        for(int i = 0;i < numOfValPerLine; i++){
          if (i == selectedColForOlatKey){
            feedbackDataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + selectedValueOfOlatKey, i, null, ureq.getLocale()));
          }else if (i == colForBulk){
            feedbackDataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + ba.getDisplayName(), i, null, ureq.getLocale()));
          }else{
            feedbackDataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("ccc"+(i+1), i, null, ureq.getLocale()));
          }
        }
        // add feedback columns
        feedbackDataTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("wizard.step6.feedback.column", numOfValPerLine, null, ureq.getLocale()));
       
        feedbackDataTableCtr.setTableDataModel(feedbackDataModel);
        step6VC.put("dataTable", feedbackDataTableCtr.getInitialComponent());
 
        wc.setWizardTitle(translate("wizard.step6.title"));
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.table.DefaultColumnDescriptor

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.