Last active
December 30, 2015 02:59
-
-
Save FeherMarcell/7766144 to your computer and use it in GitHub Desktop.
Számítási felhő alapú szoftverfejlesztés
Google Web Toolkit / Google AppEngine gyakorlat kódrészletei
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StockPrice implements Serializable{ | |
private String symbol; | |
private double price; | |
private double change; | |
public StockPrice() { | |
} | |
public StockPrice(String symbol, double price, double change) { | |
this.symbol = symbol; | |
this.price = price; | |
this.change = change; | |
} | |
public String getSymbol() { | |
return this.symbol; | |
} | |
public double getPrice() { | |
return this.price; | |
} | |
public double getChange() { | |
return this.change; | |
} | |
public double getChangePercent() { | |
return 10.0 * this.change / this.price; | |
} | |
public void setSymbol(String symbol) { | |
this.symbol = symbol; | |
} | |
public void setPrice(double price) { | |
this.price = price; | |
} | |
public void setChange(double change) { | |
this.change = change; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<!-- Google web fonts --> | |
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600' | |
rel='stylesheet' type='text/css'> | |
<link | |
href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' | |
rel='stylesheet' type='text/css'> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- Styles --> | |
<!-- Bootstrap CSS --> | |
<link href="stockwatcher/css/bootstrap.min.css" rel="stylesheet"> | |
<!-- jQuery UI --> | |
<link href="stockwatcher/css/jquery-ui.css" rel="stylesheet"> | |
<!-- jQuery Gritter --> | |
<link href="stockwatcher/css/jquery.gritter.css" rel="stylesheet"> | |
<!-- Bootstrap Switch --> | |
<link href="stockwatcher/css/bootstrap-switch.css" rel="stylesheet"> | |
<!-- jQuery Datatables --> | |
<link href="stockwatcher/css/jquery.dataTables.css" rel="stylesheet"> | |
<!-- Rateit --> | |
<link href="stockwatcher/css/rateit.css" rel="stylesheet"> | |
<!-- jQuery prettyPhoto --> | |
<link href="stockwatcher/css/prettyPhoto.css" rel="stylesheet"> | |
<!-- Full calendar --> | |
<link href="stockwatcher/css/fullcalendar.css" rel="stylesheet"> | |
<!-- Font awesome CSS --> | |
<link href="stockwatcher/css/font-awesome.min.css" rel="stylesheet"> | |
<!-- Custom CSS --> | |
<link href="stockwatcher/css/style.css" rel="stylesheet"> | |
<!--[if IE]> | |
<link rel="stylesheet" type="text/css" href="stockwatcher/css/style-ie.css" /> | |
<![endif]--> | |
<!-- Favicon --> | |
<link rel="shortcut icon" href="#"> | |
<title>Stockwatcher</title> | |
</head> | |
<body> | |
<!-- OPTIONAL: include this if you want history support --> | |
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' | |
style="position: absolute; width: 0; height: 0; border: 0"></iframe> | |
<!-- RECOMMENDED if your web app will not function without JavaScript enabled --> | |
<noscript> | |
<div | |
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"> | |
Your web browser must have JavaScript enabled in order for this | |
application to display correctly.</div> | |
</noscript> | |
<div class="out-container"> | |
<div class="outer"> | |
<!-- Mainbar starts --> | |
<div class="mainbar" style="margin-left: 0px; min-height: 100px"> | |
<div class="clearfix"></div> | |
<!-- Black block starts --> | |
<div class="blue-block"> | |
<div class="page-title"> | |
<h3 class="pull-left"> | |
<i class="icon-signal"></i> StockWatcher<span> GWT Demo</span> | |
</h3> | |
<div class="clearfix"></div> | |
</div> | |
</div> | |
<!-- Black block ends --> | |
<!-- Content starts --> | |
<div class="container"> | |
<div class="page-content page-charts"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="widget"> | |
<div class="widget-head"> | |
<h5>Watched stocks</h5> | |
</div> | |
<div class="widget-body no-padd"> | |
<div id="stockList" class="table-responsive"></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Realtime charts --> | |
<div class="widget"> | |
<div class="widget-head"> | |
<h5> | |
<i class="icon-signal"></i> Real Time Chart (szorgalmi házi) | |
</h5> | |
</div> | |
<div class="widget-body"> | |
<div class="chart-container"> | |
<div id="live-chart" class="chart-placeholder"></div> | |
</div> | |
</div> | |
</div> | |
<!-- Realtime chart --> | |
<!-- Pie chart ends --> | |
</div> | |
</div> | |
<!-- Content ends --> | |
</div> | |
<!-- Mainbar ends --> | |
<div class="clearfix"></div> | |
</div> | |
</div> | |
<script type="text/javascript" language="javascript" | |
src="stockwatcher/stockwatcher.nocache.js"></script> | |
<!-- jQuery --> | |
<script src="stockwatcher/js/jquery.js"></script> | |
<!-- Bootstrap JS --> | |
<script src="stockwatcher/js/bootstrap.min.js"></script> | |
<!-- Sparkline for Mini charts --> | |
<script src="stockwatcher/js/sparkline.js"></script> | |
<!-- jQuery UI --> | |
<script src="stockwatcher/js/jquery-ui-1.10.2.custom.min.js"></script> | |
<!-- jQuery flot --> | |
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="stockwatcher/js/excanvas.min.js"></script><![endif]--> | |
<script src="stockwatcher/js/jquery.flot.min.js"></script> | |
<script src="stockwatcher/js/jquery.flot.resize.min.js"></script> | |
<script type="text/javascript"> | |
/* Realtime chart starts */ | |
$(function () { | |
// we use an inline data source in the example, usually data would | |
// be fetched from a server | |
var data = [], totalPoints = 300; | |
function getRandomData() { | |
if (data.length > 0) | |
data = data.slice(1); | |
// do a random walk | |
while (data.length < totalPoints) { | |
var prev = data.length > 0 ? data[data.length - 1] : 50; | |
var y = prev + Math.random() * 10 - 5; | |
if (y < 10) | |
y = 10; | |
if (y > 70) | |
y = 70; | |
data.push(y); | |
} | |
// zip the generated y values with the x values | |
var res = []; | |
for (var i = 0; i < data.length; ++i){ | |
res.push([ i, data[i] ]); | |
} | |
return res; | |
} | |
// setup control widget | |
var updateInterval = 300; | |
// setup plot | |
var options = { | |
series: { shadowSize: 0 }, // drawing is faster without shadows | |
lines: {fill: true}, | |
grid: {borderWidth:0 }, | |
yaxis: { min: 0, max: 100 }, | |
colors: ["#16cbe6"] | |
}; | |
var plot = $.plot($("#live-chart"), [ getRandomData() ], options); | |
function update() { | |
plot.setData([ getRandomData() ]); | |
// since the axes don't change, we don't need to call plot.setupGrid() | |
plot.draw(); | |
setTimeout(update, updateInterval); | |
} | |
update(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment