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

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


        tableConfig.setSortingEnabled(false);
        tableConfig.setColumnMovingOffered(false);
        hcTranslator = new HeaderColumnTranslator(trans);
        sepValTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        for(int i = 0;i < numOfValuesPerLine+1; i++){ // lenght+1 since adding the delimiter above
          sepValTableCtr.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(trans.translate("column", new String[]{""+(i+1)}));
        }
        sepValModel = new GenericObjectArrayTableDataModel(rows, numOfLines);
        sepValTableCtr.setTableDataModel(sepValModel);
        keywithcolVC.put("sepValTable", sepValTableCtr.getInitialComponent());
       
        PackageTranslator userTrans = new PackageTranslator("org.olat.user", ureq.getLocale());
        PackageTranslator properyHandlersTrans = new PackageTranslator("org.olat.user.propertyhandlers", ureq.getLocale());
        olatKeys = new ArrayList();
        // adding order is relevant for the "if-else if"-statement below at events from step 3
        olatKeys.add(properyHandlersTrans.translate("form.name.institutionalUserIdentifier"));
        olatKeys.add(userTrans.translate("form.username"));
        olatKeys.add(userTrans.translate("form.email"));
       
        // add olatKeys and columnsNames to the form which displays it as pulldown menus
        kwcForm = new KeyWithColumnForm("keywithcolform", trans, olatKeys, columnNames);
        kwcForm.addListener(this);
        keywithcolVC.put("kwcForm", kwcForm);
       
        wc.setWizardTitle(trans.translate("wizard.step2.title"));
        wc.setNextWizardStep(trans.translate("wizard.step2.howto"), keywithcolVC);
      }
    // events from step 2
    // preparing step 3
    }else if (source == kwcForm){
      if (event == Form.EVNT_VALIDATION_OK) { // user clicked 'next'-button !!!!!!!
        selectedColForOlatKey = Integer.parseInt(kwcForm.getSelectedColumn());
        selectedOlatKey = Integer.parseInt(kwcForm.getSelectedOlatKey());
        selectedValueOfOlatKey = (String) olatKeys.get(selectedOlatKey);
        colwithbulkactionVC = new VelocityContainer("colwithbulkaction", VELOCITY_ROOT + "/colwithbulkaction.html", trans, this);
        backLinkCol = LinkFactory.createLinkBack(colwithbulkactionVC, this);
       
        sepValTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        columnNames = null;
        columnNames = new ArrayList();
        for(int i = 0;i < numOfValuesPerLine+1; i++){ // lenght+1 since adding the delimiter above
          if (i != selectedColForOlatKey){
            sepValTableCtr.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(trans.translate("column", new String[]{""+(i+1)}));
          }else{
            sepValTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + selectedValueOfOlatKey, i, null, ureq.getLocale()));
          }
        }
        sepValTableCtr.setTableDataModel(sepValModel);
        colwithbulkactionVC.put("sepValTable", sepValTableCtr.getInitialComponent());
       
        cwbForm = new ColWithBulkActionForm("colwithbulkactionform", trans, columnNames, bulkActions);
        cwbForm.addListener(this);
        colwithbulkactionVC.put("cwbForm", cwbForm);
       
        wc.setWizardTitle(trans.translate("wizard.step3.title"));
        wc.setNextWizardStep(trans.translate("wizard.step3.howto"), colwithbulkactionVC);
      }
    }else if (source == backLinkKey){
      wc.setWizardTitle(trans.translate("wizard.step1.title"));
      wc.setBackWizardStep(trans.translate("wizard.step1.howto"), sepValInForm);
    // events from step 3
    // preparing step 4
    }else if (source == cwbForm){
      if (event == Form.EVNT_VALIDATION_OK) { // user clicked 'next'-button !!!!!!!
        List rowsFourthStep = new ArrayList(rows.size());
        for (Iterator iter = rows.iterator(); iter.hasNext();) {
          Object[] values = (Object[]) iter.next();
          rowsFourthStep.add(values.clone());
        }
        String selectedColForBulk = cwbForm.getSelectedColumn();
        int colForBulk = Integer.parseInt(selectedColForBulk);
        // the selected column for the OLAT key was not more shown in the pulldownmenu for
        // for choosing the bulkaction, but it is not removed, therefore we have to increment
        // the colForBulk in certain cases
        if (selectedColForOlatKey <= colForBulk) colForBulk++;
        String selectedBulk = cwbForm.getSelectedBulkAction();
        int bulk = Integer.parseInt(selectedBulk);
        finishedVC = new VelocityContainer("finished", VELOCITY_ROOT + "/finished.html", trans, this);
        backLinkFin = LinkFactory.createLinkBack(finishedVC, this);
       
        GenericObjectArrayTableDataModel sepValFinModel = new GenericObjectArrayTableDataModel(rowsFourthStep, numOfLines);
         
        UserManager um = UserManager.getInstance();
        Manager secMgr = ManagerFactory.getManager();
       
        BulkActionModule bam = new BulkActionModule();
        BulkAction ba = (BulkAction) bulkActions.get(bulk);
        List identities = new ArrayList(sepValFinModel.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 < sepValFinModel.getRowCount(); i ++ ){
          String val = (String) sepValFinModel.getValueAt(i, selectedColForOlatKey);
          val = val.trim();
          Identity identity = null;

          if (selectedOlatKey == 0) { // matrikelnumber
            Map<String, String> searchValue = new HashMap<String, String>();
            searchValue.put(UserConstants.INSTITUTIONALUSERIDENTIFIER, val);
            List identitiesFoundByInst = ManagerFactory.getManager().getIdentitiesByPowerSearch(null, searchValue, true, null, null, null, null, null, null);
            //FIXME:as:b error handling if there is more than one identity found by institutionalUserIdentifier
            // see also in BulkAssessmentWizardController
            if (identitiesFoundByInst.size() == 1){
              identity = (Identity) identitiesFoundByInst.get(0);
            }
          }else if (selectedOlatKey == 1){ // username
              identity = secMgr.findIdentityByName(val);
          }else if (selectedOlatKey == 2) { // email
            identity = um.findIdentityByEmail(val);
          }
          identities.add(identity);
        }
        // get results from the user chosen bulk action for every identity
        List bulkResults = bam.apply(identities, ba);
        // add the bulk results to the data model
        for(int i = 0; i < sepValFinModel.getRowCount(); i++ ){
          String result = (String) bulkResults.get(i);
          sepValFinModel.setValueAt(result,i,colForBulk);
        }
       
        tableConfig.setDownloadOffered(true);
        TableController sepValFinTableCtr = new TableController(tableConfig, ureq, getWindowControl(), hcTranslator, this);
        columnNames = null;
        columnNames = new ArrayList();
        for(int i = 0;i < numOfValuesPerLine+1; i++){
          if (i == selectedColForOlatKey){
            sepValFinTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + selectedValueOfOlatKey, i, null, ureq.getLocale()));
          }else if (i == colForBulk){
            sepValFinTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("hhh" + ba.getDisplayName(), i, null, ureq.getLocale()));
          }else{
            sepValFinTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("ccc"+(i+1), i, null, ureq.getLocale()));
          }
        }
       
        sepValFinTableCtr.setTableDataModel(sepValFinModel);
       
View Full Code Here


      }

      // table columns
      tableFilterCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.node", 0, null,
          ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new IndentedNodeRenderer()));
      tableFilterCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.details",1, null, ureq.getLocale()));
      tableFilterCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.attempts", 2, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
      tableFilterCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.score", 3, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
      tableFilterCtr.addColumnDescriptor(new BooleanColumnDescriptor("table.header.passed", 4, translate("passed.true"), translate("passed.false")));
      // node selection only available if configured
      if (nodesSelectable) {
        tableFilterCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.action.select",5 ,CMD_SELECT_NODE, ureq.getLocale()));
      }
      nodesTableModel = new NodeAssessmentTableDataModel(nodesTableList, getTranslator(), nodesSelectable);
      tableFilterCtr.setTableDataModel(nodesTableModel);

      main.setContent(tableFilterCtr.getInitialComponent());
View Full Code Here

    super(ureq, wControl);
   
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("efficiencyStatementsPortlet.nostatements"));
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.course", 0, null, getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.score", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
    tableCtr.addColumnDescriptor(new BooleanColumnDescriptor("table.header.passed", 2, translate("passed.true"), translate("passed.false")));
    StaticColumnDescriptor cd3 = new StaticColumnDescriptor(CMD_SHOW, "table.header.show", translate("table.action.show"));
    cd3.setIsPopUpWindowAction(true, "height=600, width=800, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
    tableCtr.addColumnDescriptor(cd3);
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(CMD_LAUNCH_COURSE, "table.header.launchcourse", translate("table.action.launchcourse")));
View Full Code Here

  public void addColumnDescriptors(TableController tableCtr, String selectButtonLabel, boolean enableDirectLaunch) {
   
   
    tableCtr.addColumnDescriptor(new RepositoryEntryTypeColumnDescriptor("table.header.typeimg", 0, null,
        translator.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.displayname", 1, enableDirectLaunch ? TABLE_ACTION_SELECT_ENTRY : null, translator.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.author", 2, null, translator.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.access", 3, null, translator.getLocale()));
    tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.header.date", 4, null, translator.getLocale()));
    tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.header.lastusage", 5, null, translator.getLocale()));
    if (selectButtonLabel != null) {
      StaticColumnDescriptor desc = new StaticColumnDescriptor(TABLE_ACTION_SELECT_LINK, selectButtonLabel, selectButtonLabel);
      desc.setTranslateHeaderKey(false);     
      tableCtr.addColumnDescriptor(desc);
    }
View Full Code Here

    PropertyManager pm = PropertyManager.getInstance();
    List l = pm.listProperties(identity, null, null, null, null);
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(getTranslator().translate("error.no.props.found"));
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), this);
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.category", 0, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.grp", 1, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.resource", 2, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.name", 3, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.value", 4, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.creatdat", 5, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.prop.moddat", 6, null, ureq.getLocale()));
    // property selection / id only for admins
    if (ureq.getUserSession().getRoles().isOLATAdmin()) {
      tableCtr.addColumnDescriptor(new StaticColumnDescriptor("choose", "table.header.action", getTranslator()
          .translate("action.choose")));
    }
View Full Code Here

    String editCmd = null;
    if (courseNode == null || courseNode.isEditableConfigured()) {
      editCmd = actionCommand; // only selectable if editable
    }
    int colCount = 0;
    userListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", colCount++, editCmd, getLocale()));
   
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler  = userPropertyHandlers.get(i);     
      userListCtr.addColumnDescriptor(userPropertyHandler.getColumnDescriptor(i+1, null, getLocale()))
      colCount++;
    }   
    if ( (courseNode != null) && isNodeOrGroupFocus) {     
      if (courseNode.hasDetails()) {       
        userListCtr.addColumnDescriptor((courseNode.getDetailsListViewHeaderKey() == null ? false : true),
            new DefaultColumnDescriptor(courseNode.getDetailsListViewHeaderKey(), colCount++, null, getLocale()));
      }
      if (courseNode.hasAttemptsConfigured()) {       
        userListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.attempts", colCount++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
      }
      if (courseNode.hasScoreConfigured()) {       
        userListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.score", colCount++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
      }
      if (courseNode.hasStatusConfigured()) {       
        userListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.status", colCount++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
      }
      if (courseNode.hasPassedConfigured()) {       
        userListCtr.addColumnDescriptor(new BooleanColumnDescriptor("table.header.passed", colCount++, translator.translate("passed.true"),
            translator.translate("passed.false")));
      }
View Full Code Here

  private void initializeTableController(UserRequest ureq) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(pT.translate("error.no.repository.found"));
    if (tableCtr != null) tableCtr.dispose();
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), pT, this);
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.bgname", 0, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.description", 1, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.type", 2, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastusage", 3, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.deleteEmail", 4, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent
          .getTranslator().translate("action.activate")));
   
    updateGroupList();
    tableCtr.setMultiSelect(false);
View Full Code Here

        PropertiesTableDataModel ptdm = new PropertiesTableDataModel(entries);

        TableGuiConfiguration tableConfig = new TableGuiConfiguration();
        //use null as listener argument because we are using listenTo(..) from basiccontroller
        tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.userName", 0, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeName", 1, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeId", 2, null, ureq.getLocale(),ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.category", 3, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", 4, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.floatValue", 5, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.stringValue", 6, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.longValue", 10, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.textValue", 7, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.creationdate", 8, null, ureq.getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastmodified", 9, null, ureq.getLocale()));
        tableCtr.setTableDataModel(ptdm);
        listenTo(tableCtr);

        myPanel.setContent(tableCtr.getInitialComponent());   
    }
View Full Code Here

    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(pT.translate("error.no.repository.found"));
    if (tableCtr != null) tableCtr.dispose();
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), pT, this);
    tableCtr.addColumnDescriptor(new RepositoryEntryTypeColumnDescriptor("table.header.typeimg", 0,null, pT.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.displayname", 1, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.author", 2, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastusage", 3, null, ureq.getLocale()));
    tableCtr.addMultiSelectAction("action.delete.selection", ACTION_MULTISELECT_CHOOSE);
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent
          .getTranslator().translate("action.activate")));
    tableCtr.setMultiSelect(true);
  }
View Full Code Here

    tableConfig.setTableEmptyMessage(translate("error.no.repository.found"));
    tableConfig.setShowAllLinkEnabled(false);
    //use null as listener argument because we are using listenTo(..) from basiccontroller
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator(), null);
    tableCtr.addColumnDescriptor(new RepositoryEntryTypeColumnDescriptor("table.header.typeimg", 0,null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.displayname", 1, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.author", 2, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastusage", 3, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.deleteEmail", 4, null, ureq.getLocale()));
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent
          .getTranslator().translate("action.activate")));
    listenTo(tableCtr);
   
    tableCtr.addMultiSelectAction("action.ready.to.delete", ACTION_MULTISELECT_CHOOSE);
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.