Exemple #1
0
  /** Sets the inner HTML according to an icon */
  public void setMarkHTML() {

    // Starts with an empty HTML
    String html = "";
    String iconhtml = "";

    // Create the icon string if any
    if (this.iconType != null) {
      Icon icon = new Icon(this.iconType);
      iconhtml = icon.toString();
    } else if (this.iconOnly && this instanceof CustomMark) {
      CustomMark cmark = (CustomMark) this;
      iconhtml = cmark.getTitle();
    }

    String markername =
        EMarkingConfiguration.isMarkerAnonymous()
            ? MarkingInterface.messages.MarkerDetails(MarkingInterface.messages.Anonymous())
            : MarkingInterface.messages.MarkerDetails(this.getMarkername());
    String styleColor = "";

    // If the mark has a color, we use the background to color it
    if (this.criterionid > 0 && this.iconOnly) {
      styleColor = "style=\"color:" + Color.getCSSHueColor(criterionid) + "\"";
    }

    html +=
        "<div class=\""
            + Resources.INSTANCE.css().markicon()
            + "\" title=\""
            + markername
            + "\" "
            + styleColor
            + ">"
            + iconhtml
            + "</div>";
    // If the mark is an icon
    if (!this.iconOnly && this.getRawtext().trim().length() > 0) {
      html +=
          "<div class=\""
              + Resources.INSTANCE.css().markrawtext()
              + "\">"
              + SafeHtmlUtils.htmlEscape(this.getRawtext())
              + "</div>";
      // Show the marker's name if the marking process is not anonymous
      if (!EMarkingConfiguration.isMarkerAnonymous()) {
        html +=
            "<div class=\""
                + Resources.INSTANCE.css().markmarkername()
                + "\">"
                + markername
                + "</div>";
      }
    }

    this.setHTML(html);
  }
Exemple #2
0
 /** Changes its inner HTML while it is loading */
 protected void setLoading() {
   Icon icon = new Icon(IconType.COG);
   icon.addStyleName("icon-spin");
   icon.addStyleName(Resources.INSTANCE.css().iconupdating());
   this.setHTML(
       "<div class=\""
           + Resources.INSTANCE.css().innercomment()
           + "\">"
           + icon.toString()
           + "</div>");
   this.addStyleName(Resources.INSTANCE.css().updating());
 }
Exemple #3
0
  /**
   * Creates a Mark object at a specific position in a page
   *
   * @param posx X coordinate in the page
   * @param posy Y coordinate in the page
   * @param pageno the page number (1 to N)
   */
  public Mark(
      int id,
      int posx,
      int posy,
      int pageno,
      int markerId,
      long timecreated,
      int criterionid,
      String markername,
      String rawtext) {
    this.markerid = markerId;
    this.posx = posx;
    this.posy = posy;
    this.pageno = pageno;
    this.timecreated = timecreated;
    this.criterionid = criterionid;
    this.markername = markername;
    this.rawtext = rawtext;
    this.id = id;

    this.addStyleName(Resources.INSTANCE.css().mark());

    this.addHandlers();
    feedback = new ArrayList<FeedbackObject>();
  }
 public void setRegradeData(int regradeid, int regradeaccepted) {
   this.regradeid = regradeid;
   this.regradeaccepted = regradeaccepted;
   String html = "<div class=\"" + Resources.INSTANCE.css().criterionheaderbonus() + "\">";
   if (this.regradeid > 0) {
     if (this.regradeaccepted == 0) html += "Por recorregir";
     else html += "Recorregida";
   }
   html += "</div>";
   this.regradeHtml.setHTML(html);
 }
Exemple #5
0
  /**
   * Creates a Mark object at a specific position in a page
   *
   * @param posx X coordinate in the page
   * @param posy Y coordinate in the page
   * @param pageno the page number (1 to N)
   */
  public Mark(int posx, int posy, int pageno, int markerId, long timecreated, String colour) {
    this.markerid = markerId;
    this.posx = posx;
    this.posy = posy;
    this.pageno = pageno;
    this.timecreated = timecreated;

    this.colour = colour;

    this.addStyleName(Resources.INSTANCE.css().mark());

    this.addHandlers();
  }
Exemple #6
0
  public void updateHtml() {
    if (lvl != null) {
      String bonusHtml = "";
      if (lvl.getCriterion().getBonus() != 0
          && lvl.getCriterion().getSelectedLevel() != null
          && lvl.getCriterion().getSelectedLevel() == lvl) {
        bonusHtml = " " + RubricMark.scoreFormat(lvl.getCriterion().getBonus(), true);
      }

      this.setHTML(
          "<div class=\""
              + Resources.INSTANCE.css().leveldesc()
              + "\">"
              + lvl.getDescription()
              + "</div><div class=\""
              + Resources.INSTANCE.css().levelpts()
              + "\">"
              + RubricMark.scoreFormat(lvl.getScore(), false)
              + bonusHtml
              + " pts</div>");
    }
  }
 public void setBonus(float b) {
   float score = 0;
   Criterion criterion = MarkingInterface.submissionData.getRubricfillings().get(criterionId);
   if (criterion.getSelectedLevel() != null) {
     score += criterion.getSelectedLevel().getScore() + criterion.getSelectedLevel().getBonus();
   }
   String html =
       "<div class=\""
           + Resources.INSTANCE.css().criterionheaderbonus()
           + "\">"
           + RubricMark.scoreFormat(score, false)
           + " / "
           + RubricMark.scoreFormat(criterion.getMaxscore(), false);
   html += "</div>";
   this.bonusHtml.setHTML(html);
 }
  public CriterionHeader(int idx, int cid, String cdesc, float b, int regrid, int regraccepted) {
    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().criterionrow());
    this.criterionId = cid;
    this.criterionDescription = cdesc;
    this.index = idx;

    Label lbl = new Label(cdesc);
    lbl.addStyleName(Resources.INSTANCE.css().criterionheader());
    lbl.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (commentId > 0 && commentPage > 0)
              EMarkingWeb.markingInterface
                  .getMarkingPagesInterface()
                  .highlightRubricMark(commentId, commentPage);
          }
        });
    mainPanel.add(lbl);

    HorizontalPanel horizontal = new HorizontalPanel();
    horizontal.addStyleName(Resources.INSTANCE.css().colorsquaretable());

    // the square with the color
    if (EMarkingConfiguration.isColoredRubric()) {
      Label lbl2 = new Label("");
      Color.setWidgetBackgroundHueColor(cid, lbl2);
      lbl2.addStyleName(Resources.INSTANCE.css().colorsquare());
      lbl2.setTitle(String.valueOf(idx));
      // lbl2.addStyleName(MarkingInterface.getMapCss().get("colorsquare"));

      // HTML rectangle = new HTML();
      // rectangle.setHTML("<div data-index='"+idx+"' style='width:20px;	height:20px;border:1px
      // solid #000;' class='"+ MarkingInterface.getMapCss().get("color"+idx) +"
      // "+MarkingInterface.getMapCss().get("colorsquare") + "' ></div>");
      lbl2.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              Label rectangle = (Label) event.getSource();
              int index = Integer.parseInt(rectangle.getTitle());
              EMarkingWeb.markingInterface
                  .getToolbar()
                  .getMarkingButtons()
                  .changeCriterionList(index);
            }
          });
      horizontal.add(lbl2);
    }

    HTML separation = new HTML();
    separation.setHTML("<div style='width:20px;height:20px;'></div>");
    horizontal.add(separation);

    mainPanel.add(horizontal);

    bonusHtml = new HTML();
    setBonus(b);

    mainPanel.add(bonusHtml);

    regradeHtml = new HTML();
    regradeHtml.setVisible(false);

    mainPanel.add(regradeHtml);

    this.setRegradeData(regrid, regraccepted);

    loadingIcon = new HTML();
    loadingIcon.setVisible(false);
    Icon iconloading = new Icon(IconType.COG);
    loadingIcon.setHTML(iconloading.toString());
    loadingIcon.addStyleName(Resources.INSTANCE.css().loadingicon());
    loadingIcon.addStyleName("icon-spin");

    mainPanel.add(loadingIcon);
    mainPanel.setCellHorizontalAlignment(loadingIcon, HasHorizontalAlignment.ALIGN_CENTER);

    initWidget(mainPanel);
  }
Exemple #9
0
  /** Sets the inner HTML according to an icon */
  public void setMarkHTML() {

    // Starts with an empty HTML
    String html = "";

    // If it's a RubricMark add score header and both rubric and criterion descriptions
    if (this instanceof RubricMark) {
      RubricMark rmark = (RubricMark) this;
      html +=
          "<table style=\"background-color:hsl("
              + rmark.getLevel().getCriterion().getHue()
              + ",100%,75%);\" width=\"100%\">"
              + "<tr><td style=\"text-align: left;\"><div class=\""
              + Resources.INSTANCE.css().markcrit()
              + "\">"
              + rmark.getLevel().getCriterion().getDescription()
              + "</div></td>";
      html +=
          "<td style=\"text-align: right;\" nowrap><div class=\""
              + Resources.INSTANCE.css().markpts()
              + "\">"
              + RubricMark.scoreFormat(
                  rmark.getLevel().getScore() + rmark.getLevel().getBonus(), false)
              + " / "
              + RubricMark.scoreFormat(rmark.getLevel().getCriterion().getMaxscore(), false)
              + "</div></td></tr></table>";
      html +=
          "<div class=\""
              + Resources.INSTANCE.css().marklvl()
              + "\">"
              + rmark.getLevel().getDescription()
              + "</div>";
    }

    String iconhtml = "";

    if (this instanceof CommentMark) {
      Icon icon = new Icon(IconType.COMMENT);
      iconhtml = icon.toString();
    }

    // If the inner comment contains something
    if (this.getRawtext().trim().length() > 0) {
      html +=
          "<div class=\""
              + Resources.INSTANCE.css().markrawtext()
              + "\">"
              + iconhtml
              + "&nbsp;"
              + this.getRawtext()
              + "</div>";
    }

    // Show the marker's name if the marking process is not anonymous
    if (!MarkingInterface.isMarkerAnonymous()) {
      html +=
          "<div class=\""
              + Resources.INSTANCE.css().markmarkername()
              + "\">"
              + MarkingInterface.messages.MarkerDetails(this.getMarkername())
              + "</div>";
    }

    if (this instanceof RubricMark && ((RubricMark) this).getRegradeid() > 0) {
      html +=
          "<div style=\"background-color:yellow\">"
              + "Recorrección"
              + (((RubricMark) this).getRegradeaccepted() == 0 ? " solicitada" : " lista")
              + "</div>";
      html +=
          "<div class=\""
              + Resources.INSTANCE.css().marklvl()
              + "\">"
              + "Motivo: "
              + ((RubricMark) this).getRegradeMotiveText()
              + "<hr>"
              + "Comentario: "
              + ((RubricMark) this).getRegradecomment()
              + (((RubricMark) this).getRegradeaccepted() == 0
                  ? ""
                  : "<hr>Respuesta: " + (((RubricMark) this).getRegrademarkercomment()))
              + "</div>";
    }

    this.setHTML(html);
  }