@UiHandler("saveFolderBtn")
  public void clickSaveFolderBtn(ClickEvent clickEvent) {
    final TreeItem currentItem = rightPresenter.getCurrentTreeItem();
    if (!StringUtil.isEmpty(folderTitleTxtBox.getText())) {
      if (folderTitleTxtBox.getText().length() < 50) {
        Map<String, String> parms = new HashMap<String, String>();
        parms.put("text", folderTitleTxtBox.getText().trim());
        AppClientFactory.getInjector()
            .getResourceService()
            .checkProfanity(
                parms,
                new SimpleAsyncCallback<Boolean>() {
                  @Override
                  public void onSuccess(Boolean result) {
                    if (result) {
                      SetStyleForProfanity.SetStyleForProfanityForTextBox(
                          folderTitleTxtBox, lblErrorMessage, result);
                    } else {
                      lblErrorMessage.setVisible(false);
                      String o1 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o1", null);
                      String o2 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o2", null);
                      String o3 =
                          AppClientFactory.getPlaceManager().getRequestParameter("o3", null);
                      String gooruOid = folderObj.getGooruOid();
                      if (o3 != null) {
                        updateFolder(o3, currentItem);
                      } else if (o2 != null) {
                        updateFolder(o2, currentItem);
                      } else if (o1 != null) {
                        updateFolder(o1, currentItem);
                      }
                      /*if(o1!=null){
                      	updateFolder(o1);
                      }else if(o2!=null)*/

                      /*if(o2==null){
                      	createFolder(o1);
                      }else if(gooruOid==o2){
                      	updateFolder(o2);
                      }else if(o2!=null && o3==null){
                      	createFolder(o2);
                      }else if(gooruOid==o3){
                      	updateFolder(o3);
                      }*/
                    }
                  }
                });
      } else {
        lblErrorMessage.setVisible(true);
        lblErrorMessage.setText(i18n.GL1427());
      }
    } else {
      lblErrorMessage.setVisible(true);
      lblErrorMessage.setText(StringUtil.generateMessage(i18n.GL0067(), "Folder"));
    }
  }
 /**
  * This method is used to print scored questions data
  *
  * @param scoredQuestionsData
  */
 void setQuestionsPrintData(ArrayList<UserDataDo> scoredQuestionsData) {
   scoredPrintWidget.clear();
   final SortTable sortableTable = new SortTable();
   sortableTable.setStyleName(res.css().tableMain());
   sortableTable.getElement().setId("results");
   sortableTable.setBorderWidth(1);
   sortableTable.setCellPadding(4);
   sortableTable.setCellSpacing(1);
   sortableTable.addColumnHeader(i18n.GL3259(), 0);
   sortableTable.addColumnHeader(i18n.GL0308(), 1);
   sortableTable.addColumnHeader(i18n.GL2229(), 2);
   sortableTable.addColumnHeader(i18n.GL3269(), 3);
   sortableTable.addColumnHeader(i18n.GL2084(), 4);
   sortableTable.addColumnHeader(i18n.GL3261(), 5);
   sortableTable.getRowFormatter().addStyleName(0, res.css().tableHeader());
   // To add scored questions
   scoredQuestionHeading.setText(i18n.GL2282());
   scoredQuestionHeading.getElement().getStyle().setClear(Clear.BOTH);
   scoredQuestionHeading.getElement().getStyle().setPaddingTop(15, Unit.PX);
   scoredQuestionHeading.getElement().getStyle().setPaddingBottom(20, Unit.PX);
   scoredQuestionHeading.getElement().getStyle().setTextAlign(TextAlign.LEFT);
   printWidget.add(scoredQuestionHeading);
   scoredPrintWidget.add(sortableTable);
   scoredPrintWidget.getElement().getStyle().setPaddingTop(15, Unit.PX);
   if (scoredQuestionsData.size() != 0) {
     setSortedData(scoredQuestionsData, sortableTable, true);
   } else {
     Label erroeMsg = new Label();
     erroeMsg.setStyleName(res.css().displayMessageTextForScoredQuestions());
     erroeMsg.setText(i18n.GL3265());
     scoredPrintWidget.add(erroeMsg);
   }
   scoredPrintWidget.setVisible(false);
 }
 /** Average star ratings widget will get integrated. */
 private void setAvgRatingWidget() {
   ratingWidgetView = new RatingWidgetView();
   if (collectionItemDo.getResource().getRatings() != null) {
     if (collectionItemDo.getResource().getRatings().getCount() != null
         && collectionItemDo.getResource().getRatings().getCount() != 0) {
       ratingWidgetView.getRatingCountOpenBrace().setText(i18n.GL_SPL_OPEN_SMALL_BRACKET());
       ratingWidgetView
           .getRatingCountLabel()
           .setText(collectionItemDo.getResource().getRatings().getCount().toString());
       ratingWidgetView.getRatingCountCloseBrace().setText(i18n.GL_SPL_CLOSE_SMALL_BRACKET());
       ratingWidgetView.setAvgStarRating(collectionItemDo.getResource().getRatings().getAverage());
       ratingWidgetPanel.getElement().setId("fpnlRatingWidgetPanel");
     }
   }
   ratingWidgetPanel.clear();
   ratingWidgetPanel.add(ratingWidgetView);
 }
 /**
  * This method is used to display scored data
  *
  * @param scoredQuestionsData
  */
 void setScoredQuestionsData(ArrayList<UserDataDo> scoredQuestionsData) {
   teacherScoredData.clear();
   final SortTable sortableTable = new SortTable();
   sortableTable.setStyleName(res.css().tableMain());
   sortableTable.getElement().setId("results");
   sortableTable.setBorderWidth(1);
   sortableTable.setCellPadding(4);
   sortableTable.setCellSpacing(1);
   sortableTable.setWidth("800");
   sortableTable.addColumnHeader(i18n.GL3259(), 0);
   sortableTable.addColumnHeader(i18n.GL0308(), 1);
   sortableTable.addColumnHeader(i18n.GL3276(), 2);
   sortableTable.addColumnHeader(i18n.GL3277(), 3);
   sortableTable.addColumnHeader(i18n.GL2084(), 4);
   sortableTable.addColumnHeader(i18n.GL3261(), 5);
   sortableTable.getRowFormatter().addStyleName(0, res.css().tableHeader());
   teacherScoredData.add(sortableTable);
   if (scoredQuestionsData.size() != 0) {
     setSortedData(scoredQuestionsData, sortableTable, false);
   } else {
     Label erroeMsg = new Label();
     erroeMsg.setStyleName(res.css().displayMessageTextForScoredQuestions());
     erroeMsg.setText(i18n.GL3265());
     teacherScoredData.add(erroeMsg);
   }
 }
 /** This method is used to set default data. */
 void setData() {
   collectionSummaryText.setText(i18n.GL1587());
   collectionSummaryText.getElement().getStyle().setPaddingBottom(15, Unit.PX);
   collectionSummaryText.addStyleName("collectionSummaryText");
   printWidget.add(collectionSummaryText);
   teacherTabContainer =
       new AnalyticsTabContainer() {
         @Override
         public void onTabClick(String tabClicked) {
           if (SCORED.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherScoredDatapnl.setVisible(true);
           } else if (OPENENDED.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherOpenendedData.setVisible(true);
           } else if (BREAKDOWN.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherResourceBreakdownDatapnl.setVisible(true);
           } else if (PRINT.equalsIgnoreCase(tabClicked)) {
             Element printElement = collectionSummaryText.getElement();
             printElement.appendChild(collectionSummaryWidget.getElement());
             printElement.appendChild(scoredQuestionHeading.getElement());
             printElement.appendChild(scoredPrintWidget.getElement());
             printElement.appendChild(opendedQuestionHeading.getElement());
             printElement.appendChild(printOpendedData.getElement());
             printElement.appendChild(collectionOverViewWidget.getElement());
             printElement.appendChild(printResourceData.getElement());
             scoredPrintWidget.setVisible(true);
             Print.it(style, printElement);
             scoredPrintWidget.setVisible(false);
           } else {
             scoredPrintWidget.setVisible(true);
             Element printElement = collectionSummaryText.getElement();
             printElement.appendChild(collectionSummaryWidget.getElement());
             printElement.appendChild(scoredQuestionHeading.getElement());
             printElement.appendChild(scoredPrintWidget.getElement());
             printElement.appendChild(opendedQuestionHeading.getElement());
             printElement.appendChild(printOpendedData.getElement());
             printElement.appendChild(collectionOverViewWidget.getElement());
             printElement.appendChild(printResourceData.getElement());
             getUiHandlers()
                 .setHtmltopdf(
                     style.toString().replaceAll("'", "\\\\\"")
                         + printElement.getInnerHTML().toString().replaceAll("\"", "\\\\\""),
                     collectionMetaData.getTitle() != null ? collectionMetaData.getTitle() : "");
             scoredPrintWidget.setVisible(false);
           }
         }
       };
   teacherTabContainer.getEmailButton().setVisible(false);
   tabContainer.add(teacherTabContainer);
   filterDropDown.clear();
   filterDropDown.addItem("All", "All");
   filterDropDown.addItem("Questions", "Questions");
   filterDropDown.addItem("Resources", "Resources");
 }
  public DeleteContentPopup() {
    super(false);
    add(binder.createAndBindUi(this));
    this.setGlassEnabled(true);

    h3Panel.setVisible(false);
    lblRemoving.setVisible(false);
    lblRemoving.getElement().getStyle().setMargin(26, Unit.PX);
    txtConfirmAction.setVisible(false);
    setButtonVisibility(true);
    setElementId();

    txtConfirmAction.addKeyUpHandler(new ValidateConfirmText());
    txtConfirmAction.getElement().getStyle().setColor("#515151");
    txtConfirmAction.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (!txtConfirmAction.getText().isEmpty()) {
              if (txtConfirmAction
                  .getText()
                  .toLowerCase()
                  .equalsIgnoreCase(i18n.GL1175().toLowerCase())) {
                txtConfirmAction.setText("");
                txtConfirmAction.getElement().getStyle().setColor("#000000");
              }
            }
          }
        });

    txtConfirmAction.addBlurHandler(
        new BlurHandler() {

          @Override
          public void onBlur(BlurEvent event) {
            if (txtConfirmAction.getText().isEmpty()) {
              txtConfirmAction.getElement().getStyle().setColor("#515151");
            }
          }
        });
    StringUtil.setAttributes(txtConfirmAction, true);
    btnNegitive.setText(StringUtil.generateMessage(i18n.GL0142()));
    btnNegitive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0142()));
    btnNegitive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0142()));

    btnPositive.setText(StringUtil.generateMessage(i18n.GL0190()));
    btnPositive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0190()));
    btnPositive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0190()));

    /*lblDeleteText.setText(i18n.GL2189());
    StringUtil.setAttributes(lblDeleteText.getElement(), "lblDeleteText", null, "lblDeleteText");*/

    Window.enableScrolling(false);
    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
    this.center();
  }
  private void setElementId() {
    btnPositive.getElement().setId("btnPositive");
    btnNegitive.getElement().setId("btnNegitive");
    lblTitle.getElement().setId("lblTitle");
    txtConfirmAction.getElement().setId("txtConfirmAction");
    lblRemoving.getElement().setId("lblRemoving");
    closeBtn.getElement().getStyle().setCursor(Cursor.POINTER);

    h5Panel.setText("Warning: this cannot be undone");
    paragraphPnl.setText("Please type in delete");
    chkBoxList.add(chkBox1);
    chkBoxList.add(chkBox2);
    chkBoxList.add(chkBox3);

    chkBox1.getElement().setId("checkboxG12");
    chkBox2.getElement().setId("checkboxG13");
    chkBox3.getElement().setId("checkboxG14");

    checkboxG12.getElement().setAttribute("for", "checkboxG12");
    checkboxG13.getElement().setAttribute("for", "checkboxG13");
    checkboxG14.getElement().setAttribute("for", "checkboxG14");

    chkBox1.setValue(false);
    chkBox2.setValue(false);
    chkBox3.setValue(false);
    if (AppClientFactory.getPlaceManager()
        .getCurrentPlaceRequest()
        .getNameToken()
        .equals(PlaceTokens.EDIT_CLASS)) {
      checkboxG12.setText(i18n.GL3575());
      checkboxG13.setText(i18n.GL3576());
      checkboxG14.setText(i18n.GL3577());
      checkboxG13.getElement().getStyle().setLineHeight(18, Unit.PX);
    } else {
      checkboxG12.setText(i18n.GL3579());
      checkboxG13.setText(i18n.GL3573());
      checkboxG14.setText(i18n.GL3574());
    }
  }
  private void setElementId() {
    lblOops.setText(i18n.GL0061());
    lblErrorIEMessage.setText(i18n.GL2038());
    btnOk.setText(i18n.GL0190());

    StringUtil.setAttributes(lblOops.getElement(), i18n.GL0061(), i18n.GL0061(), i18n.GL0061());
    StringUtil.setAttributes(
        lblErrorIEMessage.getElement(), i18n.GL2038(), i18n.GL2038(), i18n.GL2038());
    StringUtil.setAttributes(btnOk.getElement(), i18n.GL0190(), i18n.GL0190(), i18n.GL0190());
  }
  /**
   * This method is used to set scored questions data.
   *
   * @param scoredQuestionsData
   * @param sortableTable
   * @param isPrint
   */
  void setSortedData(
      ArrayList<UserDataDo> scoredQuestionsData, SortTable sortableTable, boolean isPrint) {
    for (int i = 1; i <= scoredQuestionsData.size(); i++) {
      sortableTable.setValue(i, 0, scoredQuestionsData.get(i - 1).getItemSequence());
      Label questionTitle =
          new Label(
              AnalyticsUtil.html2text(
                  scoredQuestionsData.get(i - 1).getTitle() != null
                      ? scoredQuestionsData.get(i - 1).getTitle()
                      : ""));
      questionTitle.setStyleName(res.css().alignCenterAndBackground());
      questionTitle.addStyleName(res.css().alignLeft());
      sortableTable.setWidget(i, 1, questionTitle);
      VerticalPanel answerBreakDownpnl = new VerticalPanel();
      if (scoredQuestionsData.get(i - 1).getType() != null) {
        String getQuestionType = scoredQuestionsData.get(i - 1).getType();
        if (MC.equalsIgnoreCase(getQuestionType)
            || TF.equalsIgnoreCase(getQuestionType)
            || TSLASHF.equalsIgnoreCase(getQuestionType)) {
          if ((scoredQuestionsData.get(i - 1).getMetaData() != null)
              && (scoredQuestionsData.get(i - 1).getMetaData().size() != 0)) {
            int metaDataSize = scoredQuestionsData.get(i - 1).getMetaData().size();
            int totalcount = scoredQuestionsData.get(i - 1).getAttempts();
            for (int j = 0; j < metaDataSize; j++) {
              MetaDataDo metaData = scoredQuestionsData.get(i - 1).getMetaData().get(j);
              HorizontalPanel datagrap = new HorizontalPanel();
              Label tickmarklbl = new Label();
              tickmarklbl.setStyleName(res.css().tickMarkImgCss());
              datagrap.add(tickmarklbl);
              String questionSequence = AnalyticsUtil.getCharForNumber(metaData.getSequence() - 1);
              int attemptCount = 0;
              Label sequenceCharlbl = new Label(questionSequence + ")");
              sequenceCharlbl.setStyleName(res.css().barGraphCharacter());
              datagrap.add(sequenceCharlbl);
              if (scoredQuestionsData.get(i - 1).getOptions() != null) {
                Map<String, Integer> authorObject = scoredQuestionsData.get(i - 1).getOptions();
                /*JSONValue value = JSONParser.parseStrict(scoredQuestionsData.get(i-1).getOptions().toString());
                JSONObject authorObject = value.isObject();*/
                if (authorObject.keySet().size() != 0
                    && authorObject.get(questionSequence) != null) {
                  attemptCount = (int) authorObject.get(questionSequence).doubleValue();
                }
              }

              Label progressBarlbl = new Label("");
              if (metaData.getIsCorrect() == 1) {
                tickmarklbl.addStyleName(res.css().tickMarkImg());
                progressBarlbl.addStyleName(res.css().assignment_quesiton_ans_bar());
              } else {
                progressBarlbl.addStyleName(res.css().wrongSelectStyle());
              }
              float setWidth = ((float) attemptCount / (float) totalcount) * 100;
              setWidth = (setWidth == 0.0 ? 1 : setWidth);
              progressBarlbl.getElement().getStyle().setWidth(setWidth, Unit.PX);
              datagrap.add(progressBarlbl);

              Label countlbl = new Label("(" + attemptCount + ")");
              datagrap.add(countlbl);
              answerBreakDownpnl.add(datagrap);
            }
          }
        } else if ((OE.equalsIgnoreCase(getQuestionType)
                || FIB.equalsIgnoreCase(getQuestionType)
                || MA.equalsIgnoreCase(getQuestionType))
            && !isPrint) {
          Label viewResponselbl = new Label(i18n.GL2286());
          viewResponselbl.getElement().setAttribute("labelType", "View Response");
          viewResponselbl
              .getElement()
              .setAttribute(
                  "resourceGooruId", scoredQuestionsData.get(i - 1).getResourceGooruOId());
          viewResponselbl
              .getElement()
              .setAttribute("questionType", scoredQuestionsData.get(i - 1).getType());
          viewResponselbl.setStyleName(res.css().viewResponseTextOpended());
          viewResponselbl.addClickHandler(new ClickOnTableCell());
          answerBreakDownpnl.add(viewResponselbl);
        }

        sortableTable.setWidget(i, 3, answerBreakDownpnl);
        sortableTable.setValue(
            i,
            4,
            AnalyticsUtil.getTimeStampLabel(scoredQuestionsData.get(i - 1).getAvgTimeSpent())
                .getText());
        sortableTable.setWidget(
            i, 5, new AnalyticsReactionWidget(scoredQuestionsData.get(i - 1).getAvgReaction()));

        int[] pieChatValues = new int[4];
        pieChatValues[0] = scoredQuestionsData.get(i - 1).getTotalInCorrectCount();
        pieChatValues[1] = scoredQuestionsData.get(i - 1).getTotalCorrectCount();
        pieChatValues[2] = scoredQuestionsData.get(i - 1).getSkip();
        pieChatValues[3] = pieChatValues[0] + pieChatValues[1] + pieChatValues[2];

        // set row style
        if (i % 2 == 0) {
          sortableTable.getRowFormatter().addStyleName(i, res.css().tableRowOdd());
          sortableTable.setWidget(
              i, 2, new HCBarChart().pieChart("#fafafa", pieChatValues, isPrint));
        } else {
          sortableTable.getRowFormatter().addStyleName(i, res.css().tableRowEven());
          sortableTable.setWidget(i, 2, new HCBarChart().pieChart("#fff", pieChatValues, isPrint));
        }
      }
    }
  }
  /**
   * This method is used to display collection break down data.
   *
   * @param result
   * @param loadingImage
   */
  void setCollectionBreakDown(ArrayList<UserDataDo> result, final HTMLPanel loadingImage) {

    UserDataDo maxAvgValue =
        Collections.max(
            result,
            new Comparator<UserDataDo>() {
              public int compare(UserDataDo o1, UserDataDo o2) {
                Long obj1 = new Long(o1.getTimeSpent());
                Long obj2 = new Long(o2.getTimeSpent());
                return obj1.compareTo(obj2);
              }
            });

    final SortTable sortableTable = new SortTable();
    sortableTable.setStyleName(res.css().tableMain());
    sortableTable.getElement().setId("collectionbreak");
    sortableTable.setBorderWidth(1);
    sortableTable.setCellPadding(4);
    sortableTable.setCellSpacing(1);
    sortableTable.setWidth("800");
    sortableTable.getElement().getStyle().setBackgroundColor("#fff");
    sortableTable.addColumnHeader(i18n.GL3259(), 0);
    sortableTable.addColumnHeader(i18n.GL3267(), 1);
    sortableTable.addColumnHeader(i18n.GL3182(), 2);
    sortableTable.addColumnHeader(i18n.GL3268(), 3);
    sortableTable.addColumnHeader(i18n.GL0934(), 4);
    sortableTable.addColumnHeader(i18n.GL3261(), 5);
    sortableTable.getRowFormatter().addStyleName(0, res.css().tableHeader());

    int rowVal = 1;
    for (int i = 0; i < result.size(); i++) {
      Label number = new Label(String.valueOf(result.get(i).getItemSequence()));
      number.setStyleName(res.css().alignCenterAndBackground());
      sortableTable.setWidget(rowVal, 0, number);
      // set Format
      String resourceCategory =
          result.get(i).getResourceFormat() != null ? result.get(i).getResourceFormat().trim() : "";
      String categoryStyle = "";
      if (resourceCategory.equalsIgnoreCase("website")
          || resourceCategory.equalsIgnoreCase("webpage")) {
        resourceCategory = "webpage";
        categoryStyle = res.css().category_new_type_webpage();
      } else if (resourceCategory.equalsIgnoreCase("slide")
          || resourceCategory.equalsIgnoreCase("image")) {
        resourceCategory = "image";
        categoryStyle = res.css().category_new_type_image();
      } else if (resourceCategory.equalsIgnoreCase("handout")
          || resourceCategory.equalsIgnoreCase("lesson")
          || resourceCategory.equalsIgnoreCase("textbook")
          || resourceCategory.equalsIgnoreCase("text")) {
        resourceCategory = "text";
        categoryStyle = res.css().category_new_type_text();
      } else if (resourceCategory.equalsIgnoreCase("exam")) {
        resourceCategory = "webpage";
        categoryStyle = res.css().category_new_type_webpage();
      } else if (resourceCategory.equalsIgnoreCase("video")) {
        resourceCategory = "video";
        categoryStyle = res.css().category_new_type_video();
      } else if (resourceCategory.equalsIgnoreCase("interactive")) {
        resourceCategory = "webpage";
        categoryStyle = res.css().category_new_type_interactive();
      } else if (resourceCategory.equalsIgnoreCase("audio")) {
        resourceCategory = "audio";
        categoryStyle = res.css().category_new_type_audio();
      } else {
        categoryStyle = res.css().category_new_type_other();
      }
      Label categorylbl = new Label();
      categorylbl.setStyleName(res.css().alignCenterAndBackground());
      categorylbl.addStyleName(categoryStyle);
      categorylbl.addStyleName(res.css().setMarginAuto());
      sortableTable.setWidget(rowVal, 1, categorylbl);

      // 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());
      sortableTable.setWidget(rowVal, 2, questionTitle);

      // Set time spent
      HorizontalPanel timeSpentpnl = new HorizontalPanel();
      timeSpentpnl.add(AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));
      Label progressBar = new Label();
      progressBar.setStyleName(res.css().setProgressBar());
      timeSpentpnl.add(progressBar);
      double maxAvgVal =
          ((double) result.get(i).getAvgTimeSpent()) / ((double) maxAvgValue.getTimeSpent());
      progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
      sortableTable.setWidget(rowVal, 3, timeSpentpnl);

      // set Views label
      Label viewlbl = new Label(Integer.toString(result.get(i).getViews()));
      viewlbl.setStyleName(res.css().alignCenterAndBackground());
      sortableTable.setWidget(rowVal, 4, viewlbl);

      // 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());
      sortableTable.setWidget(rowVal, 5, reactionpnl);
      if (rowVal % 2 == 0) {
        sortableTable
            .getRowFormatter()
            .getElement(rowVal)
            .setAttribute("style", "background-color: #fafafa");
      }
      rowVal++;
    }
    if (result.size() == 0) {
      Label erroeMsg = new Label();
      erroeMsg.setStyleName(res.css().displayMessageTextForScoredQuestions());
      erroeMsg.setText(i18n.GL3467());
      teacherResourceBreakdownData.add(erroeMsg);
    }
    teacherResourceBreakdownData.add(sortableTable);
    filterDropDown.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            teacherResourceBreakdownData.clear();
            int selectedIndex = filterDropDown.getSelectedIndex();
            sortableTable.setStyleName("collectionProgressTable");
            sortableTable.getElement().setId("collectionbreak");
            if (selectedIndex == 1) {
              if (questionsData.size() > 0) {
                setCollectionBreakDown(questionsData, loadingImage);
              } else {
                Label erroeMsg = new Label();
                erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
                erroeMsg.setText(i18n.GL3274());
                teacherResourceBreakdownData.add(erroeMsg);
              }
            } else if (selectedIndex == 2) {
              if (resourceData.size() > 0) {
                setCollectionBreakDown(resourceData, loadingImage);
              } else {
                Label erroeMsg = new Label();
                erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
                erroeMsg.setText(i18n.GL3467());
                teacherResourceBreakdownData.add(erroeMsg);
              }
            } else {
              if (allData.size() > 0) {
                setCollectionBreakDown(allData, loadingImage);
              } else {
                Label erroeMsg = new Label();
                erroeMsg.setStyleName(res.css().displayMessageTextForOEQuestions());
                erroeMsg.setText(i18n.GL3467());
                teacherResourceBreakdownData.add(erroeMsg);
              }
            }
            sortableTable.addDomHandler(new ClickOnTableCell(), ClickEvent.getType());
          }
        });
    loadingImage.setVisible(false);
  }
  /**
   * This method is used to print collection breakdown data
   *
   * @param result
   */
  void setCollectionBreakDownPrintData(ArrayList<UserDataDo> result) {
    try {
      printResourceData.clear();
      UserDataDo maxAvgValue =
          Collections.max(
              result,
              new Comparator<UserDataDo>() {
                public int compare(UserDataDo o1, UserDataDo o2) {
                  Long obj1 = new Long(o1.getTimeSpent());
                  Long obj2 = new Long(o2.getTimeSpent());
                  return obj1.compareTo(obj2);
                }
              });

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

      adTable.setHeaderWidget(0, getHeaderLbl(i18n.GL3259(), 35));
      adTable.setHeaderWidget(1, getHeaderLbl(i18n.GL0308(), 55));
      adTable.setHeaderWidget(2, getHeaderLbl(i18n.GL3260(), 600));
      adTable.setHeaderWidget(3, getHeaderLbl(i18n.GL2084(), 110));
      adTable.setHeaderWidget(4, getHeaderLbl(i18n.GL3261(), 50));
      adTable.setHeaderWidget(5, getHeaderLbl(i18n.GL3273(), 60));

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

        // set Format
        String resourceCategory =
            result.get(i).getResourceFormat() != null
                ? result.get(i).getResourceFormat().trim()
                : "";
        String categoryStyle = "";
        if (resourceCategory.equalsIgnoreCase("website")
            || resourceCategory.equalsIgnoreCase("webpage")) {
          resourceCategory = "webpage";
          categoryStyle = res.css().category_new_type_webpage();
        } else if (resourceCategory.equalsIgnoreCase("slide")
            || resourceCategory.equalsIgnoreCase("image")) {
          resourceCategory = "image";
          categoryStyle = res.css().category_new_type_image();
        } else if (resourceCategory.equalsIgnoreCase("handout")
            || resourceCategory.equalsIgnoreCase("lesson")
            || resourceCategory.equalsIgnoreCase("textbook")
            || resourceCategory.equalsIgnoreCase("text")) {
          resourceCategory = "text";
          categoryStyle = res.css().category_new_type_text();
        } else if (resourceCategory.equalsIgnoreCase("exam")) {
          resourceCategory = "webpage";
          categoryStyle = res.css().category_new_type_webpage();
        } else if (resourceCategory.equalsIgnoreCase("video")) {
          resourceCategory = "video";
          categoryStyle = res.css().category_new_type_video();
        } else if (resourceCategory.equalsIgnoreCase("interactive")) {
          resourceCategory = "webpage";
          categoryStyle = res.css().category_new_type_interactive();
        } else if (resourceCategory.equalsIgnoreCase("audio")) {
          resourceCategory = "audio";
          categoryStyle = res.css().category_new_type_audio();
        } else {
          categoryStyle = res.css().category_new_type_other();
        }
        Label categorylbl = new Label();
        categorylbl.addStyleName(categoryStyle);
        categorylbl.addStyleName(res.css().setMarginAuto());
        adTable.setWidget(rowVal, 1, categorylbl);

        // 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(rowVal, 2, questionTitle);

        // Set time spent
        HorizontalPanel timeSpentpnl = new HorizontalPanel();
        timeSpentpnl.add(AnalyticsUtil.getTimeStampLabel(result.get(i).getAvgTimeSpent()));
        Label progressBar = new Label();
        progressBar.setStyleName(res.css().setProgressBar());
        timeSpentpnl.add(progressBar);
        double maxAvgVal =
            ((double) result.get(i).getAvgTimeSpent()) / ((double) maxAvgValue.getTimeSpent());
        progressBar.getElement().getStyle().setWidth(maxAvgVal * 100, Unit.PX);
        adTable.setWidget(rowVal, 3, timeSpentpnl);

        // set Views label
        // HorizontalPanel viewpnl=new HorizontalPanel();
        Label viewlbl = new Label(Integer.toString(result.get(i).getViews()));
        viewlbl.setStyleName(res.css().alignCenterAndBackground());
        /* viewpnl.add(viewlbl);
        Label viewProgressBar=new Label();
        viewProgressBar.setStyleName(res.css().setProgressBar());
        viewpnl.add(viewProgressBar);
        float maxViewVal = ((float) result.get(i).getViews())/((float) maxViews.getViews());
        viewProgressBar.getElement().getStyle().setWidth(maxViewVal*100, Unit.PX);*/
        adTable.setWidget(rowVal, 4, viewlbl);

        // 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(rowVal, 5, reactionpnl);
        rowVal++;
      }
      printResourceData.add(adTable);
      printWidget.add(printResourceData);
    } catch (Exception e) {
      AppClientFactory.printSevereLogger(
          "CollectionSummaryTeacherView : setCollectionBreakDownPrintData : " + e.getMessage());
    }
  }
  /**
   * 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");
  }
  /**
   * 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());
    }
  }
  public void setId() {
    saveBtn.setText(i18n.GL0141());
    saveBtn.getElement().setId("saveBtnId");
    saveBtn.getElement().setAttribute("alt", i18n.GL0141());
    saveBtn.getElement().setAttribute("title", i18n.GL0141());

    errorLabel.getElement().setId("errorLblId");
    saveLblText.setText(i18n.GL3426());
    saveLblText.getElement().setId("saveLblTxtId");
    saveLblText.setVisible(false);

    assignedCourse.setText(i18n.GL3440());
    courseAssigned.setText(i18n.GL3441());
    studentsNotes.setText(i18n.GL3442());
    createCourseBtn.setText(i18n.GL3443());
    lessonPacingPanel.setText(i18n.GL3444());
    minimumScrPanel.setText(i18n.GL3445());
    miniNotesPanel.setText(i18n.GL3446());
    pacingWorks.setText(i18n.GL3447());
    pacingNotes.setText(i18n.GL3448());
    assessmentsLbl.setText(i18n.GL3449());
    collectionLbl.setText(i18n.GL3450());
    contentRedirectionLbl.setText(i18n.GL3593());
  }