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

mobile[app] 02 - Two tabs

Ensure Mobile framework is already loaded

(SwikiCodeRobot @ #mobile) process: #s8-media tagged: #core.


Two tabs

| spec dates tab1 tab2 |
dates := (
  (#class -> #MobileEditor ),
  (#configuration -> ( 
    (#listeners -> ( (#needsTitle -> [:coordinator | #Dates] ) ) ),
    (#widgets -> ( 
      (#information -> (
        (#class -> #MobileSelector ),
        (#configuration -> (
          (#order -> 1),
          (#listeners -> (
            (#needsTitle -> [:coordinator | 'Dates for - ',coordinator model class name ]),
            (#needsItems -> [:coordinator | Array
              with: #( 'Earliest Date' #earliestDate )
              with: #( 'Latest Date' #latestDate )
              with: #( 'Planned Date' #plannedDate ) ]),
            (#configureCell:for:in:coordinator: -> [:cell :item :aList :coordinator |
              coordinator
              configure: cell title: item first
              detail: item second ] )
          ))
        ))
      )) 
    ))
  ))
).
tab1 := (
  (#tool -> #sample),
  (#coordinator -> (
    (#class -> #MobileEditor),
    (#configuration -> (
      (#title -> 'Tab 1')
    ))
  ))
).
tab2 := (
  (#tool -> #mobile),
  (#coordinator -> (
    (#class -> #MobileEditor),
    (#configuration -> (
      (#title -> 'Tab 2'),
      (#widgets -> (
        (#information -> (
          (#class -> #MobileSelector ),
          (#configuration -> (
            (#order -> 1),
            (#listeners ->(
              (#needsTitle -> [:coordinator | #Information]),
              (#needsItems -> [:coordinator | #( #( #calendar #Dates #datePlanned ) ) ] ),
              (#configureCell:for:in:coordinator: -> [:cell :item :aList :coordinator |
                coordinator configure: cell title: item second detail: item third ]),
              (#needsIconSourceFor:in:coordinator: ->  [:item :aList :coordinator |
                coordinator iconSourceFor: item object first group: (coordinator widgetAt: #information )]),
              (#selected: -> [:item :coordinator | coordinator thread next: ((coordinator newTemplateAt: #dates) model: coordinator model;yourself) ])
            ))
          ))
        ))
      ))
    ))
  ))
).
spec := (
  (#threads -> (
    (1 -> tab1),
    (2 -> tab2)
  )),
  (#templates -> ((#dates -> dates)) ),
  (#listeners -> (#needsModel -> [ #none ]))
) json.
MobileApplication open: spec.