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.SchedulePage.java
private void getActuatorSpecialSchedule(final String actuator) { Utility.newRequestObj().getActuatorSpecialSchedule(actuator, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Unable to get special schedule"); Utility.hideTimer();//from w ww . jav a2 s .c o m } public void onSuccess(String[][] result) { if (Utility.isNull(result)) { Utility.setMsg(Messages.NO_DATA); } else { currentActuatorView = actuatorLB.getSelectedItemText(); refreshSpecialScheduleData(actuator, result); Utility.hideTimer(); updateSpecialScheduleTable(scheduleTable, result); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SchedulePage.java
private void getOngoingSchedulesByName(final String actuator) { Utility.newRequestObj().getOngoingSchedulesByName(actuator, new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Unable to get ongoing schedules for " + actuator); Utility.hideTimer();//from ww w .j ava2 s. c o m } public void onSuccess(String[][] result) { if (Utility.isNull(result)) { Utility.setMsg(Messages.NO_DATA); } else { updateOngoingScheduleTable(scheduleTable, result); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SchedulePage.java
@SuppressWarnings("unused") private void getOngoingSchedules(final String actuator) { Utility.newRequestObj().getOngoingSchedulesAll(new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Unable to get ongoing schedules"); Utility.hideTimer();//from w ww .ja v a 2 s. com } public void onSuccess(String[][] result) { if (Utility.isNull(result)) { Utility.setMsg(Messages.NO_DATA); } else { updateOngoingScheduleTable(scheduleTable, result); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SensorActuatorResponsePage.java
private void sendCreateResponseRequest() { Utility.newRequestObj().sensorActuatorResponseCreate(aName, onTrigger, onNotTrigger, expression, enabled, timeout, new AsyncCallback<String>() { public void onFailure(Throwable caught) { Window.alert("Unable to create response binding"); }/* w ww .j av a 2 s. c o m*/ public void onSuccess(final String result) { if (Integer.parseInt(result) >= 0) { Window.alert("Created response binding (ID): " + result); // addSensorActuatorResponseAttributeList(result); getLatestResponseData(); } else Window.alert(result); } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SensorActuatorResponsePage.java
private void sendUpdateResponseRequest() { Utility.newRequestObj().sensorActuatorResponseUpdate(Integer.parseInt(currentSelectedID), aName, onTrigger, onNotTrigger, expression, enabled, timeout, new AsyncCallback<String>() { public void onFailure(Throwable caught) { Window.alert("Unable to update response binding"); }/*w w w . j a va 2s . co m*/ public void onSuccess(final String result) { Window.alert("Updating response binding: " + result); if (result.equalsIgnoreCase("OK")) { // updateSensorActuatorResponseAttributeList(); getLatestResponseData(); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SensorActuatorResponsePage.java
private void sendDeleteResponseRequest() { Utility.newRequestObj().sensorActuatorResponseDelete(Integer.parseInt(currentSelectedID), new AsyncCallback<String>() { public void onFailure(Throwable caught) { Window.alert("Unable to delete response binding"); }// w ww . j a v a 2s. co m public void onSuccess(final String result) { Window.alert("Deleting response binding: " + result); if (result.equalsIgnoreCase("OK")) { // Data.sensorAcutatorResponseAttributeList.remove(currentSelectedID); getLatestResponseData(); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.SensorActuatorResponsePage.java
private void getLatestResponseData() { tablePanel.clear();//ww w . j a v a 2 s .co m tablePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); tablePanel.add(Utility.addTimer()); Utility.newRequestObj().sensorActuatorResponseGetAll(new AsyncCallback<String[][]>() { public void onFailure(Throwable caught) { Window.alert("Unable to get sensor/actuator response list"); } public void onSuccess(String[][] responseList) { Utility.hideTimer(); responseTable.setVisible(true); if (responseList != null) { // Window.alert("Got latest response data: size "+responseList.length); refreshResponseCache(responseList); updateResponseTable(responseTable, responseList); } else { responsePopup.setVisible(false); FlexTable newTable = new FlexTable(); responseTable = newTable; tablePanel.clear(); tablePanel.add(responseTable); } } }); }
From source file:com.google.gwt.sample.stockwatcher.client.StockWatch.java
/** * Add stock to FlexTable. Executed when the user clicks the addStockButton * or presses enter in the newSymbolTextBox. *///from w w w.j ava2 s . c o m private void addStock() { // gets the text from the box, makes it uppercase and takes away leading // and trailing space. final String symbol = newSymbolBox.getText().toUpperCase().trim(); newSymbolBox.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."); newSymbolBox.selectAll(); return; } newSymbolBox.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 = stockTable.getRowCount(); stocks.add(symbol); stockTable.setText(row, 0, symbol); stockTable.setWidget(row, 2, new Label()); stockTable.getCellFormatter().addStyleName(row, 1, "watchListNumericColumn"); stockTable.getCellFormatter().addStyleName(row, 2, "watchListNumericColumn"); stockTable.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); stockTable.removeRow(removedIndex + 1); } }); stockTable.setWidget(row, 3, removeStockButton); // TODO Get the stock price. refreshWatchList(); }
From source file:com.google.gwt.sample.stockwatcher.client.StockWatcher.java
/** * Add stock to FlexTable. Executed when the user clicks the addStockButton or * presses enter in the newSymbolTextBox. *//*from w w w. j av a 2 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(""); // 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); // TODO Add a button to remove this stock from the table. Button removeStockButton = new Button("x"); 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.StockWatcher1.java
private void addStocks() { final String symbol = newSymbolTextBox.getText().toUpperCase().trim(); newSymbolTextBox.setFocus(true);//from w ww.ja v a 2 s .co 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."); newSymbolTextBox.selectAll(); return; } if (stocks.contains(symbol)) return; // Add the stock to the table. int row = stocksFlexTable.getRowCount(); stocks.add(symbol); stocksFlexTable.setText(row, 0, symbol); // Add a button to remove this stock from the table. Button removeStockButton = new Button("x"); 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); }