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.stockwatcher.client.ChartCreationHandler.java
private static void getCulmulativeReadingByDay(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getCulmulativeReadingGroupByDay(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }/*from w w w .j a v a 2s .c om*/ 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, "Daily Cumulative Sum Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getCulmulativeReadingByMonth(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getCulmulativeReadingGroupByMonth(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }//from w w w . j a va2 s.com 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, "Monthly Cumulative Sum Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void getCulmulativeReadingByYear(final String sensor, final Boolean isPredictionEnabled, final int steps, final int currRequestID) { Utility.newRequestObj().getCulmulativeReadingGroupByYear(sensor, isPredictionEnabled, steps, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed: " + caught.getMessage()); }//w w w . jav a 2 s . co m public void onSuccess(String[][] result) { if (currRequestID == Data.latestRequestID) { checkInsufficientDataForPrediction(result, isPredictionEnabled); Number[][] data = ChartUtilities.formatYearly(result); Chart chart = ChartUtilities.createReportChart(sensor, data, "Yearly Cumulative Sum Readings of " + sensor, isPredictionEnabled, steps); ReportingPage.chartPanel.add(chart); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChartCreationHandler.java
private static void checkInsufficientDataForPrediction(String[][] result, Boolean isPredictionEnabled) { if (result.length == 1 && isPredictionEnabled) { Window.alert("Insufficient data to perform prediction on"); }// w w w . j a v a 2 s . c om }
From source file:com.google.gwt.sample.stockwatcher.client.ChartUtilities.java
public static void getData(final String sn, final java.sql.Date sd, final java.sql.Date ed, final boolean predictionIsEnabled, final boolean isLiveUpdate, final int steps) { Data.latestRequestID++;// www . j a va2 s .c o m final int currRequestID = Data.latestRequestID; Utility.newRequestObj().greetServer(sn, sd, ed, predictionIsEnabled, steps, false, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Data request failed"); } //Remember to use Object[] input to get the rest of the information for chart display public void onSuccess(String[][] result) { if (Utility.isNull(result)) { Utility.setMsg(Messages.NO_DATA); } else if (currRequestID == Data.latestRequestID) { result = filterData(result); Number[][] data = formatData(result); Utility.hideTimer(); StockChart chart = createLiveChart(sn, data, updateLiveUpdateTitle(sn, sd, ed), predictionIsEnabled, isLiveUpdate, steps); MonitoringPage.chartPanel.clear(); MonitoringPage.chartPanel.add(chart); //BasePage.panel.add(createFlexTable(result)); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.ChatWidget.java
@UiHandler("sendButton") void handleSendClick(ClickEvent event) { Window.alert("Hello UI"); // send message... }
From source file:com.google.gwt.sample.stockwatcher.client.CopyOfStockWatcher.java
/** * Add stock to FlexTable. Executed when the user clicks the addStockButton or * presses enter in the newSymbolTextBox. *//*from ww w . j ava2 s. c o m*/ private void addStock() { final String symbol = newSymbolTextBox.getText().toUpperCase().trim(); newSymbolTextBox.setFocus(true); // 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(""); // Don't add the stock if it's already in the table. if (stocks.contains(symbol)) return; addStock(symbol); }
From source file:com.google.gwt.sample.stockwatcher.client.Gwt_Project_StockWatcher.java
private void addStock() { final String symbol = newSymbolTextBox.getText().toUpperCase().trim(); newSymbolTextBox.setFocus(true);//w w w .ja v a2 s.c o m //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."); Window.alert(messages.invalidSymbol(symbol)); newSymbolTextBox.selectAll(); return; } newSymbolTextBox.setText(""); // TODO Don't add the stock if it's already in the table. if (stocks.contains(symbol)) return; // TODO Add the stock to the table int row = stocksFlexTable.getRowCount(); stocks.add(symbol); stocksFlexTable.setText(row, 0, symbol); stocksFlexTable.setWidget(row, 2, new Label()); stocksFlexTable.getCellFormatter().addStyleName(row, 1, "watchListNumbericColumn"); stocksFlexTable.getCellFormatter().addStyleName(row, 2, "watchListNumbericColumn"); stocksFlexTable.getCellFormatter().addStyleName(row, 3, "watchListRemoveColumn"); // TODO Add a button to remove this stock from the table. Button removeStockButton = new Button("x"); removeStockButton.addStyleDependentName("remove"); removeStockButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int removedIndex = stocks.indexOf(symbol); stocks.remove(removedIndex); stocksFlexTable.removeRow(removedIndex + 1); } }); stocksFlexTable.setWidget(row, 3, removeStockButton); // TODO Get the stock price. refreshWatchList(); }
From source file:com.google.gwt.sample.stockwatcher.client.HelloButton.java
@UiHandler("button") void handleClick(ClickEvent e) { Window.alert("Hello from Button!"); }
From source file:com.google.gwt.sample.stockwatcher.client.Login.java
@UiHandler("buttonSubmit") void doClickSubmit(ClickEvent event) { if (tooShort) { Window.alert("Login or Password is too short!"); } else {// ww w. j a v a 2 s .co m Window.alert("Login Successful!"); } }