FileSelectionBrowser.st
author tz
Mon, 08 Dec 1997 22:35:24 +0100
changeset 388 45cf0af38948
parent 384 395b851346df
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
384
395b851346df intitial checkin
tz
parents:
diff changeset
     1
SelectionBrowser subclass:#FileSelectionBrowser
395b851346df intitial checkin
tz
parents:
diff changeset
     2
	instanceVariableNames:'selectedFileFilter fileName readTask'
395b851346df intitial checkin
tz
parents:
diff changeset
     3
	classVariableNames:''
395b851346df intitial checkin
tz
parents:
diff changeset
     4
	poolDictionaries:''
395b851346df intitial checkin
tz
parents:
diff changeset
     5
	category:'Interface-Advanced-Tools'
395b851346df intitial checkin
tz
parents:
diff changeset
     6
!
395b851346df intitial checkin
tz
parents:
diff changeset
     7
395b851346df intitial checkin
tz
parents:
diff changeset
     8
Object subclass:#Row
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
     9
	instanceVariableNames:'fileName size modified iconKey group owner permissions baseName'
384
395b851346df intitial checkin
tz
parents:
diff changeset
    10
	classVariableNames:''
395b851346df intitial checkin
tz
parents:
diff changeset
    11
	poolDictionaries:''
395b851346df intitial checkin
tz
parents:
diff changeset
    12
	privateIn:FileSelectionBrowser
395b851346df intitial checkin
tz
parents:
diff changeset
    13
!
395b851346df intitial checkin
tz
parents:
diff changeset
    14
395b851346df intitial checkin
tz
parents:
diff changeset
    15
395b851346df intitial checkin
tz
parents:
diff changeset
    16
!FileSelectionBrowser class methodsFor:'instance creation'!
395b851346df intitial checkin
tz
parents:
diff changeset
    17
395b851346df intitial checkin
tz
parents:
diff changeset
    18
requestFileName
395b851346df intitial checkin
tz
parents:
diff changeset
    19
395b851346df intitial checkin
tz
parents:
diff changeset
    20
    ^self new title: 'Select a file'; open
395b851346df intitial checkin
tz
parents:
diff changeset
    21
395b851346df intitial checkin
tz
parents:
diff changeset
    22
!
395b851346df intitial checkin
tz
parents:
diff changeset
    23
395b851346df intitial checkin
tz
parents:
diff changeset
    24
requestFileName: aFileName fileFilters: fileFilters
395b851346df intitial checkin
tz
parents:
diff changeset
    25
395b851346df intitial checkin
tz
parents:
diff changeset
    26
    ^self new
395b851346df intitial checkin
tz
parents:
diff changeset
    27
        fileName: aFileName;
395b851346df intitial checkin
tz
parents:
diff changeset
    28
        listOfFileFilters: fileFilters;
395b851346df intitial checkin
tz
parents:
diff changeset
    29
        open
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    30
!
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    31
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    32
title: aTitle requestFileName: aFileName fileFilters: fileFilters
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    33
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    34
    ^self new
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    35
        title: aTitle;
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    36
        fileName: aFileName;
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    37
        listOfFileFilters: fileFilters;
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    38
        open
384
395b851346df intitial checkin
tz
parents:
diff changeset
    39
! !
395b851346df intitial checkin
tz
parents:
diff changeset
    40
395b851346df intitial checkin
tz
parents:
diff changeset
    41
!FileSelectionBrowser class methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
    42
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    43
loadImageFileNameFilters
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    44
    ^self saveImageFileNameFilters addAll: #('*.jpeg' '*.jpg'); yourself
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    45
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    46
!
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    47
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    48
saveImageFileNameFilters
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    49
    ^Array withAll: #('*.xpm' '*.xbm' '*.gif' '*.tif' '*.tiff')
384
395b851346df intitial checkin
tz
parents:
diff changeset
    50
395b851346df intitial checkin
tz
parents:
diff changeset
    51
! !
395b851346df intitial checkin
tz
parents:
diff changeset
    52
395b851346df intitial checkin
tz
parents:
diff changeset
    53
!FileSelectionBrowser class methodsFor:'interface specs'!
395b851346df intitial checkin
tz
parents:
diff changeset
    54
395b851346df intitial checkin
tz
parents:
diff changeset
    55
windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    56
    "this window spec was automatically generated by the ST/X UIPainter"
395b851346df intitial checkin
tz
parents:
diff changeset
    57
395b851346df intitial checkin
tz
parents:
diff changeset
    58
    "do not manually edit this - the painter/builder may not be able to
395b851346df intitial checkin
tz
parents:
diff changeset
    59
     handle the specification if its corrupted."
395b851346df intitial checkin
tz
parents:
diff changeset
    60
395b851346df intitial checkin
tz
parents:
diff changeset
    61
    "
395b851346df intitial checkin
tz
parents:
diff changeset
    62
     UIPainter new openOnClass:FileSelectionBrowser andSelector:#windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    63
     FileSelectionBrowser new openInterface:#windowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    64
    "
395b851346df intitial checkin
tz
parents:
diff changeset
    65
    "FileSelectionBrowser open"
395b851346df intitial checkin
tz
parents:
diff changeset
    66
395b851346df intitial checkin
tz
parents:
diff changeset
    67
    <resource: #canvas>
395b851346df intitial checkin
tz
parents:
diff changeset
    68
395b851346df intitial checkin
tz
parents:
diff changeset
    69
    ^
395b851346df intitial checkin
tz
parents:
diff changeset
    70
     
395b851346df intitial checkin
tz
parents:
diff changeset
    71
       #(#FullSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    72
          #'window:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    73
           #(#WindowSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    74
              #'name:' 'File Selection Browser'
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    75
              #'layout:' #(#LayoutFrame 301 0 222 0 700 0 521 0)
384
395b851346df intitial checkin
tz
parents:
diff changeset
    76
              #'label:' 'File Selection Browser'
395b851346df intitial checkin
tz
parents:
diff changeset
    77
              #'min:' #(#Point 10 10)
395b851346df intitial checkin
tz
parents:
diff changeset
    78
              #'max:' #(#Point 1152 900)
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
    79
              #'bounds:' #(#Rectangle 301 222 701 522)
384
395b851346df intitial checkin
tz
parents:
diff changeset
    80
              #'usePreferredExtent:' false
395b851346df intitial checkin
tz
parents:
diff changeset
    81
          )
395b851346df intitial checkin
tz
parents:
diff changeset
    82
          #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    83
           #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    84
              #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    85
               #(
395b851346df intitial checkin
tz
parents:
diff changeset
    86
                 #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    87
                    #'name:' 'view'
395b851346df intitial checkin
tz
parents:
diff changeset
    88
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
    89
                    #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    90
                     #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    91
                        #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    92
                         #(
395b851346df intitial checkin
tz
parents:
diff changeset
    93
                           #(#VariableHorizontalPanelSpec
395b851346df intitial checkin
tz
parents:
diff changeset
    94
                              #'name:' 'panel'
395b851346df intitial checkin
tz
parents:
diff changeset
    95
                              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -1 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
    96
                              #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    97
                               #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
    98
                                  #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
    99
                                   #(
395b851346df intitial checkin
tz
parents:
diff changeset
   100
                                     #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   101
                                        #'name:' 'view1'
395b851346df intitial checkin
tz
parents:
diff changeset
   102
                                        #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   103
                                         #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   104
                                            #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   105
                                             #(
395b851346df intitial checkin
tz
parents:
diff changeset
   106
                                               #(#FileSelectionTreeSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   107
                                                  #'name:' 'directoryTreeView'
395b851346df intitial checkin
tz
parents:
diff changeset
   108
                                                  #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   109
                                                  #'model:' #selectionOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   110
                                                  #'hasHorizontalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   111
                                                  #'hasVerticalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   112
                                                  #'miniScrollerHorizontal:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   113
                                                  #'showRoot:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   114
                                                  #'showDirectoryIndicator:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   115
                                                  #'valueChangeSelector:' #readDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   116
                                                  #'hierarchicalList:' #rootOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   117
                                                  #'itemClass:' 'Directory'
395b851346df intitial checkin
tz
parents:
diff changeset
   118
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   119
                                            )
395b851346df intitial checkin
tz
parents:
diff changeset
   120
                                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   121
                                        #'level:' -1
395b851346df intitial checkin
tz
parents:
diff changeset
   122
                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   123
                                     #(#ViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   124
                                        #'name:' 'view2'
395b851346df intitial checkin
tz
parents:
diff changeset
   125
                                        #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   126
                                         #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   127
                                            #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   128
                                             #(
395b851346df intitial checkin
tz
parents:
diff changeset
   129
                                               #(#DataSetSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   130
                                                  #'name:' 'filesDataSetView'
395b851346df intitial checkin
tz
parents:
diff changeset
   131
                                                  #'layout:' #(#LayoutFrame 0 0.0 24 0.0 0 1.0 -23 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   132
                                                  #'model:' #selectionOfFile
395b851346df intitial checkin
tz
parents:
diff changeset
   133
                                                  #'hasHorizontalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   134
                                                  #'hasVerticalScrollBar:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   135
                                                  #'miniScrollerHorizontal:' true
395b851346df intitial checkin
tz
parents:
diff changeset
   136
                                                  #'dataList:' #listOfFiles
395b851346df intitial checkin
tz
parents:
diff changeset
   137
                                                  #'useIndex:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   138
                                                  #'level:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   139
                                                  #'doubleClickSelector:' #fileDoubleClicked
395b851346df intitial checkin
tz
parents:
diff changeset
   140
                                                  #'valueChangeSelector:' #fileSelected
395b851346df intitial checkin
tz
parents:
diff changeset
   141
                                                  #'verticalSpacing:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   142
                                                  #'columns:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   143
                                                   #(
395b851346df intitial checkin
tz
parents:
diff changeset
   144
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   145
                                                        #'label:' ''
395b851346df intitial checkin
tz
parents:
diff changeset
   146
                                                        #'width:' 30
395b851346df intitial checkin
tz
parents:
diff changeset
   147
                                                        #'printSelector:' #'iconOn:'
395b851346df intitial checkin
tz
parents:
diff changeset
   148
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   149
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   150
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   151
                                                        #'label:' 'file name'
395b851346df intitial checkin
tz
parents:
diff changeset
   152
                                                        #'minWidth:' 100
395b851346df intitial checkin
tz
parents:
diff changeset
   153
                                                        #'model:' #baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   154
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   155
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   156
                                                        #'label:' 'size'
395b851346df intitial checkin
tz
parents:
diff changeset
   157
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   158
                                                        #'model:' #size
395b851346df intitial checkin
tz
parents:
diff changeset
   159
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   160
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   161
                                                     #(#DataSetColumnSpec
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   162
                                                        #'label:' 'modified'
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   163
                                                        #'model:' #modified
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   164
                                                    )
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   165
                                                     #(#DataSetColumnSpec
384
395b851346df intitial checkin
tz
parents:
diff changeset
   166
                                                        #'label:' 'permissions'
395b851346df intitial checkin
tz
parents:
diff changeset
   167
                                                        #'width:' 85
395b851346df intitial checkin
tz
parents:
diff changeset
   168
                                                        #'model:' #permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   169
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   170
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   171
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   172
                                                        #'label:' 'owner'
395b851346df intitial checkin
tz
parents:
diff changeset
   173
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   174
                                                        #'model:' #owner
395b851346df intitial checkin
tz
parents:
diff changeset
   175
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   176
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   177
                                                     #(#DataSetColumnSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   178
                                                        #'label:' 'group'
395b851346df intitial checkin
tz
parents:
diff changeset
   179
                                                        #'width:' 50
395b851346df intitial checkin
tz
parents:
diff changeset
   180
                                                        #'model:' #group
395b851346df intitial checkin
tz
parents:
diff changeset
   181
                                                        #'canSelect:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   182
                                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   183
                                                  )
395b851346df intitial checkin
tz
parents:
diff changeset
   184
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   185
                                               #(#ComboBoxSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   186
                                                  #'name:' 'formatComboBox'
395b851346df intitial checkin
tz
parents:
diff changeset
   187
                                                  #'layout:' #(#LayoutFrame 0 0.0 2 0 0 1.0 24 0)
395b851346df intitial checkin
tz
parents:
diff changeset
   188
                                                  #'model:' #selectionOfFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   189
                                                  #'immediateAccept:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   190
                                                  #'acceptOnTab:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   191
                                                  #'comboList:' #listOfFileFilters
395b851346df intitial checkin
tz
parents:
diff changeset
   192
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   193
                                               #(#InputFieldSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   194
                                                  #'name:' 'EditField'
395b851346df intitial checkin
tz
parents:
diff changeset
   195
                                                  #'layout:' #(#LayoutFrame 0 0.0 -22 1 0 1.0 0 1)
395b851346df intitial checkin
tz
parents:
diff changeset
   196
                                                  #'model:' #valueOfFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   197
                                                  #'acceptOnReturn:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   198
                                                  #'acceptOnTab:' false
395b851346df intitial checkin
tz
parents:
diff changeset
   199
                                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   200
                                            )
395b851346df intitial checkin
tz
parents:
diff changeset
   201
                                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   202
                                        #'level:' -1
395b851346df intitial checkin
tz
parents:
diff changeset
   203
                                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   204
                                  )
395b851346df intitial checkin
tz
parents:
diff changeset
   205
                              )
395b851346df intitial checkin
tz
parents:
diff changeset
   206
                              #'handles:' #(#Any 0.5 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   207
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   208
                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   209
                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   210
                )
395b851346df intitial checkin
tz
parents:
diff changeset
   211
                 #(#HorizontalPanelViewSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   212
                    #'name:' 'horizontalPanelView'
395b851346df intitial checkin
tz
parents:
diff changeset
   213
                    #'layout:' #(#LayoutFrame 0 0.0 -40 1 0 1.0 0 1.0)
395b851346df intitial checkin
tz
parents:
diff changeset
   214
                    #'component:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   215
                     #(#SpecCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   216
                        #'collection:' 
395b851346df intitial checkin
tz
parents:
diff changeset
   217
                         #(
395b851346df intitial checkin
tz
parents:
diff changeset
   218
                           #(#ActionButtonSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   219
                              #'name:' 'cancelButton'
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   220
                              #'label:' 'Cancel'
384
395b851346df intitial checkin
tz
parents:
diff changeset
   221
                              #'model:' #cancel
395b851346df intitial checkin
tz
parents:
diff changeset
   222
                              #'extent:' #(#Point 100 22)
395b851346df intitial checkin
tz
parents:
diff changeset
   223
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   224
                           #(#ActionButtonSpec
395b851346df intitial checkin
tz
parents:
diff changeset
   225
                              #'name:' 'okButton'
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   226
                              #'label:' 'OK'
384
395b851346df intitial checkin
tz
parents:
diff changeset
   227
                              #'model:' #accept
395b851346df intitial checkin
tz
parents:
diff changeset
   228
                              #'extent:' #(#Point 100 22)
395b851346df intitial checkin
tz
parents:
diff changeset
   229
                          )
395b851346df intitial checkin
tz
parents:
diff changeset
   230
                        )
395b851346df intitial checkin
tz
parents:
diff changeset
   231
                    )
395b851346df intitial checkin
tz
parents:
diff changeset
   232
                    #'level:' 1
395b851346df intitial checkin
tz
parents:
diff changeset
   233
                    #'horizontalLayout:' #center
395b851346df intitial checkin
tz
parents:
diff changeset
   234
                    #'verticalLayout:' #center
395b851346df intitial checkin
tz
parents:
diff changeset
   235
                    #'horizontalSpace:' 3
395b851346df intitial checkin
tz
parents:
diff changeset
   236
                    #'verticalSpace:' 3
395b851346df intitial checkin
tz
parents:
diff changeset
   237
                )
395b851346df intitial checkin
tz
parents:
diff changeset
   238
              )
395b851346df intitial checkin
tz
parents:
diff changeset
   239
          )
395b851346df intitial checkin
tz
parents:
diff changeset
   240
      )
395b851346df intitial checkin
tz
parents:
diff changeset
   241
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   242
395b851346df intitial checkin
tz
parents:
diff changeset
   243
!FileSelectionBrowser methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
   244
395b851346df intitial checkin
tz
parents:
diff changeset
   245
fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   246
395b851346df intitial checkin
tz
parents:
diff changeset
   247
    (fileName notNil and: [(fileName name ~= self valueOfFileName value and: [self valueOfFileName value notNil])])
395b851346df intitial checkin
tz
parents:
diff changeset
   248
        ifTrue: [^(LastFileSelectionDirectory, Filename separator, self valueOfFileName value) asFilename].
395b851346df intitial checkin
tz
parents:
diff changeset
   249
    ^fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   250
!
395b851346df intitial checkin
tz
parents:
diff changeset
   251
395b851346df intitial checkin
tz
parents:
diff changeset
   252
fileName: aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   253
395b851346df intitial checkin
tz
parents:
diff changeset
   254
    fileName  := aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   255
!
395b851346df intitial checkin
tz
parents:
diff changeset
   256
395b851346df intitial checkin
tz
parents:
diff changeset
   257
title: aString
395b851346df intitial checkin
tz
parents:
diff changeset
   258
395b851346df intitial checkin
tz
parents:
diff changeset
   259
    title := aString
395b851346df intitial checkin
tz
parents:
diff changeset
   260
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   261
395b851346df intitial checkin
tz
parents:
diff changeset
   262
!FileSelectionBrowser methodsFor:'actions'!
395b851346df intitial checkin
tz
parents:
diff changeset
   263
395b851346df intitial checkin
tz
parents:
diff changeset
   264
closeCancel
395b851346df intitial checkin
tz
parents:
diff changeset
   265
395b851346df intitial checkin
tz
parents:
diff changeset
   266
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   267
    fileName := nil.
395b851346df intitial checkin
tz
parents:
diff changeset
   268
    super closeCancel
395b851346df intitial checkin
tz
parents:
diff changeset
   269
!
395b851346df intitial checkin
tz
parents:
diff changeset
   270
395b851346df intitial checkin
tz
parents:
diff changeset
   271
closeRequest
395b851346df intitial checkin
tz
parents:
diff changeset
   272
395b851346df intitial checkin
tz
parents:
diff changeset
   273
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   274
    super closeRequest
395b851346df intitial checkin
tz
parents:
diff changeset
   275
!
395b851346df intitial checkin
tz
parents:
diff changeset
   276
395b851346df intitial checkin
tz
parents:
diff changeset
   277
closeWindow
395b851346df intitial checkin
tz
parents:
diff changeset
   278
395b851346df intitial checkin
tz
parents:
diff changeset
   279
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   280
    super closeWindow
395b851346df intitial checkin
tz
parents:
diff changeset
   281
!
395b851346df intitial checkin
tz
parents:
diff changeset
   282
395b851346df intitial checkin
tz
parents:
diff changeset
   283
fileDoubleClicked
395b851346df intitial checkin
tz
parents:
diff changeset
   284
395b851346df intitial checkin
tz
parents:
diff changeset
   285
    self valueOfFileName value: self selectionOfFile value baseName.
395b851346df intitial checkin
tz
parents:
diff changeset
   286
    fileName := self selectionOfFile value fileName.
395b851346df intitial checkin
tz
parents:
diff changeset
   287
    accept value: true.
395b851346df intitial checkin
tz
parents:
diff changeset
   288
    self close
395b851346df intitial checkin
tz
parents:
diff changeset
   289
!
395b851346df intitial checkin
tz
parents:
diff changeset
   290
395b851346df intitial checkin
tz
parents:
diff changeset
   291
fileSelected
395b851346df intitial checkin
tz
parents:
diff changeset
   292
395b851346df intitial checkin
tz
parents:
diff changeset
   293
    self valueOfFileName value: self selectionOfFile value baseName.   
395b851346df intitial checkin
tz
parents:
diff changeset
   294
    fileName := self selectionOfFile value fileName.
395b851346df intitial checkin
tz
parents:
diff changeset
   295
!
395b851346df intitial checkin
tz
parents:
diff changeset
   296
395b851346df intitial checkin
tz
parents:
diff changeset
   297
readDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   298
395b851346df intitial checkin
tz
parents:
diff changeset
   299
    | file list dir lst|
395b851346df intitial checkin
tz
parents:
diff changeset
   300
    self selectionOfDirectory value isNil ifTrue: [^nil].
395b851346df intitial checkin
tz
parents:
diff changeset
   301
    readTask notNil ifTrue: [readTask terminate].
395b851346df intitial checkin
tz
parents:
diff changeset
   302
    readTask := [
395b851346df intitial checkin
tz
parents:
diff changeset
   303
395b851346df intitial checkin
tz
parents:
diff changeset
   304
    file := (builder componentAt: #directoryTreeView) selectedPathname asFilename.
395b851346df intitial checkin
tz
parents:
diff changeset
   305
    builder window label: 'Reading: ''', file name, ''''.
395b851346df intitial checkin
tz
parents:
diff changeset
   306
    self class lastSelection: file name.
395b851346df intitial checkin
tz
parents:
diff changeset
   307
    (file isReadable and:[file isExecutable]) ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   308
        list := self listOfFiles.
395b851346df intitial checkin
tz
parents:
diff changeset
   309
        list removeAll.
395b851346df intitial checkin
tz
parents:
diff changeset
   310
        lst := OrderedCollection new.
395b851346df intitial checkin
tz
parents:
diff changeset
   311
        self listOfFileFilters value
395b851346df intitial checkin
tz
parents:
diff changeset
   312
        do: [:filter|
395b851346df intitial checkin
tz
parents:
diff changeset
   313
            (file filesMatchingWithoutDotDirs: filter) do:
395b851346df intitial checkin
tz
parents:
diff changeset
   314
            [:aFileName|                
395b851346df intitial checkin
tz
parents:
diff changeset
   315
                lst add: (Row new fileName: (file name, Filename separator, aFileName) asFilename)
395b851346df intitial checkin
tz
parents:
diff changeset
   316
            ].
395b851346df intitial checkin
tz
parents:
diff changeset
   317
        ].
395b851346df intitial checkin
tz
parents:
diff changeset
   318
        lst := lst asSortedCollection: [:r1 :r2| r1 baseName < r2 baseName].
395b851346df intitial checkin
tz
parents:
diff changeset
   319
        list addAll:lst beforeIndex:1].
395b851346df intitial checkin
tz
parents:
diff changeset
   320
        self selectionOfFile value: (self listOfFiles detect: [:r| r fileName = fileName] ifNone: [nil]).
395b851346df intitial checkin
tz
parents:
diff changeset
   321
        self setLabel.
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   322
    ] forkAt: Processor userBackgroundPriority
384
395b851346df intitial checkin
tz
parents:
diff changeset
   323
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   324
395b851346df intitial checkin
tz
parents:
diff changeset
   325
!FileSelectionBrowser methodsFor:'aspects'!
395b851346df intitial checkin
tz
parents:
diff changeset
   326
395b851346df intitial checkin
tz
parents:
diff changeset
   327
listOfFileFilters
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   328
384
395b851346df intitial checkin
tz
parents:
diff changeset
   329
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   330
    (holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   331
        builder aspectAt:#listOfFileFilters put:(holder :=  List with: '*.*').
395b851346df intitial checkin
tz
parents:
diff changeset
   332
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   333
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   334
!
395b851346df intitial checkin
tz
parents:
diff changeset
   335
395b851346df intitial checkin
tz
parents:
diff changeset
   336
listOfFileFilters: aCollection
395b851346df intitial checkin
tz
parents:
diff changeset
   337
    self listOfFileFilters contents: aCollection.
395b851346df intitial checkin
tz
parents:
diff changeset
   338
!
395b851346df intitial checkin
tz
parents:
diff changeset
   339
395b851346df intitial checkin
tz
parents:
diff changeset
   340
listOfFiles
395b851346df intitial checkin
tz
parents:
diff changeset
   341
395b851346df intitial checkin
tz
parents:
diff changeset
   342
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   343
    (holder := builder bindingAt:#listOfFiles) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   344
        builder aspectAt:#listOfFiles put:(holder :=  List new).
395b851346df intitial checkin
tz
parents:
diff changeset
   345
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   346
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   347
395b851346df intitial checkin
tz
parents:
diff changeset
   348
!
395b851346df intitial checkin
tz
parents:
diff changeset
   349
395b851346df intitial checkin
tz
parents:
diff changeset
   350
rootOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   351
395b851346df intitial checkin
tz
parents:
diff changeset
   352
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   353
    (holder := builder bindingAt:#rootOfDirectory) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   354
        builder aspectAt:#rootOfDirectory put: (holder :=  ValueHolder with: Filename rootDirectory name).
395b851346df intitial checkin
tz
parents:
diff changeset
   355
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   356
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   357
395b851346df intitial checkin
tz
parents:
diff changeset
   358
!
395b851346df intitial checkin
tz
parents:
diff changeset
   359
395b851346df intitial checkin
tz
parents:
diff changeset
   360
selectionOfDirectory
395b851346df intitial checkin
tz
parents:
diff changeset
   361
395b851346df intitial checkin
tz
parents:
diff changeset
   362
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   363
    (holder := builder bindingAt:#selectionOfDirectory) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   364
        builder aspectAt:#selectionOfDirectory put: (holder := ValueHolder new)
395b851346df intitial checkin
tz
parents:
diff changeset
   365
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   366
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   367
395b851346df intitial checkin
tz
parents:
diff changeset
   368
!
395b851346df intitial checkin
tz
parents:
diff changeset
   369
395b851346df intitial checkin
tz
parents:
diff changeset
   370
selectionOfFile
395b851346df intitial checkin
tz
parents:
diff changeset
   371
395b851346df intitial checkin
tz
parents:
diff changeset
   372
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   373
    (holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   374
        builder aspectAt:#selectionOfFile put:(holder :=  ValueHolder new).
395b851346df intitial checkin
tz
parents:
diff changeset
   375
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   376
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   377
395b851346df intitial checkin
tz
parents:
diff changeset
   378
!
395b851346df intitial checkin
tz
parents:
diff changeset
   379
395b851346df intitial checkin
tz
parents:
diff changeset
   380
selectionOfFileFilter
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   381
384
395b851346df intitial checkin
tz
parents:
diff changeset
   382
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   383
    (holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   384
        builder aspectAt:#selectionOfFileFilter put:
395b851346df intitial checkin
tz
parents:
diff changeset
   385
        (holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter).
395b851346df intitial checkin
tz
parents:
diff changeset
   386
        selectedFileFilter := '*.*'.
395b851346df intitial checkin
tz
parents:
diff changeset
   387
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   388
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   389
!
395b851346df intitial checkin
tz
parents:
diff changeset
   390
395b851346df intitial checkin
tz
parents:
diff changeset
   391
valueOfFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   392
395b851346df intitial checkin
tz
parents:
diff changeset
   393
    |holder|
395b851346df intitial checkin
tz
parents:
diff changeset
   394
    (holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   395
        builder aspectAt:#valueOfFileName put:(holder :=  ValueHolder new).
395b851346df intitial checkin
tz
parents:
diff changeset
   396
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   397
    ^ holder
395b851346df intitial checkin
tz
parents:
diff changeset
   398
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   399
395b851346df intitial checkin
tz
parents:
diff changeset
   400
!FileSelectionBrowser methodsFor:'initialization'!
395b851346df intitial checkin
tz
parents:
diff changeset
   401
395b851346df intitial checkin
tz
parents:
diff changeset
   402
open
395b851346df intitial checkin
tz
parents:
diff changeset
   403
395b851346df intitial checkin
tz
parents:
diff changeset
   404
    super open.
395b851346df intitial checkin
tz
parents:
diff changeset
   405
    accept value
395b851346df intitial checkin
tz
parents:
diff changeset
   406
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   407
    [
395b851346df intitial checkin
tz
parents:
diff changeset
   408
        ^(self selectionOfDirectory value ? '') , Filename separator, (self valueOfFileName value ? '')
395b851346df intitial checkin
tz
parents:
diff changeset
   409
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   410
    ^nil
395b851346df intitial checkin
tz
parents:
diff changeset
   411
395b851346df intitial checkin
tz
parents:
diff changeset
   412
395b851346df intitial checkin
tz
parents:
diff changeset
   413
395b851346df intitial checkin
tz
parents:
diff changeset
   414
!
395b851346df intitial checkin
tz
parents:
diff changeset
   415
395b851346df intitial checkin
tz
parents:
diff changeset
   416
postBuildWith:aBuilder
395b851346df intitial checkin
tz
parents:
diff changeset
   417
395b851346df intitial checkin
tz
parents:
diff changeset
   418
    (fileName notNil and: [fileName asFilename exists])
395b851346df intitial checkin
tz
parents:
diff changeset
   419
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   420
    [
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   421
        self class lastSelection: fileName asFilename asAbsoluteFilename directoryName.
384
395b851346df intitial checkin
tz
parents:
diff changeset
   422
        self valueOfFileName value: fileName asFilename baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   423
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   424
    (builder componentAt: #directoryTreeView) selectPathname: self class lastSelection.
395b851346df intitial checkin
tz
parents:
diff changeset
   425
    self selectionOfFileFilter value:  (self listOfFileFilters at: 1 ifAbsent: [nil]).
395b851346df intitial checkin
tz
parents:
diff changeset
   426
    self readDirectory.
395b851346df intitial checkin
tz
parents:
diff changeset
   427
    (builder componentAt: #directoryTreeView) monitoring: true.
395b851346df intitial checkin
tz
parents:
diff changeset
   428
    ^super postBuildWith:aBuilder
395b851346df intitial checkin
tz
parents:
diff changeset
   429
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   430
395b851346df intitial checkin
tz
parents:
diff changeset
   431
!FileSelectionBrowser methodsFor:'selection'!
395b851346df intitial checkin
tz
parents:
diff changeset
   432
395b851346df intitial checkin
tz
parents:
diff changeset
   433
selectedFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   434
395b851346df intitial checkin
tz
parents:
diff changeset
   435
    ^selectedFileFilter
395b851346df intitial checkin
tz
parents:
diff changeset
   436
!
395b851346df intitial checkin
tz
parents:
diff changeset
   437
395b851346df intitial checkin
tz
parents:
diff changeset
   438
selectedFileFilter: aString
395b851346df intitial checkin
tz
parents:
diff changeset
   439
395b851346df intitial checkin
tz
parents:
diff changeset
   440
    selectedFileFilter := aString.
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   441
    self valueOfFileName value: (fileName :=
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   442
        ((self valueOfFileName value ? 'unknown') readStream upTo: $.), '.',
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   443
        (selectedFileFilter reversed readStream upTo: $.) reversed). 
384
395b851346df intitial checkin
tz
parents:
diff changeset
   444
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   445
    self readDirectory.
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   446
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   447
384
395b851346df intitial checkin
tz
parents:
diff changeset
   448
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   449
395b851346df intitial checkin
tz
parents:
diff changeset
   450
!FileSelectionBrowser::Row methodsFor:'accessing'!
395b851346df intitial checkin
tz
parents:
diff changeset
   451
395b851346df intitial checkin
tz
parents:
diff changeset
   452
baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   453
    baseName isNil ifTrue: [baseName := fileName baseName].
395b851346df intitial checkin
tz
parents:
diff changeset
   454
    ^ baseName
395b851346df intitial checkin
tz
parents:
diff changeset
   455
395b851346df intitial checkin
tz
parents:
diff changeset
   456
395b851346df intitial checkin
tz
parents:
diff changeset
   457
395b851346df intitial checkin
tz
parents:
diff changeset
   458
395b851346df intitial checkin
tz
parents:
diff changeset
   459
395b851346df intitial checkin
tz
parents:
diff changeset
   460
!
395b851346df intitial checkin
tz
parents:
diff changeset
   461
395b851346df intitial checkin
tz
parents:
diff changeset
   462
fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   463
    ^ fileName
395b851346df intitial checkin
tz
parents:
diff changeset
   464
395b851346df intitial checkin
tz
parents:
diff changeset
   465
!
395b851346df intitial checkin
tz
parents:
diff changeset
   466
395b851346df intitial checkin
tz
parents:
diff changeset
   467
fileName: aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   468
    fileName := aFileName
395b851346df intitial checkin
tz
parents:
diff changeset
   469
395b851346df intitial checkin
tz
parents:
diff changeset
   470
!
395b851346df intitial checkin
tz
parents:
diff changeset
   471
395b851346df intitial checkin
tz
parents:
diff changeset
   472
group
395b851346df intitial checkin
tz
parents:
diff changeset
   473
    group isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   474
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   475
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   476
    ^ group
395b851346df intitial checkin
tz
parents:
diff changeset
   477
!
395b851346df intitial checkin
tz
parents:
diff changeset
   478
395b851346df intitial checkin
tz
parents:
diff changeset
   479
iconOn:aGC
395b851346df intitial checkin
tz
parents:
diff changeset
   480
    |icon|
395b851346df intitial checkin
tz
parents:
diff changeset
   481
395b851346df intitial checkin
tz
parents:
diff changeset
   482
    iconKey isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   483
        self validateAttributes.
395b851346df intitial checkin
tz
parents:
diff changeset
   484
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   485
    (iconKey == #image) | (iconKey == #imageFile)
395b851346df intitial checkin
tz
parents:
diff changeset
   486
    ifTrue:
395b851346df intitial checkin
tz
parents:
diff changeset
   487
    [
395b851346df intitial checkin
tz
parents:
diff changeset
   488
        Object errorSignal handle: [:ex|]
395b851346df intitial checkin
tz
parents:
diff changeset
   489
        do:
395b851346df intitial checkin
tz
parents:
diff changeset
   490
        [
395b851346df intitial checkin
tz
parents:
diff changeset
   491
            ((size < 5000) and: [(icon := Image fromFile: fileName name) notNil]) 
395b851346df intitial checkin
tz
parents:
diff changeset
   492
            ifTrue: [aGC registerImage: icon key:(iconKey :=fileName name asSymbol).]
395b851346df intitial checkin
tz
parents:
diff changeset
   493
        ].
395b851346df intitial checkin
tz
parents:
diff changeset
   494
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   495
    (icon := aGC registeredImageAt:iconKey) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   496
        self registerIconsOn:aGC.
395b851346df intitial checkin
tz
parents:
diff changeset
   497
        icon := aGC  registeredImageAt:iconKey.
395b851346df intitial checkin
tz
parents:
diff changeset
   498
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   499
    ^ icon
395b851346df intitial checkin
tz
parents:
diff changeset
   500
395b851346df intitial checkin
tz
parents:
diff changeset
   501
395b851346df intitial checkin
tz
parents:
diff changeset
   502
395b851346df intitial checkin
tz
parents:
diff changeset
   503
!
395b851346df intitial checkin
tz
parents:
diff changeset
   504
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   505
modified
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   506
    ^ modified
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   507
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   508
!
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   509
384
395b851346df intitial checkin
tz
parents:
diff changeset
   510
owner
395b851346df intitial checkin
tz
parents:
diff changeset
   511
    owner isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   512
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   513
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   514
    ^ owner
395b851346df intitial checkin
tz
parents:
diff changeset
   515
395b851346df intitial checkin
tz
parents:
diff changeset
   516
395b851346df intitial checkin
tz
parents:
diff changeset
   517
!
395b851346df intitial checkin
tz
parents:
diff changeset
   518
395b851346df intitial checkin
tz
parents:
diff changeset
   519
permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   520
    permissions isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   521
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   522
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   523
    ^ permissions
395b851346df intitial checkin
tz
parents:
diff changeset
   524
395b851346df intitial checkin
tz
parents:
diff changeset
   525
395b851346df intitial checkin
tz
parents:
diff changeset
   526
!
395b851346df intitial checkin
tz
parents:
diff changeset
   527
395b851346df intitial checkin
tz
parents:
diff changeset
   528
size
395b851346df intitial checkin
tz
parents:
diff changeset
   529
    size isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   530
        self validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   531
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   532
    ^ size
395b851346df intitial checkin
tz
parents:
diff changeset
   533
395b851346df intitial checkin
tz
parents:
diff changeset
   534
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   535
395b851346df intitial checkin
tz
parents:
diff changeset
   536
!FileSelectionBrowser::Row methodsFor:'private'!
395b851346df intitial checkin
tz
parents:
diff changeset
   537
395b851346df intitial checkin
tz
parents:
diff changeset
   538
registerIconsOn:aGC
395b851346df intitial checkin
tz
parents:
diff changeset
   539
    "register all file icons on the gc
395b851346df intitial checkin
tz
parents:
diff changeset
   540
    "
395b851346df intitial checkin
tz
parents:
diff changeset
   541
    |directory|
395b851346df intitial checkin
tz
parents:
diff changeset
   542
395b851346df intitial checkin
tz
parents:
diff changeset
   543
    directory := 'xpmBitmaps/document_images/'.
395b851346df intitial checkin
tz
parents:
diff changeset
   544
395b851346df intitial checkin
tz
parents:
diff changeset
   545
    #(
395b851346df intitial checkin
tz
parents:
diff changeset
   546
        (#file            'tiny_file_plain.xpm'       )
395b851346df intitial checkin
tz
parents:
diff changeset
   547
        (#fileLink        'tiny_file_link.xpm'        )
395b851346df intitial checkin
tz
parents:
diff changeset
   548
        (#fileLocked      'tiny_file_lock.xpm'        )
395b851346df intitial checkin
tz
parents:
diff changeset
   549
        (#imageFile       'tiny_file_pix.xpm'         )
395b851346df intitial checkin
tz
parents:
diff changeset
   550
395b851346df intitial checkin
tz
parents:
diff changeset
   551
     ) do:[:el|
395b851346df intitial checkin
tz
parents:
diff changeset
   552
        aGC registerImage:(Image fromFile:(directory, el last)) key:(el first)
395b851346df intitial checkin
tz
parents:
diff changeset
   553
     ].
395b851346df intitial checkin
tz
parents:
diff changeset
   554
395b851346df intitial checkin
tz
parents:
diff changeset
   555
395b851346df intitial checkin
tz
parents:
diff changeset
   556
395b851346df intitial checkin
tz
parents:
diff changeset
   557
395b851346df intitial checkin
tz
parents:
diff changeset
   558
395b851346df intitial checkin
tz
parents:
diff changeset
   559
!
395b851346df intitial checkin
tz
parents:
diff changeset
   560
395b851346df intitial checkin
tz
parents:
diff changeset
   561
validateAttributes
395b851346df intitial checkin
tz
parents:
diff changeset
   562
    |info mode|
395b851346df intitial checkin
tz
parents:
diff changeset
   563
395b851346df intitial checkin
tz
parents:
diff changeset
   564
    permissions := String new:9 withAll:$-.
395b851346df intitial checkin
tz
parents:
diff changeset
   565
395b851346df intitial checkin
tz
parents:
diff changeset
   566
    (info := fileName info) isNil ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   567
        iconKey := #fileLocked.
395b851346df intitial checkin
tz
parents:
diff changeset
   568
        size    := owner := group := '?'.
395b851346df intitial checkin
tz
parents:
diff changeset
   569
      ^ self
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   570
    ].        
384
395b851346df intitial checkin
tz
parents:
diff changeset
   571
    size   := info size.
388
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   572
    modified := info modified printString.
45cf0af38948 checkin from browser
tz
parents: 384
diff changeset
   573
    owner  := OperatingSystem getUserNameFromID:(info uid).
384
395b851346df intitial checkin
tz
parents:
diff changeset
   574
    group  := OperatingSystem getGroupNameFromID:(info gid).
395b851346df intitial checkin
tz
parents:
diff changeset
   575
    mode   := info mode.
395b851346df intitial checkin
tz
parents:
diff changeset
   576
395b851346df intitial checkin
tz
parents:
diff changeset
   577
    1 to:9 by:3 do:[:i|
395b851346df intitial checkin
tz
parents:
diff changeset
   578
        (mode bitAt:i    ) == 1 ifTrue:[permissions at:10 - i put:$x].
395b851346df intitial checkin
tz
parents:
diff changeset
   579
        (mode bitAt:i + 1) == 1 ifTrue:[permissions at:9  - i put:$w].
395b851346df intitial checkin
tz
parents:
diff changeset
   580
        (mode bitAt:i + 2) == 1 ifTrue:[permissions at:8  - i put:$r].
395b851346df intitial checkin
tz
parents:
diff changeset
   581
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   582
395b851346df intitial checkin
tz
parents:
diff changeset
   583
    fileName isReadable ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   584
        info type == #symbolicLink ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   585
            iconKey == #fileLink
395b851346df intitial checkin
tz
parents:
diff changeset
   586
        ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   587
            (Image isImageFileSuffix:(fileName suffix)) ifTrue:[
395b851346df intitial checkin
tz
parents:
diff changeset
   588
                iconKey := #imageFile
395b851346df intitial checkin
tz
parents:
diff changeset
   589
            ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   590
                iconKey := #file
395b851346df intitial checkin
tz
parents:
diff changeset
   591
            ]
395b851346df intitial checkin
tz
parents:
diff changeset
   592
        ]
395b851346df intitial checkin
tz
parents:
diff changeset
   593
    ] ifFalse:[
395b851346df intitial checkin
tz
parents:
diff changeset
   594
        iconKey := #fileLocked
395b851346df intitial checkin
tz
parents:
diff changeset
   595
    ].
395b851346df intitial checkin
tz
parents:
diff changeset
   596
395b851346df intitial checkin
tz
parents:
diff changeset
   597
! !
395b851346df intitial checkin
tz
parents:
diff changeset
   598
395b851346df intitial checkin
tz
parents:
diff changeset
   599
!FileSelectionBrowser class methodsFor:'documentation'!
395b851346df intitial checkin
tz
parents:
diff changeset
   600
395b851346df intitial checkin
tz
parents:
diff changeset
   601
version
395b851346df intitial checkin
tz
parents:
diff changeset
   602
    ^ '$Header$'
395b851346df intitial checkin
tz
parents:
diff changeset
   603
! !