List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:com.ephesoft.dcma.gwt.rv.client.view.TableExtractionView.java
License:Open Source License
/** * This method sets the view of the empty table. * //from w w w . ja va 2 s. c o m * @param flexTable {@link FlexTable} * @param headerRow {@link HeaderRow} */ private void setEmptyTableView(final FlexTable flexTable, final HeaderRow headerRow) { Label label = new Label(LocaleDictionary.get().getMessageValue(ReviewValidateMessages.NO_DATA_TO_DISPLAY)); int columnCount = headerRow.getColumns().getColumn().size(); addHeaderColumns(headerRow.getColumns().getColumn(), flexTable); flexTable.getRowFormatter().setStyleName(0, "header"); flexTable.setWidget(1, 0, label); flexTable.getFlexCellFormatter().setColSpan(1, 0, columnCount); }
From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java
License:Apache License
public void rebuildResultsTable() { if (plainText) { Label label = new Label(); label.setStyleName("plaintext"); label.setText(gridToString(toGrid())); resultsDiv.clear();/*from w w w . j a v a2 s . c om*/ resultsDiv.add(label); resultsDiv.add(new PlainTextEditor().getWidget()); HTML dash = new HTML(" - ", false); dash.setStyleName("inline"); resultsDiv.add(dash); resultsDiv.add(new SnapshotCreator().getWidget()); return; } FlexTable table = new FlexTable(); table.setStyleName("data"); int r = 0; int c = 0; int evenRowMod = 0; // results header #1: cValue variables if (cVariable != null) { evenRowMod = 1; table.insertRow(r); table.getRowFormatter().setStyleName(r, "valueRow"); table.getRowFormatter().addStyleName(r, "headerRow"); table.addCell(r); table.getFlexCellFormatter().setColSpan(r, 0, rVariables.size()); c++; for (Value cValue : cValues) { table.addCell(r); table.getFlexCellFormatter().setColSpan(r, c, 3); table.getCellFormatter().setStyleName(r, c, "parameterKey"); Widget contents = newVariableLabel(cVariable, cValue.getLabel(), rVariables.size()); contents.setStyleName("valueHeader"); table.setWidget(r, c++, contents); } r++; } // results header 2: rValue variables, followed by "nanos/barchart" column pairs c = 0; table.insertRow(r); table.getRowFormatter().setStyleName(r, "evenRow"); table.getRowFormatter().addStyleName(r, "headerRow"); for (Variable variable : rVariables) { table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c, newVariableLabel(variable, variable.getName(), c)); c++; } for (Value unused : cValues) { table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, newUnitLabel(unitMap.get(selectedType).trim())); table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, newRuntimeLabel()); table.addCell(r); table.getCellFormatter().setStyleName(r, c, "parameterKey"); table.setWidget(r, c++, new InlineLabel("%")); } r++; Key key = newDefaultKey(); for (RowsIterator rows = new RowsIterator(rVariables); rows.nextRow();) { rows.updateKey(key); table.insertRow(r); table.getRowFormatter().setStyleName(r, r % 2 == evenRowMod ? "evenRow" : "oddRow"); c = 0; for (int v = 0, size = rVariables.size(); v < size; v++) { table.addCell(r); table.setWidget(r, c++, new Label(rows.getRValue(v).getLabel())); } for (Value value : cValues) { table.addCell(r); table.addCell(r); if (cVariable != null) { key.set(cVariable, value); } final Datapoint datapoint = keysToDatapoints.get(key); table.getCellFormatter().setStyleName(r, c, "numericCell"); table.getCellFormatter().setStyleName(r, c + 1, "bar"); table.getCellFormatter().setStyleName(r, c + 2, "numericCell"); MeasurementSet measurementSet; if (datapoint != null && (measurementSet = datapoint.scenarioResults.getMeasurementSet(selectedType)) != null) { double rawMedian = getMedian(selectedType, measurementSet); String displayedValue = numberFormatMap.get(selectedType) .format(rawMedian / divideByMap.get(selectedType)); Anchor valueAnchor = new Anchor(displayedValue, false); valueAnchor.setStyleName("subtleLink"); valueAnchor.setStyleName("nanos", true); final DialogBox eventLogPopup = new DialogBox(true); eventLogPopup.setText(""); valueAnchor.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { // Do this lazily since it takes quite a bit of time to render these popups for all // the scenarios shown, and quite often they won't even be used. if (eventLogPopup.getText().isEmpty()) { eventLogPopup.setText("Event Log"); String eventLog = datapoint.scenarioResults.getEventLog(selectedType); if (eventLog == null || eventLog.isEmpty()) { eventLog = "No event log recorded."; } FlowPanel panel = new FlowPanel(); for (String line : eventLog.split("\n")) { panel.add(new Label(line)); } panel.setStyleName("eventLog"); eventLogPopup.add(panel); } eventLogPopup.center(); eventLogPopup.show(); } }); table.setWidget(r, c, valueAnchor); table.setWidget(r, c + 1, newBar(datapoint.style, measurementSet, value)); table.setWidget(r, c + 2, newPercentOfReferencePointLabel(rawMedian, value)); } else { table.setWidget(r, c, new Label("")); table.setWidget(r, c + 1, new Label("")); table.setWidget(r, c + 2, new Label("")); } c += 3; } r++; } resultsDiv.clear(); resultsDiv.add(table); resultsDiv.add(new PlainTextEditor().getWidget()); HTML dash = new HTML(" - ", false); dash.setStyleName("inline"); resultsDiv.add(dash); resultsDiv.add(new SnapshotCreator().getWidget()); }
From source file:com.google.gwt.examples.FlexTableExample.java
License:Apache License
public void onModuleLoad() { // Tables have no explicit size -- they resize automatically on demand. FlexTable t = new FlexTable(); // Put some text at the table's extremes. This forces the table to be // 3 by 3.//from w w w.j a v a 2s. c o m t.setText(0, 0, "upper-left corner"); t.setText(2, 2, "bottom-right corner"); // Let's put a button in the middle... t.setWidget(1, 0, new Button("Wide Button")); // ...and set it's column span so that it takes up the whole row. t.getFlexCellFormatter().setColSpan(1, 0, 3); RootPanel.get().add(t); }
From source file:com.google.gwt.sample.healthyeatingapp.client.FoodLog.FoodLog.java
public FlowPanel onModuleLoad() { rpcUserNameCall();/*from www . jav a 2 s .c o m*/ rpcCall(); // Create a Flex Table final FlexTable flexTable = new FlexTable(); FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter(); flexTable.addStyleName("flexTable"); flexTable.setCellSpacing(2); flexTable.setCellPadding(2); lbFG = new ListBox(); lbFN = new ListBox(); submit = new Button("Submit"); cancel = new Button("Pick a New Date"); fp = new FlowPanel(); // Add some text cellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); flexTable.setHTML(0, 0, "This table allows you to log your food entries:"); cellFormatter.setColSpan(0, 0, 2); lbFG.setVisibleItemCount(1); lbFN.setVisible(false); lbFG.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { fp.remove(SuccessLabel); int selectedIndex = lbFG.getSelectedIndex(); int numRows = 0; if (selectedIndex > 0) { numRows = flexTable.getRowCount(); flexTable.setWidget(numRows - 1, 0, lbFG); lbFN.clear(); caloriesText.setText("", Direction.DEFAULT); String test = lbFG.getValue(lbFG.getSelectedIndex()); String[] str = getFoodNames(ret, test); lbFN.addItem(""); for (String s : str) { lbFN.addItem(s); } lbFN.setSelectedIndex(0); lbFN.setVisible(true); flexTable.setWidget(numRows - 1, 1, lbFN); } } }); lbFN.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int selectedIndex = lbFN.getSelectedIndex(); int numRows = 0; if (selectedIndex > 0) numRows = flexTable.getRowCount(); flexTable.setWidget(numRows - 1, 1, lbFN); String test = lbFN.getValue(lbFN.getSelectedIndex()); String str = "" + getCalories(ret, test); caloriesText.setText(str, Direction.DEFAULT); flexTable.setWidget(numRows - 1, 2, caloriesText); } }); // Add a button that will add more rows to the table final Button addRowButton = new Button("Add a Row"); Button btn2 = new Button("Update"); addRowButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { fp.remove(SuccessLabel); addRow(flexTable); } }); addRowButton.addStyleName("fixedWidthButton"); VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setStyleName("flexTable-buttonPanel"); buttonPanel.add(addRowButton); flexTable.setWidget(0, 1, buttonPanel); cellFormatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); // Add two rows to start // addRow(flexTable); final DatePicker datePicker = new DatePicker(); // Set the value in the text box when the user selects a date datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { Date date = event.getValue(); DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd"); dateString = dfm.format(date); dateLabel.setText(dateString, Direction.DEFAULT); selectedDate = dateLabel.getText(); queryRpcCall(userNameTyped, selectedDate); } }); final Button Btn2 = new Button(); ret = new ArrayList<FoodLogItems>(); Btn2.setSize("100px", "30px"); Btn2.setText("View/Update"); Btn2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Btn2.setVisible(false); datePicker.setVisible(false); selectedDate = dateLabel.getText(); String[] dbRows; String[] dbElements; // Window.alert(prevFoodData); if (!(prevFoodData.equals(""))) { dbRows = prevFoodData.split(";"); for (String s : dbRows) { dbElements = s.split(":"); FoodLogData e = new FoodLogData(userNameTyped, dbElements[2], Integer.parseInt(dbElements[1]), dbElements[0], selectedDate); foodEntries.add(e); } } String[] temp; if (foodLogItems != null) { array = foodLogItems.split(";"); // String s=""; for (String s : array) { temp = s.split(":"); FoodLogItems e = new FoodLogItems(temp[0], Integer.parseInt(temp[1]), temp[2]); ret.add(e); } lbFG.addItem(""); String[] input = new String[ret.size()]; int i = 0; for (FoodLogItems e : ret) { input[i] = e.FoodGroup(); i++; } Set<String> tmp = new LinkedHashSet<String>(); for (String each : input) { tmp.add(each); } String[] output = new String[tmp.size()]; int j = 0; for (String each : tmp) { output[j++] = each; } for (String s : output) { lbFG.addItem(s); } lbFG.setSelectedIndex(0); } int numRows = flexTable.getRowCount(); // Window.alert(""+numRows); flexTable.removeAllRows(); flexTable.insertRow(0); int i = 0; for (FoodLogData j : foodEntries) { flexTable.insertRow(i + 1); numRows = flexTable.getRowCount(); flexTable.setText(numRows - 1, 0, j.getFoodGroup()); flexTable.setText(numRows - 1, 1, j.getFoodName()); flexTable.setText(numRows - 1, 2, j.getCalories() + ""); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); i++; } numRows = flexTable.getRowCount(); lbFG.setSelectedIndex(0); flexTable.setWidget(numRows, 0, lbFG); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); fp.add(flexTable); fp.add(addRowButton); fp.add(submit); fp.add(cancel); } }); InlineLabel dateMessageLabel = new InlineLabel(); dateMessageLabel.setText("Pick a date: "); submit.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { System.out.println("Submitting these items"); for (FoodLogData e : foodEntries) { System.out.println("Food name is " + e.getFoodName()); insertRpcCall(e.getUserName(), e.getFoodName(), e.getDate(), e.getCalories()); } fp.add(SuccessLabel); foodEntries.clear(); } }); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub fp.remove(SuccessLabel); Window.Location.reload(); } }); fp.add(dateMessageLabel); fp.add(dateLabel); fp.add(datePicker); fp.add(Btn2); return fp; }
From source file:com.google.gwt.sample.healthyeatingapp.client.FoodLog.FoodLog.java
private void addRow(FlexTable flexTable) { int numRows = flexTable.getRowCount(); if ((lbFG.getSelectedIndex() != 0)) { if ((lbFN.getSelectedIndex() != 0)) { String str2 = lbFG.getValue(lbFG.getSelectedIndex()); String str3 = lbFN.getValue(lbFN.getSelectedIndex()); String str4 = flexTable.getText(numRows - 1, 2); FoodLogData e = new FoodLogData(userNameTyped, str3, Integer.parseInt(str4), str2, selectedDate); foodEntries.add(e);/*from w w w . j a v a 2 s . c o m*/ //Kevin's code flexTable.insertRow(flexTable.getRowCount()); numRows = flexTable.getRowCount(); flexTable.setText(numRows - 2, 0, e.getFoodGroup()); flexTable.setText(numRows - 2, 1, e.getFoodName()); flexTable.setText(numRows - 2, 2, e.getCalories() + ""); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); //Kevin's code ends //Window.alert(""+numRows); /*Nadeem's original code flexTable.removeAllRows(); flexTable.insertRow(0); numRows = flexTable.getRowCount(); int i = 0; for (FoodLogData j : foodEntries) { flexTable.insertRow(i + 1); numRows = flexTable.getRowCount(); flexTable.setText(numRows - 1, 0, j.getFoodGroup()); flexTable.setText(numRows - 1, 1, j.getFoodName()); flexTable.setText(numRows - 1, 2, j.getCalories()+""); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); i++; }*/ //Nadeem's code ends numRows = flexTable.getRowCount(); lbFG.setSelectedIndex(0); flexTable.setWidget(numRows, 0, lbFG); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); } else { Window.alert("Food Item Not Selected."); } } else if (numRows <= 1) { lbFG.setSelectedIndex(0); flexTable.setWidget(numRows, 0, lbFG); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); } else { Window.alert("Food Item Not Selected."); } }
From source file:com.google.gwt.sample.healthyeatingapp.client.SocialMedia.SocialMedia.java
private void flexTableInitialize(FlexTable ft) { ft.setTitle("Leaderboard"); ft.setText(0, 0, "Leaderboard"); ft.getFlexCellFormatter().setColSpan(0, 0, 2); ft.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); ft.setText(1, 0, "Friend"); ft.setText(1, 1, "Points"); }
From source file:com.google.gwt.sample.showcase.client.content.i18n.CwBidiFormatting.java
License:Apache License
/** * Initialize this example./*from w w w .j av a 2 s .com*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create the internationalized blog messages blogMessages = GWT.create(BlogMessages.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface final String rawFile = getSimpleName(BlogMessages.class); Anchor link = new Anchor(rawFile); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { fireRawSourceRequest(rawFile + ".java"); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwBidiFormattingLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Show the template for reference String template = blogMessages.userComment("{0}", "{1}", "{2}"); layout.setHTML(1, 0, constants.cwBidiFormattingTemplateLabel()); layout.setHTML(1, 1, template); // Add argument 0 arg0Box = new TextBox(); // Using an initial value whose direction is opposite the locale's direction // demonstrates the need for and effect of bidi formatting. arg0Box.setText(LocaleInfo.getCurrentLocale().isRTL() ? "Tom Bombadil" : " "); layout.setHTML(2, 0, constants.cwBidiFormattingArg0Label()); layout.setWidget(2, 1, arg0Box); // Add argument 1 arg1Box = new TextBox(); arg1Box.setText("16"); layout.setHTML(3, 0, constants.cwBidiFormattingArg1Label()); layout.setWidget(3, 1, arg1Box); // Add argument 2 arg2Box = new TextBox(); // Using an initial value whose direction is opposite the locale's direction // demonstrates the need for and effect of bidi formatting. arg2Box.setText( LocaleInfo.getCurrentLocale().isRTL() ? "How deep is your love?" : " ?"); layout.setHTML(4, 0, constants.cwBidiFormattingArg2Label()); layout.setWidget(4, 1, arg2Box); // Add the unformatted message message = new HTML(); layout.setHTML(5, 0, constants.cwBidiFormattingNonbidiFormattedLabel()); layout.setWidget(5, 1, message); formatter.setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); // Add the bidi formatted message bidiFormattedMessage = new HTML(); layout.setHTML(6, 0, constants.cwBidiFormattingBidiFormattedLabel()); layout.setWidget(6, 1, bidiFormattedMessage); formatter.setVerticalAlignment(6, 0, HasVerticalAlignment.ALIGN_TOP); // Add handlers to all of the argument boxes KeyUpHandler keyUpHandler = new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateMessages(); } }; arg0Box.addKeyUpHandler(keyUpHandler); arg1Box.addKeyUpHandler(keyUpHandler); arg2Box.addKeyUpHandler(keyUpHandler); // Return the layout Widget updateMessages(); return layout; }
From source file:com.google.gwt.sample.showcase.client.content.i18n.CwConstantsExample.java
License:Apache License
/** * Initialize this example./*from w ww .j ava2s.com*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create the internationalized constants ExampleConstants exampleConstants = GWT.create(ExampleConstants.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface final String rawFile = getSimpleName(ExampleConstants.class); Anchor link = new Anchor(rawFile); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { fireRawSourceRequest(rawFile + ".java"); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwConstantsExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Show the first name TextBox firstNameBox = new TextBox(); firstNameBox.setText("Amelie"); firstNameBox.setWidth("17em"); layout.setHTML(1, 0, exampleConstants.firstName()); layout.setWidget(1, 1, firstNameBox); // Show the last name TextBox lastNameBox = new TextBox(); lastNameBox.setText("Crutcher"); lastNameBox.setWidth("17em"); layout.setHTML(2, 0, exampleConstants.lastName()); layout.setWidget(2, 1, lastNameBox); // Create a list box of favorite colors ListBox colorBox = new ListBox(); Map<String, String> colorMap = exampleConstants.colorMap(); for (Map.Entry<String, String> entry : colorMap.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); colorBox.addItem(value, key); } layout.setHTML(3, 0, exampleConstants.favoriteColor()); layout.setWidget(3, 1, colorBox); // Return the layout Widget return layout; }
From source file:com.google.gwt.sample.showcase.client.content.i18n.CwConstantsWithLookupExample.java
License:Apache License
/** * Initialize this example./* w ww . ja v a 2 s . c o m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create the internationalized constants colorConstants = GWT.create(ColorConstants.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface final String rawFile = getSimpleName(ColorConstants.class); Anchor link = new Anchor(rawFile); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { fireRawSourceRequest(rawFile + ".java"); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwConstantsWithLookupExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Add a field so the user can type a color colorBox = new TextBox(); colorBox.setText("red"); colorBox.setWidth("17em"); layout.setHTML(1, 0, constants.cwConstantsWithLookupExampleMethodName()); layout.setWidget(1, 1, colorBox); // Show the last name colorResultsBox = new TextBox(); colorResultsBox.setEnabled(false); colorResultsBox.setWidth("17em"); layout.setHTML(2, 0, constants.cwConstantsWithLookupExampleResults()); layout.setWidget(2, 1, colorResultsBox); // Add a handler to update the color as the user types a lookup value colorBox.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateColor(); } }); // Return the layout Widget updateColor(); return layout; }
From source file:com.google.gwt.sample.showcase.client.content.i18n.CwMessagesExample.java
License:Apache License
/** * Initialize this example./*from ww w . j av a 2 s .co m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create the internationalized error messages errorMessages = GWT.create(ErrorMessages.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface final String rawFile = getSimpleName(ErrorMessages.class); Anchor link = new Anchor(rawFile); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { fireRawSourceRequest(rawFile + ".java"); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwMessagesExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Show the template for reference String template = errorMessages.permissionDenied("{0}", "{1}", "{2}"); layout.setHTML(1, 0, constants.cwMessagesExampleTemplateLabel()); layout.setHTML(1, 1, template); // Add argument 0 arg0Box = new TextBox(); arg0Box.setText("amelie"); layout.setHTML(2, 0, constants.cwMessagesExampleArg0Label()); layout.setWidget(2, 1, arg0Box); // Add argument 1 arg1Box = new TextBox(); arg1Box.setText("guest"); layout.setHTML(3, 0, constants.cwMessagesExampleArg1Label()); layout.setWidget(3, 1, arg1Box); // Add argument 2 arg2Box = new TextBox(); arg2Box.setText("/secure/blueprints.xml"); layout.setHTML(4, 0, constants.cwMessagesExampleArg2Label()); layout.setWidget(4, 1, arg2Box); // Add the formatted message formattedMessage = new HTML(); layout.setHTML(5, 0, constants.cwMessagesExampleFormattedLabel()); layout.setWidget(5, 1, formattedMessage); formatter.setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); // Add handlers to all of the argument boxes KeyUpHandler keyUpHandler = new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateMessage(); } }; arg0Box.addKeyUpHandler(keyUpHandler); arg1Box.addKeyUpHandler(keyUpHandler); arg2Box.addKeyUpHandler(keyUpHandler); // Return the layout Widget updateMessage(); return layout; }