wakanda#2

81
Shibuya, Tokyo Wakanda 勉強会 #2 2013-08-13 presented by

Upload: kmiyako

Post on 25-Dec-2014

347 views

Category:

Technology


0 download

DESCRIPTION

sample solution and database posted on GitHub: https://github.com/miyako/4d-training-wakanda-2

TRANSCRIPT

Page 1: Wakanda#2

Shibuya, Tokyo

Wakanda勉強会 #22013-08-13

presented by

Page 2: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

studio server

NoSQL object datastore+

web server

WAF: widget-centric JavaScript framework

Single Page Application (SPA) method

Page 3: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

studio server

NoSQL object datastore+

web server

WAF: widget-centric JavaScript framework

Single Page Application (SPA) method

Page 4: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

Page 5: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

Page 6: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

<button><input><label><div><span>

Page 7: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

Page 8: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

Page 9: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

datasource: コミュニケーションレイヤーを提供するオブジェクト

Page 10: Wakanda#2

Shibuya, Tokyo

agenda

client-side development

.../Introduction-to-Wakanda-Client-Side-Development.100-875591.ja.html

widget: datasourceにバインドされたHTMLコントロール

datasource: コミュニケーションレイヤーを提供するオブジェクト

datasource

widgetwidget

server

Page 11: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

architecture

WAK1 WAK2 WAK3

page.htmlpage.html

page.waPagepage.csspage.css page.waPage

page.jspage.js

page.waPage

Page 12: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

architecture

page.waPagepage.waPagepage.waPageindex.htmlindex.htmlindex-smartphone.htmlindex-smartphone.htmlindex-tablet.htmlindex-tablet.htmlstylesstyles

index.cssindex-smartphone.cssindex-tablet.css

scriptsscriptsindex.jsindex-smartphone.jsindex-tablet.js

Page 13: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

desktop

page.waPagepage.waPagepage.waPageindex.htmlindex.htmlindex-smartphone.htmlindex-smartphone.htmlindex-tablet.htmlindex-tablet.htmlstylesstyles

index.cssindex-smartphone.cssindex-tablet.css

scriptsscriptsindex.jsindex-smartphone.jsindex-tablet.js

Page 14: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

smartphone

page.waPagepage.waPagepage.waPageindex.htmlindex.htmlindex-smartphone.htmlindex-smartphone.htmlindex-tablet.htmlindex-tablet.htmlstylesstyles

index.cssindex-smartphone.cssindex-tablet.css

scriptsscriptsindex.jsindex-smartphone.jsindex-tablet.js

Page 15: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

tablet

page.waPagepage.waPagepage.waPageindex.htmlindex.htmlindex-smartphone.htmlindex-smartphone.htmlindex-tablet.htmlindex-tablet.htmlstylesstyles

index.cssindex-smartphone.cssindex-tablet.css

scriptsscriptsindex.jsindex-smartphone.jsindex-tablet.js

Page 16: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

view

page.waPagepage.waPagepage.waPagepage.waPageindex.htmlindex.html

GUI Designerと連動index-smartphone.htmlindex-smartphone.html GUI Designerと連動index-tablet.htmlindex-tablet.html

GUI Designerと連動

stylesstylesstylesindex.css

GUI Designerと連動index-smartphone.css GUI Designerと連動index-tablet.css

GUI Designerと連動

scriptsscriptsscriptsindex.js

GUI Designerと連動index-smartphone.js GUI Designerと連動index-tablet.js

GUI Designerと連動

Page 17: Wakanda#2

Shibuya, Tokyo

Architecture-of-a-Wakanda-Solution/Page.200-1022685.ja.html

page

view

page.waPagepage.waPagepage.waPageindex.html

GUI Designerと連動index-smartphone.html GUI Designerと連動index-tablet.html

GUI Designerと連動

<meta name="generator" content="Wakanda GUIDesigner"/><meta name="wakanda-version" content="5 build 5.137191"/><meta name="wakanda-build" content="5.137191"/>

Page 18: Wakanda#2

Shibuya, Tokyo

Architecture-of-a-Wakanda-Solution/Page.200-1022685.ja.html

page

view

page.waPagepage.waPagepage.waPageindex.html

GUI Designerと連動index-smartphone.html GUI Designerと連動index-tablet.html

GUI Designerと連動

XHTML5: 空要素のタグも閉じる

<img src="car.jpg" alt="vehicle" height="128" width="128" /> OK

<img src="car.jpg" alt="vehicle" height="128" width="128"> NG

Page 19: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer.200-306826.ja.html

page

view

page.waPagepage.waPagepage.waPageindex.html

GUI Designerと連動index-smartphone.html GUI Designerと連動index-tablet.html

GUI Designerと連動

<input type="checkbox" name="vehicle" value="Car" checked="checked" /> OK

<input type="checkbox" name="vehicle" value="Car" checked /> NG

XHTML5: 属性の省略書式は使用しない

Page 20: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer.200-306826.ja.html

page

view

page.waPagepage.waPagepage.waPageindex.html

GUI Designerと連動index-smartphone.html GUI Designerと連動index-tablet.html

GUI Designerと連動

<a href="/myscript?name=miyako&amp;value=keisuke" /> OK

<a href="/myscript?name=miyako&value=keisuke" /> NG

XHTML5: アンパーサンドは&amp;と記述する

Page 21: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

styles

page.waPagepage.waPagepage.waPagepage.waPagestylesstylesstyles

index.cssGUI Designerと連動index-smartphone.css GUI Designerと連動

index-tablet.cssGUI Designerと連動

index*.css: 編集してはいけない(GUI Designerが上書き)

Page 24: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

styles

page.waPagepage.waPagepage.waPagepage.waPagestylesstylesstyles

index.cssGUI Designerと連動index-smartphone.css GUI Designerと連動

index-tablet.cssGUI Designerと連動

Page 25: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

styles

page.waPagepage.waPagepage.waPagepage.waPagestylesstylesstyles

index.cssGUI Designerと連動index-smartphone.css GUI Designerと連動

index-tablet.cssGUI Designerと連動

page.css 自由

Page 26: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page

styles

page.waPagepage.waPagepage.waPagepage.waPagestylesstylesstyles

index.cssGUI Designerと連動index-smartphone.css GUI Designerと連動

index-tablet.cssGUI Designerと連動

page.css 自由application.css theme/role管理(後述)

Page 27: Wakanda#2

Shibuya, Tokyo

page

page.waPagepage.waPagepage.waPagepage.waPagescriptsscriptsscripts

index.jsGUI Designerと連動index-smartphone.js GUI Designerと連動

index-tablet.jsGUI Designerと連動

scripts

index*.js: 既定のイベントでコールされるJavaScript

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

Page 30: Wakanda#2

Shibuya, Tokyo

page

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

scripts

desktop smartphone tablet

On LoadOn LoadOn Load

On Orientation ChangeOn Orientation Change

index*.js: 既定のイベント

Page 33: Wakanda#2

Shibuya, Tokyo

page

page.waPagepage.waPagepage.waPagepage.waPagescriptsscriptsscripts

index.jsGUI Designerと連動index-smartphone.js GUI Designerと連動

index-tablet.jsGUI Designerと連動

scripts

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

Page 34: Wakanda#2

Shibuya, Tokyo

page

page.waPagepage.waPagepage.waPagepage.waPagescriptsscriptsscripts

index.jsGUI Designerと連動index-smartphone.js GUI Designerと連動

index-tablet.jsGUI Designerと連動

scripts

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page.js 自由

Page 35: Wakanda#2

Shibuya, Tokyo

page

page.waPagepage.waPagepage.waPagepage.waPagescriptsscriptsscripts

index.jsGUI Designerと連動index-smartphone.js GUI Designerと連動

index-tablet.jsGUI Designerと連動

scripts

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

page.js 自由

WAF.onAfterInit = function() {    WAF.addListener("button1", "click", function(event) {       //put code here for your event     });};

エントリーポイント: onAfterInit

Page 36: Wakanda#2

Shibuya, Tokyo

Architecture-of-a-Wakanda-Solution/Routing-Pages.300-972295.ja.html

view

targets.json

{Solution folder}/targets.json

{Wakanda Server folder}/walib/WAF/routing/targets.json

{Project folder}/targets.json

[ { "name" : "PSP", "suffix" : "smartphone", "touch" : "true", "resolution" : "480x272", "background-landscape" : "background-psp-landscape.png", "background-portrait" : "background-psp-portrait.png", "rules" : [ { "include" : "PlayStation Portable"} ] }]

Page 39: Wakanda#2

Shibuya, Tokyo

Architecture-of-a-Wakanda-Solution/Routing-Pages.300-972295.ja.html

view

targets.json

waPlatform: キャッシュされたCookie (User-Agent)

desktop smartphone tabletiPhone, Android, Mobilephone, Samsung Galaxy NoteGalaxy Nexus, Nexus OneDROID2, DROID, DROIDXHTC Desire, ADR6300myTouch, Desire, SonyEricssonX10i, E10iSGH

iPad, Android (ex.Mobile)GTSCHXoomStreak

Page 40: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

designer preferences

preferences.json

Library/Application Support/Wakanda Studio/

C:\Users\{userName}\AppData\Roaming\Wakanda Studio\

{ "gui":{ snapping : { grid : { activeByDefault : true, showByDefault : true, color : "black" } } }}

Page 41: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

Snap to gridShow grid

designer preferences

Page 42: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

{ "gui":{ themes : { desktop: "lilac", smartphone: "cupertino", tablet: "cupertinoIpad" } }}

preferences.json

Library/Application Support/Wakanda Studio/

C:\Users\{userName}\AppData\Roaming\Wakanda Studio\

designer preferences

Page 43: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

preferences.json

desktop smartphone tablet

default cupertino cupertino

metal cupertinoIpad cupertinoIpad

lilac

light

softGray

designer preferences

Page 44: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

command/control+drag

designer preferences

Page 45: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Preferences.200-1023373.ja.html

{ "gui":{ snapping : { magneticGrid : { automaticallyActive : true, onlySnapToSiblings : true, color : "red" } } }}

preferences.json

Library/Application Support/Wakanda Studio/

C:\Users\{userName}\AppData\Roaming\Wakanda Studio\

designer preferences

Page 46: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Pages/Page.300-966038.ja.html

Google Fonts

Page 47: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 48: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 49: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 50: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 51: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 52: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 53: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 54: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 55: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 56: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 57: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 58: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 59: Wakanda#2

Shibuya, Tokyo

Google Fonts

Page 65: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/.../Widget-Overview.300-306931.ja.html

application.css

.waf-theme.lilac .waf-button.waf-role-Japanese-Button {ゴ" font-family: 'メイリオ,'Meiryo','ヒラギノ角ゴro W3','Hiragino Kaku Gothic Pro','MSPゴシック,'MS PGothic',Osaka,sans-serif; }

theme毎/widget-type毎のクラス

widget roles

Page 70: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/.../Widget-Overview.300-306931.ja.html

page.waPage/styles/index.css

#button1 {" width: 186px;" height: 99px;" top: 40px;" left: 21px;"" position: absolute;" font-family: 'Lucida grande', 'Segoe UI', Tahoma, sans-serif;}

widget roles

Page 71: Wakanda#2

Shibuya, Tokyo

http://www.w3.org/TR/css3-selectors/

specificity

specificity = a b c (n進数)

count the number of ID attributes in the selector a

count the number of other attributes and pseudo-classes in the selector b

count the number of element names in the selector c

widget roles

Page 72: Wakanda#2

Shibuya, Tokyo

widget roles

application.css | index.css

Wakanda-Studio-Reference-Guide/.../Widget-Overview.300-306931.ja.html

widgetを配置 (index.css)

styleを設定 (index.css)roleを作成 (application.css)スタイルを削除 (index.css)

styleを変更 (index.css)roleを更新 (application.css)スタイルを削除 (index.css)

roleを設定した後にスタイルをいじることは避けたほうが良い

Page 74: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Widgets/Button.300-307059.ja.html

button

properties/general

link datasourceID HTML unique idHTML unique idHide widget on loadButton titleSourceActionURL http, ftp, mailto...Target _blank, _selfTabindex

Page 75: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Widgets/Button.300-307059.ja.html

button

properties/general

link datasourceID HTML unique idHTML unique idHide widget on loadButton titleSource datasourceAction simple, autoURLTargetTabindex

Page 76: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Widgets/Button.300-307059.ja.html

button

properties/general

buttonbuttonbuttonbutton

simplesimplesimple

On Click

JavaScript記述On Double Click

JavaScript記述On Mouse Down, Out, Over, Up

JavaScript記述

On Touch Start, End, Cancel

JavaScript記述

!simple!simple!simple

Create, Save, Remove自動処理

Previous , Next, First, Last自動処理

Page 78: Wakanda#2

Shibuya, Tokyo

Widgets-API/Widgets-API.100-744727.ja.html

widgets

var myValue = $$('widgetID').getValue();

var myValue = WAF.widgets.widgetID.getValue();

syntax

method()

var myLabel = $$('widgetID').label;

var myLabel = WAF.widgets.widgetID.label;

property

Page 79: Wakanda#2

Shibuya, Tokyo

Widgets-API/Button.201-867857.ja.html

widgets

syntax

var myValue = this.getValue();

var myLabel = this.label;

this

Page 80: Wakanda#2

Shibuya, Tokyo

Wakanda-Studio-Reference-Guide/GUI-Designer-Widgets/Button.300-307059.ja.html

button

button2.click = function button2_click (event){" var url = $$('textField1').getValue();"" if(url.length){" " if(url.substr(0,7) == "http://"){" " this.setURL(url);"" " this.setValue("jump to " + url);" " }" }};

index.js

Page 81: Wakanda#2

Shibuya, Tokyo

Wakanda勉強会 #22013-08-13

presented by