Browse Source

Trivial first Enyo app written in Jtalk, works in SDK 3.0.2.

Göran Krampe 13 years ago
parent
commit
3b9a5d2468

+ 0 - 0
webos/hellojtalk/HelloJtalk.css


+ 54 - 0
webos/hellojtalk/HelloJtalk.st

@@ -0,0 +1,54 @@
+
+Dictionary subclass: #EKind
+        instanceVariableNames: ''
+        category: 'HelloJtalk'!
+
+Dictionary subclass: #EComponent
+        instanceVariableNames: ''
+        category: 'HelloJtalk'!
+
+EKind subclass: #HelloJtalk
+        instanceVariableNames: ''
+        category: 'HelloJtalk'!
+
+!HelloJtalk class methodsFor: 'initializing'!
+initialize
+        | me control button input popup myInput pageHeader arr field children |
+	pageHeader := EComponent new.
+	pageHeader at: 'kind' put: 'PageHeader'; at: 'content' put: 'JTalk Live'.
+	button := EComponent new.
+	<popup = {kind: "Popup", components: [
+    		{content: "Pick something you like"},
+    		{kind: "ListSelector", value: "Foo", items: ["Foo", "Bar", "Bot"]}]}>.
+	button at: 'kind' put: 'Button';
+		at: 'caption' put: 'Click here please';
+		at: 'onclick' put: 'buttonClick'.
+	input := EComponent new.
+	input at: 'kind' put: 'Input'.
+	me := self new.
+	arr := Array new.
+	arr add: pageHeader; add: button; add: input; add: popup.
+	me at: 'components' put: arr; 
+             at: 'name' put: 'jtalk.HelloJtalk';
+	     at: 'kind' put: 'VFlexBox';
+	     at: 'buttonClick' put: [
+		children := <this.$>.
+
+		field := children input.
+
+"This next line works fine"
+
+		<field.setValue('Yo')>.
+
+"But for some reason I can not get this next line to do anything"
+
+		field setValue: 'Yowza'.
+
+"But this line works fine, but has no arguments... ?"
+		children popup openAtCenter].
+
+	enyo kind: me.
+	enyo log: 'Done initializing.'
+
+! !
+

+ 16 - 0
webos/hellojtalk/Makefile

@@ -0,0 +1,16 @@
+Program.js: HelloJtalk.st
+	../../bin/jtalkc -K -I HelloJtalk.st Program
+
+jtalk.hellojtalk_1.0.0_all.ipk: Program.js
+	palm-package .
+
+clean:
+	rm -f Program.js HelloJtalk.js jtalk.hellojtalk_1.0.0_all.ipk
+	palm-install -r jtalk.hellojtalk
+
+install:jtalk.hellojtalk_1.0.0_all.ipk
+	palm-install jtalk.hellojtalk_1.0.0_all.ipk
+
+run:    jtalk.hellojtalk_1.0.0_all.ipk
+	palm-install jtalk.hellojtalk_1.0.0_all.ipk
+	palm-launch jtalk.hellojtalk

+ 10 - 0
webos/hellojtalk/appinfo.json

@@ -0,0 +1,10 @@
+{
+	"id": "jtalk.hellojtalk",
+	"version": "1.0.0",
+	"vendor": "Krampe Dynamic Development",
+	"type": "web",
+	"main": "index.html",
+	"title": "Enyo Hello Jtalk",
+	"icon": "icon.png",
+	"uiRevision": 2
+}

+ 4 - 0
webos/hellojtalk/depends.js

@@ -0,0 +1,4 @@
+enyo.depends(
+	"Program.js",
+	"HelloJtalk.css"
+);

+ 12 - 0
webos/hellojtalk/index.html

@@ -0,0 +1,12 @@
+<!doctype html>
+<html>
+<head>
+	<title>Enyo Jtalk HelloWorld</title>
+	<script src="../../../enyo/1.0/framework/enyo.js" type="text/javascript"></script>
+</head>
+<body>
+<script type="text/javascript">
+	new jtalk.HelloJtalk().renderInto(document.body);
+</script>
+</body>
+</html>