Wakanda#2

Post on 25-Dec-2014

347 views 0 download

description

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

Transcript of Wakanda#2

Shibuya, Tokyo

Wakanda勉強会 #22013-08-13

presented by

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

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

Shibuya, Tokyo

agenda

client-side development

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

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

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

datasource

widgetwidget

server

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

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

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

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

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

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と連動

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"/>

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

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: 属性の省略書式は使用しない

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;と記述する

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が上書き)

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と連動

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 自由

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管理(後述)

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

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: 既定のイベント

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

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 自由

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

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"} ] }]

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

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" } } }}

Shibuya, Tokyo

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

Snap to gridShow grid

designer preferences

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

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

Shibuya, Tokyo

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

command/control+drag

designer preferences

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

Shibuya, Tokyo

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

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

Shibuya, Tokyo

Google Fonts

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

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

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

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を設定した後にスタイルをいじることは避けたほうが良い

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

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

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自動処理

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

Shibuya, Tokyo

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

widgets

syntax

var myValue = this.getValue();

var myLabel = this.label;

this

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

Shibuya, Tokyo

Wakanda勉強会 #22013-08-13

presented by