Java Code Examples for com.google.gwt.user.client.ui.Grid#setText()

The following examples show how to use com.google.gwt.user.client.ui.Grid#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadingMessagePopupPanel.java    From demo-gwt-springboot with Apache License 2.0 5 votes vote down vote up
@Inject
public LoadingMessagePopupPanel(Messages messages, Asset asset) {
	final Image ajaxImage = new Image(asset.loadingIcon());
	final Grid grid = new Grid(1, 3);
	grid.setWidget(0, 0, ajaxImage);
	grid.setText(0, 2, messages.loadingMessage_message());
	this.container.add(grid);
	add(this.container);
}
 
Example 2
Source File: GeneralView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {

        columns = new Column[]{
                new TextColumn("Status", "OFF"),
                new NumberColumn("average-commit-time", "Average Commit Time"),
                new NumberColumn("number-of-inflight-transactions", "Inflight Transactions"),
                new NumberColumn("number-of-nested-transactions", "Nested Transactions")
        };
        grid = new Grid(columns.length, 2);
        grid.addStyleName("metric-grid");

        for (int row = 0; row < columns.length; ++row) {
            grid.getCellFormatter().addStyleName(row, 0, "nominal");
            grid.getCellFormatter().addStyleName(row, 1, "numerical");
        }
        grid.setText(0, 0, "Status");

        HorizontalPanel header = new HorizontalPanel();
        header.addStyleName("fill-layout-width");
        header.add(new HTML("<h3 class='metric-label'>General Statistics</h3>"));

        final HelpSystem.AddressCallback addressCallback = () -> {
            ModelNode address = new ModelNode();
            address.get(ModelDescriptionConstants.ADDRESS).set(RuntimeBaseAddress.get());
            address.get(ModelDescriptionConstants.ADDRESS).add("subsystem", "transactions");
            return address;
        };

        MetricHelpPanel helpPanel = new MetricHelpPanel(addressCallback, this.columns);

        VerticalPanel metricsPanel = new VerticalPanel();
        metricsPanel.addStyleName("metric-container");
        metricsPanel.add(header);
        metricsPanel.add(helpPanel.asWidget());
        metricsPanel.add(grid);

        return metricsPanel.asWidget();
    }
 
Example 3
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldBeAbleToSetTextInGrids() {
  Grid grid = new Grid();
  grid.setText(0, 0, "foo");
}
 
Example 4
Source File: BulletGraphView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public Widget asWidget() {

    VerticalPanel desc = new VerticalPanel();
    desc.addStyleName("metric-container");
    if(embeddedUse)
        desc.add(new HTML("<h3 class='metric-label-embedded'>" + title + "</h3>"));
    else
        desc.add(new HTML("<h3 class='metric-label'>" + title + "</h3>"));

    container = new HorizontalPanel();
    container.setStyleName("fill-layout-width");
    container.addStyleName("metric-panel");


    grid = new Grid(columns.length, 2);
    grid.addStyleName("metric-grid");

    // format
    for (int row = 0; row < columns.length; ++row) {
        grid.getCellFormatter().addStyleName(row, 0,  "nominal");
        grid.getCellFormatter().addStyleName(row, 1, "numerical");
    }

    int baselineIndex = getBaseLineIndex();
    if(baselineIndex>=0)
        grid.getRowFormatter().addStyleName(baselineIndex, "baseline");

    // init
    for(int i=0; i<columns.length;i++)
    {
        grid.setText(i, 0, columns[i].label);
        grid.setText(i, 1, "0");
    }


    container.add(grid);

    ProtovisWidget graphWidget = new ProtovisWidget();
    graphWidget.initPVPanel();
    vis = createVisualization(graphWidget);

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            renderDefault();    // the 'empty' display
        }
    });

    if (address != null) {
        MetricHelpPanel helpPanel = new MetricHelpPanel(address, this.columns);
        desc.add(helpPanel.asWidget());
    }

    container.add(graphWidget);
    graphWidget.getElement().getParentElement().setAttribute("align", "center");
    graphWidget.getElement().getParentElement().setAttribute("width", "80%");

    desc.add(container);

    return desc;
}