summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/ui-contribution
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-03 13:36:24 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-03 13:36:24 +0000
commitdecdb7869ac71c291b835db1b291172b73e3c280 (patch)
tree0eca72e470f26cb889fddf122a5bd9cdb7ea8352 /sandbox/travelsample/ui-contribution
parent2039d195339d7790cb584e19058deeaf7db95829 (diff)
Updates to add in cars and flights
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@682170 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml2
-rw-r--r--sandbox/travelsample/ui-contribution/build.xml2
-rw-r--r--sandbox/travelsample/ui-contribution/scatours.composite41
-rw-r--r--sandbox/travelsample/ui-contribution/scatours.html94
4 files changed, 114 insertions, 25 deletions
diff --git a/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml
index ca5bb4bc3e..51f91e071e 100644
--- a/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml
+++ b/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml
@@ -22,6 +22,8 @@
<import.java package="scatours.common"/>
<import.java package="scatours.currencyconverter"/>
<import.java package="scatours.hotel"/>
+ <import.java package="scatours.flight"/>
+ <import.java package="scatours.car"/>
<import.java package="scatours.trip"/>
<deployable composite="scatours:scatours"/>
</contribution> \ No newline at end of file
diff --git a/sandbox/travelsample/ui-contribution/build.xml b/sandbox/travelsample/ui-contribution/build.xml
index 924456228e..8d5b4a8dfa 100644
--- a/sandbox/travelsample/ui-contribution/build.xml
+++ b/sandbox/travelsample/ui-contribution/build.xml
@@ -88,7 +88,7 @@
<include name="tuscany-xsd-1.4-SNAPSHOT.jar"/>
</fileset>
<fileset id="3rdparty.jars" dir="../../lib">
- <include name="XmlSchema-1.3.1.jar"/>
+ <include name="XmlSchema-1.3.2.jar"/>
<include name="activation-1.1.jar"/>
<include name="asm-all-3.1.jar"/>
<include name="cglib-nodep-2.1_3.jar"/>
diff --git a/sandbox/travelsample/ui-contribution/scatours.composite b/sandbox/travelsample/ui-contribution/scatours.composite
index 7d340bebba..76fdc2c0d6 100644
--- a/sandbox/travelsample/ui-contribution/scatours.composite
+++ b/sandbox/travelsample/ui-contribution/scatours.composite
@@ -31,21 +31,40 @@
<reference name="hotel" target="HotelComponent">
<tuscany:binding.jsonrpc/>
</reference>
- <reference name="trip" target="TripComponent">
+ <reference name="flight" target="FlightComponent">
<tuscany:binding.jsonrpc/>
</reference>
+ <reference name="car" target="CarComponent">
+ <tuscany:binding.jsonrpc/>
+ </reference>
+ <reference name="tripSearch" target="TripComponent/TripSearch">
+ <tuscany:binding.jsonrpc/>
+ </reference>
+ <reference name="tripContents" target="TripComponent/TripContents">
+ <tuscany:binding.jsonrpc/>
+ </reference>
</component>
<component name="TripComponent">
<implementation.java class="scatours.trip.TripImpl"/>
- <service name="Trip">
+ <service name="TripSearch">
+ <tuscany:binding.jsonrpc/>
+ </service>
+ <service name="TripContents">
<tuscany:binding.jsonrpc/>
</service>
<reference name="hotelSearch" target="HotelComponent">
<binding.sca/>
</reference>
+ <reference name="flightSearch" target="FlightComponent">
+ <binding.sca/>
+ </reference>
+ <reference name="carSearch" target="CarComponent">
+ <binding.sca/>
+ </reference>
<reference name="currencyConverter" target="CurrencyConverterComponent">
</reference>
+ <property name="quoteCurrencyCode">GBP</property>
</component>
<component name="HotelComponent">
@@ -54,7 +73,23 @@
<binding.sca/>
<tuscany:binding.jsonrpc/>
</service>
- </component>
+ </component>
+
+ <component name="FlightComponent">
+ <implementation.java class="scatours.flight.FlightImpl"/>
+ <service name="Search">
+ <binding.sca/>
+ <tuscany:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="CarComponent">
+ <implementation.java class="scatours.car.CarImpl"/>
+ <service name="Search">
+ <binding.sca/>
+ <tuscany:binding.jsonrpc/>
+ </service>
+ </component>
<component name="CurrencyConverterComponent">
<implementation.java class="scatours.currencyconverter.CurrencyConverterImpl"/>
diff --git a/sandbox/travelsample/ui-contribution/scatours.html b/sandbox/travelsample/ui-contribution/scatours.html
index 88bad8ed1f..51feeb0815 100644
--- a/sandbox/travelsample/ui-contribution/scatours.html
+++ b/sandbox/travelsample/ui-contribution/scatours.html
@@ -28,14 +28,22 @@
//@Reference
var hotel = new Reference("hotel");
+
+ //@Reference
+ var flight = new Reference("flight");
+
+ //@Reference
+ var car = new Reference("car");
//@Reference
- var trip = new Reference("trip");
+ var tripSearch = new Reference("tripSearch");
+ //@Reference
+ var tripContents = new Reference("tripContents");
+
//local state
- var hotels;
- var flights;
- var cars;
+ var searchResponseItems;
+ var tripItems;
//the constructor for trip leg beans
function TripLegType(id,
@@ -74,8 +82,16 @@
hotel.searchSynch(getTripLeg(), search_response);
}
+ function searchFlights() {
+ flight.searchSynch(getTripLeg(), search_response);
+ }
+
+ function searchCars() {
+ car.searchSynch(getTripLeg(), search_response);
+ }
+
function searchTrip() {
- trip.search(getTripLeg(), search_response);
+ tripSearch.search(getTripLeg(), search_response);
}
function search_response(items, exception) {
@@ -83,15 +99,48 @@
alert(exception.javaStack);
return;
}
- var hotelsHTML = "";
+ var responseHTML = '<table border="0">';
+ responseHTML += '<tr>';
+ responseHTML += '<td>Select</td><td>Name</td><td>Description</td><td>Location</td><td>From - To</td><td>Price</td>';
+ responseHTML += '</tr>';
+
for (var i=0; i<items.length; i++) {
- var item = items[i].name + ' - ' + items[i].description;
- hotelsHTML += '<input name="items" type="checkbox" value="' +
- item + '">' + item + ' <br>';
+ responseHTML += '<tr>';
+ responseHTML += '<td><input onClick="processSelection()" name="items" type="checkbox" value="' + items[i].id + '"></td>'
+ responseHTML += '<td>' + items[i].name + '</td>';
+ responseHTML += '<td>' + items[i].description + '</td>';
+ responseHTML += '<td>' + items[i].location + '</td>';
+ responseHTML += '<td>' + items[i].fromDate + ' - ' + items[i].toDate +'</td>';
+ responseHTML += '<td>' + items[i].price + ' ' + items[i].currency + '</td>';
+ responseHTML += '</tr>';
}
- document.getElementById('searchResponse').innerHTML = hotelsHTML;
- hotels = items;
+
+ responseHTML += '</table>';
+
+ document.getElementById('searchResponse').innerHTML = responseHTML;
+
+ searchResponseItems = items;
}
+
+ function processSelection() {
+ var items = document.tripForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++) {
+ if (items[i].checked == true) {
+ tripContents.addTripItem(items[i].value);
+ }
+ }
+
+ tripContents.getTotalPrice(totalPrice_response);
+ }
+
+ function totalPrice_response(totalPrice, exception) {
+ if(exception){
+ alert(exception.javaStack);
+ return;
+ }
+ document.getElementById('totalPrice').innerHTML = totalPrice;
+ }
</script>
@@ -113,7 +162,7 @@
<td>Start Date:</td>
<td><input type="text" name="fromDate" value="06/12/08"></td>
<td>End Date:</td>
- <td><input type="text" name="toDate" value="06/12/08"></td>
+ <td><input type="text" name="toDate" value="13/12/08"></td>
</tr>
<tr>
<td>Number of people:</td>
@@ -127,18 +176,21 @@
<td/>
</tr>
</table>
- <input type="button" onClick="searchHotels()" value="SearchHotels">
+ <input type="button" onClick="searchHotels()" value="Search Hotels">
+ <input type="button" onClick="searchFlights()" value="Search Flights">
+ <input type="button" onClick="searchHotels()" value="Search Cars">
+ <br/>
<input type="button" onClick="searchTrip()" value="SearchTrip">
</form>
- <div id="searchResponse"></div>
- <br>
- <form name="tripForm">
- <input type="button" onClick="bookTrip()" value="BookTrip">
+ <form name="tripForm">
+ <div id="searchResponse"></div>
+ <br>
+ <div id="totalPrice"></div>
+ <br>
+ <input type="button" onClick="bookTrip()" value="Book Trip">
</form>
- <br>
- <div id="trip"></div>
- <br>
- <div id="total"></div>
+
+
</div>
</body>