AssistantApplication.st
changeset 3811 ebc2b9a0f94e
parent 3810 0df3ba9c453a
child 3812 f65a55aadf08
equal deleted inserted replaced
3810:0df3ba9c453a 3811:ebc2b9a0f94e
     3 ApplicationModel subclass:#AssistantApplication
     3 ApplicationModel subclass:#AssistantApplication
     4 	instanceVariableNames:'currentPageSpecHolder backButtonEnabled forwardButtonEnabled
     4 	instanceVariableNames:'currentPageSpecHolder backButtonEnabled forwardButtonEnabled
     5 		backButtonVisible forwardButtonVisible finishButtonVisible
     5 		backButtonVisible forwardButtonVisible finishButtonVisible
     6 		finishButtonEnabled currentPageInfoHTMLHolder
     6 		finishButtonEnabled currentPageInfoHTMLHolder
     7 		currentPageIndexHolder backButtonLabelHolder
     7 		currentPageIndexHolder backButtonLabelHolder
     8 		nextButtonLabelHolder pageLabelsInList'
     8 		nextButtonLabelHolder pageLabelsInList pageInfoHolder'
     9 	classVariableNames:''
     9 	classVariableNames:''
    10 	poolDictionaries:''
    10 	poolDictionaries:''
    11 	category:'Views-DialogBoxes'
    11 	category:'Views-DialogBoxes'
    12 !
    12 !
    13 
    13 
   148                     name: 'VariableHorizontalPanel1'
   148                     name: 'VariableHorizontalPanel1'
   149                     layout: (LayoutFrame 0 0 0 0 0 1 -40 1)
   149                     layout: (LayoutFrame 0 0 0 0 0 1 -40 1)
   150                     component: 
   150                     component: 
   151                    (SpecCollection
   151                    (SpecCollection
   152                       collection: (
   152                       collection: (
   153                        (SequenceViewSpec
   153                        (ViewSpec
   154                           name: 'List1'
   154                           name: 'Box2'
   155                           level: 0
   155                           component: 
   156                           enableChannel: false
   156                          (SpecCollection
   157                           hasHorizontalScrollBar: true
   157                             collection: (
   158                           hasVerticalScrollBar: true
   158                              (SequenceViewSpec
   159                           useIndex: true
   159                                 name: 'PagesLabelList'
   160                           sequenceList: pageLabelsInList
   160                                 layout: (LayoutFrame 0 0 0 0 0 1 0 0.7)
       
   161                                 level: 0
       
   162                                 enableChannel: false
       
   163                                 hasHorizontalScrollBar: true
       
   164                                 hasVerticalScrollBar: true
       
   165                                 useIndex: true
       
   166                                 sequenceList: pageLabelsInList
       
   167                               )
       
   168                              (HTMLViewSpec
       
   169                                 name: 'HTMLBrowser1'
       
   170                                 layout: (LayoutFrame 0 0 0 0.7 0 1 0 1)
       
   171                                 level: 0
       
   172                                 hasHorizontalScrollBar: true
       
   173                                 hasVerticalScrollBar: true
       
   174                                 miniScrollerHorizontal: true
       
   175                                 miniScrollerVertical: true
       
   176                                 htmlText: pageInfoHolder
       
   177                               )
       
   178                              )
       
   179                            
       
   180                           )
   161                         )
   181                         )
   162                        (SubCanvasSpec
   182                        (SubCanvasSpec
   163                           name: 'SubCanvas1'
   183                           name: 'SubCanvas1'
   164                           hasHorizontalScrollBar: false
   184                           hasHorizontalScrollBar: false
   165                           hasVerticalScrollBar: false
   185                           hasVerticalScrollBar: false
   190                           visibilityChannel: backButtonVisible
   210                           visibilityChannel: backButtonVisible
   191                           translateLabel: true
   211                           translateLabel: true
   192                           labelChannel: backButtonLabelHolder
   212                           labelChannel: backButtonLabelHolder
   193                           model: goBackward
   213                           model: goBackward
   194                           enableChannel: backButtonEnabled
   214                           enableChannel: backButtonEnabled
   195                           extent: (Point 132 22)
   215                           useDefaultExtent: true
   196                         )
   216                         )
   197                        (ActionButtonSpec
   217                        (ActionButtonSpec
   198                           label: 'Next'
   218                           label: 'Next'
   199                           name: 'Button2'
   219                           name: 'Button2'
   200                           activeHelpKey: nextButton
   220                           activeHelpKey: nextButton
   201                           visibilityChannel: forwardButtonVisible
   221                           visibilityChannel: forwardButtonVisible
   202                           translateLabel: true
   222                           translateLabel: true
   203                           labelChannel: nextButtonLabelHolder
   223                           labelChannel: nextButtonLabelHolder
   204                           model: goForward
   224                           model: goForward
   205                           enableChannel: forwardButtonEnabled
   225                           enableChannel: forwardButtonEnabled
   206                           extent: (Point 132 22)
   226                           useDefaultExtent: true
   207                         )
   227                         )
   208                        )
   228                        )
   209                      
   229                      
   210                     )
   230                     )
   211                   )
   231                   )
   529         nextButtonLabelHolder := self nextButtonLabel asValue.
   549         nextButtonLabelHolder := self nextButtonLabel asValue.
   530     ].
   550     ].
   531     ^ nextButtonLabelHolder.
   551     ^ nextButtonLabelHolder.
   532 !
   552 !
   533 
   553 
       
   554 pageInfoHolder
       
   555     <resource: #uiAspect>
       
   556 
       
   557     pageInfoHolder isNil ifTrue:[
       
   558         pageInfoHolder := nil asValue.
       
   559     ].
       
   560     ^ pageInfoHolder.
       
   561 !
       
   562 
   534 pageLabelsInList
   563 pageLabelsInList
   535     pageLabelsInList isNil ifTrue:[
   564     pageLabelsInList isNil ifTrue:[
   536         pageLabelsInList := List new.
   565         pageLabelsInList := List new.
   537         pageLabelsInList contents:(self pageLabelsInListWithBullet).
   566         pageLabelsInList contents:(self pageLabelsInListWithBullet).
   538     ].
   567     ].
   545     newList := self pageLabels.
   574     newList := self pageLabels.
   546     newList := newList with:(1 to:newList size) 
   575     newList := newList with:(1 to:newList size) 
   547                 collect:[:entry :index |
   576                 collect:[:entry :index |
   548                     index == self currentPageIndex ifTrue:[
   577                     index == self currentPageIndex ifTrue:[
   549                         LabelAndTwoIcons new 
   578                         LabelAndTwoIcons new 
   550                             string:entry;
   579                             string:(entry allBold colorizeAllWith:(TextView defaultSelectionForegroundColor) on:(TextView defaultSelectionBackgroundColor) );
   551                             icon:(self class rightArrowIcon);
   580                             icon:(self class rightArrowIcon);
   552                             image2:(self class leftArrowIcon)
   581                             image2:(self class leftArrowIcon)
   553                     ] ifFalse:[
   582                     ] ifFalse:[
   554                         (self isPageEnabledAtIndex:index) ifFalse:[
   583                         (self isPageEnabledAtIndex:index) ifFalse:[
   555                             entry colorizeAllWith:(Button defaultDisabledForegroundColor) "Color grey".
   584                             entry colorizeAllWith:(Button defaultDisabledForegroundColor) "Color grey".
   712     ^ self assistantSpec at:index.
   741     ^ self assistantSpec at:index.
   713 !
   742 !
   714 
   743 
   715 previousPageSpec
   744 previousPageSpec
   716     ^ self assistantSpec at:(self currentPageIndex - 1).
   745     ^ self assistantSpec at:(self currentPageIndex - 1).
   717 !
   746 ! !
       
   747 
       
   748 !AssistantApplication methodsFor:'update'!
   718 
   749 
   719 updateButtonEnableState
   750 updateButtonEnableState
   720     self backButtonEnabled value:(self canGoBackward).
   751     self backButtonEnabled value:(self canGoBackward).
   721     self forwardButtonEnabled value:(self canGoForward).
   752     self forwardButtonEnabled value:(self canGoForward).
   722     self backButtonLabelHolder value:(self backButtonLabel).
   753     self backButtonLabelHolder value:(self backButtonLabel).
   740     self forwardButtonEnabled value:(pageIndex < self numberOfPages).
   771     self forwardButtonEnabled value:(pageIndex < self numberOfPages).
   741     self finishButtonEnabled value:(pageIndex == self numberOfPages and:[ self canFinish ]).
   772     self finishButtonEnabled value:(pageIndex == self numberOfPages and:[ self canFinish ]).
   742 
   773 
   743     self backButtonLabelHolder value:(self backButtonLabel).
   774     self backButtonLabelHolder value:(self backButtonLabel).
   744     self nextButtonLabelHolder value:(self nextButtonLabel).
   775     self nextButtonLabelHolder value:(self nextButtonLabel).
       
   776 
       
   777     self pageInfoHolder value:(pageSpec infoText).
   745 ! !
   778 ! !
   746 
   779 
   747 !AssistantApplication class methodsFor:'documentation'!
   780 !AssistantApplication class methodsFor:'documentation'!
   748 
   781 
   749 version_CVS
   782 version_CVS
   750     ^ '$Header: /cvs/stx/stx/libwidg2/AssistantApplication.st,v 1.8 2009-10-22 12:43:52 cg Exp $'
   783     ^ '$Header: /cvs/stx/stx/libwidg2/AssistantApplication.st,v 1.9 2009-10-22 17:38:57 cg Exp $'
   751 ! !
   784 ! !