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

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

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

Usage

From source file:cc.kune.gspace.client.licensewizard.pages.LicenseWizardTrdForm.java

License:GNU Affero Public License

/**
 * Instantiates a new license wizard trd form.
 * /*from   www. j av  a  2s .c  om*/
 * @param i18n
 *          the i18n
 * @param res
 *          the res
 * @param commonRes
 *          the common res
 */
@Inject
public LicenseWizardTrdForm(final I18nTranslationService i18n, final IconicResources res,
        final CommonResources commonRes) {
    super.setFrame(true);
    super.setPadding(10);
    super.setAutoHeight(true);

    final Label intro = new Label();
    intro.setText(i18n.t(
            "With a Creative Commons license, you keep your copyright but allow people to copy and distribute your work provided they give you credit  and only on the conditions you specify here. What do you want to do?"));
    intro.addStyleName("kune-Margin-10-b");

    final FieldSet commercialfieldSet = new FieldSet();
    commercialfieldSet.setHeadingHtml(i18n.t("Allow any uses of your work, including commercial?"));
    commercialfieldSet.setCollapsible(false);
    commercialfieldSet.setAutoHeight(true);
    final FieldSet modificationsfieldSet = new FieldSet();
    modificationsfieldSet.setHeadingHtml(i18n.t("Allow modifications of your work?"));
    modificationsfieldSet.setCollapsible(false);
    modificationsfieldSet.setAutoHeight(true);

    createRadios(i18n, commercialfieldSet, modificationsfieldSet);
    createRadioListeners();

    info = new LicenseWizardFlags(res, commonRes, i18n);

    add(intro);
    add(commercialfieldSet);
    add(modificationsfieldSet);
    add(info);
}

From source file:cc.kune.gspace.client.options.general.EntityOptGeneralPanel.java

License:GNU Affero Public License

/**
 * Instantiates a new entity opt general panel.
 * //from   w  w w. j  a  v a2 s.c o  m
 * @param maskWidget
 *          the mask widget
 * @param img
 *          the img
 * @param title
 *          the title
 * @param introMessage
 *          the intro message
 */
public EntityOptGeneralPanel(final MaskWidgetView maskWidget, final ImageResource img, final String title,
        final String introMessage) {
    this.maskWidget = maskWidget;

    tabTitle = TabTitleGenerator.generate(img, title, MAX_TABTITLE_LENGTH, TAB_ID);
    super.setWidth(EntityOptionsView.WIDTH);
    super.setFrame(true);
    super.getFormPanel().setLabelWidth(100);
    super.addStyleName("k-overflow-y-auto");
    final Label label = new Label();
    label.setText(introMessage);
    label.addStyleName("kune-Margin-10-tb");
    super.add(label);
}

From source file:cc.kune.gspace.client.options.tools.EntityOptToolsPanel.java

License:GNU Affero Public License

@Override
public void clear() {
    super.getFormPanel().removeAll();
    fields.clear();//from ww  w  .  j ava2  s  . co m
    final Label label = new Label();
    label.setText(i18n.t("Here you can select the tools used:"));
    label.addStyleName("kune-Margin-10-tb");
    super.add(label);
}

From source file:ch.heftix.mailxel.client.MailDetailGrid.java

License:Open Source License

public void displayMailDetail(final int id) {

    mailxelService.get(id, new AsyncCallback<MailTO>() {

        final StatusItem si = mailxelPanel.statusStart("getting mail detail");

        public void onSuccess(MailTO result) {

            categorizationToolbar.setCurrentMessageId(result.id);

            if (null != mailxelTab) {
                mailxelTab.setTabText(result.subject);
            }/*ww  w .j a  v  a 2 s .  c  o m*/

            initWidgets();

            AddressLabel lFrom = new AddressLabel(result.fromATO);

            grid.setText(0, 0, "From");
            grid.setWidget(0, 1, lFrom);

            AddressBar toBar = new AddressBar();
            toBar.add(result.toATOs);

            grid.setText(1, 0, "To");
            grid.setWidget(1, 1, toBar);

            int cursor = 2;

            if (null != result.ccATOs && result.ccATOs.size() > 0) {
                grid.setText(cursor, 0, "Cc");
                AddressBar ccBar = new AddressBar();
                ccBar.add(result.ccATOs);
                grid.setWidget(cursor, 1, ccBar);
                cursor++;
            }
            if (null != result.bccATOs && result.bccATOs.size() > 0) {
                grid.setText(cursor, 0, "Bcc");
                AddressBar bccBar = new AddressBar();
                bccBar.add(result.bccATOs);
                grid.setWidget(cursor, 1, bccBar);
                cursor++;
            }

            // date
            grid.setText(cursor, 0, "Date");
            String zDate = result.date;
            if (null != result.time && null != cTO && cTO.displayTime) {
                zDate = zDate + " " + result.time;
            }
            zDate = zDate + " (access count: " + Integer.toString(result.count) + ")";
            Label lDate = new Label();
            lDate.setText(zDate);
            lDate.setTitle(result.time);

            grid.setWidget(cursor, 1, lDate);
            cursor++;

            grid.setText(cursor, 0, "Subject");
            grid.setText(cursor, 1, result.subject);
            cursor++;

            bodyArea.setText(result.body);
            contentTabPanel.add(bodyArea);

            if (null != result.attachments && result.attachments.size() > 0) {
                grid.setText(cursor, 0, "A");
                grid.setWidget(cursor, 1, attachementBar);
                cursor++;

                for (AttachmentTO attachement : result.attachments) {
                    attachementBar.addAttachement(attachement, mailxelPanel, contentTabPanel);
                }

            }

            mailTO = result;

            cursor = 0;

            if (null != result.categories && result.categories.size() > 0) {
                for (AttachedCategoryTO aCat : result.categories) {
                    categoryHistory.setText(cursor, 0, "C");
                    categoryHistory.setText(cursor, 1, aCat.date);
                    categoryHistory.setText(cursor, 2, aCat.category.name);
                    cursor++;
                }
            }

            si.done();
        }

        public void onFailure(Throwable caught) {
            si.error(caught);
        }

    });
}

From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java

License:Open Source License

/**
 * create a label. Shorten text for normal display and unshortened text for
 * setTitle, i.e. mouse-over tool-tip./*from  w ww  . j  a va 2s . co  m*/
 * 
 * @param shortenTo
 *            avoid shortening if <0
 */
public Label createLabel(final String text, final int shortenTo) {
    Label label = new Label();
    if (shortenTo >= 0 && null != text && text.length() > shortenTo) {
        label.setText(UIUtil.shorten(text, shortenTo, ".."));
        label.setTitle(text);
    } else {
        label.setText(text);
    }
    return label;
}

From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java

License:Open Source License

/**
 * create a label, display date, add time as tool tip
 *///from w w  w. j  a  v a  2 s. c  om
public Label dateTimeLabel(final String date, final String time) {
    Label label = new Label();
    label.setText(date);
    label.setTitle(time);
    return label;
}

From source file:ch.unifr.pai.ice.client.tracking.LineTracking2users.java

License:Apache License

public void setLabelText(String text, Label label) {
    label.setText(text);
}

From source file:cl.uai.client.EMarkingWeb.java

License:Open Source License

/**
 * This is the entry point method.//from w w  w.jav  a2s . c  om
 */
public void onModuleLoad() {
    // Pointer to CSS manager. It has to go first!
    GWT.<Resources>create(Resources.class).css().ensureInjected();
    // Log messages
    String msg = "\nInitializing EMarking 3.0\n" + "Platform: " + Navigator.getPlatform() + "\n"
            + "User agent: " + Navigator.getUserAgent() + "\n" + "App name: " + Navigator.getAppName() + "\n"
            + "App code name: " + Navigator.getAppCodeName() + "\n" + "App version: "
            + Navigator.getAppVersion();

    logger.fine(msg);

    // List of errors after trying to initialize
    ArrayList<String> errors = new ArrayList<String>();

    // Get id for eMarkingWeb's DIV tag
    final String eMarkingDivId = "emarking";
    if (RootPanel.get(eMarkingDivId) == null) {
        errors.add("Can not initalize. EMarking requires an existing DIV tag with id: emarking.");
        return;
    }

    RootPanel.get(eMarkingDivId).add(new Label("Loading"));

    int draftId = 0;
    int preferredWidth = 860;
    boolean showRubric = true;
    boolean showColors = false;

    try {
        // First, if there's a URL parameter, replace the value
        if (Window.Location.getParameter("id") != null) {
            draftId = Integer.parseInt(Window.Location.getParameter("id"));
        }

        // Validate that the submission id is a positive integer
        if (draftId <= 0) {
            errors.add("Submission id must be a non negative integer.");
        }

        // Reading the image width
        float imagewidth = 0;
        if (RootPanel.get(eMarkingDivId).getElement().getAttribute("imagewidth") != null)
            imagewidth = Float.parseFloat(RootPanel.get(eMarkingDivId).getElement().getAttribute("imagewidth"));

        String cookie_width = Cookies.getCookie("emarking_width");

        if (cookie_width != null) {
            preferredWidth = Integer.parseInt(cookie_width);
        } else if (imagewidth > 0) {
            preferredWidth = (int) (imagewidth / 0.6f);
        }

        // Validate that the preferredWidth is a positive integer greater than 10
        if (preferredWidth <= 10) {
            errors.add("Preferred width should be a positive integer greater than 10.");
        }

        // Validate that the preferredWidth is a positive integer greater than 10
        if (preferredWidth <= 10) {
            errors.add("Preferred width should be a positive integer greater than 10.");
        }

        String cookie_showrubric = Cookies.getCookie("emarking_showrubric");

        if (cookie_showrubric != null) {
            showRubric = Integer.parseInt(cookie_showrubric) == 1;
        }

        String cookie_showcolors = Cookies.getCookie("emarking_showcolors");

        if (cookie_showcolors != null) {
            showColors = Integer.parseInt(cookie_showcolors) == 1;
        }

    } catch (Exception e) {
        logger.severe(e.getMessage());
        errors.add(
                "Error in HTML for eMarkingWeb can not initalize. Invalid submissionId value (must be integer).");
    }

    // Read div attribute for readonly
    String moodleurl = null;
    if (RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl") != null)
        moodleurl = RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl");

    logger.fine("\nShowRubric: " + showRubric + "\nShow colors:" + showColors + "\nPreferred width:"
            + preferredWidth + "\nMoodle ajax url: " + moodleurl);

    if (moodleurl == null)
        errors.add("Invalid Moodle ajax url");

    // If there are errors die with a configuration message
    if (errors.size() > 0) {
        Label errorsLabel = new Label();
        String text = "";
        for (int i = 0; i < errors.size(); i++) {
            text += "\n" + errors.get(i);
        }
        errorsLabel.setText(text);
        errorsLabel.setTitle("Fatal error while initializing eMarking-Web");

        RootPanel.get(eMarkingDivId).clear();
        RootPanel.get(eMarkingDivId).add(errorsLabel);
    } else {
        // Set eMarking's main interface submission id according to HTML
        MarkingInterface.setDraftId(draftId);

        EMarkingConfiguration.setShowRubricOnLoad(showRubric);
        EMarkingConfiguration.setColoredRubric(showColors);

        // Ajax URL in moodle
        EMarkingConfiguration.setMoodleUrl(moodleurl);

        // Automagically resize popup to use most of the window
        int width = screenWidth();
        int height = screenHeight();

        // Preferred width can not be bigger than the screen
        if (width < preferredWidth) {
            preferredWidth = width;
        }

        //  Resize the popup window and move it to the top left corner
        Window.resizeTo(preferredWidth, height);
        Window.moveTo(0, 0);

        // Initialize eMarking's interface
        markingInterface = new MarkingInterface();

        // Add eMarking to the browser
        RootPanel.get(eMarkingDivId).clear();
        RootPanel.get(eMarkingDivId).add(markingInterface);
        RootPanel.getBodyElement().focus();
    }
}

From source file:client.argon.page.ArgonEndpointCreatePage.java

License:Open Source License

private final Widget getEditPanel() {
    final VerticalPanel outerPanel = new VerticalPanel();

    final FlexTable table = new FlexTable();
    outerPanel.setSpacing(5);//from   ww w .ja v  a 2s .c om

    final Label labelSource = new Label();
    labelSource.setText("SourceNode: ");
    table.setWidget(0, 0, labelSource);
    table.setWidget(0, 1, this.sourceNode);

    final Label labelDestination = new Label();
    labelDestination.setText("DestinationNode: ");
    table.setWidget(1, 0, labelDestination);
    table.setWidget(1, 1, this.destinationNode);

    final Label labelOutgoing = new Label();
    labelOutgoing.setText("Outgoing Interface: ");
    table.setWidget(2, 0, labelOutgoing);
    table.setWidget(2, 1, this.outgoingInterface);

    final Label labelIngoing = new Label();
    labelIngoing.setText("Ingoing Interface: ");
    table.setWidget(3, 0, labelIngoing);
    table.setWidget(3, 1, this.ingoingInterface);

    final Label labelBw = new Label();
    labelBw.setText("Bandwidth: ");
    this.bandwidth.setText("0");
    table.setWidget(4, 0, labelBw);
    table.setWidget(4, 1, this.bandwidth);

    final Label labelValidFrom = new Label();
    labelValidFrom.setText("Valid From: ");
    table.setWidget(5, 0, labelValidFrom);
    this.validFrom.setText(this.dateTimeFormat.format(new Date()));
    table.setWidget(5, 1, this.validFrom);

    final Label labelValidTo = new Label();
    labelValidTo.setText("Valid To: ");
    this.validTo.setText(this.dateTimeFormat.format(new Date()));
    table.setWidget(6, 0, labelValidTo);
    table.setWidget(6, 1, this.validTo);

    final Label labelLinkUp = new Label();
    labelLinkUp.setText("Link Up: ");
    table.setWidget(7, 0, labelLinkUp);
    this.linkUp.addItem("true");
    this.linkUp.addItem("false");
    table.setWidget(7, 1, this.linkUp);

    final Label labelDelay = new Label();
    labelDelay.setText("Delay: ");
    this.delay.setText("0");
    table.setWidget(8, 0, labelDelay);
    table.setWidget(8, 1, this.delay);

    this.button.addClickListener(this);
    this.button.setText("Create");
    table.setWidget(9, 0, this.button);
    table.setWidget(9, 1, this.activity);
    // table.getFlexCellFormatter().setColSpan(3, 1, 3);

    return table;
}

From source file:client.argon.page.ArgonRouterCreatePage.java

License:Open Source License

private final Widget getEditPanel() {
    final VerticalPanel outerPanel = new VerticalPanel();

    final FlexTable table = new FlexTable();
    outerPanel.setSpacing(5);/*www. j  av  a  2  s  . c o m*/

    final Label labelLoopB = new Label();
    labelLoopB.setText("LoopBack: ");
    table.setWidget(0, 0, labelLoopB);
    table.setWidget(0, 1, this.loopBackAd);
    //
    final Label labelConfig = new Label();
    labelConfig.setText("Configuration: ");
    table.setWidget(1, 0, labelConfig);
    table.setWidget(1, 1, this.configAd);
    //
    final Label labelType = new Label();
    labelType.setText("Type: ");
    table.setWidget(2, 0, labelType);
    table.setWidget(2, 1, this.type);

    this.button.addClickListener(this);
    this.button.setText("Create");
    table.setWidget(3, 0, this.button);
    table.setWidget(3, 1, this.activity);
    // table.getFlexCellFormatter().setColSpan(3, 1, 3);

    return table;
}