Example usage for com.google.gwt.user.client.ui Anchor Anchor

List of usage examples for com.google.gwt.user.client.ui Anchor Anchor

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Anchor Anchor.

Prototype

private Anchor(String text, boolean asHTML, DirectionEstimator directionEstimator, String href) 

Source Link

Document

Creates an anchor with its text, direction and href (target URL) specified.

Usage

From source file:cl.uai.client.marks.RubricMark.java

License:Open Source License

@Override
protected String getMarkPopupHTML() {
    // Starts with an empty HTML
    String html = "";
    boolean headerOnly = false;

    RubricMark rmark = (RubricMark) this;
    headerOnly = rmark.isHeaderOnly();//from  w  w w.j a  v  a  2s .  c o m

    String criterionindex = "" + EMarkingWeb.markingInterface.getRubricInterface().getRubricPanel()
            .getCriterionIndex(rmark.getCriterionId());
    String leveldesc = headerOnly ? criterionindex
            : " " + SafeHtmlUtils.htmlEscape(rmark.getLevel().getCriterion().getDescription());
    String score = EMarkingConfiguration.isFormativeFeedbackOnly() ?
    // Level information only
            rmark.getLevel().getCriterion()
                    .getLevelFormativeIndex(rmark.getLevel().getCriterion().getSelectedLevel().getId()) + " / "
                    + rmark.getLevel().getCriterion().getLevels().size()
            :
            // Score and bonus information
            RubricMark.scoreFormat(rmark.getLevel().getScore() + rmark.getLevel().getBonus(), false) + " / "
                    + RubricMark.scoreFormat(rmark.getLevel().getCriterion().getMaxscore(), false);
    Icon icon = new Icon(this.iconType);

    html += "<table class=\"markrubricheader\" style=\"background-color:hsl("
            + rmark.getLevel().getCriterion().getHue() + ",100%,75%);\" width=\"100%\">"
            + "<tr><td style=\"text-align: left;\"><div class=\"" + Resources.INSTANCE.css().markicon() + "\">"
            + icon.toString() + "</div></td><td><div class=\"" + Resources.INSTANCE.css().markcrit() + "\">"
            + leveldesc + "</div></td>";
    html += "<td style=\"text-align: right;\" nowrap><div class=\"" + Resources.INSTANCE.css().markpts() + "\">"
            + score + "</div></td></tr></table>";
    if (!headerOnly) {
        // Show the level description
        html += "<div class=\"" + Resources.INSTANCE.css().marklvl() + "\">" + rmark.getLevel().getDescription()
                + "</div>";
        html += "<div class=\"" + Resources.INSTANCE.css().markrawtext() + "\">"
                + SafeHtmlUtils.htmlEscape(this.getRawtext()) + "</div>";
        // Show the feedback
        if (!EMarkingConfiguration.getKeywords().equals("") && feedback.size() > 0) {
            html += "<div class=\"" + Resources.INSTANCE.css().markmarkername() + "\">" + "Feedback" + "</div>";
            int count = 0;
            while (count < feedback.size()) {
                Anchor resourceLink = new Anchor(feedback.get(count).getName().replaceAll("\\<.*?>", ""), true,
                        feedback.get(count).getLink(), "_blank");
                resourceLink.addStyleName(Resources.INSTANCE.css().resourcelink());

                String sourceName = "";
                switch (feedback.get(count).getNameOER()) {
                case "ocwmit":
                    sourceName = "OCW MIT";
                    break;
                case "merlot":
                    sourceName = "Merlot";
                    break;
                case "CS50":
                    sourceName = "CS50 Harvard";
                    break;
                default:
                    sourceName = "Webcursos";
                }
                html += "<div class=\"" + Resources.INSTANCE.css().markrawtext() + "\">" + (count + 1) + ".-"
                        + resourceLink + "<br>" + "Source: " + sourceName + "</div>";
                count = count + 1;
            }
        }
        // Show the marker's name if the marking process is not anonymous
        if (!EMarkingConfiguration.isMarkerAnonymous()) {
            html += "<div class=\"" + Resources.INSTANCE.css().markmarkername() + "\">"
                    + MarkingInterface.messages.MarkerDetails(this.getMarkername()) + "</div>";
        }
    }

    if (this.getRegradeid() > 0 && !headerOnly) {
        html += "<div style=\"background-color:#FFFF99; width:99%; font-size: 10pt;\" class=\""
                + Resources.INSTANCE.css().markcrit() + "\">" + MarkingInterface.messages.Regrade() + " "
                + MarkingInterface.messages.Requested() + "</div>";
        html += "<div class=\"" + Resources.INSTANCE.css().marklvl() + "\">"
                + MarkingInterface.messages.Motive() + ": " + this.getRegradeMotiveText() + "<hr>"
                + MarkingInterface.messages.Comment() + ": "
                + SafeHtmlUtils.htmlEscape(this.getRegradecomment()) + "</div>";
        if (this.getRegradeaccepted() > 0) {
            html += "<div style=\"background-color:#FFFF99; width:99%; font-size: 10pt;\" class=\""
                    + Resources.INSTANCE.css().markcrit() + "\">" + MarkingInterface.messages.Regrade() + " "
                    + MarkingInterface.messages.Replied() + "</div>";
            html += "<div class=\"" + Resources.INSTANCE.css().marklvl() + "\">" + "<hr>"
                    + MarkingInterface.messages.RegradeReply() + ": "
                    + SafeHtmlUtils.htmlEscape(this.getRegrademarkercomment()) + "</div>";
        }
    }

    return html;
}

From source file:cl.uai.client.page.EditMarkDialog.java

License:Open Source License

public void loadFeedback() {
    feedbackForStudent.clear();/*from  ww w  .j  a v  a2 s .com*/
    count = 1;
    int iterator = 0;
    while (iterator < feedbackArray.size()) {
        final Anchor link = new Anchor(feedbackArray.get(iterator).getLink(), false,
                feedbackArray.get(iterator).getLink(), "_blank");
        link.addStyleName(Resources.INSTANCE.css().resourcelink());
        addFeedback(feedbackArray.get(iterator).getName(), link.toString(),
                feedbackArray.get(iterator).getNameOER(), feedbackArray.get(iterator).getLink(), -1);
        iterator += 1;
    }
}

From source file:cl.uai.client.page.EditMarkDialog.java

License:Open Source License

public void setFeedbackArray(ArrayList<FeedbackObject> feedbackArray, int id) {
    int iterator = 0;
    while (iterator < feedbackArray.size()) {
        final Anchor link = new Anchor(feedbackArray.get(iterator).getLink(), false,
                feedbackArray.get(iterator).getLink(), "_blank");
        link.addStyleName(Resources.INSTANCE.css().resourcelink());
        addFeedback(feedbackArray.get(iterator).getName(), link.toString(),
                feedbackArray.get(iterator).getNameOER(), feedbackArray.get(iterator).getLink(), id);
        iterator += 1;//w  ww.j  a va  2 s  . c  o  m
    }

}

From source file:de.hdawg.wci.portlets.bookmarks.client.view.BookmarksView.java

License:Apache License

@Override
public void setData(List<Bookmark> data) {
    ImageResources IMAGES = GWT.create(ImageResources.class);
    bookmarkTable.removeAllRows();// w  w w .ja  va2 s . com

    for (int i = 0; i < data.size(); i++) {
        int tableCellId = 0;

        if (data.get(i).hasIcon()) {
            if (data.get(i).getObjectType().equals("folder"))
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.folder()));
            else if (data.get(i).getObjectType().equals("document"))
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.document()));
            else if (data.get(i).getObjectType().equals("community"))
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.comunity()));
            else if (data.get(i).getObjectType().equals("page"))
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.page()));
            else if (data.get(i).getObjectType().equals("link"))
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.weblink()));
            else
                bookmarkTable.setWidget(i, tableCellId, new Image(IMAGES.weblink()));

            tableCellId++;
        }
        if (data.get(i).getObjectType().equals("link")) {
            bookmarkTable.setWidget(i, tableCellId,
                    new Anchor(data.get(i).getName(), true, data.get(i).getUri(), "_blank"));
        } else {
            bookmarkTable.setWidget(i, tableCellId,
                    new Anchor(data.get(i).getName(), true, data.get(i).getUri()));
        }
        tableCellId++;

        if (data.get(i).getDescription() != null) {
            // TODO fix layout and enter description
        }
    }
}

From source file:gate.mimir.gus.client.Application.java

License:Open Source License

/**
 * Update the results within the page./*  w  w  w. ja v  a2s .c  om*/
 * @param time elapsed time since the query has been executed
 */
private void updateQueryResults(String time) {

    //update the title of the page
    Window.setTitle("GUS - GATE Unified Search - " + query + " - page " + currentPage);

    // update the statistics line
    statisticsLabel.displayResults(queryID, resultsStartIndex + 1,
            Math.min((currentPage * resultsPerPage), numberOfResults));

    // update the results table
    for (int row = 0; row < resultsPerPage; row++) {
        if (resultsTable.getRowCount() > row && resultsTable.getCellCount(row) > 1
                && resultsTable.getWidget(row, 0) != null) {
            // non empty row, skip it
            continue;
        }
        if (row >= resultsPageList.size()) {
            // no more results to display
            break;
        }
        int documentID = resultsPageList.get(row).getDocumentID();
        String documentURI = resultsPageList.get(row).getDocumentURI();
        String documentTitle = resultsPageList.get(row).getDocumentTitle();
        if (documentTitle == null || documentTitle.trim().length() == 0) {
            // we got no title to display: use the URI file
            String[] pathElems = documentURI.split("/");
            documentTitle = pathElems[pathElems.length - 1];
        }
        // zebra stripes
        resultsTable.getRowFormatter().addStyleName(row, (row % 2 == 0) ? "even" : "odd");
        resultsTable.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_LEFT);
        // each cell is a Grid
        Grid hitGrid = new Grid(2, 1);
        hitGrid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
        hitGrid.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT);
        // top row of grid contains the link(s) 
        String documentURIText = "<span title=\"" + documentURI + "\">" + documentTitle + "</span>";
        if (getUriIsLink().equals("true")) {
            // generate two links: original doc and cached
            FlowPanel linksPanel = new FlowPanel();
            linksPanel.setStylePrimaryName("hit");
            linksPanel.add(new Anchor(documentURIText, true, documentURI, "documentWindow"));
            linksPanel.add(new InlineLabel(" ("));
            linksPanel.add(new Anchor("cached", false, "gusDocument/" + documentID + "?queryId=" + queryID,
                    "documentWindow"));
            linksPanel.add(new InlineLabel(")"));
            hitGrid.setWidget(0, 0, linksPanel);
        } else {
            // generate one link: cached, with document name as text
            hitGrid.setWidget(0, 0, new Anchor(documentURIText, true,
                    "gusDocument/" + documentID + "?queryId=" + queryID, "documentWindow"));
        }
        // second row is the hit text + contexts 
        HTML snippet = new HTML(resultsPageList.get(row).getLeftContext() + "<span class=\"mimir-hit\">"
                + resultsPageList.get(row).getSpanText() + "</span>"
                + resultsPageList.get(row).getRightContext());
        snippet.setStylePrimaryName("snippet");
        hitGrid.setWidget(1, 0, snippet);
        resultsTable.setWidget(row, 0, hitGrid);
    }
}

From source file:olanto.myTerm.client.ContainerPanels.StatusPanel.java

License:Open Source License

public StatusPanel() {
    contact = new HorizontalPanel();
    msg = new Label();
    setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    setStyleName("headerPanel");
    add(msg);//from ww w . j  a v a 2s.  c o m
    setCellHorizontalAlignment(msg, HorizontalPanel.ALIGN_LEFT);
    add(contact);
    setCellHorizontalAlignment(contact, HorizontalPanel.ALIGN_RIGHT);
    contact.setPixelSize(300, 25);
    contact.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    Anchor poweredBy = new Anchor(GuiConstant.OLANTO_URL.substring(0, GuiConstant.OLANTO_URL.indexOf("|")),
            true,
            GuiConstant.OLANTO_URL.substring(GuiConstant.OLANTO_URL.indexOf("|") + 1,
                    GuiConstant.OLANTO_URL.lastIndexOf("|")),
            GuiConstant.OLANTO_URL.substring(GuiConstant.OLANTO_URL.lastIndexOf("|") + 1));
    contact.add(poweredBy);
    poweredBy.setStylePrimaryName("contactInfo");
    contact.setCellHorizontalAlignment(poweredBy, HorizontalPanel.ALIGN_LEFT);
    contact.add(new HTML("||"));
    Anchor feedback = new Anchor(
            GuiConstant.FEEDBACK_MAIL.substring(0, GuiConstant.FEEDBACK_MAIL.indexOf("|")));
    contact.add(feedback);
    feedback.setStylePrimaryName("contactInfo");
    contact.setCellHorizontalAlignment(feedback, HorizontalPanel.ALIGN_RIGHT);
    contact.add(new HTML("&nbsp;"));
    feedback.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            mailto(GuiConstant.FEEDBACK_MAIL.substring(GuiConstant.FEEDBACK_MAIL.lastIndexOf("|") + 1),
                    "Feedback about myTerm");
        }
    });
}