/** 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"); }
/* (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); }