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

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

Introduction

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

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:cl.uai.client.rubric.ChangeLogInterface.java

License:Open Source License

public ChangeLogInterface() {
    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().previouscomments());

    this.title = new Label(MarkingInterface.messages.ChangeLogInstructions());

    this.changeLogText = new TextArea();
    this.changeLogText.addStyleName(Resources.INSTANCE.css().generalfeedbacktxt());
    this.changeLogText.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override//from   w  w  w . ja v  a2 s .  c  o  m
        public void onValueChange(ValueChangeEvent<String> event) {
            logger.fine("Changed!");
        }
    });

    this.saveLog = new Button(MarkingInterface.messages.SaveChanges());
    this.saveLog.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            AjaxRequest.ajaxRequest("action=addchangelog&txt=" + URL.encode(getChangeLogText()),
                    new AsyncCallback<AjaxData>() {
                        @Override
                        public void onSuccess(AjaxData result) {
                            Window.alert("Success!");
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                            Window.alert("Falied! :-( Please try again later");
                        }
                    });
        }
    });

    mainPanel.add(title);
    mainPanel.add(changeLogText);
    mainPanel.add(saveLog);
    mainPanel.setCellHorizontalAlignment(saveLog, HasHorizontalAlignment.ALIGN_RIGHT);

    this.initWidget(mainPanel);
}

From source file:cl.uai.client.rubric.CriterionHeader.java

License:Open Source License

public CriterionHeader(int idx, int cid, String cdesc, float b, int regrid, int regraccepted) {
    this.mainPanel = new FlowPanel();
    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// w  w  w.  j  av  a  2  s.c  om
        public void onClick(ClickEvent event) {
            if (commentId > 0 && commentPage > 0)
                EMarkingWeb.markingInterface.getMarkingPagesInterface().highlightRubricMark(commentId,
                        commentPage);
        }
    });
    mainPanel.add(lbl);

    bonusHtml = new HTML();
    bonusHtml.addStyleName(Resources.INSTANCE.css().criterionheaderbonus());
    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);

    initWidget(mainPanel);
}

From source file:cl.uai.client.rubric.GeneralFeedbackInterface.java

License:Open Source License

public GeneralFeedbackInterface() {
    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().previouscomments());

    this.title = new Label(MarkingInterface.messages.GeneralFeedbackInstructions());

    this.feedbackText = new TextArea();
    this.feedbackText.addStyleName(Resources.INSTANCE.css().generalfeedbacktxt());
    this.feedbackText.addChangeHandler(new ChangeHandler() {
        @Override//w  ww  .  j  av  a  2 s  . co  m
        public void onChange(ChangeEvent event) {
            TextArea txt = (TextArea) event.getSource();
            if (EMarkingConfiguration.isDebugging()) {
                logger.fine("General feedback changed! ");
            }
            EMarkingWeb.markingInterface.updateGeneralFeedback(txt.getValue());
        }
    });

    mainPanel.add(title);
    mainPanel.add(feedbackText);

    this.initWidget(mainPanel);
}

From source file:cl.uai.client.toolbar.DraftGrade.java

License:Open Source License

/**
 * Loads submission data from the interface
 *//*from w w w.jav  a  2s  .  c o m*/
public void loadSubmissionData() {
    mainPanel.clear();

    SubmissionGradeData sdata = MarkingInterface.submissionData;

    if (sdata == null
            || EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_PRINT_SCAN)
        return;

    lblGrade = new Label(RubricMark.scoreFormat(sdata.getFinalgrade(), false) + "");
    lblGrade.addStyleName(Resources.INSTANCE.css().grade());

    VerticalPanel gradePanel = new VerticalPanel();
    gradePanel.addStyleName(Resources.INSTANCE.css().minigradepanel());
    gradePanel.add(lblGrade);
    gradePanel.setCellHorizontalAlignment(lblGrade, HasAlignment.ALIGN_CENTER);

    mainPanel.add(gradePanel);
}

From source file:cl.uai.client.toolbar.FinishMarkingDialog.java

License:Open Source License

public FinishMarkingDialog() {
    this.setHTML(MarkingInterface.messages.GeneralFeedback());
    this.addStyleName(Resources.INSTANCE.css().commentdialog());

    generalFeedback = new TextArea();
    generalFeedback.addStyleName(Resources.INSTANCE.css().generalfeedbacktxt());

    this.setModal(true);
    this.setAutoHideEnabled(false);
    this.setGlassEnabled(true);

    vpanel = new VerticalPanel();
    vpanel.add(new Label(MarkingInterface.messages.GeneralFeedbackInstructions()));
    vpanel.add(generalFeedback);//from   w w w  . java 2s  .  c om

    HorizontalPanel hpanel = new HorizontalPanel();

    Button saveButton = new Button(MarkingInterface.messages.Save());
    saveButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cancelled = false;
            hide();
        }
    });

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

    hpanel.add(saveButton);
    hpanel.add(cancelButton);

    vpanel.add(hpanel);
    vpanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    this.setWidget(vpanel);
}

From source file:cl.uai.client.toolbar.RotatePagesDialog.java

License:Open Source License

public RotatePagesDialog() {
    this.setHTML(MarkingInterface.messages.SortPages());
    this.addStyleName(Resources.INSTANCE.css().commentdialog());

    int pages = EMarkingWeb.markingInterface.getMarkingPagesInterface().getNumPages();

    this.setPixelSize(300, 300);

    scrollpanel = new ScrollPanel();
    scrollpanel.setPixelSize(300, 300);/*  www .  j  a v a2  s.  co  m*/

    apanel = new VerticalPanel();
    for (int i = 0; i < pages; i++) {
        PushButton btnPage = new PushButton(MarkingInterface.messages.RotatePage(i + 1));
        btnPage.setTabIndex(i + 1);
        btnPage.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                PushButton btn = (PushButton) event.getSource();
                selectedPage = btn.getTabIndex();
                cancelled = false;
                hide();
            }
        });
        apanel.add(btnPage);
    }
    scrollpanel.add(apanel);

    this.setModal(true);
    this.setAutoHideEnabled(false);
    this.setGlassEnabled(true);

    vpanel = new VerticalPanel();
    vpanel.add(new Label(MarkingInterface.messages.RotatePagesInstructions()));
    vpanel.add(scrollpanel);

    // Basic save/cancel buttons
    HorizontalPanel hpanel = new HorizontalPanel();

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

    hpanel.add(cancelButton);

    vpanel.add(hpanel);
    vpanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    this.setWidget(vpanel);
}

From source file:cl.uai.client.toolbar.SortPagesDialog.java

License:Open Source License

public SortPagesDialog() {
    this.setHTML(MarkingInterface.messages.SortPages());
    this.addStyleName(Resources.INSTANCE.css().commentdialog());

    int pages = EMarkingWeb.markingInterface.getMarkingPagesInterface().getNumPages();

    this.setPixelSize(300, 300);

    scrollpanel = new ScrollPanel();
    scrollpanel.setPixelSize(300, 300);/*from ww  w . j av a 2s.  c o  m*/

    apanel = new AbsolutePanel();
    scrollpanel.add(apanel);

    FlexTableRowDragController drag = new FlexTableRowDragController(apanel);
    pagesTable = new SortPagesFlexTable(pages, 1, drag);
    pagesTable.addStyleName(Resources.INSTANCE.css().generalfeedbacktxt());
    apanel.add(pagesTable);

    FlexTableRowDropController drop = new FlexTableRowDropController(pagesTable);
    drag.registerDropController(drop);

    this.setModal(true);
    this.setAutoHideEnabled(false);
    this.setGlassEnabled(true);

    vpanel = new VerticalPanel();
    vpanel.add(new Label(MarkingInterface.messages.SortPagesInstructions()));
    vpanel.add(scrollpanel);

    HorizontalPanel hpanel = new HorizontalPanel();

    Button saveButton = new Button(MarkingInterface.messages.SaveChanges());
    saveButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cancelled = false;
            hide();
        }
    });

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

    hpanel.add(saveButton);
    hpanel.add(cancelButton);

    vpanel.add(hpanel);
    vpanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT);

    this.setWidget(vpanel);
}

From source file:cl.uai.client.toolbar.SubmissionGrade.java

License:Open Source License

/**
 * Loads submission data from the interface
 *///from  w ww.  j a va2  s.  c  om
public void loadSubmissionData() {
    mainPanel.clear();

    SubmissionGradeData sdata = MarkingInterface.submissionData;

    if (sdata == null)
        return;

    lblGrade = new Label(RubricMark.scoreFormat(sdata.getFinalgrade(), false) + "");
    lblGrade.addStyleName(Resources.INSTANCE.css().grade());

    lblScale = new Label(RubricMark.scoreFormat(sdata.getGrademin(), false) + " / "
            + RubricMark.scoreFormat(sdata.getGrademax(), false));
    lblScale.addStyleName(Resources.INSTANCE.css().scale());

    VerticalPanel gradePanel = new VerticalPanel();
    gradePanel.addStyleName(Resources.INSTANCE.css().gradepanel());
    gradePanel.add(lblGrade);
    gradePanel.add(lblScale);
    gradePanel.setCellHorizontalAlignment(lblGrade, HasAlignment.ALIGN_RIGHT);
    gradePanel.setCellHorizontalAlignment(lblScale, HasAlignment.ALIGN_RIGHT);

    mainPanel.add(gradePanel);
}

From source file:client.richedit.RichTextToolbar.java

License:Apache License

/**
 * Creates a new toolbar that drives the given rich text area.
 *
 * @param richText the rich text area to be controlled
 *//*from w w  w  .  j a  va  2  s  .  c o  m*/
public RichTextToolbar(RichTextArea richText, boolean allowPanelEdit) {
    this.richText = richText;
    this.formatter = richText.getFormatter();

    outer.add(topPanel);
    outer.add(bottomPanel);
    topPanel.setWidth("100%");
    bottomPanel.setWidth("100%");

    initWidget(outer);
    setStyleName("gwt-RichTextToolbar");

    if (formatter == null) {
        return;
    }

    topPanel.add(bold = createToggleButton(images.bold(), strings.bold()));
    topPanel.add(italic = createToggleButton(images.italic(), strings.italic()));
    topPanel.add(underline = createToggleButton(images.underline(), strings.underline()));
    topPanel.add(subscript = createToggleButton(images.subscript(), strings.subscript()));
    topPanel.add(superscript = createToggleButton(images.superscript(), strings.superscript()));
    topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), strings.justifyLeft()));
    topPanel.add(justifyCenter = createPushButton(images.justifyCenter(), strings.justifyCenter()));
    topPanel.add(justifyRight = createPushButton(images.justifyRight(), strings.justifyRight()));

    topPanel.add(strikethrough = createToggleButton(images.strikeThrough(), strings.strikeThrough()));
    topPanel.add(indent = createPushButton(images.indent(), strings.indent()));
    topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent()));
    topPanel.add(hr = createPushButton(images.hr(), strings.hr()));
    topPanel.add(ol = createPushButton(images.ol(), strings.ol()));
    topPanel.add(ul = createPushButton(images.ul(), strings.ul()));
    topPanel.add(removeFormat = createPushButton(images.removeFormat(), strings.removeFormat()));
    topPanel.add(createLink = createPushButton(images.createLink(), strings.createLink()));
    topPanel.add(removeLink = createPushButton(images.removeLink(), strings.removeLink()));
    topPanel.add(insertImage = createPushButton(images.insertImage(), strings.insertImage()));

    bottomPanel.add(new Label("Text:"));
    bottomPanel.add(foreColors = createColorList("Foreground"));
    bottomPanel.add(fonts = createFontList());
    bottomPanel.add(fontSizes = createFontSizes());
    bottomPanel.add(blockFormats = createBlockFormats());

    if (allowPanelEdit) {
        bottomPanel.add(new Button("Panel Colors", new ClickHandler() {
            public void onClick(ClickEvent event) {
                showPanelColorsPopup();
            }
        }), HasAlignment.ALIGN_MIDDLE);
    }

    // we only use these listeners for updating status, so don't hook them up unless at
    // least basic editing is supported.
    richText.addKeyUpHandler(handler);
    richText.addClickHandler(handler);
}

From source file:client.template.dialog.LoginDialog.java

License:Open Source License

public LoginDialog(final String title) {
    this.setText(title);

    final FlexTable panel = new FlexTable();
    panel.setStyleName("gwt-DialogBoxContent");

    this.username = new TextBox();
    this.password = new PasswordTextBox();

    panel.setWidget(0, 0, new Label("Username "));
    panel.setWidget(0, 1, this.username);

    panel.setWidget(1, 0, new Label("Password "));
    panel.setWidget(1, 1, this.password);

    panel.setWidget(2, 0, new Button("Close", new ClickListener() {
        public void onClick(final Widget sender) {
            LoginDialog.this.hide();
        }/*from  www.j a  va2s. c  o  m*/
    }));

    panel.setWidget(2, 1, new Button("Sign In", new ClickListener() {
        public void onClick(final Widget sender) {
            LoginDialog.this.logIn();
        }
    }));

    this.setWidget(panel);
}