TabItemEditor.st
changeset 766 cecf78615ed1
parent 765 27936ff059d3
child 767 ed96f735dab1
equal deleted inserted replaced
765:27936ff059d3 766:cecf78615ed1
     1 "
       
     2  COPYRIGHT (c) 1997 by eXept Software AG
       
     3               All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 
       
    14 
       
    15 ToolApplicationModel subclass:#TabItemEditor
       
    16 	instanceVariableNames:'rebuildMode testView className selector aspects listOfTabs
       
    17 		hasChanged selectedIndex'
       
    18 	classVariableNames:''
       
    19 	poolDictionaries:''
       
    20 	category:'Interface-UIPainter'
       
    21 !
       
    22 
       
    23 !TabItemEditor class methodsFor:'documentation'!
       
    24 
       
    25 copyright
       
    26 "
       
    27  COPYRIGHT (c) 1997 by eXept Software AG
       
    28               All Rights Reserved
       
    29 
       
    30  This software is furnished under a license and may be used
       
    31  only in accordance with the terms of that license and with the
       
    32  inclusion of the above copyright notice.   This software may not
       
    33  be provided or otherwise made available to, or used by, any
       
    34  other person.  No title to or ownership of the software is
       
    35  hereby transferred.
       
    36 "
       
    37 
       
    38 
       
    39 !
       
    40 
       
    41 documentation
       
    42 "
       
    43     create and modify or inspect a list of tabs
       
    44 
       
    45     [start with:]
       
    46         TabItemEditor open
       
    47 
       
    48     [see also:]
       
    49         TabItem
       
    50         TabView
       
    51         NoteBookView
       
    52         UIPainter
       
    53 
       
    54     [author:]
       
    55         Claus Atzkern, eXept Software AG
       
    56 "
       
    57 
       
    58 
       
    59 ! !
       
    60 
       
    61 !TabItemEditor class methodsFor:'help specs'!
       
    62 
       
    63 helpSpec
       
    64     "return a dictionary filled with helpKey -> helptext associations.
       
    65      These are used by the activeHelp tool."
       
    66 
       
    67     "
       
    68     UIHelpTool openOnClass:TabItemEditor    
       
    69     "
       
    70 
       
    71   ^ super helpSpec addPairsFrom:#(
       
    72 
       
    73 #addTabItem
       
    74 'Adds a new tab item.'
       
    75 
       
    76 #argument
       
    77 'a user defined argument not explicitly used by the tab item.'
       
    78 
       
    79 #canSelect
       
    80 'Turns on/off selection behavior of the tab item.'
       
    81 
       
    82 #color
       
    83 'define the foreground color of the  label. The default derives from the style sheet.'
       
    84 
       
    85 #fileCreateAspectMethod
       
    86 'Creates the aspect method for the tab list.'
       
    87 
       
    88 #fileNew
       
    89 'Creates a new tab list.'
       
    90 
       
    91 #fileReload
       
    92 'Reload tab list from current class and selector.'
       
    93 
       
    94 #fileSave
       
    95 'Saves current tab list.'
       
    96 
       
    97 #label
       
    98 'Label of the tab item.'
       
    99 
       
   100 #labelDerivesFromApplication
       
   101 'if the value is off (the default), the tabs label is the string as entered in the label aspect. Otherwise, its the name of the message sent to the application - this should return a string or bitmap image, which is used as logo in the tab.'
       
   102 
       
   103 #testPreview
       
   104 'Turns on/off preview of the tab list.'
       
   105 
       
   106 )
       
   107 ! !
       
   108 
       
   109 !TabItemEditor class methodsFor:'interface specs'!
       
   110 
       
   111 nameAndSelectorSpec
       
   112     "this window spec was automatically generated by the ST/X UIPainter"
       
   113 
       
   114     "do not manually edit this - the painter/builder may not be able to
       
   115      handle the specification if its corrupted."
       
   116 
       
   117     "
       
   118      UIPainter new openOnClass:TabItemEditor andSelector:#nameAndSelectorSpec
       
   119      TabItemEditor new openInterface:#nameAndSelectorSpec
       
   120     "
       
   121 
       
   122     <resource: #canvas>
       
   123 
       
   124     ^
       
   125      
       
   126        #(#FullSpec
       
   127           #'window:' 
       
   128            #(#WindowSpec
       
   129               #'name:' 'Tab Item Editor'
       
   130               #'layout:' #(#LayoutFrame 141 0 424 0 456 0 551 0)
       
   131               #'label:' 'Tab Item Editor'
       
   132               #'min:' #(#Point 10 10)
       
   133               #'max:' #(#Point 1152 900)
       
   134               #'bounds:' #(#Rectangle 141 424 457 552)
       
   135               #'usePreferredExtent:' false
       
   136           )
       
   137           #'component:' 
       
   138            #(#SpecCollection
       
   139               #'collection:' 
       
   140                #(
       
   141                  #(#FramedBoxSpec
       
   142                     #'name:' 'framedBox1'
       
   143                     #'layout:' #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -33 1.0)
       
   144                     #'label:' 'Define class and selector'
       
   145                     #'labelPosition:' #topLeft
       
   146                 )
       
   147                  #(#LabelSpec
       
   148                     #'name:' 'ClassLabel'
       
   149                     #'layout:' #(#AlignmentOrigin 58 0.11 37 0 1 0.5)
       
   150                     #'label:' 'Class:'
       
   151                     #'adjust:' #right
       
   152                     #'resizeForLabel:' true
       
   153                 )
       
   154                  #(#InputFieldSpec
       
   155                     #'name:' 'ClassField'
       
   156                     #'layout:' #(#LayoutFrame 62 0.11 26 0 -18 1.0 48 0)
       
   157                     #'tabable:' true
       
   158                     #'model:' #className
       
   159                 )
       
   160                  #(#LabelSpec
       
   161                     #'name:' 'SelectorLabel'
       
   162                     #'layout:' #(#AlignmentOrigin 58 0.11 62 0 1 0.5)
       
   163                     #'label:' 'Selector:'
       
   164                     #'adjust:' #right
       
   165                     #'resizeForLabel:' true
       
   166                 )
       
   167                  #(#InputFieldSpec
       
   168                     #'name:' 'SelectorField'
       
   169                     #'layout:' #(#LayoutFrame 62 0.11 51 0 -18 1.0 73 0)
       
   170                     #'tabable:' true
       
   171                     #'model:' #selector
       
   172                 )
       
   173                  #(#UISubSpecification
       
   174                     #'name:' 'CommitPanel'
       
   175                     #'layout:' #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
       
   176                     #'majorKey:' #ToolApplicationModel
       
   177                     #'minorKey:' #windowSpecForCommitWithoutChannels
       
   178                 )
       
   179               )
       
   180           )
       
   181       )
       
   182 !
       
   183 
       
   184 tabSpec
       
   185     "this window spec was automatically generated by the ST/X UIPainter"
       
   186 
       
   187     "do not manually edit this - the painter/builder may not be able to
       
   188      handle the specification if its corrupted."
       
   189 
       
   190     "
       
   191      UIPainter new openOnClass:TabItemEditor andSelector:#tabSpec
       
   192      TabItemEditor new openInterface:#tabSpec
       
   193     "
       
   194 
       
   195     <resource: #canvas>
       
   196 
       
   197     ^
       
   198      
       
   199        #(#FullSpec
       
   200           #'window:' 
       
   201            #(#WindowSpec
       
   202               #'name:' 'Tab Basic'
       
   203               #'layout:' #(#LayoutFrame 134 0 107 0 496 0 332 0)
       
   204               #'label:' 'Tab Basic'
       
   205               #'min:' #(#Point 10 10)
       
   206               #'max:' #(#Point 1280 1024)
       
   207               #'bounds:' #(#Rectangle 134 107 497 333)
       
   208               #'usePreferredExtent:' false
       
   209           )
       
   210           #'component:' 
       
   211            #(#SpecCollection
       
   212               #'collection:' 
       
   213                #(
       
   214                  #(#LabelSpec
       
   215                     #'name:' 'Label'
       
   216                     #'layout:' #(#AlignmentOrigin 104 0 26 0 1 0.5)
       
   217                     #'label:' 'Label:'
       
   218                     #'resizeForLabel:' true
       
   219                 )
       
   220                  #(#InputFieldSpec
       
   221                     #'name:' 'LabelField'
       
   222                     #'layout:' #(#LayoutFrame 107 0 15 0 -5 1.0 37 0)
       
   223                     #'activeHelpKey:' #label
       
   224                     #'model:' #label
       
   225                 )
       
   226                  #(#CheckBoxSpec
       
   227                     #'name:' 'TranslateLabel'
       
   228                     #'layout:' #(#LayoutOrigin 104 0 42 0)
       
   229                     #'activeHelpKey:' #labelDerivesFromApplication
       
   230                     #'model:' #translateLabel
       
   231                     #'label:' 'Label derives from Application'
       
   232                 )
       
   233                  #(#ColorMenuSpec
       
   234                     #'name:' 'ForegroundColorMenu'
       
   235                     #'layout:' #(#LayoutFrame 75 0 124 0 -7 1.0 146 0)
       
   236                     #'activeHelpKey:' #color
       
   237                     #'model:' #labelForegroundColor
       
   238                     #'labelsAreColored:' false
       
   239                 )
       
   240                  #(#LabelSpec
       
   241                     #'name:' 'ForegroundLabel'
       
   242                     #'layout:' #(#AlignmentOrigin 73 0 136 0 1 0.5)
       
   243                     #'label:' 'Color:'
       
   244                     #'adjust:' #right
       
   245                     #'resizeForLabel:' true
       
   246                 )
       
   247                  #(#CheckBoxSpec
       
   248                     #'name:' 'CanSelect'
       
   249                     #'layout:' #(#LayoutFrame 107 0 176 0 226 0 198 0)
       
   250                     #'activeHelpKey:' #canSelect
       
   251                     #'model:' #enabled
       
   252                     #'label:' 'Can Select'
       
   253                 )
       
   254                  #(#LabelSpec
       
   255                     #'name:' 'ArgumentLabel'
       
   256                     #'layout:' #(#AlignmentOrigin 104 0 91 0 1 0.5)
       
   257                     #'label:' 'Argument:'
       
   258                     #'resizeForLabel:' true
       
   259                 )
       
   260                  #(#InputFieldSpec
       
   261                     #'name:' 'ArgumentField'
       
   262                     #'layout:' #(#LayoutFrame 107 0 80 0 -5 1.0 102 0)
       
   263                     #'activeHelpKey:' #argument
       
   264                     #'model:' #editAgument
       
   265                 )
       
   266               )
       
   267           )
       
   268       )
       
   269 !
       
   270 
       
   271 windowSpec
       
   272     "this window spec was automatically generated by the ST/X UIPainter"
       
   273 
       
   274     "do not manually edit this - the painter/builder may not be able to
       
   275      handle the specification if its corrupted."
       
   276 
       
   277     "
       
   278      UIPainter new openOnClass:TabItemEditor andSelector:#windowSpec
       
   279      TabItemEditor new openInterface:#windowSpec
       
   280     "
       
   281     "TabItemEditor open"
       
   282 
       
   283     <resource: #canvas>
       
   284 
       
   285     ^
       
   286      
       
   287        #(#FullSpec
       
   288           #'window:' 
       
   289            #(#WindowSpec
       
   290               #'name:' 'TabItem Editor'
       
   291               #'layout:' #(#LayoutFrame 275 0 353 0 743 0 681 0)
       
   292               #'label:' 'TabItem Editor'
       
   293               #'min:' #(#Point 10 10)
       
   294               #'max:' #(#Point 1152 900)
       
   295               #'bounds:' #(#Rectangle 275 353 744 682)
       
   296               #'menu:' #menu
       
   297               #'usePreferredExtent:' false
       
   298           )
       
   299           #'component:' 
       
   300            #(#SpecCollection
       
   301               #'collection:' 
       
   302                #(
       
   303                  #(#MenuPanelSpec
       
   304                     #'name:' 'menuToolbarView'
       
   305                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0)
       
   306                     #'menu:' #menuToolbar
       
   307                     #'showSeparatingLines:' true
       
   308                 )
       
   309                  #(#VariableHorizontalPanelSpec
       
   310                     #'name:' 'VariablePanel'
       
   311                     #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0)
       
   312                     #'component:' 
       
   313                      #(#SpecCollection
       
   314                         #'collection:' 
       
   315                          #(
       
   316                            #(#SequenceViewSpec
       
   317                               #'name:' 'columnView'
       
   318                               #'enableChannel:' #isNotModified
       
   319                               #'model:' #selectionHolder
       
   320                               #'menu:' #menuEdit
       
   321                               #'hasHorizontalScrollBar:' true
       
   322                               #'hasVerticalScrollBar:' true
       
   323                               #'miniScrollerHorizontal:' true
       
   324                               #'useIndex:' true
       
   325                               #'sequenceList:' #listOfLabels
       
   326                           )
       
   327                            #(#ViewSpec
       
   328                               #'name:' 'specView'
       
   329                               #'component:' 
       
   330                                #(#SpecCollection
       
   331                                   #'collection:' 
       
   332                                    #(
       
   333                                      #(#ViewSpec
       
   334                                         #'name:' 'TestView'
       
   335                                         #'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 0 1.0)
       
   336                                         #'component:' 
       
   337                                          #(#SpecCollection
       
   338                                             #'collection:' 
       
   339                                              #(
       
   340                                                #(#TabViewSpec
       
   341                                                   #'name:' 'TestTabsView'
       
   342                                                   #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 0.5)
       
   343                                               )
       
   344                                             )
       
   345                                         )
       
   346                                     )
       
   347                                      #(#SubCanvasSpec
       
   348                                         #'name:' 'specCanvas'
       
   349                                         #'layout:' #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0)
       
   350                                         #'specHolder:' #specChannel
       
   351                                     )
       
   352                                      #(#HorizontalPanelViewSpec
       
   353                                         #'name:' 'modifyPanel'
       
   354                                         #'layout:' #(#LayoutFrame 1 0.0 -30 1.0 0 1.0 0 1.0)
       
   355                                         #'component:' 
       
   356                                          #(#SpecCollection
       
   357                                             #'collection:' 
       
   358                                              #(
       
   359                                                #(#ActionButtonSpec
       
   360                                                   #'name:' 'cancelButton'
       
   361                                                   #'label:' 'Cancel'
       
   362                                                   #'model:' #cancel
       
   363                                                   #'enableChannel:' #modifiedChannel
       
   364                                                   #'extent:' #(#Point 166 24)
       
   365                                               )
       
   366                                                #(#ActionButtonSpec
       
   367                                                   #'name:' 'acceptButton'
       
   368                                                   #'label:' 'OK'
       
   369                                                   #'model:' #accept
       
   370                                                   #'enableChannel:' #modifiedChannel
       
   371                                                   #'extent:' #(#Point 167 24)
       
   372                                               )
       
   373                                             )
       
   374                                         )
       
   375                                         #'horizontalLayout:' #fitSpace
       
   376                                         #'verticalLayout:' #fitSpace
       
   377                                         #'horizontalSpace:' 3
       
   378                                         #'verticalSpace:' 3
       
   379                                     )
       
   380                                   )
       
   381                               )
       
   382                               #'level:' -1
       
   383                           )
       
   384                         )
       
   385                     )
       
   386                     #'handles:' #(#Any 0.259875 1.0)
       
   387                 )
       
   388                  #(#UISubSpecification
       
   389                     #'name:' 'infoBarSubSpec'
       
   390                     #'layout:' #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
       
   391                     #'majorKey:' #ToolApplicationModel
       
   392                     #'minorKey:' #windowSpecForInfoBar
       
   393                 )
       
   394               )
       
   395           )
       
   396       )
       
   397 ! !
       
   398 
       
   399 !TabItemEditor class methodsFor:'menu specs'!
       
   400 
       
   401 menu
       
   402     "this window spec was automatically generated by the ST/X MenuEditor"
       
   403 
       
   404     "do not manually edit this - the builder may not be able to
       
   405      handle the specification if its corrupted."
       
   406 
       
   407     "
       
   408      MenuEditor new openOnClass:TabItemEditor andSelector:#menu
       
   409      (Menu new fromLiteralArrayEncoding:(TabItemEditor menu)) startUp
       
   410     "
       
   411 
       
   412     <resource: #menu>
       
   413 
       
   414     ^
       
   415      
       
   416        #(#Menu
       
   417           
       
   418            #(
       
   419              #(#MenuItem
       
   420                 #'label:' 'About'
       
   421                 #'activeHelpKey:' #about
       
   422                 #'labelImage:' #(#ResourceRetriever nil #menuIcon)
       
   423                 #'submenuChannel:' #menuAbout
       
   424             )
       
   425              #(#MenuItem
       
   426                 #'label:' 'File'
       
   427                 #'activeHelpKey:' #file
       
   428                 #'submenu:' 
       
   429                  #(#Menu
       
   430                     
       
   431                      #(
       
   432                        #(#MenuItem
       
   433                           #'label:' 'New'
       
   434                           #'value:' #doNew
       
   435                           #'activeHelpKey:' #fileNew
       
   436                       )
       
   437                        #(#MenuItem
       
   438                           #'label:' '-'
       
   439                       )
       
   440                        #(#MenuItem
       
   441                           #'label:' 'Reload'
       
   442                           #'value:' #doReload
       
   443                           #'activeHelpKey:' #fileReload
       
   444                           #'enabled:' #hasClassAndSelector
       
   445                       )
       
   446                        #(#MenuItem
       
   447                           #'label:' '-'
       
   448                       )
       
   449                        #(#MenuItem
       
   450                           #'label:' 'Save'
       
   451                           #'value:' #doInstallSpec
       
   452                           #'activeHelpKey:' #fileSave
       
   453                           #'enabled:' #isNotModified
       
   454                       )
       
   455                        #(#MenuItem
       
   456                           #'label:' '-'
       
   457                       )
       
   458                        #(#MenuItem
       
   459                           #'label:' 'Define Class And Selector...'
       
   460                           #'value:' #doDefineClassAndSelector
       
   461                           #'activeHelpKey:' #fileDefineClassAndSelector
       
   462                       )
       
   463                        #(#MenuItem
       
   464                           #'label:' 'Create Aspect Method'
       
   465                           #'value:' #doInstallAspect
       
   466                           #'activeHelpKey:' #fileCreateAspectMethod
       
   467                           #'enabled:' #hasClassAndSelector
       
   468                       )
       
   469                        #(#MenuItem
       
   470                           #'label:' '-'
       
   471                       )
       
   472                        #(#MenuItem
       
   473                           #'label:' 'Exit'
       
   474                           #'value:' #closeRequest
       
   475                           #'activeHelpKey:' #fileExit
       
   476                           #'enabled:' #isNotModified
       
   477                       )
       
   478                     ) nil
       
   479                     nil
       
   480                 )
       
   481             )
       
   482              #(#MenuItem
       
   483                 #'label:' 'Edit'
       
   484                 #'activeHelpKey:' #edit
       
   485                 #'submenuChannel:' #menuEdit
       
   486             )
       
   487              #(#MenuItem
       
   488                 #'label:' 'Add'
       
   489                 #'activeHelpKey:' #add
       
   490                 #'submenu:' 
       
   491                  #(#Menu
       
   492                     
       
   493                      #(
       
   494                        #(#MenuItem
       
   495                           #'label:' 'Tab Item'
       
   496                           #'value:' #doCreateTab
       
   497                           #'activeHelpKey:' #addTabItem
       
   498                           #'enabled:' #isNotModified
       
   499                           #'labelImage:' #(#ResourceRetriever nil #newTabItemIcon 'Tab Item')
       
   500                       )
       
   501                     ) nil
       
   502                     nil
       
   503                 )
       
   504             )
       
   505              #(#MenuItem
       
   506                 #'label:' 'Test'
       
   507                 #'activeHelpKey:' #test
       
   508                 #'submenu:' 
       
   509                  #(#Menu
       
   510                     
       
   511                      #(
       
   512                        #(#MenuItem
       
   513                           #'label:' 'Preview'
       
   514                           #'activeHelpKey:' #testPreview
       
   515                           #'enabled:' #canShowTestMode
       
   516                           #'indication:' #testMode
       
   517                       )
       
   518                     ) nil
       
   519                     nil
       
   520                 )
       
   521             )
       
   522              #(#MenuItem
       
   523                 #'label:' 'History'
       
   524                 #'activeHelpKey:' #history
       
   525                 #'submenuChannel:' #menuHistory
       
   526             )
       
   527              #(#MenuItem
       
   528                 #'label:' 'Help'
       
   529                 #'startGroup:' #right
       
   530                 #'activeHelpKey:' #help
       
   531                 #'submenuChannel:' #menuHelp
       
   532             )
       
   533           ) nil
       
   534           nil
       
   535       )
       
   536 !
       
   537 
       
   538 menuEdit
       
   539     "this window spec was automatically generated by the ST/X MenuEditor"
       
   540 
       
   541     "do not manually edit this - the builder may not be able to
       
   542      handle the specification if its corrupted."
       
   543 
       
   544     "
       
   545      MenuEditor new openOnClass:TabItemEditor andSelector:#menuEdit
       
   546      (Menu new fromLiteralArrayEncoding:(TabItemEditor menuEdit)) startUp
       
   547     "
       
   548 
       
   549     <resource: #menu>
       
   550 
       
   551     ^
       
   552      
       
   553        #(#Menu
       
   554           
       
   555            #(
       
   556              #(#MenuItem
       
   557                 #'label:' 'Cut'
       
   558                 #'value:' #doCutTab
       
   559                 #'activeHelpKey:' #editCut
       
   560                 #'enabled:' #isColumnSelected
       
   561             )
       
   562              #(#MenuItem
       
   563                 #'label:' 'Copy'
       
   564                 #'value:' #doCopyTab
       
   565                 #'activeHelpKey:' #editCopy
       
   566                 #'enabled:' #isColumnSelected
       
   567             )
       
   568              #(#MenuItem
       
   569                 #'label:' 'Paste'
       
   570                 #'value:' #doPasteTab
       
   571                 #'activeHelpKey:' #editPaste
       
   572                 #'enabled:' #valueOfHavingClipboard
       
   573             )
       
   574              #(#MenuItem
       
   575                 #'label:' '-'
       
   576             )
       
   577              #(#MenuItem
       
   578                 #'label:' 'Move Up'
       
   579                 #'value:' #'doMoveTabUpOrDown:'
       
   580                 #'activeHelpKey:' #editMoveUp
       
   581                 #'enabled:' #canMoveTabUpOrDown
       
   582                 #'argument:' #up
       
   583                 #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #upIcon 'Move Up')
       
   584             )
       
   585              #(#MenuItem
       
   586                 #'label:' 'Move Down'
       
   587                 #'value:' #'doMoveTabUpOrDown:'
       
   588                 #'activeHelpKey:' #editMoveDown
       
   589                 #'enabled:' #canMoveTabUpOrDown
       
   590                 #'argument:' #down
       
   591                 #'labelImage:' #(#ResourceRetriever #ToolApplicationModel #downIcon 'Move Down')
       
   592             )
       
   593           ) nil
       
   594           nil
       
   595       )
       
   596 !
       
   597 
       
   598 menuToolbar
       
   599     "this window spec was automatically generated by the ST/X MenuEditor"
       
   600 
       
   601     "do not manually edit this - the builder may not be able to
       
   602      handle the specification if its corrupted."
       
   603 
       
   604     "
       
   605      MenuEditor new openOnClass:TabItemEditor andSelector:#menuToolbar
       
   606      (Menu new fromLiteralArrayEncoding:(TabItemEditor menuToolbar)) startUp
       
   607     "
       
   608 
       
   609     <resource: #menu>
       
   610 
       
   611     ^
       
   612      
       
   613        #(#Menu
       
   614           
       
   615            #(
       
   616              #(#MenuItem
       
   617                 #'label:' 'New'
       
   618                 #'isButton:' true
       
   619                 #'value:' #doNew
       
   620                 #'activeHelpKey:' #fileNew
       
   621                 #'labelImage:' #(#ResourceRetriever nil #newIcon)
       
   622             )
       
   623              #(#MenuItem
       
   624                 #'label:' 'Save'
       
   625                 #'isButton:' true
       
   626                 #'value:' #doInstallSpec
       
   627                 #'activeHelpKey:' #fileSave
       
   628                 #'enabled:' #isNotModified
       
   629                 #'labelImage:' #(#ResourceRetriever nil #saveIcon)
       
   630             )
       
   631              #(#MenuItem
       
   632                 #'label:' ''
       
   633             )
       
   634              #(#MenuItem
       
   635                 #'label:' 'Add Tab Item'
       
   636                 #'isButton:' true
       
   637                 #'value:' #doCreateTab
       
   638                 #'activeHelpKey:' #addTabItem
       
   639                 #'enabled:' #isNotModified
       
   640                 #'labelImage:' #(#ResourceRetriever nil #newTabItemIcon)
       
   641             )
       
   642              #(#MenuItem
       
   643                 #'label:' ''
       
   644             )
       
   645              #(#MenuItem
       
   646                 #'label:' 'Move Tab Up'
       
   647                 #'isButton:' true
       
   648                 #'value:' #'doMoveTabUpOrDown:'
       
   649                 #'activeHelpKey:' #editMoveUp
       
   650                 #'enabled:' #canMoveTabUpOrDown
       
   651                 #'argument:' #up
       
   652                 #'labelImage:' #(#ResourceRetriever nil #upIcon)
       
   653             )
       
   654              #(#MenuItem
       
   655                 #'label:' 'Move Tab Down'
       
   656                 #'isButton:' true
       
   657                 #'value:' #'doMoveTabUpOrDown:'
       
   658                 #'activeHelpKey:' #editMoveDown
       
   659                 #'enabled:' #canMoveTabUpOrDown
       
   660                 #'argument:' #down
       
   661                 #'labelImage:' #(#ResourceRetriever nil #downIcon)
       
   662             )
       
   663              #(#MenuItem
       
   664                 #'label:' ''
       
   665             )
       
   666              #(#MenuItem
       
   667                 #'label:' 'Preview'
       
   668                 #'activeHelpKey:' #testPreview
       
   669                 #'enabled:' #canShowTestMode
       
   670                 #'indication:' #testMode
       
   671             )
       
   672           ) nil
       
   673           nil
       
   674       )
       
   675 ! !
       
   676 
       
   677 !TabItemEditor class methodsFor:'resources'!
       
   678 
       
   679 newTabItemIcon
       
   680     "Generated by the Image Editor"
       
   681     "
       
   682     ImageEditor openOnClass:self andSelector:#newTabItemIcon
       
   683     "
       
   684 
       
   685     <resource: #image>
       
   686 
       
   687     ^Icon
       
   688         constantNamed:#'TabItemEditor newTabItemIcon'
       
   689         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'U@@@@EUPUEUUVEUPUF**+EUPUF**+EUPUF**+EUP@F**+@@@EV***UV@F*****+@F KNC*+NF(("H*+@F((BC +EF(("H*+@F(("C*+MF*****+@F"@ H*K@F"""(LK@F"" ("K@F"""(*K@F"" H*K@F*****+HK??????@@@@@@@@@'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G?<@G?<@G?<@G?<@G?<@???<???<???<???????<???<???<???<???????=???<???????<???????<???<???='); yourself); yourself]! !
       
   690 
       
   691 !TabItemEditor methodsFor:'accessing'!
       
   692 
       
   693 className
       
   694     ^ className
       
   695 !
       
   696 
       
   697 didInstall
       
   698     ^ hasChanged not
       
   699 !
       
   700 
       
   701 selector
       
   702     ^ selector
       
   703 ! !
       
   704 
       
   705 !TabItemEditor methodsFor:'actions'!
       
   706 
       
   707 accept
       
   708     "accept changes
       
   709     "
       
   710     |label|
       
   711 
       
   712     self modified ifTrue:[
       
   713         selectedIndex ~~ 0 ifTrue:[
       
   714             rebuildMode := true.
       
   715             label := listOfTabs at:selectedIndex.
       
   716             hasChanged := true.
       
   717 
       
   718             aspects keysAndValuesDo:[:aKey :aModel|
       
   719                 label perform:(aKey , ':') asSymbol with:(aModel value).
       
   720             ].
       
   721             self listOfLabels at:selectedIndex put:(label label).
       
   722 
       
   723             rebuildMode := false.
       
   724         ].
       
   725         self cancel
       
   726     ]
       
   727 !
       
   728 
       
   729 cancel
       
   730     "cancel all changes
       
   731     "
       
   732     |tab|
       
   733 
       
   734     rebuildMode ifFalse:[
       
   735         selectedIndex ~~ 0 ifTrue:[
       
   736             tab := listOfTabs at:selectedIndex.
       
   737 
       
   738             rebuildMode := true.
       
   739 
       
   740             aspects keysAndValuesDo:[:aKey :aModel|
       
   741                 aModel value:(tab perform:aKey)    
       
   742             ].
       
   743 
       
   744             rebuildMode := false.
       
   745         ].
       
   746         self modified:false.
       
   747     ].
       
   748     self canMoveTabUpOrDown value:(selectedIndex ~~ 0 and:[listOfTabs size > 1])
       
   749 
       
   750 
       
   751 
       
   752 
       
   753 !
       
   754 
       
   755 modified
       
   756     "returns true if current tab is modified
       
   757     "
       
   758     ^ self modifiedChannel value
       
   759 !
       
   760 
       
   761 modified:aState
       
   762     "change modification state
       
   763     "
       
   764     rebuildMode ifFalse:[
       
   765         self modifiedChannel value:aState.
       
   766         self isNotModified   value:(aState not).
       
   767     ]
       
   768 ! !
       
   769 
       
   770 !TabItemEditor methodsFor:'aspects'!
       
   771 
       
   772 aspectFor:aKey
       
   773     "returns aspect for a key or nil
       
   774     "
       
   775     ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
       
   776 
       
   777 
       
   778 !
       
   779 
       
   780 canMoveTabUpOrDown
       
   781 
       
   782     |holder|
       
   783 
       
   784     (holder := builder bindingAt:#canMoveTabUpOrDown) isNil ifTrue:[
       
   785         builder aspectAt:#canMoveTabUpOrDown put:(holder := false asValue).
       
   786     ].
       
   787     ^ holder
       
   788 
       
   789 !
       
   790 
       
   791 canShowTestMode
       
   792 
       
   793     |holder|
       
   794 
       
   795     (holder := builder bindingAt:#canShowTestMode) isNil ifTrue:[
       
   796         builder aspectAt:#canShowTestMode put:(holder := false asValue).
       
   797     ].
       
   798     ^ holder
       
   799 
       
   800 !
       
   801 
       
   802 hasClassAndSelector
       
   803 
       
   804     |holder|
       
   805 
       
   806     (holder := builder bindingAt:#hasClassAndSelector) isNil ifTrue:[
       
   807         builder aspectAt:#hasClassAndSelector put:(holder := false asValue).
       
   808     ].
       
   809     ^ holder
       
   810 
       
   811 !
       
   812 
       
   813 isNotModified
       
   814     "returns true if current tab spec is not modified
       
   815     "
       
   816     |holder|
       
   817 
       
   818     (holder := builder bindingAt:#isNotModified) isNil ifTrue:[
       
   819         builder aspectAt:#isNotModified put:(holder :=  true asValue).
       
   820     ].
       
   821     ^ holder
       
   822 !
       
   823 
       
   824 listOfLabels
       
   825     "returns a holder which keeps the list of tab labels
       
   826     "
       
   827     |list|
       
   828 
       
   829     (list := builder bindingAt:#listOfLabels) isNil ifTrue:[
       
   830         builder aspectAt:#listOfLabels put:(list :=  List new).
       
   831     ].
       
   832     ^ list
       
   833 !
       
   834 
       
   835 modifiedChannel
       
   836     "channel which is true if the current tab specification is modified
       
   837     "
       
   838     |holder|
       
   839 
       
   840     (holder := builder bindingAt:#modifiedChannel) isNil ifTrue:[
       
   841         builder aspectAt:#modifiedChannel put:(holder :=  false asValue).
       
   842     ].
       
   843     ^ holder
       
   844 !
       
   845 
       
   846 selectionHolder
       
   847     "holder which keeps the current selection
       
   848     "
       
   849     |holder|
       
   850 
       
   851     (holder := builder bindingAt:#selectionHolder) isNil ifTrue:[
       
   852         holder := AspectAdaptor new subject:self; forAspect:#selectedIndex.
       
   853         builder aspectAt:#selectionHolder put:holder.
       
   854     ].
       
   855     ^ holder
       
   856 !
       
   857 
       
   858 specChannel
       
   859     "holder which keeps the current tab specification
       
   860     "
       
   861     |holder|
       
   862 
       
   863     (holder := builder bindingAt:#specChannel) isNil ifTrue:[
       
   864         builder aspectAt:#specChannel put:(holder :=  ValueHolder new).
       
   865     ].
       
   866     ^ holder
       
   867 !
       
   868 
       
   869 testMode
       
   870 
       
   871     |holder|
       
   872 
       
   873     (holder := builder bindingAt:#testMode) isNil ifTrue:[
       
   874         builder aspectAt:#testMode put:(holder := false asValue).
       
   875         holder addDependent: self
       
   876     ].
       
   877     ^ holder
       
   878 
       
   879 ! !
       
   880 
       
   881 !TabItemEditor methodsFor:'building'!
       
   882 
       
   883 buildFrom:aClass andSelector:aSelector
       
   884     "build from class and selector
       
   885     "
       
   886     |spec list validClSl|
       
   887 
       
   888     self doNew.
       
   889 
       
   890     selector  := nil.
       
   891     className := self resolveName:aClass.
       
   892     validClSl := false.
       
   893 
       
   894     className notNil ifTrue:[
       
   895         aSelector notNil ifTrue:[
       
   896             validClSl := true.
       
   897             selector  := aSelector asSymbol.
       
   898 
       
   899             (className respondsTo:selector) ifTrue:[
       
   900                 spec := className perform:selector.
       
   901                 list := self listOfLabels.
       
   902 
       
   903                 spec size ~~ 0 ifTrue:[
       
   904 
       
   905                     rebuildMode := true.
       
   906 
       
   907                     spec do:[:aTab|
       
   908                         list add:aTab label.
       
   909                         listOfTabs add:aTab.
       
   910                     ].
       
   911                     rebuildMode := false.          
       
   912                     self addToHistory:(className name, ' ', selector) -> #loadFromMessage:                        
       
   913                 ]
       
   914             ]
       
   915         ]
       
   916     ].
       
   917 
       
   918     self hasClassAndSelector value:validClSl.
       
   919     self modified:false.
       
   920     hasChanged := false.
       
   921 
       
   922     listOfTabs notEmpty ifTrue:[
       
   923         self selectionHolder value:1
       
   924     ].
       
   925 
       
   926     self updateInfoLabel
       
   927 !
       
   928 
       
   929 loadFromMessage:aMessage
       
   930     "load tabs from class and selector derived from history
       
   931     "
       
   932     |msg cls|
       
   933 
       
   934     aMessage notNil ifTrue:[
       
   935         msg := aMessage asCollectionOfWords.
       
   936 
       
   937         (msg size == 2 and:[(cls := self resolveName:(msg at:1)) notNil]) ifTrue:[
       
   938             self buildFrom:cls andSelector:((msg at:2) asSymbol)
       
   939         ]
       
   940     ]
       
   941 ! !
       
   942 
       
   943 !TabItemEditor methodsFor:'change & update'!
       
   944 
       
   945 update:something with:aParameter from:someObject
       
   946     "one of my aspects has changed; update modified channel
       
   947     "
       
   948     self modified:true.
       
   949 
       
   950     someObject = self testMode
       
   951     ifTrue:
       
   952     [              
       
   953         someObject value
       
   954             ifTrue: [self doTest]
       
   955             ifFalse:[testView lower. self selectionHolder value:1].
       
   956 
       
   957         self updateInfoLabel
       
   958     ]
       
   959 ! !
       
   960 
       
   961 !TabItemEditor methodsFor:'help'!
       
   962 
       
   963 defaultInfoLabel
       
   964 
       
   965     self testMode value
       
   966         ifTrue:  [^'Test mode']
       
   967         ifFalse: [
       
   968         className isNil ifTrue: [^'No tab list class defined'].
       
   969         ^className name, ' >> ', selector printString]
       
   970 ! !
       
   971 
       
   972 !TabItemEditor methodsFor:'selection'!
       
   973 
       
   974 selectedIndex
       
   975     ^ selectedIndex
       
   976 !
       
   977 
       
   978 selectedIndex:anIndex
       
   979     |s oldSel|
       
   980 
       
   981     self listOfLabels notEmpty ifTrue: [self canShowTestMode value: true].
       
   982     anIndex notNil ifTrue: [self testMode value: false].
       
   983 
       
   984     oldSel := selectedIndex.
       
   985     selectedIndex := anIndex ? 0.
       
   986 
       
   987     selectedIndex == oldSel ifTrue:[^ self].
       
   988 
       
   989     oldSel == 0 ifTrue:[
       
   990         self specChannel value:(self class tabSpec)
       
   991     ] ifFalse:[
       
   992         selectedIndex == 0 ifTrue:[
       
   993             self specChannel value:nil
       
   994         ]
       
   995     ].
       
   996     self cancel.
       
   997 
       
   998     testView notNil ifTrue:[
       
   999         testView lower.
       
  1000     ].
       
  1001 
       
  1002 ! !
       
  1003 
       
  1004 !TabItemEditor methodsFor:'startup / release'!
       
  1005 
       
  1006 closeRequest
       
  1007 
       
  1008     hasChanged ifTrue:[
       
  1009         ( YesNoBox title:'Tab spec was modified!!'
       
  1010                  yesText:'Waste it and proceed'
       
  1011                   noText:'Cancel'
       
  1012         ) confirm ifFalse:[
       
  1013             ^ self
       
  1014         ].
       
  1015         hasChanged := false.
       
  1016     ].
       
  1017     super closeRequest.
       
  1018 !
       
  1019 
       
  1020 initialize
       
  1021     "setup aspects used by column description specifications
       
  1022     "
       
  1023     |holder|
       
  1024 
       
  1025     super initialize.
       
  1026 
       
  1027     aspects       := IdentityDictionary new.
       
  1028     listOfTabs    := OrderedCollection new.
       
  1029     hasChanged    := false.
       
  1030     selectedIndex := 0.
       
  1031     rebuildMode   := false.
       
  1032 
       
  1033    #(
       
  1034         label
       
  1035         translateLabel
       
  1036         labelForegroundColor
       
  1037         enabled
       
  1038         editAgument
       
  1039 
       
  1040     ) do:[:aKey|
       
  1041         aspects at:aKey put:(holder := ValueHolder new).
       
  1042         holder addDependent:self.
       
  1043     ].
       
  1044 
       
  1045 
       
  1046 !
       
  1047 
       
  1048 openModalOnClass:aClass andSelector:aSelector
       
  1049 
       
  1050     className := aClass.
       
  1051     selector  := aSelector.
       
  1052 
       
  1053     super openInterfaceModal.
       
  1054 
       
  1055 
       
  1056 !
       
  1057 
       
  1058 openOnClass:aClass andSelector:aSelector
       
  1059 
       
  1060     className := aClass.
       
  1061     selector  := aSelector.
       
  1062 
       
  1063     super openInterface.
       
  1064 
       
  1065 
       
  1066 !
       
  1067 
       
  1068 postBuildWith:builder
       
  1069     self buildFrom:className andSelector:selector.
       
  1070     testView := builder componentAt:#TestView.
       
  1071 ! !
       
  1072 
       
  1073 !TabItemEditor methodsFor:'user interactions'!
       
  1074 
       
  1075 doCopyTab
       
  1076     "copy selected tab
       
  1077     "
       
  1078     selectedIndex ~~ 0 ifTrue:[
       
  1079         self clipboard:(listOfTabs at:selectedIndex) deepCopy
       
  1080     ]
       
  1081 !
       
  1082 
       
  1083 doCreateTab
       
  1084 
       
  1085     |tab|
       
  1086     self testMode value: false.
       
  1087     tab := TabItem label:'Tab Item ', (listOfTabs size + 1) printString.
       
  1088 
       
  1089     listOfTabs add:tab afterIndex:selectedIndex.
       
  1090     self listOfLabels add:(tab label) afterIndex:selectedIndex.
       
  1091     hasChanged := true.
       
  1092 
       
  1093     selectedIndex == 0 ifTrue:[
       
  1094         self selectionHolder value:1
       
  1095     ] ifFalse:[    
       
  1096         self selectionHolder value:selectedIndex + 1.
       
  1097         self cancel.
       
  1098     ]
       
  1099 !
       
  1100 
       
  1101 doCutTab
       
  1102     "cut selected tab
       
  1103     "
       
  1104     |list index|
       
  1105 
       
  1106     (index := selectedIndex) ~~ 0 ifTrue:[
       
  1107         self testMode value: false.
       
  1108         list := self listOfLabels.
       
  1109         self clipboard:(listOfTabs at:index) deepCopy.
       
  1110         self selectionHolder value:0.
       
  1111         listOfTabs removeIndex:index.
       
  1112         list removeIndex:index.
       
  1113         hasChanged := true.
       
  1114 
       
  1115         index > list size ifTrue:[
       
  1116             index := index - 1
       
  1117         ].
       
  1118         self selectionHolder value:index.
       
  1119         self listOfLabels isEmpty ifTrue: [self canShowTestMode value: false].
       
  1120     ]
       
  1121 
       
  1122 !
       
  1123 
       
  1124 doDefineClassAndSelector
       
  1125     "launch a dialog to define class and selector
       
  1126     "
       
  1127     |cls sel bindings|
       
  1128 
       
  1129     bindings := IdentityDictionary new.
       
  1130 
       
  1131     [true] whileTrue:[
       
  1132         cls := className notNil ifTrue:[className name] ifFalse:['NewApplication'].
       
  1133         sel := selector  ? 'tabItemList'.
       
  1134 
       
  1135         bindings at:#className put:cls asValue.
       
  1136         bindings at:#selector  put:sel asValue.
       
  1137 
       
  1138         (self openDialogInterface:#nameAndSelectorSpec withBindings:bindings)
       
  1139         ifFalse:[ ^ self ].
       
  1140 
       
  1141         cls := (bindings at:#className) value withoutSeparators.
       
  1142         sel := (bindings at:#selector)  value withoutSeparators.
       
  1143 
       
  1144         (cls := self resolveName:cls) notNil ifTrue:[
       
  1145             className := cls.
       
  1146 
       
  1147             sel notNil ifTrue:[
       
  1148                 selector := sel asSymbol.
       
  1149                 self hasClassAndSelector value:true.
       
  1150 
       
  1151                 listOfTabs size == 0 ifTrue:[
       
  1152                     self buildFrom:className andSelector:selector
       
  1153                 ].
       
  1154                 ^ self
       
  1155             ]
       
  1156         ]
       
  1157     ]
       
  1158 !
       
  1159 
       
  1160 doInstallAspect
       
  1161     "generate aspect method
       
  1162     "
       
  1163     |code|
       
  1164 
       
  1165     className isNil ifTrue:[ ^ self information:'No valid class defined!!'].
       
  1166     selector isNil  ifTrue:[ ^ self information:'No selector defined!!'   ].
       
  1167 
       
  1168     (className canUnderstand:selector) ifTrue:[
       
  1169         "/ method already exists, do not overwrite the method automaticaly
       
  1170 
       
  1171         ( YesNoBox title:'method '
       
  1172                          , (Text string:('#', selector) emphasis:#bold)
       
  1173                          , ' already exists'
       
  1174                  yesText:'overwrite'
       
  1175                   noText:'cancel'
       
  1176         ) confirm ifFalse:[
       
  1177             ^ self
       
  1178         ]
       
  1179     ].
       
  1180 
       
  1181     code := '!!' , className name , ' methodsFor:''aspects''!!\\' ,
       
  1182             selector , '\' ,
       
  1183             '    "automatically generated by TabItem Editor ..."\' ,
       
  1184             '\' ,
       
  1185             '    |list|\' ,
       
  1186             '\' ,
       
  1187             '    (list := builder bindingAt:#' , selector , ') isNil ifTrue:[\' ,
       
  1188             '        builder aspectAt:#' , selector, ' put:(list := self class ', selector, ').\' ,
       
  1189             '    ].\' ,
       
  1190             '    ^ list\' ,
       
  1191             '!! !!\\'.
       
  1192 
       
  1193     (ReadStream on:(code withCRs)) fileIn
       
  1194 
       
  1195 
       
  1196 !
       
  1197 
       
  1198 doInstallSpec
       
  1199     "generate code for class and instance
       
  1200     "
       
  1201     |code spec category mthd|
       
  1202 
       
  1203     (className isNil or:[selector isNil]) ifTrue:[
       
  1204         self doDefineClassAndSelector
       
  1205     ].
       
  1206     className isNil ifTrue:[ ^ self information:'No valid class defined!!'].
       
  1207     selector isNil  ifTrue:[ ^ self information:'No selector defined!!'   ].
       
  1208     listOfTabs isEmpty ifTrue:[ ^ self information:'No valid tabs defined!!' ].
       
  1209 
       
  1210     spec  := WriteStream on:String new.
       
  1211     UISpecification prettyPrintSpecArray:(listOfTabs literalArrayEncoding) on:spec indent:5.
       
  1212     spec := spec contents.
       
  1213 
       
  1214     "/ if that method already exists, do not overwrite the category
       
  1215 
       
  1216     category := 'interface specs'.
       
  1217 
       
  1218     (mthd := className class compiledMethodAt:selector) notNil ifTrue:[
       
  1219         category := mthd category.
       
  1220     ].
       
  1221 
       
  1222     code := Character excla asString 
       
  1223             , className name , ' class methodsFor:' , category storeString
       
  1224             , Character excla asString , '\\'
       
  1225 
       
  1226             , selector , '\'
       
  1227             , '    "this window spec was automatically generated by the ST/X TabItemEditor"\\'
       
  1228             , '    "do not manually edit this - the builder may not be able to\'
       
  1229             , '     handle the specification if its corrupted."\\'
       
  1230             , '    "\'
       
  1231             , '     TabItemEditor new openOnClass:' , className name , ' andSelector:#' , selector , '\'
       
  1232             , '    "\'.
       
  1233 
       
  1234     code := code 
       
  1235             , '\'
       
  1236             , '    <resource: #tabList>\\'
       
  1237             , '    ^\' 
       
  1238             , '     ', spec, '\'
       
  1239             , '      collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]'
       
  1240             , '\'
       
  1241             , Character excla asString
       
  1242             , ' '
       
  1243             , Character excla asString
       
  1244             , '\\'.
       
  1245 
       
  1246     code := code withCRs.
       
  1247     (ReadStream on:code) fileIn.
       
  1248     hasChanged := false.
       
  1249     self addToHistory:(className name, ' ', selector) -> #loadFromMessage:.
       
  1250 
       
  1251     (className canUnderstand:selector) ifFalse:[
       
  1252         (YesNoBox confirm:'install aspect method') ifTrue:[
       
  1253             self doInstallAspect
       
  1254         ]
       
  1255     ]
       
  1256 
       
  1257 
       
  1258 !
       
  1259 
       
  1260 doMoveTabUpOrDown:what
       
  1261     "step up or down
       
  1262     "
       
  1263     |tab list index|
       
  1264 
       
  1265     (selectedIndex ~~ 0 and:[listOfTabs size > 1]) ifFalse:[
       
  1266         ^ self
       
  1267     ].
       
  1268 
       
  1269     list := self listOfLabels.
       
  1270     tab  := listOfTabs at:selectedIndex.
       
  1271 
       
  1272     list removeIndex:selectedIndex.
       
  1273     listOfTabs removeIndex:selectedIndex.
       
  1274 
       
  1275     what == #down ifTrue:[
       
  1276         index := selectedIndex > list size ifTrue:[1]
       
  1277                                           ifFalse:[selectedIndex + 1]
       
  1278     ] ifFalse:[
       
  1279         index := selectedIndex == 1 ifTrue:[list size + 1]
       
  1280                                    ifFalse:[selectedIndex - 1]
       
  1281     ].
       
  1282 
       
  1283     list add:(tab label) beforeIndex:index.
       
  1284     listOfTabs add:tab beforeIndex:index.
       
  1285     hasChanged  := true.
       
  1286 
       
  1287     rebuildMode := true.
       
  1288     self selectionHolder value:index.
       
  1289     rebuildMode := false.
       
  1290 
       
  1291 
       
  1292 !
       
  1293 
       
  1294 doNew
       
  1295 
       
  1296     self testMode value: false.
       
  1297 
       
  1298     self modified:false.
       
  1299 
       
  1300     rebuildMode := true.
       
  1301 
       
  1302     self selectionHolder value:0.
       
  1303     self listOfLabels removeAll.
       
  1304     listOfTabs removeAll.
       
  1305 
       
  1306     testView notNil ifTrue:[
       
  1307         testView lower
       
  1308     ].
       
  1309 
       
  1310     hasChanged  := true.
       
  1311     rebuildMode := false.
       
  1312 
       
  1313     self canShowTestMode value: false
       
  1314 !
       
  1315 
       
  1316 doPasteTab
       
  1317     "paste a tab
       
  1318     "
       
  1319     |tab|
       
  1320 
       
  1321     self testMode value: false.
       
  1322     tab := self class clipboard deepCopy.
       
  1323     listOfTabs add:tab afterIndex:selectedIndex.
       
  1324     self listOfLabels add:(tab label) afterIndex:selectedIndex.
       
  1325     hasChanged := true.
       
  1326 
       
  1327     selectedIndex == 0 ifTrue:[
       
  1328         self selectionHolder value:1
       
  1329     ] ifFalse:[    
       
  1330         self selectionHolder value:selectedIndex + 1.
       
  1331         self cancel.
       
  1332     ]
       
  1333 !
       
  1334 
       
  1335 doReload
       
  1336     "reload from class and selector
       
  1337     "
       
  1338     self buildFrom:className andSelector:selector
       
  1339 !
       
  1340 
       
  1341 doTest
       
  1342     "run a test
       
  1343     "
       
  1344     |tabView list|
       
  1345 
       
  1346     self selectionHolder value:nil.
       
  1347 
       
  1348     listOfTabs size ~~ 0 ifTrue:[
       
  1349         list := listOfTabs collect:[:aTab||t|
       
  1350             t := aTab copy.
       
  1351             t setAttributesFromClass:className.
       
  1352             t
       
  1353         ]
       
  1354     ] ifFalse:[
       
  1355         list := nil
       
  1356     ].
       
  1357     tabView  := builder componentAt:#TestTabsView.
       
  1358     tabView list:list.
       
  1359     testView raise.
       
  1360 
       
  1361 
       
  1362 
       
  1363 ! !
       
  1364 
       
  1365 !TabItemEditor class methodsFor:'documentation'!
       
  1366 
       
  1367 version
       
  1368     ^ '$Header$'
       
  1369 ! !