[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

cousteau[system] Divers

"Application's model for Cousteau Divers"

Object
	subclass: #CousteauDivers
	instanceVariableNames: ''
	category: #Cousteau !

! CousteauDivers class methodsFor: #ui !
open
	" Open the receiver. "

	self note: 'Waiting for Cousteau...'.
	^MobileApplication open: self spec json! !

! CousteauDivers class methodsFor: #specs !
spec
	" Private - Return the application spec. "

	^(#threads -> self tabs),
	 (#templates -> self pages),
	 (#listeners -> (
		(#needsModel -> [ CousteauDivers new ]),
		(#opened -> [:application | "do nothing" ])
	 ))! !

! CousteauDivers class methodsFor: #specs !
tabs
	 " Private - Return the specs for application tabs. "

	| count |
	count := 0.
	 ^#( home science community media ) inject: nil into: [:total :key| | each |
	 	 each := self tabFor: key.
	 	 each isNil ifTrue: [ total ] ifFalse: [
	 	 	total isNil
			  ifTrue: [ count -> each ]
	 	 	  ifFalse: [
				count := count + 1.
				total , (count -> each)
			  ]
	 	 ]
	 ]! !

! CousteauDivers class methodsFor: #specs !
tabFor: key
	 " Private - Return the application tab for key (or nil). "

	| selector |
	selector := key ,#CoordinatorSpec.
	(self respondsTo: selector) ifFalse: [
		self note: self name,'>>#',selector ,' not implemented. Yet.'.
		^nil
	].
	^(#tool -> key)
	,(#coordinator -> (self perform: selector))! !

! CousteauDivers class methodsFor: #specs !
pages
	 " Private - Return the specs for application pages. "

	 ^#(	welcome map feedback
		program diveLog enrolment
		login profile
		profiles centers biographies
		upload
	) inject: nil into: [:total :key| | each |
	 	 each := self pageFor: key.
	 	 each isNil ifTrue: [ total ] ifFalse: [
	 	 	 total isNil ifTrue: [ each ]
	 	 	 	 ifFalse: [ total , (key -> each) ]
	 	 ]
	 ]! !

! CousteauDivers class methodsFor: #specs !
pageFor: key
	 " Private - Return the application page for key (or nil). "

	| selector |
	selector := key ,#Spec.
	(self respondsTo: selector) ifFalse: [
		self note: self name,'>>#',selector ,' not implemented. Yet.'.
		^nil
	].
	^self perform: selector! !