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:com.youtube.statistics.client.ResultsPanel.java

License:Apache License

public void drawError(String error) {
    panel.clear();//w w  w.  j ava  2 s.  com
    panel.add(new Label(MSG_ERROR));
    final Label serverResponseLabel = new Label();
    panel.add(serverResponseLabel);
    serverResponseLabel.addStyleName(SERVER_RESPONSE_LABEL_ERROR_ID);
    serverResponseLabel.setText(error);
}

From source file:com.ziroby.dmassist.gwt.client.MainPanel.java

License:GNU General Public License

private void createStatusBar() {
    statusBar = new FlexTable();

    int column = 0;
    final Label timeWidget = new Label("00:00");
    statusBar.setWidget(0, column++, timeWidget);
    final Label roundWidget = new Label("round 0");
    statusBar.setWidget(0, column++, roundWidget);

    for (int i = 0; i < column; ++i)
        statusBar.getCellFormatter().addStyleName(0, i, "statusElement");

    entityList.addListener(new Listener() {
        public void objectChanged(ObjectEvent event) {
            timeWidget.setText(entityList.formatRoundsAsTime());
        }/*from   w w  w .  java  2 s  .c o  m*/
    });

    entityList.addListener(new Listener() {
        public void objectChanged(ObjectEvent event) {
            roundWidget.setText("round " + entityList.getNumRounds());
        }
    });

    statusBar.setStyleName("statusBar");
}

From source file:com.ziroby.dmassist.gwt.client.MainPanel.java

License:GNU General Public License

private Widget createInitCount() {
    Panel panel = new FlowPanel();

    Widget label = new Label("Init Count");
    panel.add(label);//from   w ww .j  a  v a  2s  .c  o m

    final Label initCountLabel = new Label("-");
    initCountLabel.setStyleName("initBox");
    initCountLabel.setWidth("3em");
    panel.add(initCountLabel);

    label.setStyleName("initLabel");
    initCountLabel.setStyleName("initBox");
    panel.setStyleName("initPanel");

    entityList.addListener(new Listener() {
        public void objectChanged(ObjectEvent event) {
            Integer initCount = entityList.getInitCount();
            initCountLabel.setText((initCount == null) ? "-" : initCount.toString());
        }
    });

    return panel;
}

From source file:cometedgwt.auction.client.App.java

License:Open Source License

private void sendNewBid(AuctionItem item, TextBox myBid, Label message) {

    int itemId = item.getId();
    double lastBid = item.getPrice();

    String newBid = myBid.getText();
    double newBidValue = 0.0;

    try {// ww  w.j a v  a  2  s .  co m
        newBidValue = Double.parseDouble(newBid);
    } catch (NumberFormatException e) {
        message.setText("Not a valid bid");
        return;
    }

    if (newBidValue < lastBid) {
        message.setText("Not a valid bid");
        return;
    }

    message.setText("");

    item.setPrice(newBidValue);
    int numberOfBids = item.getNumberOfBids();

    JSONArray array = new JSONArray();
    array.set(0, new JSONNumber(itemId));
    array.set(1, new JSONNumber(newBidValue));
    array.set(2, new JSONNumber(numberOfBids));

    JSONObject container = new JSONObject();
    container.put("value", array);

    streamingService.sendMessage(TOPIC, container);
    myBid.setText("");
    myBid.setFocus(true);
}

From source file:custgwttbl.client.CustGwtItem.java

License:Apache License

/**
 * Sets the items text. For IMAGE it will be image Url.
 * /*from w w w  .  j a  v  a 2  s  . c o  m*/
 * @param text
 *            text of the item
 */
public void setText(String text) {

    if (text == null) {
        text = "";
    }
    if (this.getSpecifier() == CustGwtItem.EDITABLE) {
        TextBox tBox = (TextBox) vPanel.getWidget(0);
        tBox.setText(text);
    } else if (this.getSpecifier() == CustGwtItem.NON_EDITABLE) {
        Label label = (Label) vPanel.getWidget(0);
        label.setText(text);
    } else if (this.getSpecifier() == CustGwtItem.NON_EDITABLE_HTML) {
        HTML htmlWid = (HTML) vPanel.getWidget(0);
        htmlWid.setHTML(text);
    } else if (this.getSpecifier() == CustGwtItem.IMAGE) {
        if (CustGwtUtil.isNull(text)) {
            if (image != null) {
                imagePanel.remove(image);
            }
            imagePanel.setTitle("");
        } else {
            if (image != null) {
                image.setUrl(text);
            } else {
                image = new Image(text);
                imagePanel.add(image, 5, 5);
            }
        }
    }
    if (this.itemBean.isTextAsTitle()) {
        if (this.getSpecifier() == CustGwtItem.NON_EDITABLE || this.getSpecifier() == CustGwtItem.EDITABLE) {
            if (!CustGwtUtil.isNull(text)) {
                this.getInnerWidget().setTitle(text);
            }
        }
    }
}

From source file:cz.filmtit.client.pages.TranslationWorkspace.java

License:Open Source License

/**
 * Called when a time of some chunks gets changed by the TimeEditDialog.
 * Changes the labels in the workspace to match the new values.
 */// www. j av a 2 s  .  c o m
public void changeTimeLabels(List<TimedChunk> chunks) {
    if (chunks == null || chunks.isEmpty()) {
        return;
    }

    String newLabelValue = chunks.get(0).getDisplayTimeInterval();
    for (TimedChunk chunk : chunks) {
        Label label = timeLabels.get(chunk.getChunkIndex());
        assert label != null : "Each chunk has its timelabel";
        label.setText(newLabelValue);
    }
}

From source file:cz.incad.kramerius.editor.client.view.ElementViewImpl.java

License:Open Source License

private void initPopupUI(final String url) {
    popupPanel = new PopupPanel(true, true);
    popupPanel.setAnimationEnabled(true);
    final Image preview = new Image();
    final Label status = new Label("Loading...");
    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(status);//w w  w  .  jav  a 2s. com
    flowPanel.add(preview);
    popupPanel.setWidget(flowPanel);
    preview.setVisible(false);
    preview.addLoadHandler(new LoadHandler() {

        @Override
        public void onLoad(LoadEvent event) {
            preview.setVisible(true);
            status.setVisible(false);
            centerUpdatedPopupWorkaround(popupPanel);
        }
    });
    preview.addErrorHandler(new ErrorHandler() {

        @Override
        public void onError(ErrorEvent event) {
            status.setText("Cannot load image " + url);
            centerUpdatedPopupWorkaround(popupPanel);
        }
    });
    preview.setUrl(url);
}

From source file:de.lilawelt.zmachine.client.MachineInterface.java

License:Open Source License

public void showStatusBar(String s, int a, int b, boolean flag) {

    if (statusbar == null) {
        statusbar = new HorizontalPanel();
        statusbar.setStyleName("statusBar");
        statusbar.add(new Label());
        statusbar.add(new Label());
        statusbar.setWidth("100%");
        statusbar.getWidget(0).setStyleName("statusBar-left");
        statusbar.getWidget(1).setStyleName("statusBar-right");
        outer.add(statusbar, DockPanel.NORTH);

        correctWindowSizes();/* w  w w .ja va  2s.co m*/
    }

    // String text = s+ " ";
    String text = "";
    if (flag) {
        text += " Time: " + a + ":";
        if (b < 10) {
            text += "0";
        }
        text += b;
    } else {
        text += "Score: " + a + " Turns: " + b;
    }
    Log.debug("method showStatusbar: " + text);
    // statusbar.setText(text);

    Label l1 = (Label) statusbar.getWidget(0);
    Label l2 = (Label) statusbar.getWidget(1);

    l1.setText(s);
    l2.setText(text);

}

From source file:de.metanome.frontend.client.BasePage.java

License:Apache License

/**
 * Create the "About" Page, which should include information about the project.
 *
 * @return Widget with contents to be placed on the page.
 *///  w w w  .j  av  a2  s.  c o m
private Widget createAboutPage() {
    SimplePanel content = new SimplePanel();
    Label temporaryContent = new Label();
    temporaryContent.setText("Metanome Version 0.0.2.");
    content.add(temporaryContent);
    // content.addStyleName("aboutPage");
    return content;
}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.editor.client.entry.list.dataprovider.SimplePagingDataProvider.java

License:Apache License

public SimplePagingDataProvider(final PagingDataGrid<LexEntry> table, final HorizontalPanel pagination,
        final ListFilter filterOptions, final Label resultSummary) {
    this.table = table;
    this.service = GWT.create(EditorService.class);
    pagination.getElement().getStyle().setMarginBottom(10, Unit.PX);
    final HorizontalPanel sizePanel = new HorizontalPanel();
    table.setIncrementSize(10);//from w  w  w .j  av a 2 s  .  c o m
    searchOptions.setPageSize(10);
    searchOptions.setVerification(Verification.UNVERIFIED);

    // Callback responsible for updating the list
    callback = new AsyncCallback<LexEntryList>() {

        @Override
        public void onFailure(Throwable caught) {
            pagination.clear();
            Dialog.showError(constants.failedToUpdateEntryList(), caught);
        }

        @Override
        public void onSuccess(LexEntryList result) {
            if (result.getOverallCount() == 0) {
                resultSummary.setText(constants.noEntriesMached());
            } else {
                resultSummary.setText(messages.displayingEntries((searchOptions.getCurrent() + 1),
                        (searchOptions.getCurrent() + result.entries().size()), result.getOverallCount()));
            }
            setList(result.entries());
            updatePagination(result.getOverallCount());
            MultiSelectionModel<?> selectionModel = (MultiSelectionModel<?>) table.getSelectionModel();
            selectionModel.clear();
            table.redraw();
            lastQuery = searchOptions.getCopy();
        }

        private void updatePagination(final int overall) {
            int currentPage = searchOptions.getCurrent() / searchOptions.getPageSize();
            int start = Math.max(0, currentPage - 3);
            final int end = Math.min(currentPage + 4,
                    (overall + searchOptions.getPageSize() - 1) / searchOptions.getPageSize());
            pagination.clear();
            pagination.add(sizePanel);
            pagination.setCellHorizontalAlignment(sizePanel,
                    HorizontalAlignmentConstant.startOf(Direction.LTR));
            ButtonGroup pagingButtons = new ButtonGroup();
            pagingButtons.getElement().getStyle().setFloat(Float.RIGHT);
            pagination.setCellHorizontalAlignment(pagingButtons,
                    HorizontalAlignmentConstant.endOf(Direction.LTR));
            Button first = new Button(constants.first(), IconType.FAST_BACKWARD);
            first.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    searchOptions.setCurrent(0);
                    doUpdate();
                }
            });
            pagingButtons.add(first);
            for (int i = start; i < end; i++) {
                final int page = i;
                Button button = new Button((i + 1) + "");
                button.setToggle(true);
                if (i == currentPage) {
                    button.setStyleName("active", true);
                } else {
                    button.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            searchOptions.setCurrent(page * searchOptions.getPageSize());
                            doUpdate();
                        }
                    });
                }
                pagingButtons.add(button);
            }
            Button last = new Button(constants.last(), IconType.FAST_FORWARD);
            last.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    int lastPage = (overall + searchOptions.getPageSize() - 1) / searchOptions.getPageSize()
                            - 1;
                    searchOptions.setCurrent(lastPage * searchOptions.getPageSize());
                    doUpdate();
                }
            });
            pagingButtons.add(last);
            pagination.add(pagingButtons);
        }

    };
    addDataDisplay(table);
    // Enable sorting columns 
    table.addColumnSortHandler(new Handler() {

        @Override
        public void onColumnSort(ColumnSortEvent event) {
            Column<?, ?> column = event.getColumn();
            // Update sort properties and start a new query
            searchOptions.setOrder(column.getDataStoreName(), event.getColumnSortList().get(0).isAscending());
            searchOptions.setCurrent(0);
            refreshQuery();
        }
    });
}