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

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

Introduction

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

Prototype

public HorizontalPanel() 

Source Link

Document

Creates an empty horizontal panel.

Usage

From source file:ch.sebastienzurfluh.swissmuseum.core.client.view.tilemenu.TileMenu.java

License:Open Source License

public TileMenu(String title, PageRequestClickHandler pageRequestHandler) {
    this.pageRequestHandler = pageRequestHandler;

    setStyleName(stylePrimaryName);/*from w  ww  .j a v  a2 s . co m*/

    HorizontalPanel firstLine = new HorizontalPanel();

    button = new ModeSwapButton(this);
    button.setStyleName(stylePrimaryName + "-" + "detailButton");
    firstLine.add(button);

    Label titleLabel = new Label(title);
    titleLabel.setStyleName(stylePrimaryName + "-" + "title");
    firstLine.add(titleLabel);

    add(firstLine);

    tilePanel = new FlowPanel();
    tileOrderList = new LinkedList<Tile>();

    tilePanel.setStyleName(stylePrimaryName + "-" + "tileList");
    add(tilePanel);
}

From source file:ch.sebastienzurfluh.swissmuseum.parcours.client.view.infos.InfoPanel.java

License:Open Source License

public InfoPanel(String title, final Widget returnToIt, final AnimationHelper animationHelper) {

    setStyleName("infoPanel");

    HorizontalPanel titleLine = new HorizontalPanel();

    Label returnLabel = new Label("Retourner");
    returnLabel.setStyleName("infoPanel-returnButton");

    returnLabel.addClickHandler(new ClickHandler() {

        @Override//from  w ww  .ja va2  s . c  om
        public void onClick(ClickEvent event) {
            animationHelper.goTo(returnToIt, Animation.SLIDE_UP);
        }
    });

    titleLine.add(returnLabel);

    Label titleLabel = new Label(title);
    titleLabel.setStyleName("infoPanel-title");
    titleLine.add(titleLabel);

    this.add(titleLine);

    setContent(new Label("loading..."));
    this.add(contentPanel);
}

From source file:ch.unifr.pai.twice.layout.client.eclipseLayout.MiceLayoutTabPanel.java

License:Apache License

/**
 * Sets up the tab button bar (including the full screen button)
 * // w ww.java2  s.c om
 * @return
 */
private Widget createTabButtonBar() {
    HorizontalPanel p = new HorizontalPanel();
    fullscreenButton.setWidget(showFullscreenButton);
    p.add(fullscreenButton);
    return p;
}

From source file:ch.unifr.pai.twice.layout.client.eclipseLayout.MiceSplitLayoutPanel.java

License:Apache License

/**
 * Creates the header widget for a slot (including the icons for dialog, fullscreen or no-fullscreen mode.
 * //from  w w w .j  av  a  2 s  .  c  o m
 * @param slot
 * @param w
 * @return
 */
private HorizontalPanel createHeader(final ResizableDecoratorPanel slot, Widget w) {
    HorizontalPanel header = new HorizontalPanel();
    header.setHeight("100%");
    header.setWidth("100%");
    header.setStyleName("miceWidgetCaption");

    if (!isInFullscreenMode) {
        Image dialogButton = new Image(GWT.getModuleBaseURL() + "images/dialog.png");
        dialogButton.addStyleName("miceWidgetButton");
        dialogButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                toDialog(slot);
            }
        });

        header.add(dialogButton);
        Image fullscreenButton = new Image(GWT.getModuleBaseURL() + "images/fullscreen.png");
        fullscreenButton.addStyleName("miceWidgetButton");
        fullscreenButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                makeFullScreen(slot);
            }
        });
        header.add(fullscreenButton);
    } else {
        Image nofullscreenButton = new Image(GWT.getModuleBaseURL() + "images/nofullscreen.png");
        nofullscreenButton.addStyleName("miceWidgetButton");
        nofullscreenButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                releaseFullScreen();
            }
        });
        header.add(nofullscreenButton);
    }
    //
    // Image closeButton = new Image(GWT.getModuleBaseURL()
    // + "images/close_hover.png");
    // closeButton.addStyleName("miceWidgetButton");
    // header.add(closeButton);

    return header;
}

From source file:ch.unifr.pai.twice.widgets.mpproxyframe.client.ComplexMPFrame.java

License:Apache License

public ComplexMPFrame() {
    super();/*from www .  j  av  a2 s . c  om*/
    HorizontalPanel p = new HorizontalPanel();
    p.add(back);
    p.add(forward);
    p.add(url);
    p.add(reload);
    p.setWidth("100%");
    p.setHeight("100%");

    back.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            frame.back();
        }
    });

    forward.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            frame.forward();
        }
    });

    reload.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent arg0) {
            frame.reload();
        }
    });
    p.setCellWidth(url, "100%");

    addNorth(p, 30);
    url.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> arg0) {
            frame.setUrl(arg0.getValue());
        }
    });
    addSouth(controller, 170);
    add(frame);
}

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

License:Open Source License

/**
 * Creates a new RubricMark at a specific position in a page
 * //  ww  w.j  a va  2 s .  c o m
 * @param posx X coordinate in the page
 * @param posy Y coordinate in the page
 * @param pageno page number (from 1 to N)
 * @param rubricLevel the rubric level indicating criterion and level in the rubric
 */
public RubricMark(int id, int posx, int posy, int pageno, int markerid, int lvlid, long timecreated,
        int criterionid, String markername, String rawtext) {
    super(id, posx, posy, pageno, markerid, timecreated, criterionid, markername, rawtext);

    feedback = new ArrayList<FeedbackObject>();

    // Rubric marks have format 2
    this.format = 2;
    this.iconType = IconType.TH;

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

    this.setLevelId(lvlid);

    // Collaborative buttons
    if (EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_MARKER_TRAINING
            && EMarkingConfiguration.isChatEnabled()) {
        collaborativeMarks = new HorizontalPanel();

        like = new LikeMark();
        like.setMark(this);
        like.setValue(0);
        collaborativeMarks.add(like);

        dislike = new DisLikeMark();
        dislike.setMark(this);
        dislike.setValue(0);
        collaborativeMarks.add(dislike);

        quote = new QuoteMark();
        quote.setMark(this);
        quote.setValue(0);
        collaborativeMarks.add(quote);

        discussion = new DiscussionMark();
        discussion.setMark(this);
        discussion.setValue(0);
        collaborativeMarks.add(discussion);
        //TODO
        Date time = new Date(timecreated * 1000L);
        discussion.addMessage(time.toString(), markername, rawtext, markerid);

        collaborativeMarks.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        collaborativeMarks.addStyleName(Resources.INSTANCE.css().tablecollaborativebuttons());

        // The mark dont belongs me
        if (markerid != EMarkingConfiguration.getMarkerId()) {
            like.setCanClick(true);
            dislike.setCanClick(true);
            quote.setCanClick(true);
            //discussion.setCanClick(true);
        } else {
            like.removeStyleName(Resources.INSTANCE.css().likeIcon());
            like.addStyleName(Resources.INSTANCE.css().mycolloborativeicon());

            dislike.removeStyleName(Resources.INSTANCE.css().likeIcon());
            dislike.addStyleName(Resources.INSTANCE.css().mycolloborativeicon());

            quote.removeStyleName(Resources.INSTANCE.css().likeIcon());
            quote.addStyleName(Resources.INSTANCE.css().mycolloborativeicon());
        }

        // get counter for collaborative buttons
        String url = "ids=" + MarkingInterface.getDraftId() + "&commentid=" + this.getId();
        AjaxRequest.ajaxRequest("action=getvaluescollaborativebuttons&" + url, new AsyncCallback<AjaxData>() {

            @Override
            public void onFailure(Throwable caught) {
                logger.warning("Error values collaboratives buttons");
                hideCollaborativeButtons();
            }

            @Override
            public void onSuccess(AjaxData result) {
                List<Map<String, String>> valuesCollaborativesButtons = AjaxRequest.getValuesFromResult(result);

                for (Map<String, String> value : valuesCollaborativesButtons) {

                    int markerid = Integer.parseInt(value.get("markerid"));
                    int type = Integer.parseInt(value.get("type"));
                    String markername = value.get("markername");
                    String date = value.get("date");
                    String text = value.get("text");

                    switch (type) {
                    case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_LIKE:
                        like.addValue(1);
                        like.setFormat(markerid, markername);
                        like.setMarkHTML();
                        break;

                    case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_DISLIKE:
                        dislike.addValue(1);
                        dislike.setFormat(markerid, markername);
                        dislike.setMarkHTML();
                        break;

                    case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_QUOTE:
                        quote.addValue(1);
                        quote.setMarkHTML();
                        quote.setFormat(markerid, markername);
                        quote.setMarkHTML();
                        break;

                    case EMarkingConfiguration.EMARKING_COLLABORATIVE_BUTTON_DISCUSSION:
                        discussion.addValue(1);
                        discussion.setMarkHTML();
                        discussion.setFormat(markerid, markername);
                        discussion.setMarkHTML();
                        String[] parts = date.split(" ");
                        String[] hourMinute = parts[1].split(":");
                        String realDate = hourMinute[0] + ":" + hourMinute[1] + " &nbsp &nbsp" + parts[0];
                        discussion.addMessage(realDate, markername, text, markerid);
                        break;
                    }
                }
            }
        });
        like.setMarkHTML();
        dislike.setMarkHTML();
        quote.setMarkHTML();
        if (getMarkername() != null) {
            discussion.instanceDialog();
        }
        discussion.setMarkHTML();
    }

}

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

License:Open Source License

/**
 * Creates a comment dialog at a specific position
 */// ww w  . j ava  2s.  com
public AddMarkDialog(MarkingPage _parent) {
    super(true, false);

    this.page = _parent;

    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().addmarkdialog());

    this.rubricPanel = new RubricPanel(true);

    this.mainPanel.add(rubricPanel);

    // Adds the CSS style and other settings
    this.addStyleName(Resources.INSTANCE.css().commentdialog());

    this.setAnimationEnabled(true);
    this.setGlassEnabled(true);

    this.setHTML(MarkingInterface.messages.AddEditMark());

    // Cancel button
    Button btnCancel = new Button(MarkingInterface.messages.Cancel());
    btnCancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cancelled = true;
            hide();
        }
    });

    // Add buttons
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.add(btnCancel);
    mainPanel.add(hpanel);
    mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    this.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            if (!cancelled && levelId > 0) {
                EMarkingWeb.markingInterface.addRubricMark(levelId, rubricLeft, rubricTop, page);
            } else if (!cancelled) {
                logger.severe("Error adding mark! Level id " + levelId);
            }
        }
    });

    this.getElement().getStyle().setProperty("MaxWidth", (Window.getClientWidth() - 100) + "px");

    this.setWidget(mainPanel);
}

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

License:Open Source License

/**
 * Creates a comment dialog at a specific position
 * /*from  www  . j a v a 2 s .  c  o  m*/
 * @param posx Top position for the dialog
 * @param posy Left position for the dialog
 * @param level An optional rubric level in case we are editing one
 */
public EditMarkDialog(int posx, int posy, int level, int regradeid) {
    super(true, false);

    this.regradeId = regradeid;

    this.levelId = level;
    Level lvl = MarkingInterface.submissionData.getLevelById(levelId);

    if (EMarkingConfiguration.getKeywords() != null && EMarkingConfiguration.getKeywords().length() > 0) {
        logger.fine("Keywords: " + EMarkingConfiguration.getKeywords());
    }
    if (!EMarkingConfiguration.getKeywords().equals("") && (level > 0 || regradeid > 0)) {
        feedbackArray = new ArrayList<FeedbackObject>();
        feedbackPanel = new FeedbackInterface();
        feedbackPanel.setParent(this);
    } else {
        simplePanel = true;
    }

    superPanel = new HorizontalPanel();
    superPanel.addStyleName(Resources.INSTANCE.css().feedbackdialog());

    feedbackForStudent = new VerticalPanel();
    feedbackForStudent.addStyleName(Resources.INSTANCE.css().feedbackforstudent());

    feedbackSummary = new ScrollPanel(feedbackForStudent);
    feedbackSummary.addStyleName(Resources.INSTANCE.css().feedbacksummary());

    mainPanel = new VerticalPanel();
    mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialog());

    // Adds the CSS style and other settings
    this.addStyleName(Resources.INSTANCE.css().commentdialog());
    this.setAnimationEnabled(true);
    this.setGlassEnabled(true);

    bonusTxt = new TextBox();
    bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslist());

    this.levelsList = new ListBox();
    this.levelsList.addStyleName(Resources.INSTANCE.css().levelslist());
    this.levelsList.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            int levelid = Integer.parseInt(levelsList.getValue(levelsList.getSelectedIndex()));
            levelId = levelid;
            Level lvl = MarkingInterface.submissionData.getLevelById(levelId);
            setBonus(lvl.getBonus());
        }
    });

    // If there's a rubric level we should edit a Mark
    // otherwise we are just editing its comment
    if (this.levelId == 0) {
        this.setHTML(MarkingInterface.messages.AddEditComment());
    } else {
        this.setHTML(MarkingInterface.messages.AddEditMark() + "<br/>" + lvl.getCriterion().getDescription());
    }

    // Position the dialog
    if (simplePanel) {
        this.setPopupPosition(posx, posy);
    } else {
        // The Dialog is more big, so we need to fix the position
        this.setPopupPosition((int) (Window.getClientWidth() * 0.08), (int) (Window.getClientHeight() * 0.15));
    }

    if (this.levelId > 0) {

        loadLevelsList();

        HorizontalPanel hpanelLevels = new HorizontalPanel();
        hpanelLevels.setWidth("100%");
        Label messages = new Label(MarkingInterface.messages.Level());
        hpanelLevels.add(messages);
        hpanelLevels.add(levelsList);
        hpanelLevels.setCellHorizontalAlignment(levelsList, HasHorizontalAlignment.ALIGN_RIGHT);
        mainPanel.add(hpanelLevels);
        mainPanel.setCellHorizontalAlignment(hpanelLevels, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // Save button
    Button btnSave = new Button(MarkingInterface.messages.Save());
    btnSave.addStyleName(Resources.INSTANCE.css().btnsave());
    btnSave.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (levelId > 0 && !bonusIsValid()) {
                Window.alert(MarkingInterface.messages.InvalidBonusValue());
                return;
            }
            cancelled = false;
            hide();
        }
    });

    // Cancel button
    Button btnCancel = new Button(MarkingInterface.messages.Cancel());
    btnSave.addStyleName(Resources.INSTANCE.css().btncancel());
    btnCancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cancelled = true;
            hide();
        }
    });

    // The comment text box
    TextArea txt = new TextArea();
    txt.setVisibleLines(5);
    txt.getElement().getStyle().setMarginBottom(5, Unit.PT);
    txtComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt);
    txtComment.setAutoSelectEnabled(false);
    txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestbox());

    HorizontalPanel hpanelComment = new HorizontalPanel();
    hpanelComment.setWidth("100%");
    hpanelComment.add(new Label(MarkingInterface.messages.Comment()));
    hpanelComment.add(txtComment);
    hpanelComment.setCellHorizontalAlignment(txtComment, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.add(hpanelComment);
    mainPanel.setCellHorizontalAlignment(hpanelComment, HasHorizontalAlignment.ALIGN_RIGHT);

    // If the rubric level is not null then create the bonus list and add it to the dialog 
    if (this.levelId > 0) {
        setBonus(lvl.getBonus());

        HorizontalPanel hpanelBonus = new HorizontalPanel();
        hpanelBonus.setWidth("100%");
        hpanelBonus.add(new Label(MarkingInterface.messages.SetBonus()));
        hpanelBonus.add(bonusTxt);
        hpanelBonus.setCellHorizontalAlignment(bonusTxt, HasHorizontalAlignment.ALIGN_RIGHT);
        if (EMarkingConfiguration.isFormativeFeedbackOnly()) {
            hpanelBonus.setVisible(false);
        }
        mainPanel.add(hpanelBonus);
        mainPanel.setCellHorizontalAlignment(hpanelBonus, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // The regrade comment text box
    txt = new TextArea();
    txt.setVisibleLines(5);
    txt.getElement().getStyle().setMarginBottom(5, Unit.PT);
    txtRegradeComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt);

    if (this.regradeId > 0) {

        mainPanel.add(new HTML("<hr>"));
        mainPanel.add(new Label(MarkingInterface.messages.Regrade()));

        // Add the textbox
        HorizontalPanel hpanelRegradeComment = new HorizontalPanel();
        hpanelRegradeComment.setWidth("100%");
        hpanelRegradeComment.add(new Label(MarkingInterface.messages.RegradeComment()));
        hpanelRegradeComment.add(txtRegradeComment);
        hpanelRegradeComment.setCellHorizontalAlignment(txtRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT);
        mainPanel.add(hpanelRegradeComment);
        mainPanel.setCellHorizontalAlignment(hpanelRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // Add buttons
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(2);
    hpanel.setWidth("100%");
    hpanel.add(btnSave);
    hpanel.add(btnCancel);
    hpanel.setCellWidth(btnSave, "100%");
    hpanel.setCellWidth(btnCancel, "0px");
    hpanel.setCellHorizontalAlignment(btnCancel, HasHorizontalAlignment.ALIGN_RIGHT);
    hpanel.setCellHorizontalAlignment(btnSave, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.add(hpanel);
    mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    if (simplePanel) {
        // No feedback
        this.setWidget(mainPanel);
    } else {
        // Remove CSS Style
        mainPanel.removeStyleName(Resources.INSTANCE.css().editmarkdialog());
        mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialogWithFeedback());

        bonusTxt.removeStyleName(Resources.INSTANCE.css().bonuslist());
        bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslistWithFeedback());

        this.levelsList.removeStyleName(Resources.INSTANCE.css().levelslist());
        this.levelsList.addStyleName(Resources.INSTANCE.css().levelslistWithFeedback());

        txtComment.removeStyleName(Resources.INSTANCE.css().editmarksuggestbox());
        txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestboxWithFeedback());

        // Add feedback panel
        mainPanel.add(new HTML("<h4>Feedback</h4>"));
        mainPanel.add(feedbackSummary);

        superPanel.add(mainPanel);
        superPanel.add(feedbackPanel);
        this.setWidget(superPanel);
    }
}

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

License:Open Source License

public void addFeedback(final String name, String auxLink, String source, String rawLink, int id) {

    HorizontalPanel rowFeedback = new HorizontalPanel();
    HTML feedback = new HTML();
    Icon iconRemove = new Icon(IconType.TRASH);
    String sourceName = "";

    HTML lessIcon = new HTML(iconRemove.toString());
    lessIcon.addStyleName(Resources.INSTANCE.css().plusicon());

    switch (source) {
    case "ocwmit":
        sourceName = "OCW MIT";
        break;// ww w  .j av  a  2  s.co m
    case "merlot":
        sourceName = "Merlot";
        break;
    case "CS50":
        sourceName = "CS50 Harvard";
        break;
    default:
        sourceName = "Webcursos";
    }

    String html = "<p>" + count + ". " + sourceName + " - " + name + "</p><p>Link " + auxLink + "</p><hr>";
    count += 1;
    feedback.setHTML(html);
    rowFeedback.add(lessIcon);
    rowFeedback.add(feedback);
    feedbackForStudent.add(rowFeedback);

    if (id > 0) {
        feedbackArray.add(new FeedbackObject(id, name, rawLink, source));
    } else if (id == 0) {
        feedbackArray.add(new FeedbackObject(name, rawLink, source));
    }
    lessIcon.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            removeFeedback(name);
            loadFeedback();
        }
    });

}

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

License:Open Source License

/**
 * Creates a comment dialog at a specific position
 *//*from  ww  w  .  j  a v a2s .c  o  m*/
public RequestRegradeDialog() {
    super(true, false);

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

    this.mainPanel = new VerticalPanel();
    this.mainPanel.setWidth("100%");

    motive = new ListBox();
    motive.setWidth("390px");

    motive.addItem(MarkingInterface.messages.Select(), "0");
    for (int motiveId : EMarkingConfiguration.getRegradeMotives().keySet()) {
        String motiveName = EMarkingConfiguration.getRegradeMotives().get(motiveId);
        motive.addItem(motiveName, Integer.toString(motiveId));
    }

    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setWidth("100%");
    hpanel.add(new Label(MarkingInterface.messages.Motive()));
    hpanel.add(motive);
    hpanel.setCellHorizontalAlignment(motive, HasAlignment.ALIGN_RIGHT);
    this.mainPanel.add(hpanel);

    comment = new TextArea();
    comment.setVisibleLines(10);
    comment.setWidth("380px");
    comment.setHeight("150px");

    hpanel = new HorizontalPanel();
    hpanel.setWidth("100%");
    hpanel.add(new Label(MarkingInterface.messages.CommentForMarker()));
    hpanel.add(comment);
    hpanel.setCellHorizontalAlignment(comment, HasAlignment.ALIGN_RIGHT);
    this.mainPanel.add(hpanel);

    // Adds the CSS style and other settings
    this.addStyleName(Resources.INSTANCE.css().commentdialog());

    this.setAnimationEnabled(true);
    this.setGlassEnabled(true);

    this.setHTML(MarkingInterface.messages.RequestRegrade());

    // Save button
    Button btnSave = new Button(MarkingInterface.messages.Save());
    btnSave.addStyleName(Resources.INSTANCE.css().btnsave());
    btnSave.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (comment.getText().length() > 500) {
                Window.alert(MarkingInterface.messages.RequestMaximumLength(comment.getText().length()));
                return;
            } else if (motive.isItemSelected(0)) {
                Window.alert(MarkingInterface.messages.MotiveIsMandatory());
                return;
            } else {
                cancelled = false;
                hide();
            }
        }
    });

    // Cancel button
    Button btnCancel = new Button(MarkingInterface.messages.Cancel());
    btnSave.addStyleName(Resources.INSTANCE.css().btncancel());
    btnCancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cancelled = true;
            hide();
        }
    });

    // Add buttons
    hpanel = new HorizontalPanel();
    hpanel.add(btnSave);
    hpanel.add(btnCancel);
    mainPanel.add(hpanel);
    mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    this.setWidget(mainPanel);
}