List of usage examples for com.google.gwt.user.client.ui Label addClickHandler
public HandlerRegistration addClickHandler(ClickHandler handler)
From source file:org.ednovo.gooru.client.mvp.analytics.collectionSummaryTeacher.CollectionSummaryTeacherView.java
License:Open Source License
/** * This method is used to set scored questions data. * @param scoredQuestionsData/*w w w . j av a 2 s . co m*/ * @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)); } } } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.AssessmentsEndView.java
License:Open Source License
@Override public void setQuestionsData(final ArrayList<UserDataDo> result) { loadingImageLabel.setVisible(false); questionsTable.setVisible(true);// w w w . ja v a 2 s . c o m questionsTable.clear(); if (isTableToDestroy) { isTableToDestroy = false; destoryTables(); } if (result.size() > 0) { final AdvancedFlexTable adTable = new AdvancedFlexTable(); adTable.removeAllRows(); adTable.getElement().setId("report-student-assessment-report"); adTable.addStyleName("table table-bordered reportTableStyle"); questionsTable.add(adTable); Label heading1 = new Label(i18n.GL3259()); Label heading2 = new Label(i18n.GL0308()); Label heading3 = new Label(i18n.GL0315()); Label heading4 = new Label(i18n.GL2288()); Label heading5 = new Label(i18n.GL2084()); Label heading6 = new Label(i18n.GL3271()); heading1.addStyleName("headingLabel"); heading2.addStyleName("headingLabel"); heading3.addStyleName("headingLabel"); heading4.addStyleName("headingLabel"); heading5.addStyleName("headingLabel"); heading6.addStyleName("headingLabel"); adTable.setHeaderWidget(0, heading1); adTable.setHeaderWidget(1, heading2); adTable.setHeaderWidget(2, heading3); adTable.setHeaderWidget(3, heading4); adTable.setHeaderWidget(4, heading5); adTable.setHeaderWidget(5, heading6); for (int i = 0; i < result.size(); i++) { Label questionTitle = new Label( AnalyticsUtil.html2text(result.get(i).getTitle() != null ? result.get(i).getTitle() : "")); questionTitle.setStyleName(STYLE_TABLE_CENTER); questionTitle.setStyleName(STYLE_TXTLEFT); adTable.setWidget(i, 0, new Label(String.valueOf(i + 1))); adTable.setWidget(i, 1, questionTitle); int noOfAttempts = result.get(i).getAttempts(); String scoreStatus = result.get(i).getStatus(); //Set Answer choices String questionType = result.get(i).getType(); if (questionType.equalsIgnoreCase("HS")) { questionType = result.get(i).getQuestionType(); } if (MC.equalsIgnoreCase(questionType) || TF.equalsIgnoreCase(questionType) || TSLASHF.equalsIgnoreCase(questionType)) { Label anserlbl = new Label(); if (result.get(i).getMetaData() != null && result.get(i).getOptions() != null) { Map<String, Integer> authorObject = result.get(i).getOptions(); for (Map.Entry<String, Integer> entry : authorObject.entrySet()) { String userSelectedOption = entry.getKey(); // int ansStatus=entry.getValue(); if (userSelectedOption != null) { anserlbl.setText(userSelectedOption); if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts == 1) { anserlbl.getElement().getStyle().setColor(CORRECT); } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts > 1) { anserlbl.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } else { anserlbl.getElement().getStyle().setColor(INCORRECT); } } } } anserlbl.setStyleName(STYLE_TABLE_CENTER); adTable.setWidget(i, 2, anserlbl); } else if (FIB.equalsIgnoreCase(questionType)) { VerticalPanel answerspnl = new VerticalPanel(); if (result.get(i).getMetaData() != null && result.get(i).getOptions() != null) { String answerTextFormat = ""; String[] answersArry = null; ArrayList<MetaDataDo> questionList = result.get(i).getMetaData(); for (MetaDataDo metaDataDo : questionList) { String answerText = ""; if ((metaDataDo.getAnswerText() != null)) { String text = StringUtil.removeAllHtmlCss(removeHtmlTags( InfoUtil.removeQuestionTagsOnBoldClick(metaDataDo.getAnswerText()))); answerText = text; } answerTextFormat += '[' + answerText + ']'; if (questionList.size() != metaDataDo.getSequence()) { answerTextFormat += ","; } } String[] userFibOption = null; if (result.get(i).getText() != null) { answersArry = answerTextFormat.split(","); userFibOption = result.get(i).getText().split(","); } if (answersArry != null && userFibOption != null) { for (int k = 0; k < answersArry.length; k++) { Label answerChoice = new Label(); if (answersArry[k] != null && k < userFibOption.length) { if ((answersArry[k].toLowerCase().trim() .equalsIgnoreCase(userFibOption[k].toLowerCase().trim())) && (noOfAttempts == 1)) { answerChoice.setText(userFibOption[k]); answerChoice.getElement().getStyle().setColor(CORRECT); } else if ((answersArry[k].toLowerCase().trim() .equalsIgnoreCase(userFibOption[k].toLowerCase().trim())) && (noOfAttempts > 1)) { answerChoice.setText(userFibOption[k]); answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } else { answerChoice.setText(userFibOption[k]); answerChoice.getElement().getStyle().setColor(INCORRECT); } answerChoice.setStyleName(STYLE_TABLE_CENTER); answerspnl.add(answerChoice); } } } } answerspnl.setStyleName(STYLE_MARGIN_AUTO); adTable.setWidget(i, 2, answerspnl); //data.setValue(i, 2, answerspnl.toString()); } else if (MA.equalsIgnoreCase(questionType)) { VerticalPanel answerspnl = new VerticalPanel(); if (result.get(i).getAnswerObject() != null) { JSONValue value = JSONParser.parseStrict(result.get(i).getAnswerObject()); JSONObject answerObject = value.isObject(); Set<String> keys = answerObject.keySet(); Iterator<String> itr = keys.iterator(); while (itr.hasNext()) { answerspnl.clear(); JSONArray attemptsObj = (JSONArray) answerObject.get(itr.next().toString()); for (int j = 0; j < attemptsObj.size(); j++) { Label answerChoice = new Label(); String showMessage = null; boolean skip = attemptsObj.get(j).isObject().get("skip").isBoolean().booleanValue(); String status = attemptsObj.get(j).isObject().get("status").isString() .stringValue(); String matext = attemptsObj.get(j).isObject().get("text").isString().stringValue(); if (skip == false) { if (ZERO_NUMERIC.equalsIgnoreCase(matext)) { showMessage = i18n.GL_GRR_NO(); } else if (ONE.equalsIgnoreCase(matext)) { showMessage = i18n.GL_GRR_YES(); } answerChoice.setText(showMessage); if (ZERO_NUMERIC.equalsIgnoreCase(status)) { answerChoice.getElement().getStyle().setColor(INCORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts == 1)) { answerChoice.getElement().getStyle().setColor(CORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts > 1)) { answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } } answerChoice.setStyleName(STYLE_TABLE_CENTER); answerspnl.add(answerChoice); } } } answerspnl.setStyleName(STYLE_MARGIN_AUTO); adTable.setWidget(i, 2, answerspnl); } else if (HT_RO.equalsIgnoreCase(questionType) || HT_HL.equalsIgnoreCase(questionType) || HS_TXT.equalsIgnoreCase(questionType) || HS_IMG.equalsIgnoreCase(questionType)) { if (result.get(i).getAnswerObject() != null && !result.get(i).getStatus().equalsIgnoreCase("skipped")) { Label viewResponselbl = new Label(VIEWRESPONSE); viewResponselbl.setStyleName("summaryViewResponse"); viewResponselbl.getElement().setAttribute("resourceGooruId", result.get(i).getResourceGooruOId()); viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType()); viewResponselbl.getElement().setAttribute("answerObj", result.get(i).getAnswerObject()); viewResponselbl.getElement().setAttribute("attempts", String.valueOf(noOfAttempts)); viewResponselbl.addClickHandler(new SummaryPopupClick(result.get(i))); adTable.setWidget(i, 2, viewResponselbl); } } //Set attempts Label attempts = new Label(i18n.GL2269()); attempts.setStyleName(STYLE_TABLE_CENTER); attempts.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); if (STATUS_INCORRECT.equalsIgnoreCase(scoreStatus)) { adTable.setWidget(i, 3, attempts); adTable.getRowFormatter().addStyleName(i, STYLE_WHITE); } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus)) { Image correctImg = new Image(); correctImg.setUrl(urlDomain + "/images/analytics/tick.png"); adTable.setWidget(i, 3, correctImg); adTable.getRowFormatter().addStyleName(i, STYLE_GREEN); } //Set time spent adTable.setWidget(i, 4, AnalyticsUtil.getTimeStampLabel(result.get(i).getTimeSpent())); //Set reactions int reaction = result.get(i).getReaction(); adTable.setWidget(i, 5, new AnalyticsReactionWidget(reaction)); } // sortAndFixed(); } else { Label erroeMsg = new Label(); erroeMsg.setStyleName(STYLE_ERROR_MSG); erroeMsg.setText(i18n.GL3265()); questionsTable.add(erroeMsg); } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.preview.home.ResourceCurosal.java
License:Open Source License
public ResourceCurosal(Label nextButton, Label previousButton, FlowPanel widgetsPanel, int widgetsCount, int widgetWidth, FlowPanel carosualContainer) { WIDGET_WIDTH = widgetWidth;//from ww w . j a v a2 s. com this.nextButton = nextButton; this.previousButton = previousButton; this.widgetsPanel = widgetsPanel; this.widgetsCount = widgetsCount; this.carosualContainer = carosualContainer; setTotalWidth(); nextButton.addClickHandler(new ShowNextWidgetEvent()); previousButton.addClickHandler(new ShowPreviousWidgetEvent()); nextButton.addMouseOverHandler(new ButtonMouseOverEvent(true)); nextButton.addMouseOutHandler(new ButtonMouseOutEvent(true)); previousButton.addMouseOverHandler(new ButtonMouseOverEvent(false)); previousButton.addMouseOutHandler(new ButtonMouseOutEvent(false)); adjustNextbuttonVisibility(currentMarginLeft); adjustPreviousButtonVisibility(); addWidthCarouselContainer(); Window.addResizeHandler(new ResizeLogicEvent()); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.resource.add.AddResourceAssessmentsView.java
License:Open Source License
public void addDropDownListItem(String collectionName, String collectionId, int collectionItemsSize) { Label dropDownListItem = new Label(collectionName); dropDownListItem.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().dropdownListItemContainer()); dropdownListContainer.add(dropDownListItem); dropDownListItem .addClickHandler(new OnDropdownItemClick(collectionName, collectionId, collectionItemsSize)); }
From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.reports.assessmentreport.AssessmentProgressReportChildView.java
License:Open Source License
@Override public void setQuestionsData(final ArrayList<UserDataDo> result, String contentType) { loadingImageLabel.setVisible(false); questionsTable.setVisible(true);// w w w . ja v a 2 s .com questionsTable.clear(); if (isTableToDestroy) { isTableToDestroy = false; destoryTables(); } if (result.size() > 0) { final AdvancedFlexTable adTable = new AdvancedFlexTable(); adTable.removeAllRows(); adTable.getElement().setId("report-student-assessment-report"); adTable.addStyleName("table table-bordered reportTableStyle"); questionsTable.add(adTable); Label heading1 = new Label(i18n.GL3259()); Label heading2 = new Label(i18n.GL0308()); String heading3Str = i18n.GL0315(); if (contentType.equalsIgnoreCase(OE)) { heading3Str = i18n.GL3262(); } Label heading3 = new Label(heading3Str); String heading4Str = i18n.GL2288(); if (contentType.equalsIgnoreCase(OE)) { heading4Str = i18n.GL3260(); } Label heading4 = new Label(heading4Str); Label heading5 = new Label(i18n.GL2084()); Label heading6 = new Label(i18n.GL3271()); heading1.addStyleName("headingLabel"); heading2.addStyleName("headingLabel"); heading3.addStyleName("headingLabel"); heading4.addStyleName("headingLabel"); heading5.addStyleName("headingLabel"); heading6.addStyleName("headingLabel"); adTable.setHeaderWidget(0, heading1); adTable.setHeaderWidget(1, heading2); adTable.setHeaderWidget(2, heading3); adTable.setHeaderWidget(3, heading4); adTable.setHeaderWidget(4, heading5); adTable.setHeaderWidget(5, heading6); for (int i = 0; i < result.size(); i++) { Label questionTitle = new Label(AnalyticsUtil.html2text(result.get(i).getTitle())); questionTitle.setStyleName(STYLE_TABLE_CENTER); questionTitle.setStyleName(STYLE_TXTLEFT); adTable.setWidget(i, 0, new Label(String.valueOf(result.get(i).getSequence()))); adTable.setWidget(i, 1, questionTitle); int noOfAttempts = result.get(i).getAttempts(); String scoreStatus = result.get(i).getStatus(); //Set Answer choices String questionType = result.get(i).getType(); if (questionType.equalsIgnoreCase("HS")) { questionType = result.get(i).getQuestionType(); } if (MC.equalsIgnoreCase(questionType) || TF.equalsIgnoreCase(questionType) || TSLASHF.equalsIgnoreCase(questionType)) { Label anserlbl = new Label(); if (result.get(i).getMetaData() != null && result.get(i).getOptions() != null) { Map<String, Integer> authorObject = result.get(i).getOptions(); for (Map.Entry<String, Integer> entry : authorObject.entrySet()) { String userSelectedOption = entry.getKey(); // int ansStatus=entry.getValue(); if (userSelectedOption != null) { anserlbl.setText(userSelectedOption); if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts == 1) { anserlbl.getElement().getStyle().setColor(CORRECT); } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus) && noOfAttempts > 1) { anserlbl.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } else { anserlbl.getElement().getStyle().setColor(INCORRECT); } } } } anserlbl.setStyleName(STYLE_TABLE_CENTER); adTable.setWidget(i, 2, anserlbl); } else if (FIB.equalsIgnoreCase(questionType)) { VerticalPanel answerspnl = new VerticalPanel(); if (result.get(i).getAnswerObject() != null) { JSONValue value = JSONParser.parseStrict(result.get(i).getAnswerObject()); JSONObject answerObject = value.isObject(); Set<String> keys = answerObject.keySet(); Iterator<String> itr = keys.iterator(); while (itr.hasNext()) { answerspnl.clear(); JSONArray attemptsObj = (JSONArray) answerObject.get(itr.next().toString()); for (int j = 0; j < attemptsObj.size(); j++) { Label answerChoice = new Label(); boolean skip = attemptsObj.get(j).isObject().get("skip").isBoolean().booleanValue(); String status = attemptsObj.get(j).isObject().get("status").isString() .stringValue(); String fibtext = attemptsObj.get(j).isObject().get("text").isString().stringValue(); if (skip == false) { answerChoice.setText(fibtext); if (ZERO_NUMERIC.equalsIgnoreCase(status)) { answerChoice.getElement().getStyle().setColor(INCORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts == 1)) { answerChoice.getElement().getStyle().setColor(CORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts > 1)) { answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } } answerChoice.setStyleName(STYLE_TABLE_CENTER); answerspnl.add(answerChoice); } } } answerspnl.setStyleName(STYLE_MARGIN_AUTO); adTable.setWidget(i, 2, answerspnl); //data.setValue(i, 2, answerspnl.toString()); } else if (MA.equalsIgnoreCase(questionType)) { VerticalPanel answerspnl = new VerticalPanel(); if (result.get(i).getAnswerObject() != null) { JSONValue value = JSONParser.parseStrict(result.get(i).getAnswerObject()); JSONObject answerObject = value.isObject(); Set<String> keys = answerObject.keySet(); Iterator<String> itr = keys.iterator(); while (itr.hasNext()) { answerspnl.clear(); JSONArray attemptsObj = (JSONArray) answerObject.get(itr.next().toString()); for (int j = 0; j < attemptsObj.size(); j++) { Label answerChoice = new Label(); String showMessage = null; boolean skip = attemptsObj.get(j).isObject().get("skip").isBoolean().booleanValue(); String status = attemptsObj.get(j).isObject().get("status").isString() .stringValue(); String matext = attemptsObj.get(j).isObject().get("text").isString().stringValue(); if (skip == false) { if (ZERO_NUMERIC.equalsIgnoreCase(matext)) { showMessage = i18n.GL_GRR_NO(); } else if (ONE.equalsIgnoreCase(matext)) { showMessage = i18n.GL_GRR_YES(); } answerChoice.setText(showMessage); if (ZERO_NUMERIC.equalsIgnoreCase(status)) { answerChoice.getElement().getStyle().setColor(INCORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts == 1)) { answerChoice.getElement().getStyle().setColor(CORRECT); } else if (ONE.equalsIgnoreCase(status) && (noOfAttempts > 1)) { answerChoice.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); } } answerChoice.setStyleName(STYLE_TABLE_CENTER); answerspnl.add(answerChoice); } } } answerspnl.setStyleName(STYLE_MARGIN_AUTO); adTable.setWidget(i, 2, answerspnl); } else if (HT_RO.equalsIgnoreCase(questionType) || HT_HL.equalsIgnoreCase(questionType) || HS_TXT.equalsIgnoreCase(questionType) || HS_IMG.equalsIgnoreCase(questionType) || OE.equalsIgnoreCase(questionType)) { if (result.get(i).getAnswerObject() != null && !result.get(i).getStatus().equalsIgnoreCase("skipped")) { Label viewResponselbl = new Label(VIEWRESPONSE); viewResponselbl.setStyleName("summaryViewResponse"); viewResponselbl.getElement().setAttribute("resourceGooruId", result.get(i).getResourceGooruOId()); viewResponselbl.getElement().setAttribute("questionType", result.get(i).getType()); viewResponselbl.getElement().setAttribute("answerObj", result.get(i).getAnswerObject()); viewResponselbl.getElement().setAttribute("attempts", String.valueOf(noOfAttempts)); viewResponselbl.addClickHandler(new SummaryPopupClick(result.get(i))); adTable.setWidget(i, 2, viewResponselbl); } } //Set attempts Label attempts = new Label(i18n.GL2269()); attempts.setStyleName(STYLE_TABLE_CENTER); attempts.getElement().getStyle().setColor(ONMULTIPULEATTEMPTS); if (OE.equalsIgnoreCase(questionType)) { Label completion = new Label(); completion.setStyleName("alignCenterAndBackground"); if (noOfAttempts > 0) { completion.setText(i18n.GL_GRR_YES()); } else { completion.setText(i18n.GL_GRR_NO()); } adTable.setWidget(i, 3, completion); } else { if (STATUS_INCORRECT.equalsIgnoreCase(scoreStatus)) { adTable.setWidget(i, 3, attempts); adTable.getRowFormatter().addStyleName(i, STYLE_WHITE); } else if (STATUS_CORRECT.equalsIgnoreCase(scoreStatus)) { Image correctImg = new Image(); correctImg.setUrl(urlDomain + "/images/analytics/tick.png"); adTable.setWidget(i, 3, correctImg); adTable.getRowFormatter().addStyleName(i, STYLE_GREEN); } } //Set time spent adTable.setWidget(i, 4, AnalyticsUtil.getTimeStampLabel(result.get(i).getTimeSpent())); //Set reactions int reaction = result.get(i).getReaction(); adTable.setWidget(i, 5, new AnalyticsReactionWidget(reaction)); } // sortAndFixed(); } else { setErrorData(questionsTable); } }
From source file:org.ednovo.gooru.client.mvp.classpage.teach.reports.unit.TeachUnitReportChildView.java
License:Open Source License
@Override public void setAssessmentTableData(ArrayList<PlanProgressDo> userList) { boolean isCollection = false; String contentView = AppClientFactory.getPlaceManager().getRequestParameter( UrlNavigationTokens.TEACHER_CLASSPAGE_CONTENT, UrlNavigationTokens.TEACHER_CLASSPAGE_ASSESSMENT); if (contentView.equalsIgnoreCase(UrlNavigationTokens.TEACHER_CLASSPAGE_COLLECTION)) { isCollection = true;//from w ww . j a v a2s . c o m } unitTablePanel.clear(); assessmentTableWidget.getElement().setId("unit-table-report-data-id"); unitTablePanel.add(assessmentTableWidget); unitTablePanel.getElement().setId("courseTableID"); unitTablePanel.getElement().setClassName("scrollTBL"); assessmentTableWidget.addStyleName("table table-bordered tableStyle"); int rowCount = userList.size(); Label studentNameLbl = new Label(""); studentNameLbl.setStyleName(""); studentNameLbl.setWidth("100px"); assessmentTableWidget.setWidget(0, 1, studentNameLbl); assessmentTableWidget.getWidget(0, 1).getElement().getParentElement().getStyle() .setBackgroundColor("#f8fafb"); for (int rowWidgetCount = 0; rowWidgetCount < rowCount; rowWidgetCount++) { String color = "#fff"; if (rowWidgetCount % 2 == 1) { color = "#f8fafb"; } int columnWidgetCount = 0; if (columnWidgetCount == 0) { Anchor studentName = new Anchor(userList.get(rowWidgetCount).getUserName()); // studentName.setStyleName("myclasses-mastery-unit-cell-style"); studentName.addClickHandler(new StudentUnitView(userList.get(rowWidgetCount).getUserName(), userList.get(rowWidgetCount).getUserUId())); assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, studentName); assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor(color); if (rowWidgetCount == 0) { HTML studentNameTitle = new HTML("Student"); assessmentTableWidget.setWidget(rowWidgetCount + 1, columnWidgetCount, studentNameTitle); assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor("#f8fafb"); assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement() .getParentElement().getStyle().setFontWeight(FontWeight.BOLD); } columnWidgetCount++; } ArrayList<PlanProgressDo> lessonList = userList.get(rowWidgetCount).getUsageData(); int lessonCount = lessonList.size(); for (int lessonWidgetCount = 0; lessonWidgetCount < lessonCount; lessonWidgetCount++) { ArrayList<PlanProgressDo> collectionList = lessonList.get(lessonWidgetCount).getUsageData(); int collectionCount = collectionList.size(); for (int collectionWidgetCount = 0; collectionWidgetCount < collectionCount; collectionWidgetCount++) { if (rowWidgetCount == 0) { String A_STRING = "A"; if (isCollection) { A_STRING = "C"; } Label scoreLblTitle = new Label(A_STRING + (collectionWidgetCount + 1)); scoreLblTitle.setWidth("80px"); String type = collectionList.get(collectionWidgetCount).getType(); if (type != null && type.equalsIgnoreCase("assessment/url")) { scoreLblTitle .addMouseOverHandler(new MouseOverShowClassCodeToolTip("External Assessment")); scoreLblTitle.addMouseOutHandler(new MouseOutHideToolTip()); } else { scoreLblTitle.addStyleName("myclasses-mastery-collection-cell-style"); scoreLblTitle.addClickHandler( new CollectionAssessmentView(lessonList.get(lessonWidgetCount).getGooruOId(), collectionList.get(collectionWidgetCount).getGooruOId(), contentView, A_STRING + " " + (collectionWidgetCount + 1) + " " + collectionList.get(collectionWidgetCount).getTitle())); } assessmentTableWidget.setWidget(rowWidgetCount + 1, columnWidgetCount, scoreLblTitle); assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor("#f8fafb"); assessmentTableWidget.getWidget(rowWidgetCount + 1, columnWidgetCount).getElement() .getParentElement().getStyle().setFontWeight(FontWeight.BOLD); } final Label contentLabel = new Label(""); if (isCollection) { contentLabel.setText(StringUtil .getFormattedDate(collectionList.get(collectionWidgetCount).getTimeSpent(), "")); assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, contentLabel); assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor(color); } else { int score = collectionList.get(collectionWidgetCount).getScoreInPercentage(); int views = collectionList.get(collectionWidgetCount).getViews(); String scoreStr = "--"; if (views > 0 && score >= 0) { scoreStr = score + "%"; } contentLabel.setText(scoreStr); contentLabel.setWidth("80px"); if (!scoreStr.equalsIgnoreCase("--")) { contentLabel.setStyleName("cursorPointer"); contentLabel.addClickHandler( new StudentPlaySummary(userList.get(rowWidgetCount).getUserName(), userList.get(rowWidgetCount).getUserUId(), lessonList.get(lessonWidgetCount).getGooruOId(), collectionList.get(collectionWidgetCount).getGooruOId(), collectionList.get(collectionWidgetCount).getType())); } assessmentTableWidget.setWidget(rowWidgetCount + 2, columnWidgetCount, contentLabel); if (score >= 0 && score <= 100) { if (views > 0) { assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement() .getParentElement().setClassName(StringUtil.getHighlightStyle(score)); } else { assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor(color); } } else { assessmentTableWidget.getWidget(rowWidgetCount + 2, columnWidgetCount).getElement() .getParentElement().getStyle().setBackgroundColor(color); } } columnWidgetCount++; } } } if (userList != null && userList.size() > 0 && userList.get(0) != null) { int lessonSize = userList.get(0).getUsageData().size(); for (int headerColumnCount = 0; headerColumnCount < lessonSize; headerColumnCount++) { int colSpan = 0; PlanProgressDo lessonDo = userList.get(0).getUsageData().get(headerColumnCount); if (lessonDo.getUsageData().size() > 0) { HTML unitName = new HTML("L" + (headerColumnCount + 1) + " " + lessonDo.getTitle()); unitName.setStyleName(""); assessmentTableWidget.setWidget(0, headerColumnCount + 1, unitName); assessmentTableWidget.getWidget(0, headerColumnCount + 1).getElement().getParentElement() .getStyle().setBackgroundColor("#f8fafb"); assessmentTableWidget.getWidget(0, headerColumnCount + 1).getElement().getParentElement() .getStyle().setFontWeight(FontWeight.BOLD); colSpan = colSpan + lessonDo.getUsageData().size(); assessmentTableWidget.getFlexCellFormatter().setColSpan(0, (headerColumnCount + 1), colSpan); } } } }
From source file:org.ednovo.gooru.client.mvp.classpages.ClasspageListVc.java
License:Open Source License
/** * /*w w w. ja v a2 s .c om*/ * @function createClasspageTitleLabel * * @created_date : Aug 15, 2013 * * @description * * * @parm(s) : @param classpageTitle * @parm(s) : @param classpageId * @parm(s) : @return * * @return : Label * * @throws : <Mentioned if any exceptions> * * * * */ private Label createClasspageTitleLabel(String classpageTitle, final String classpageId, boolean isStatic) { Label titleLabel = null; if (classpageTitle != null) { if (classpageTitle.length() >= 30) { titleLabel = new Label(classpageTitle.substring(0, 30)); } else { titleLabel = new Label(classpageTitle); } titleLabel.getElement().setAttribute("id", classpageId); if (!isStatic) { titleLabel.setStyleName(ClasspageListPopupViewCBundle.INSTANCE.css().classpageTitleHeader()); } else { titleLabel .setStyleName(ClasspageListPopupViewCBundle.INSTANCE.css().classpageLoadingOnPagination()); } // Set Click event for title titleLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { OpenClasspageEdit(classpageId); hide(); } }); } return titleLabel; }
From source file:org.ednovo.gooru.client.mvp.classpages.edit.AssignmentProgressVc.java
License:Open Source License
public Label createLabel(String title) { Label lblLabel = new Label(); lblLabel.setText(title);/*from w ww . j a va 2s . c om*/ lblLabel.getElement().addClassName(res.css().myFolderCollectionFolderDropdown()); lblLabel.getElement().addClassName(res.css().myFolderCollectionFolderVideoTitle()); lblLabel.getElement().setAttribute("alt", title); lblLabel.getElement().setAttribute("title", title); lblLabel.getElement().setAttribute("id", title); lblLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Label lbl = (Label) event.getSource(); resourceCategoryLabel.setText(lbl.getText()); resourceCategoryLabel.getElement().setAttribute("alt", lbl.getText()); resourceCategoryLabel.getElement().setAttribute("title", lbl.getText()); AppClientFactory.getInjector().getClasspageService().v2ChangeAssignmentSequence("", classpageItemDo.getCollectionItemId(), Integer.parseInt(lbl.getText()), new SimpleAsyncCallback<Void>() { @Override public void onSuccess(Void result) { resourceTypePanel.setVisible(resourceTypePanel.isVisible() ? false : true); AppClientFactory.fireEvent(new ResetProgressEvent()); } }); } }); return lblLabel; }
From source file:org.ednovo.gooru.client.mvp.classpages.studentView.StudentAssignmentView.java
License:Open Source License
public void showPaginationButton() { paginationFocPanel.clear();/*from ww w. j a v a2s . c om*/ Label seeMoreLabel = new Label(GL0508); seeMoreLabel.addClickHandler(new PaginationEvent()); seeMoreLabel.setStyleName(EditClasspageCBundle.INSTANCE.css().paginationPanel()); paginationFocPanel.add(seeMoreLabel); }
From source file:org.ednovo.gooru.client.mvp.classpages.tabitem.assignments.AssignmentsTabView.java
License:Open Source License
/** * This method is used to get the list of collection * /* ww w. j a v a 2 s . c om*/ */ @Override public void onPostUserCollections(List<CollectionDo> result) { totalSize = result.size(); totalSelfCollection = totalSelfCollection + result.size(); if (totalSelfCollection == 0) { addCollections.collectionFirstElement.setVisible(false); addCollections.loadingPanel.setVisible(false); addCollections.btnCancel.setVisible(true); addCollections.btnCancel.getElement().setAttribute("style", "margin-left:37px"); addCollections.nocollectionMsgLabel.setVisible(true); } if (totalSize == 0 && totalSelfCollection != 0) { addCollections.addLabel.setVisible(true); addCollections.btnCancel.setVisible(true); addCollections.loadingPanel.setVisible(false); } int count = 1; collectionItems = new ArrayList<Integer>(); collectionItems.add(-1); for (CollectionDo collection : result) { if (!collection.getCollectionType().toString().trim().equalsIgnoreCase("folder")) { final Label titleLabel = new Label(collection.getTitle()); titleLabel .setStyleName(CollectionEditResourceCBundle.INSTANCE.css().copyPopUpResourceListBoxText()); titleLabel.getElement().setAttribute("id", collection.getGooruOid()); addCollections.htmlScrollPanel.add(titleLabel); count++; addCollections.addLabel.setVisible(true); addCollections.btnCancel.setVisible(true); // addCollections.addLabel.getElement().getStyle().setVisibility(Visibility.VISIBLE); // addCollections.btnCancel.getElement().getStyle().setVisibility(Visibility.VISIBLE); addCollections.loadingPanel.setVisible(false); addCollections.nocollectionMsgLabel.setVisible(false); int collectionItemDoSize = collection.getCollectionItems().size(); collectionItems.add(collectionItemDoSize); addCollections.setCollectionItemDoSize(collectionItems); titleLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addCollections.getMandatorySelectCollectionLbl().setVisible(false); if (titleLabel.getText().length() >= 40) { addCollections.collectionFirstElement .setText(titleLabel.getText().substring(0, 40) + "..."); addCollections.collectionFirstElement.getElement().setAttribute("id", titleLabel.getElement().getAttribute("id")); } else { addCollections.collectionFirstElement.setText(titleLabel.getText()); addCollections.collectionFirstElement.getElement().setAttribute("id", titleLabel.getElement().getAttribute("id")); } addCollections.copyPopUpScrollHtmlPanel.getElement().getStyle() .setVisibility(Visibility.HIDDEN); collId = addCollections.collectionFirstElement.getElement().getId(); } }); } } /** * to get more collection after scroll down, if collection item is more * than 20 */ addCollections.copyPopUpScrollHtmlPanel.addScrollHandler(new ScrollHandler() { @Override public void onScroll(ScrollEvent event) { if (addCollections.copyPopUpScrollHtmlPanel .getVerticalScrollPosition() == addCollections.copyPopUpScrollHtmlPanel .getMaximumVerticalScrollPosition() && totalSize >= 20) { addCollections.addLabel.getElement().setAttribute("style", "display:none"); addCollections.addLabel.setVisible(false); addCollections.btnCancel.setVisible(false); addCollections.loadingPanel.setVisible(true); addCollections.nocollectionMsgLabel.setVisible(false); addCollections.loadingPanel.getElement().setAttribute("style", "display:block"); addCollections.loadingPanel.getElement().setAttribute("style", "margin-top:18px"); pageNumber = pageNumber + 1; getPresenter().getUserColletionsList(pageSize, pageNumber); } } }); // Set current collection as selected // for (int i = 0; i < result.size(); i++) { // // if (addCollections.copyPopupListBox.getValue(i).equalsIgnoreCase( // collectionItemDo.getCollection().getGooruOid())) { // // addCollections.copyPopupListBox.setItemSelected(i, true); // collId = collectionItemDo.getCollection().getGooruOid(); // break; // // } // } }