Package muntjac :: Package ui :: Module html5_file
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.html5_file

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16   
17 -class Html5File(object):
18 """L{DragAndDropWrapper} can receive also files from client computer 19 if appropriate HTML 5 features are supported on client side. This class 20 wraps information about dragged file on server side. 21 """ 22
23 - def __init__(self, name, size, mimeType):
24 self._name = name 25 self._size = size 26 self._type = mimeType 27 self._streamVariable = None
28 29
30 - def getFileName(self):
31 return self._name
32 33
34 - def getFileSize(self):
35 return self._size
36 37
38 - def getType(self):
39 return self._type
40 41
42 - def setStreamVariable(self, streamVariable):
43 """Sets the L{StreamVariable} that into which the file contents 44 will be written. Usage of StreamVariable is similar to L{Upload} 45 component. 46 47 If the L{StreamVariable} is not set in the L{DropHandler} 48 the file contents will not be sent to server. 49 50 I{Note!} receiving file contents is experimental feature 51 depending on HTML 5 API's. It is supported only by modern web browsers 52 like Firefox 3.6 and above and recent webkit based browsers (Safari 5, 53 Chrome 6) at this time. 54 55 @param streamVariable: 56 the callback that returns stream where the implementation 57 writes the file contents as it arrives. 58 """ 59 self._streamVariable = streamVariable
60 61
62 - def getStreamVariable(self):
63 return self._streamVariable
64