org.telscenter.pas.steps
Class ChallengeQuestion

java.lang.Object
  extended by java.beans.beancontext.BeanContextChildSupport
      extended by org.telscenter.pas.beans.PasStep
          extended by org.telscenter.pas.steps.Assessment
              extended by org.telscenter.pas.steps.ChallengeQuestion
All Implemented Interfaces:
java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextChildComponentProxy, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServicesListener, java.io.Serializable, java.util.EventListener, net.sf.sail.common.beansupport.ITitleAware, IAuthorNotation, IHelp, IWorkReporter

public class ChallengeQuestion
extends Assessment

Implement of the Pas step type, ChallengeQuestion.

Author:
Jerry Cheung, Hiroki Terashima, turadg
See Also:
Serialized Form

Field Summary
static java.lang.String[] indexes
           
 
Fields inherited from class org.telscenter.pas.steps.Assessment
agentService, assessmentItem, responseDeclarationToSocks, responses, sessionService
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Constructor Summary
ChallengeQuestion()
           
 
Method Summary
 java.lang.String correctAnswer()
          TODO: refactor into utils along w/ lastAnswer retrieves correct answer based on the inline feedback
protected  java.lang.String extractBody(java.lang.String prompt)
          Extracts the text in between the ...
protected  java.lang.String getAnswer(ResponseDeclaration rd, BlockInteraction bi)
           
 java.lang.String[] getAttemptIndexes()
           
 java.lang.String getChoiceOrdering()
           
 java.awt.Component getComponent()
          The entry method to CQ.
protected  java.lang.String getCorrectAnswerReport(int sNumAttempts, java.util.List<java.lang.Integer> scores, java.lang.String[] indexes)
          provides scorereport to be shown for correct answer by stating how many attempts (tries) have been made and how many points have been earned
 java.lang.String getCorrectFeedbackInline()
          returns the inline feedback if the chosen answer is the correct one
 ChallengeQuestionUI getCqUI()
           
 java.util.Map<java.lang.String,java.lang.String> getEntityToPromptMap()
          Returns a mapping(s) for this step Note that steps like Note can have multiple Rims because if it were a multi-part note step.
protected  java.lang.String getFeedbackContentFromChoices(java.util.List<SimpleChoice<java.lang.String>> choices)
          returns the inline feedback from the choices, choosing the one for the correct answer if the number of points for this attempt is greater than 0, the feedback would include saying that "you answered on the nth try for x points" where n is the number of attempts the user has made, and x is the number of points allotted for that attempt on a particular question, otherwise the part about the points is not included.
 PasStep getGotoStep()
           
 int getGotoStepIndex()
           
protected  BlockInteraction getInteractionByResponseDeclaration(ResponseDeclaration rd)
           
 net.sf.sail.core.entity.ISock<java.lang.String> getLastAnswerSock()
           
 java.lang.String getLastFeedbackInline(Assessment assessment)
          returns the inline feedback for the last answer chosen
 net.sf.sail.core.entity.ISockEntry<java.lang.String> getLastGotoStepVisitedSockEntry()
          Checks if gotoStep has ever been visited
 int getMaxAttempts()
           
 INavigationService getNavigationService()
           
 PasProject getPasProject()
           
 com.lowagie.text.pdf.PdfPCell getReportForLearnerPDF(boolean withAnnotations)
          Returns a PDF-version of the report
 java.lang.String getScoreReport()
           
 java.util.List<java.lang.Integer> getScores()
           
 java.lang.String getScoringMode()
           
 java.util.List<javax.swing.JPanel> getStepParts()
           
 java.lang.String getType()
          Replaced by hoverString property
 boolean isGotoStepEverVisited()
          Checks if gotoStep has ever been visited
 boolean isGotoStepVisitedSinceLastWrongAnswer()
          Checks if gotoStep has been visited between the last time this step was visited and now This must only be called if the last answer was wrong
 boolean isStudentAnswerCorrect(net.sf.sail.core.entity.ISock<java.lang.String> studentAnswerSock)
          Checks if student's answer in the provided sock is correct
 java.lang.String lastAnswer()
          retrieves last answer based on the data from student sock
 int numStudentAttempts()
           
 void setChoiceOrdering(java.lang.String choiceOrdering)
           
 void setCqUI(ChallengeQuestionUI cqUI)
           
 void setGotoStep(PasStep gotoStep)
           
 void setGotoStepIndex(int gotoStepIndex)
           
 void setMaxAttempts(int maxAttempts)
           
 void setNavigationService(INavigationService navigationService)
           
 void setPasProject(PasProject pasProject)
           
 void setScores(java.util.List<java.lang.Integer> scores)
           
 void setScoringMode(java.lang.String scoringMode)
           
 
Methods inherited from class org.telscenter.pas.steps.Assessment
bindResponsesToSocks, consumeService, getAgentService, getAssessmentItem, getCurrentAnswers, getCurrentPrompts, getCurrentStepParts, getInteractionByResponseDeclaration, getPossibleScore, getReportForLearner, getReportForLearner, getReportForLearnerPDF, getReportForLearnerWithAnnotations, getReportForLearnerWithAnnotations, getResponseDeclarationToSocks, getResponses, getSessionService, getStudentAnswer, getTabbed, initStepParts, isInjectPrompt, isSubmitted, lastAnswer, saveAssessmentItem, saveData, setAssessmentItem, setInjectPrompt, setPossibleScore, setSubmitted, setTabbed
 
Methods inherited from class org.telscenter.pas.beans.PasStep
addPropertyChangeListener, afterComponentAdded, beforeSessionStart, getAuthorNotes, getHelpId, getHintSet, getHoverString, getTitle, hasHints, initializeBeanContextResources, initializePasStep, removePropertyChangeListener, serviceAvailable, setAuthorNotes, setBeanContext, setHintSet, setHoverString, setTitle, stepEnter, stepExit, toString
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceRevoked, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

indexes

public static final java.lang.String[] indexes
Constructor Detail

ChallengeQuestion

public ChallengeQuestion()
Method Detail

getType

public java.lang.String getType()
Description copied from class: PasStep
Replaced by hoverString property

Specified by:
getType in class Assessment
Returns:

getComponent

public java.awt.Component getComponent()
The entry method to CQ. This method gets called when the step is visited If the evidence step has not been visited before visiting this CQ step, display a message to go back to the step

Specified by:
getComponent in interface java.beans.beancontext.BeanContextChildComponentProxy
Specified by:
getComponent in class Assessment
Returns:
visual representation of the Challenge Question

getReportForLearnerPDF

public com.lowagie.text.pdf.PdfPCell getReportForLearnerPDF(boolean withAnnotations)
Returns a PDF-version of the report

See Also:
org.telscenter.pas.steps.ChallengeQuestion#getReportForLearnerPDF()

isGotoStepEverVisited

public boolean isGotoStepEverVisited()
Checks if gotoStep has ever been visited

Returns:
true iff the gotoStep has ever been visited (at least once) before visiting this Challenge Question step

getLastGotoStepVisitedSockEntry

public net.sf.sail.core.entity.ISockEntry<java.lang.String> getLastGotoStepVisitedSockEntry()
Checks if gotoStep has ever been visited

Returns:
true iff the gotoStep has ever been visited (at least once) before visiting this Challenge Question step

isGotoStepVisitedSinceLastWrongAnswer

public boolean isGotoStepVisitedSinceLastWrongAnswer()
Checks if gotoStep has been visited between the last time this step was visited and now This must only be called if the last answer was wrong

Returns:
true iff the gotoStep has been visited (at least once) between the last time this ChallengeQuestion step was visited until now

numStudentAttempts

public int numStudentAttempts()
Returns:
number of attempts that the student has made

getAnswer

protected java.lang.String getAnswer(ResponseDeclaration rd,
                                     BlockInteraction bi)
Parameters:
rd -
bi -
Returns:
answer - either stored in socks or whatever is retrieved from choice interaction

correctAnswer

public java.lang.String correctAnswer()
TODO: refactor into utils along w/ lastAnswer retrieves correct answer based on the inline feedback

Returns:
corrAnswer

lastAnswer

public java.lang.String lastAnswer()
retrieves last answer based on the data from student sock


getLastAnswerSock

public net.sf.sail.core.entity.ISock<java.lang.String> getLastAnswerSock()
Parameters:
rd -
Returns:
sock last answer from sock

isStudentAnswerCorrect

public boolean isStudentAnswerCorrect(net.sf.sail.core.entity.ISock<java.lang.String> studentAnswerSock)
Checks if student's answer in the provided sock is correct

Parameters:
studentAnswerSock - the Sock containing the student's answer
Returns:
true iff the first item in the sock contains a correct answer response

getInteractionByResponseDeclaration

protected BlockInteraction getInteractionByResponseDeclaration(ResponseDeclaration rd)
Parameters:
rd -
Returns:

getStepParts

public java.util.List<javax.swing.JPanel> getStepParts()
Returns:
stepParts

getScoringMode

public java.lang.String getScoringMode()
Returns:
scoringMode

setScoringMode

public void setScoringMode(java.lang.String scoringMode)
Parameters:
scoringMode - how the scoring is done - quantitative, qualitative, or off

getScores

public java.util.List<java.lang.Integer> getScores()
Returns:
the scores

setScores

public void setScores(java.util.List<java.lang.Integer> scores)
Parameters:
scores - the scores to set

getGotoStepIndex

public int getGotoStepIndex()
Returns:
the gotoStepIndex

setGotoStepIndex

public void setGotoStepIndex(int gotoStepIndex)
Parameters:
gotoStepIndex - the gotoStepIndex to set

getGotoStep

public PasStep getGotoStep()
Returns:
the gotoStep

setGotoStep

public void setGotoStep(PasStep gotoStep)
Parameters:
gotoStep - the step to go to when reviewing evidence

getScoreReport

public java.lang.String getScoreReport()
Returns:
scoreReport

getCorrectAnswerReport

protected java.lang.String getCorrectAnswerReport(int sNumAttempts,
                                                  java.util.List<java.lang.Integer> scores,
                                                  java.lang.String[] indexes)
provides scorereport to be shown for correct answer by stating how many attempts (tries) have been made and how many points have been earned

Parameters:
sNumAttempts -
scores -
initHtml -
Returns:
reportText

getAttemptIndexes

public java.lang.String[] getAttemptIndexes()
Returns:
the indexes of the attempts

getMaxAttempts

public int getMaxAttempts()
Returns:
the maxAttempts

setMaxAttempts

public void setMaxAttempts(int maxAttempts)
Parameters:
maxAttempts - the maxAttempts to set

getCqUI

public ChallengeQuestionUI getCqUI()
Returns:
the cqUI

setCqUI

public void setCqUI(ChallengeQuestionUI cqUI)
Parameters:
cqUI - the cqUI to set

setNavigationService

public void setNavigationService(INavigationService navigationService)
Parameters:
navigationService - navigation service for being able to retrieve, visit, and update steps in the navigation task panel

getNavigationService

public INavigationService getNavigationService()
Returns:
the navigationService

getPasProject

public PasProject getPasProject()
Returns:
the pasProject

setPasProject

public void setPasProject(PasProject pasProject)
Parameters:
pasProject - the pasProject to set

setChoiceOrdering

public void setChoiceOrdering(java.lang.String choiceOrdering)
Parameters:
choiceOrdering - - sets the variable for whether to reorder choices or not

getChoiceOrdering

public java.lang.String getChoiceOrdering()
Returns:
choiceOrdering

getCorrectFeedbackInline

public java.lang.String getCorrectFeedbackInline()
returns the inline feedback if the chosen answer is the correct one

Returns:
newFeedbackInline

getFeedbackContentFromChoices

protected java.lang.String getFeedbackContentFromChoices(java.util.List<SimpleChoice<java.lang.String>> choices)
returns the inline feedback from the choices, choosing the one for the correct answer if the number of points for this attempt is greater than 0, the feedback would include saying that "you answered on the nth try for x points" where n is the number of attempts the user has made, and x is the number of points allotted for that attempt on a particular question, otherwise the part about the points is not included.

Returns:
newFeedbackInline

getLastFeedbackInline

public java.lang.String getLastFeedbackInline(Assessment assessment)
returns the inline feedback for the last answer chosen

Returns:
newFeedbackInline

extractBody

protected java.lang.String extractBody(java.lang.String prompt)
Extracts the text in between the ...

Overrides:
extractBody in class Assessment

getEntityToPromptMap

public java.util.Map<java.lang.String,java.lang.String> getEntityToPromptMap()
Description copied from interface: IWorkReporter
Returns a mapping(s) for this step Note that steps like Note can have multiple Rims because if it were a multi-part note step.

Specified by:
getEntityToPromptMap in interface IWorkReporter
Overrides:
getEntityToPromptMap in class Assessment
Returns:
Map rimname<->prompt mapping for this step.
See Also:
IWorkReporter.getEntityToPromptMap()


Copyright © 2004-2008 TELS Center. All Rights Reserved.