Ejemplo n.º 1
0
  /** {@inheritDoc} */
  public void setText(String text) {
    this.text = text;

    if (icon.isAttached()) {
      icon.removeFromParent();
    }
    getElement().setInnerText(text);
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  public void setBaseIcon(BaseIconType type) {
    if (text != null) {
      getElement().setInnerHTML("");
    }

    icon.setBaseType(type);

    if (!icon.isAttached()) {
      add(icon);
    }
  }
Ejemplo n.º 4
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());
 }
  public PropertyEditorColorPicker() {
    initWidget(uiBinder.createAndBindUi(this));

    editIcon.addDomHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            openColorPickerDialog();
          }
        },
        ClickEvent.getType());

    colorAddOn.addAppendWidget(editIcon);
  }
Ejemplo n.º 6
0
  /** {@inheritDoc} */
  @Override
  public void setIconPosition(IconPosition position) {

    this.iconPosition = position;
    icon.removeFromParent();
    text.removeFromParent();

    if (IconPosition.RIGHT == position) {
      this.insert(text, 0);
      this.insert(icon, 1);
      return;

    } else if (IconPosition.LEFT == position) {
      this.insert(icon, 0);
      this.insert(text, 1);
      return;
    }
  }
Ejemplo n.º 7
0
  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);
  }
Ejemplo n.º 8
0
 /** {@inheritDoc} */
 @Override
 public void setCustomIconStyle(String customIconStyle) {
   icon.addStyleName(customIconStyle);
 }
Ejemplo n.º 9
0
 /** {@inheritDoc} */
 @Override
 public void setIconSize(IconSize size) {
   icon.setIconSize(size);
 }
Ejemplo n.º 10
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);
  }