List of usage examples for com.google.gwt.user.client Window alert
public static void alert(String msg)
From source file:com.google.gwt.sample.simplexml.client.SimpleXML.java
License:Apache License
private void requestFailed(Throwable exception) { Window.alert("Failed to send the request. The error message was: " + exception.getMessage()); }
From source file:com.google.gwt.sample.stockwatch.client.StockWatcher.java
private void addStock() { final String symbol = newSymbolTextBox.getText().toUpperCase().trim(); newSymbolTextBox.setFocus(true);/*from w w w . j a va2 s. c om*/ //Stock Code must be between 1 and 10 chars that are numbers, letters, or dots. if (!symbol.matches("^[0-9A-Z\\.]{1,10}$")) { Window.alert("'" + symbol + "' is not a valid symbol."); newSymbolTextBox.selectAll(); return; } newSymbolTextBox.setText(""); //Do not add the stock if it is already in the table. if (stocks.contains(symbol)) { return; } addStock(symbol); // displayStock(symbol); }
From source file:com.google.gwt.sample.stockwatch.client.StockWatcher.java
private void handleError(Throwable error) { Window.alert(error.getMessage()); if (error instanceof NotLoggedInException) { Window.Location.replace(loginInfo.getLogoutUrl()); }//from ww w. j a va 2 s .c o m }
From source file:com.google.gwt.sample.stockwatcher.client.Cells.java
private Widget createCellList() { TextCell textCell = new TextCell(); CellList<String> cellList = new CellList<>(textCell); final List<String> DAYS = Arrays.asList("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); /*//from w ww . j a v a2 s .co m * Selection Model */ cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); //Add a selection model to handle user selection final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(); cellList.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { String selected = selectionModel.getSelectedObject(); if (selected != null) { Window.alert("You selected: " + selected); } } }); /* * Value updater */ // cellList.setValueUpdater(new ValueUpdater<String>() { // @Override // public void update(String value) { // Window.alert("New Value: " + value); // } // }); // Set the total row count. This isn't strictly necessary, but it affects // paging calculations, so its good habit to keep the row count up to date. cellList.setRowCount(DAYS.size(), true); cellList.setRowData(0, DAYS); // Create a SimplePager. SimplePager pager = new SimplePager(); // Set the cellList as the display. pager.setDisplay(cellList); // Add the pager and list to the page. VerticalPanel vPanel = new VerticalPanel(); vPanel.add(pager); vPanel.add(cellList); return vPanel; }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getTotalReadingByDay(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getTotalReadingGroupByDay(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }//from www . ja v a2 s. co m public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); // String [][] result2 = combineDate(result); Number[][] data = ChartUtilities.formatDaily(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Sum of Daily Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getTotalReadingByMonth(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getTotalReadingGroupByMonth(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }/* w w w . j ava 2 s. c o m*/ public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); // String [][] result2 = combineDate(result); Number[][] data = ChartUtilities.formatMonthly(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Sum of Monthly Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getTotalReadingByYear(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getTotalReadingGroupByYear(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }//w w w . jav a 2s .c o m public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); Number[][] data = ChartUtilities.formatYearly(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Sum of Yearly Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getAverageReadingByDay(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getAverageReadingGroupByDay(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }/*from w w w. j a va2s . co m*/ public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); // String [][] result2 = combineDate(result); Number[][] data = ChartUtilities.formatDaily(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Average Daily Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getAverageReadingByMonth(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getAverageReadingGroupByMonth(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }//w w w . j a va2s.c om public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); // String [][] result2 = combineDate(result); Number[][] data = ChartUtilities.formatMonthly(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Average Monthly Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getAverageReadingByYear(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getAverageReadingGroupByYear(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }// w w w . j a v a 2 s .c o m public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); Number[][] data = ChartUtilities.formatYearly(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Average Yearly Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }