Example usage for com.google.gwt.user.client.ui Widget setTitle

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

Introduction

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

Prototype

public void setTitle(String title) 

Source Link

Document

Sets the title associated with this object.

Usage

From source file:org.unitime.timetable.gwt.client.sectioning.TimeGrid.java

License:Apache License

public ArrayList<Meeting> addClass(ClassAssignmentInterface.ClassAssignment row, int index) {
    if (!row.isAssigned())
        return null;
    iClasses.add(row);/*from   ww  w  .  ja  va 2s .c o m*/
    String name = (row.isFreeTime() ? MESSAGES.freeTimeCourse() + " " + MESSAGES.freeTimeSubject()
            : row.getSubject() + " " + row.getCourseNbr() + " " + row.getSubpart());
    String longName = name + (row.isFreeTime() ? "" : " " + row.getSection());
    String time = row.getDaysString(CONSTANTS.shortDays()) + " " + row.getStartString(CONSTANTS.useAmPm())
            + " - " + row.getEndString(CONSTANTS.useAmPm());
    ArrayList<String> notes = new ArrayList<String>();
    ArrayList<String> notesNoHtml = new ArrayList<String>();
    if (row.hasTitle() && CONSTANTS.showCourseTitle()) {
        notes.add(row.getTitle());
        notesNoHtml.add(row.getTitle());
    }
    if (row.hasRoom()) {
        notes.add(row.getRooms(", "));
        notesNoHtml.add(row.getRooms(", "));
    }
    String color = iColor.getColor(row);
    if (row.hasInstructors()) {
        if (!iPrint) {
            String instructors = "";
            for (int i = 0; i < row.getInstructors().size(); i++) {
                String email = (row.hasInstructorEmails() && i < row.getInstructorEmails().size()
                        ? row.getInstructorEmails().get(i)
                        : null);
                if (email != null && !email.isEmpty()) {
                    ImageLink il = new ImageLink(new Image(RESOURCES.email()), "mailto:" + email);
                    il.setTitle(MESSAGES.sendEmail(row.getInstructors().get(i)));
                    il.setStyleName("A.unitime-SimpleLink");
                    il.getElement().getStyle().setMarginRight(1, Unit.PX);
                    instructors += il.getElement().getString() + row.getInstructors().get(i)
                            + (i + 1 < row.getInstructors().size() ? ", " : "");
                } else {
                    instructors += row.getInstructors().get(i)
                            + (i + 1 < row.getInstructors().size() ? ", " : "");
                }
            }
            notes.add(instructors);
            notesNoHtml.add(row.getInstructors(", "));
        } else {
            notes.add(row.getInstructors(", "));
            notesNoHtml.add(row.getInstructors(", "));
        }
    }
    if (row.hasDatePattern()) {
        notes.add(row.getDatePattern());
        notesNoHtml.add(row.getDatePattern());
    }
    String note = "";
    for (String n : notesNoHtml) {
        if (n == null || n.isEmpty())
            continue;
        if (!note.isEmpty())
            note += ", ";
        note += n;
    }
    String title = longName + " (" + time + ", " + note + ")";
    if (note.isEmpty()) {
        title = longName + " (" + time + ")";
        note = time;
    }
    final ArrayList<Meeting> meetings = new ArrayList<Meeting>();
    for (int day : row.getDays()) {
        meetings.add(addMeeting(index, day, row.getStart(), row.getLength(), name, notes, row.getNote(), title,
                color, row.isPinned(), meetings));
    }
    if (row.isPinned())
        for (Meeting m : meetings)
            m.setPinned(true);
    if (row.hasDistanceConflict()) {
        for (Meeting m : meetings) {
            Widget dist = new Image(RESOURCES.distantConflict());
            if (iPrint) {
                dist = new Label(MESSAGES.distanceConflict(row.getBackToBackDistance()));
                dist.setStyleName("label");
                // FIXME: Workaround about inability of image bundle images to be printed
                // dist = new Image(GWT.getHostPageBaseURL() + "roadrunner16.png");
            }
            dist.setTitle(MESSAGES.backToBackDistance(row.getBackToBackRooms(), row.getBackToBackDistance()));
            m.addIcon(dist);
        }
    }
    if (row.isOfHighDemand() && !iPrint) {
        for (Meeting m : meetings) {
            Image highDemand = new Image(RESOURCES.highDemand());
            highDemand.setTitle(MESSAGES.highDemand(row.getExpected(), row.getAvailableLimit()));
            m.addIcon(highDemand);
        }
    }
    if (row.isSaved() && !iPrint) {
        for (Meeting m : meetings)
            m.setSaved(row.isSaved());
    }
    if (row.isCancelled() && !iPrint) {
        for (Meeting m : meetings) {
            Image cancelled = new Image(RESOURCES.cancelled());
            cancelled.setTitle(MESSAGES.classCancelled(name));
            m.addIcon(cancelled);
        }
    }
    iMeetings.add(meetings);
    return meetings;
}

From source file:scrum.client.collaboration.CommentWidget.java

License:Open Source License

@Override
protected Widget onInitialization() {
    Label authorLabel = new Label(comment.getAuthorName());
    authorLabel.setStyleName("CommentWidget-header-author");

    User author = comment.getAuthor();/*from  w w  w  . j  a va2s  .  co  m*/
    if (author != null) {
        String color = getCurrentProject().getUserConfig(author).getColor();
        authorLabel.getElement().getStyle().setProperty("color", color);
    }

    date = new Label();
    date.setStyleName("CommentWidget-header-date");

    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("CommentWidget-header");
    header.add(Gwt.createFlowPanel(authorLabel, date));
    if (getCurrentProject().getHomepageDir() != null) {
        header.add(new AOutputViewEditWidget() {

            @Override
            protected void onViewerUpdate() {
                Widget widget = null;
                if (comment.isPublished()) {
                    widget = Img.bundle.publicComment().createImage();
                    widget.setTitle("This comment is visible on the homepage.");
                } else {
                    widget = new ButtonWidget(new PublishCommentAction(comment)).update();
                }
                setViewer(ScrumGwt.createDiv("Comment-Widget-header-pub", widget));
            }
        });
    }

    FlowPanel panel = new FlowPanel();
    panel.setStyleName("CommentWidget");
    panel.add(header);

    editor = new RichtextEditorWidget(comment.getTextModel());
    panel.add(editor);

    return panel;
}