List of usage examples for com.google.gwt.event.dom.client StockPrice StockPrice
public StockPrice(String symbol, double price, double change)
From source file:com.google.gwt.example.stockwatcher.client.StockWatcher.java
/** * Generate random stock prices./*from w w w . j a v a 2s . com*/ */ private void refreshWatchList() { final double MAX_PRICE = 100.0; // $100.00 final double MAX_PRICE_CHANGE = 0.02; // +/- 2% StockPrice[] prices = new StockPrice[stocks.size()]; for (int i = 0; i < stocks.size(); i++) { double price = Random.nextDouble() * MAX_PRICE; double change = price * MAX_PRICE_CHANGE * (Random.nextDouble() * 2.0 - 1.0); prices[i] = new StockPrice(stocks.get(i), price, change); } updateTable(prices); }
From source file:com.google.gwt.sample.stockwatcher.client.StockWatcher1.java
protected void refreshWatchList() { final double MAX_PRICE = 100.0; // $100.00 final double MAX_PRICE_CHANGE = 0.02; // +/- 2% StockPrice[] prices = new StockPrice[stocks.size()]; for (int i = 0; i < stocks.size(); i++) { double price = Random.nextDouble() * MAX_PRICE; double change = price * MAX_PRICE_CHANGE * (Random.nextDouble() * 2.0 - 1.0); prices[i] = new StockPrice(stocks.get(i), price, change); }/*w w w .j av a2s . c o m*/ updateTable(prices); }