/** * 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()); } }
/** * 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"); }
/* (non-Javadoc) * @see org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.IsCollectionSummaryTeacherView#setTeacherResourceData(java.util.ArrayList, org.ednovo.gooru.shared.model.analytics.CollectionSummaryMetaDataDo, com.google.gwt.user.client.ui.HTMLPanel) */ @Override public void setTeacherResourceData( ArrayList<UserDataDo> resourcesData, CollectionSummaryMetaDataDo collectionMetaData, HTMLPanel loadingImage) { this.collectionMetaData = collectionMetaData; teacherTabContainer.clearStyles(); teacherTabContainer.setScoredQuestionsHilight(); hideAllPanels(); teacherResourceBreakdownDatapnl.setVisible(true); teacherScoredData.clear(); teacherOpenendedData.clear(); teacherResourceBreakdownData.clear(); questionsData.clear(); openendedData.clear(); collectionProgressCount = 0; questionRowIndex.clear(); resourceRowIndex.clear(); // Set collection meta data if (collectionMetaData != null) { collectionOverViewWidget.setData(collectionMetaData, true); collectionSummaryWidget.setDataAnalyticsData(collectionMetaData, null); printWidget.add(collectionSummaryWidget); printWidget.add(collectionOverViewWidget); totalTimeSpentlbl.setText(getTimeSpent(collectionMetaData.getAvgTimeSpent())); totalViewlbl.setText(Integer.toString(collectionMetaData.getViews())); totalAvgReactionlbl.clear(); totalAvgReactionlbl.add(new AnalyticsReactionWidget(collectionMetaData.getAvgReaction())); } Collections.sort( resourcesData, new Comparator<UserDataDo>() { public int compare(UserDataDo o1, UserDataDo o2) { Integer obj1 = new Integer(o1.getItemSequence()); Integer obj2 = new Integer(o2.getItemSequence()); return obj1.compareTo(obj2); } }); // This is used for segrate data based on the category for (UserDataDo userDataDo : resourcesData) { if (QUESTION.equalsIgnoreCase(userDataDo.getResourceFormat())) { if (OE.equalsIgnoreCase(userDataDo.getType())) { openendedData.add(userDataDo); } else { questionsData.add(userDataDo); } questionRowIndex.add(collectionProgressCount); } else { resourceData.add(userDataDo); resourceRowIndex.add(collectionProgressCount); } collectionProgressCount++; } this.allData = resourcesData; setScoredQuestionsData(questionsData); setQuestionsPrintData(questionsData); setOpenendedQuestionsData(openendedData); setOpenendedQuestionsPrintData(openendedData); setCollectionBreakDown(resourcesData, loadingImage); setCollectionBreakDownPrintData(resourcesData); }