コード例 #1
0
  /**
   * This method is used to set opended question data.
   *
   * @param result
   */
  void setOpenendedQuestionsData(ArrayList<UserDataDo> result) {

    int totalUserCount = collectionMetaData.getUserCount();

    final AdvancedFlexTable adTable = new AdvancedFlexTable();
    adTable.getElement().setAttribute("style", "background: #fff; width: 1000px;");

    adTable.setHeaderWidget(0, getHeaderLbl(i18n.GL3259(), 25));
    adTable.setHeaderWidget(1, getHeaderLbl(i18n.GL0308(), 35));
    adTable.setHeaderWidget(2, getHeaderLbl(i18n.GL3260(), 500));
    adTable.setHeaderWidget(3, getHeaderLbl(i18n.GL2084(), 70));
    adTable.setHeaderWidget(4, getHeaderLbl(i18n.GL3261(), 30));
    adTable.setHeaderWidget(5, getHeaderLbl(i18n.GL3273(), 80));

    if (result.size() != 0) {

      for (int i = 0; i < result.size(); i++) {
        adTable.setWidget(i, 0, new Label(String.valueOf(result.get(i).getItemSequence())));

        // Set Question Title
        Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle()));
        questionTitle.setStyleName(res.css().alignCenterAndBackground());
        questionTitle.addStyleName(res.css().alignLeft());
        adTable.setWidget(i, 1, questionTitle);

        // Set completion
        HTMLPanel completionpnl = new HTMLPanel("");
        Label progressBar = new Label();
        progressBar.setStyleName(res.css().setProgressBar());
        completionpnl.add(progressBar);
        Label incompleteProgressBar = new Label();
        incompleteProgressBar.setStyleName(res.css().setIncorrectProgressBar());
        completionpnl.add(incompleteProgressBar);
        int attemptedCount = result.get(i).getTotalAttemptUserCount();
        float maxAvgVal = ((float) attemptedCount) / ((float) totalUserCount);
        progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
        incompleteProgressBar.getElement().getStyle().setWidth((100 - maxAvgVal * 100), Unit.PX);
        Label studentTextlbl = new Label(attemptedCount + "/" + totalUserCount + " Students");
        studentTextlbl.setStyleName(res.css().alignCenterAndBackground());
        studentTextlbl.getElement().getStyle().setWidth(100, Unit.PX);
        completionpnl.add(studentTextlbl);
        adTable.setWidget(i, 2, completionpnl);

        // Set time spent
        adTable.setWidget(i, 3, AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));

        // Set reactions
        int reaction = result.get(i).getAvgReaction();
        HTMLPanel reactionpnl = new HTMLPanel("");
        reactionpnl.add(new AnalyticsReactionWidget(reaction));
        Label reactioncount = new Label();
        reactionpnl.add(reactioncount);
        reactioncount.setText(reaction + "/5");
        reactioncount.setStyleName(res.css().alignCenterAndBackground());
        adTable.setWidget(i, 4, reactionpnl);

        // set View response label
        Label viewResponselbl = new Label(i18n.GL2286());
        viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
        viewResponselbl
            .getElement()
            .setAttribute("resourceGooruId", result.get(i).getResourceGooruOId());
        viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType());
        viewResponselbl.getElement().setAttribute("labelType", "View Response");
        adTable.setWidget(i, 5, viewResponselbl);
      }
    }

    adTable.getElement().setId("opendedData");
    teacherOpenendedData.add(adTable);
    if (result.size() == 0) {
      Label erroeMsg = new Label();
      erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
      erroeMsg.setText(i18n.GL3118());
      teacherOpenendedData.add(erroeMsg);
    }
    adTable.addDomHandler(new ClickOnTableCell(), ClickEvent.getType());
    adTable
        .getElement()
        .getFirstChildElement()
        .getFirstChildElement()
        .getFirstChildElement()
        .getStyle()
        .setProperty("width", "98% !important");
  }
コード例 #2
0
  /**
   * This is used to print opened questions data
   *
   * @param result
   */
  void setOpenendedQuestionsPrintData(ArrayList<UserDataDo> result) {
    try {
      printOpendedData.clear();
      int totalUserCount = collectionMetaData.getUserCount();

      final AdvancedFlexTable adTable = new AdvancedFlexTable();
      adTable.getElement().setAttribute("style", "background: #fff; width: 1000px;");

      adTable.setHeaderWidget(0, getHeaderLbl(i18n.GL3259(), 25));
      adTable.setHeaderWidget(1, getHeaderLbl(i18n.GL0308(), 35));
      adTable.setHeaderWidget(2, getHeaderLbl(i18n.GL3260(), 500));
      adTable.setHeaderWidget(3, getHeaderLbl(i18n.GL2084(), 70));
      adTable.setHeaderWidget(4, getHeaderLbl(i18n.GL3261(), 30));
      adTable.setHeaderWidget(5, getHeaderLbl(i18n.GL3273(), 80));

      if (result.size() != 0) {
        for (int i = 0; i < result.size(); i++) {
          adTable.setWidget(i, 0, new Label(String.valueOf(result.get(i).getItemSequence())));

          // Set Question Title
          Label questionTitle =
              new Label(
                  AnalyticsUtil.html2text(
                      result.get(i).getTitle() != null ? result.get(i).getTitle() : ""));
          questionTitle.setStyleName(res.css().alignCenterAndBackground());
          questionTitle.addStyleName(res.css().alignLeft());
          adTable.setWidget(i, 1, questionTitle);

          // Set completion
          HTMLPanel completionpnl = new HTMLPanel("");
          Label progressBar = new Label();
          progressBar.setStyleName(res.css().setProgressBar());
          completionpnl.add(progressBar);
          Label incompleteProgressBar = new Label();
          incompleteProgressBar.setStyleName(res.css().setIncorrectProgressBar());
          completionpnl.add(incompleteProgressBar);
          int attemptedCount = result.get(i).getTotalAttemptUserCount();
          float maxAvgVal = ((float) attemptedCount) / ((float) totalUserCount);
          progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
          incompleteProgressBar.getElement().getStyle().setWidth((100 - maxAvgVal * 100), Unit.PX);
          Label studentTextlbl = new Label(attemptedCount + "/" + totalUserCount + " Students");
          studentTextlbl.setStyleName(res.css().alignCenterAndBackground());
          studentTextlbl.getElement().getStyle().setWidth(100, Unit.PX);
          completionpnl.add(studentTextlbl);
          adTable.setWidget(i, 2, completionpnl);

          // Set time spent
          adTable.setWidget(i, 3, AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));

          // Set reactions
          int reaction = result.get(i).getAvgReaction();
          HTMLPanel reactionpnl = new HTMLPanel("");
          reactionpnl.add(new AnalyticsReactionWidget(reaction));
          Label reactioncount = new Label();
          reactionpnl.add(reactioncount);
          reactioncount.setText(reaction + "/5");
          reactioncount.setStyleName(res.css().alignCenterAndBackground());
          adTable.setWidget(i, 4, reactionpnl);

          // set View response label
          Label viewResponselbl = new Label("");
          viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
          adTable.setWidget(i, 5, viewResponselbl);
        }
      }
      adTable.getElement().setId("opendedData");
      printOpendedData.add(adTable);
      if (result.size() == 0) {
        Label erroeMsg = new Label();
        erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
        erroeMsg.setText(i18n.GL3264());
        printOpendedData.add(erroeMsg);
      }
      // To add OE questions
      opendedQuestionHeading.setText(i18n.GL3266());
      opendedQuestionHeading.getElement().getStyle().setPaddingTop(15, Unit.PX);
      opendedQuestionHeading.getElement().getStyle().setPaddingBottom(20, Unit.PX);
      opendedQuestionHeading.getElement().getStyle().setTextAlign(TextAlign.LEFT);
      printWidget.add(opendedQuestionHeading);
      printWidget.add(printOpendedData);
      printOpendedData.getElement().getStyle().setPaddingBottom(20, Unit.PX);
    } catch (Exception e) {
      AppClientFactory.printSevereLogger(
          "CollectionSummaryTeacherView : setOpenendedQuestionsPrintData : " + e.getMessage());
    }
  }