Examples of ISIPrompt


Examples of org.cast.isi.data.ISIPrompt

    TreeMap<ISIXmlSection, SortedMap<ISIPrompt, List<ISIResponse>>> responseMap = new TreeMap<ISIXmlSection, SortedMap<ISIPrompt, List<ISIResponse>>>();

    // Fit Responses into Map
    for (ISIResponse r : responseList) {

      ISIPrompt prompt = ((ISIPrompt)r.getPrompt());
      ISIXmlSection section = prompt.getContentElement().getContentLocObject().getSection();
      if (section != null) {
        if (!responseMap.containsKey(section))
          responseMap.put(section, new TreeMap<ISIPrompt, List<ISIResponse>>());
        if (!responseMap.get(section).containsKey(prompt))
          responseMap.get(section).put(prompt, new ArrayList<ISIResponse>());
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

public class ResponseViewerFactory {

  public Component makeResponseViewComponent(
      String wicketId, IModel<ISIResponse> model) {
    ISIResponse response = model.getObject();
    ISIPrompt prompt = (ISIPrompt) response.getPrompt();
    PromptType type = prompt.getType();
    if (type == PromptType.SINGLE_SELECT) {
      return makeXmlComponentViewer(wicketId, prompt);
    }
    else {
      return makeResponseViewer(wicketId, model);
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

      promptId = (parameters.getLong("promptId"));
    }

    // get the prompt for this id
    IModel<Prompt> mPrompt = responseService.getPromptById(promptId);
    ISIPrompt prompt = (ISIPrompt) mPrompt.getObject();

    // Add the crumb trail, link and icon link to the page where this response is located
    String crumbTrail = prompt.getContentElement().getContentLocObject().getSection().getCrumbTrailAsString(1, 1);
    add(new Label("crumbTrail", crumbTrail));
    // TODO: should target link to main window, not in popup
    BookmarkablePageLink<ISIStandardPage> link = new SectionLinkFactory().linkToPage("titleLink", prompt.getContentElement().getContentLocObject().getSection());
    link.add(new Label("title", prompt.getContentElement().getContentLocObject().getSection().getTitle()));
    link.add(new ClassAttributeModifier("sectionLink"));
    add(link);
    add(ISIApplication.get().iconFor(prompt.getContentElement().getContentLocObject().getSection().getSectionAncestor()));   
    add(makeSummary("promptResponseSummary", mPrompt));
   
    // Add the text associated with Prompt
    add(factory.makeQuestionTextComponent("question", prompt));
   
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

   *
   * @param mPrompt
   * @return
   */
  private boolean validAnswers(IModel<Prompt> mPrompt) {
    ISIPrompt prompt = ((ISIPrompt)mPrompt.getObject());
    if (prompt.getType().equals(PromptType.SINGLE_SELECT)) {
      ContentLoc promptLoc = prompt.getContentLoc();
      String xmlId = prompt.getContentElement().getXmlId();
      Element xmlElement = promptLoc.getSection().getElement().getOwnerDocument().getElementById(xmlId);
      NodeList items = xmlElement.getElementsByTagName("item");
       for(int i=0; i < items.getLength(); i++){
         Node node = (Node) items.item(i);
         Element itemElement =  (Element) node;
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

    IModel<List<ISIResponse>> responses =  responseService.getPeriodResponsesForPrompt(mPrompt, ISISession.get().getCurrentPeriodModel());
    return ScoreCounts.forResponses("students", responses);
  }

  protected void addDetailsPanel(IModel<Prompt> mPrompt) {   
    ISIPrompt prompt = ((ISIPrompt)mPrompt.getObject());
    if (prompt.getType().equals(PromptType.SINGLE_SELECT)) {
      ContentLoc location = prompt.getContentElement().getContentLocObject();
      ISIXmlSection section = location.getSection();
      String xmlId = prompt.getContentElement().getXmlId();
      ISIXmlComponent xml = new ISIXmlComponent("details", new XmlSectionModel(section), "compare-responses");
      xml.setTransformParameter(FilterElements.XPATH, String.format("//dtb:responsegroup[@id='%s']", xmlId));
      xml.setOutputMarkupId(true);
      add (xml);
    } else {
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

  protected Integer getScore() {
    List<Response> responses = getResponses();
    if (responses.isEmpty())
      return null;
    Response response = responses.get(0);
    ISIPrompt prompt = (ISIPrompt) response.getPrompt();
    PromptType type = prompt.getType();
    if (type.equals(PromptType.SINGLE_SELECT))
      return response.getResponseData().getScore();
    else
      return response.getScore();
  }
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

    // to the notebook most recently.
    ISIXmlSection currentChapterSection = currentChapterLoc.getSection();
    for (ISIResponse r : responseList.getObject()) {

      // check if the response is a child of the current chapter, if so add it to the response map
      ISIPrompt prompt = (ISIPrompt) r.getPrompt();
      ISIXmlSection promptSection = new ContentLoc(prompt.getContentElement().getContentLocation()).getSection();
     
      if (promptSection != null) {
        if (currentChapterSection.isAncestorOf(promptSection)) {
          if (responseMap.containsKey(r.getPrompt()))
            responseMap.get(r.getPrompt()).add(r);
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

    RepeatingView noteRepeater = new RepeatingView("noteRepeater");
    add(noteRepeater.setVisible(!responseMap.isEmpty()));

    for (Entry<ISIPrompt, List<ISIResponse>> entry : responseMap.entrySet()) {
      ISIPrompt currentPrompt = entry.getKey();

      WebMarkupContainer promptGroup = new WebMarkupContainer(noteRepeater.newChildId());
      noteRepeater.add(promptGroup);

      String crumbTrail = currentPrompt.getContentElement().getContentLocObject().getSection().getCrumbTrailAsString(1, 1);           
      promptGroup.add(new Label("responseHeader", crumbTrail));

      // Prompt Icon
      promptGroup.add(ISIApplication.get().iconFor(
          currentPrompt.getContentElement().getContentLocObject().getSection().getSectionAncestor()));

      // Add the title and link to the page where this note is located
      BookmarkablePageLink<ISIStandardPage> link = new SectionLinkFactory().linkToPage("titleLink", currentPrompt.getContentElement().getContentLocObject().getSection());
      link.add(new Label("sectionTitle", currentPrompt.getContentElement().getContentLocObject().getSection().getTitle()));
      link.add(new ClassAttributeModifier("sectionLink"));
      promptGroup.add(link);

      // Show the score
      promptGroup.add(new StudentScorePanel("responseScore", getModels(entry.getValue())));
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

  }


  private ListView<ISIResponse> makeResponseListView(
      Entry<ISIPrompt, List<ISIResponse>> entry) {
    final ISIPrompt currentPrompt = entry.getKey();
    return new ListView<ISIResponse>("responseList", entry.getValue()) {
      private static final long serialVersionUID = 1L;

      @Override
      protected void populateItem(ListItem<ISIResponse> item) {

        // Anchor so links can jump to this id
        item.add(new WebMarkupContainer("responseAnchor")
        .add(new SimpleAttributeModifier("name", String.valueOf(item.getModelObject().getId()))));

        // Actual response
        item.add(factory.makeResponseViewComponent("response", item.getModel()));

        // Remove From Notebook button
        NotebookRemoveDialog removeDialog = new NotebookRemoveDialog("removeModal", item.getModel());
        item.add(removeDialog);
        Component removeLink = new WebMarkupContainer("removeLink").add(removeDialog.getClickToOpenBehavior());
        removeLink.setVisible(!isTeacher);
        item.add(removeLink);

        // Link back to content
        BookmarkablePageLink<ISIStandardPage> editLink = new SectionLinkFactory().linkTo(
            "editLink",
            currentPrompt.getContentElement().getContentLocObject().getSection(),
            currentPrompt.getContentElement().getXmlId());
        editLink.add(new ClassAttributeModifier("sectionLink"));
        item.add(editLink);
      }

    };
View Full Code Here

Examples of org.cast.isi.data.ISIPrompt

   * @see org.cast.isi.service.IQuestionService#createQuestion(org.cast.cwm.data.models.UserModel, java.lang.String, java.lang.String)
   */
  public void createQuestion(UserModel mOwner, String text, String pageName) {
    Session session = Databinder.getHibernateSession();
    Question question = new Question(text, mOwner.getObject(), null);
    ISIPrompt prompt = new ISIPrompt(PromptType.MY_QUESTIONS);
    if (mOwner != null) {
      prompt.setTargetUser(mOwner.getObject());
      eventService.saveEvent("question:create", text, pageName);
    }
    session.save(prompt)
    question.setPrompt(prompt);
    session.save(question);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.