Example #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);
  }