Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Templates/UI5 XACE - XML App Component With EventBus/Component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
jQuery.sap.declare("${namespace}.Component");

sap.ui.core.UIComponent.extend("${namespace}.Component", {

createContent : function() {

// create root view
var oView = sap.ui.view({
id: "idViewApp",
viewName: "${namespace}.view.App",
type: "XML",
viewData: { component : this }
});

// set data model on root view
oView.setModel(new sap.ui.model.json.JSONModel("model/mock.json"));

// set i18n model
var i18nModel = new sap.ui.model.resource.ResourceModel({
bundleUrl : "i18n/messageBundle.properties"
});
oView.setModel(i18nModel, "i18n");

// done
return oView;
}
});
10 changes: 10 additions & 0 deletions Templates/UI5 XACE - XML App Component With EventBus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
XACE - XML | App | Component | EventBus

Basic app with:

Views: XML
Main Control: App
Driver: Component
Navigation: EventBus

From SublimeUI5 - see [SublimeUI5 on Github](https://github.com/qmacro/SublimeUI5) for more info.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders":
[
{
"path": "."
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FirstPageTitle=Overview
SecondPageTitle=Detail
30 changes: 30 additions & 0 deletions Templates/UI5 XACE - XML App Component With EventBus/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">

<title>${project_name}</title>

<script id="sap-ui-bootstrap"
type="text/javascript"
src="/sapui5/latest/libs/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{"${namespace}": "./"}'>
</script>

<script>

new sap.ui.core.ComponentContainer({
name : "${namespace}"
}).placeAt("content");

</script>
</head>

<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"beers": [
{
"brewName": "India Pale Ale (IPA)",
"brewerName": "Goose Island Beer Co.",
"brewType": "English IPA",
"ABV": 5.9
},
{
"brewName": "Pint",
"brewerName": "Marble Beers",
"brewType": "Golden Ale",
"ABV": 5.9
},
{
"brewName": "Orval",
"brewerName": "Brasserie d'Orval",
"brewType": "Belgian Pale Ale",
"ABV": 3.9
},
{
"brewName": "Old Peculier",
"brewerName": "Theakstons",
"brewType": "Old Ale",
"ABV": 6.2
},
{
"brewName": "5 A.M. Saint",
"brewerName": "BrewDog",
"brewType": "American Amber / Red Ale",
"ABV": 5.6
},
{
"brewName": "90 Minute IPA",
"brewerName": "Dogfish Head Craft Brewery",
"brewType": "Imperial / Double IPA",
"ABV": 9.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
sap.ui.controller("${namespace}.view.App", {

onInit: function(oEvent) {

var bus = sap.ui.getCore().getEventBus();
bus.subscribe("nav", "to", this.navToHandler, this);
bus.subscribe("nav", "back", this.navBackHandler, this);

this.oApp = this.getView().byId("idAppRoot");

},


navToHandler: function(channelId, eventId, data) {

this.oApp.to(data.id);
if (data.data.context) {
this.oApp.getPage(data.id).setBindingContext(data.data.context);
}

},


navBackHandler: function() {

this.oApp.back();

}

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<core:View
controllerName="${namespace}.view.App"
displayBlock="true"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">

<App id="idAppRoot">
<mvc:XMLView viewName="${namespace}.view.First" id="idViewFirst" />
<mvc:XMLView viewName="${namespace}.view.Second" id="idViewSecond" />
</App>

</core:View>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sap.ui.controller("${namespace}.view.First", {

onInit: function() {
this.bus = sap.ui.getCore().getEventBus();
},

handleListSelect: function(oEvent) {
this.bus.publish("nav", "to", {
id: "idViewApp--idViewSecond",
data: {
context: oEvent.getParameter("listItem").getBindingContext()
}
});
}


});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<core:View
controllerName="${namespace}.view.First"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">

<Page title="{i18n>FirstPageTitle}">
<List
id="idListBeers"
items="{/beers}"
mode="SingleSelectMaster"
select="handleListSelect">
<StandardListItem
title="{brewName}"
description="{brewerName}" />
</List>
</Page>

</core:View>

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sap.ui.controller("${namespace}.view.Second", {

onInit: function() {
this.bus = sap.ui.getCore().getEventBus();
},

handleNavButtonPress: function(oEvent) {
this.bus.publish("nav", "back");
}

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<core:View
controllerName="${namespace}.view.Second"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">

<Page
showNavButton="true"
navButtonPress="handleNavButtonPress"
title="{i18n>SecondPageTitle}">
<ObjectHeader
title="{brewName}"
number="{ABV}%"
numberUnit="ABV">
<attributes>
<ObjectAttribute text="{brewType}" />
<ObjectAttribute text="{brewerName}" />
</attributes>
</ObjectHeader>
</Page>

</core:View>