| Package | com.yworks.remote |
| Class | public class AbstractFileReadHandler |
| Inheritance | AbstractFileReadHandler flash.events.EventDispatcher |
| Subclasses | LoadHandler, UploadHandler |
UploadHandler and LoadHandler.
See also
| Property | Defined By | ||
|---|---|---|---|
| fileFilter : Array
An array of flash.net.FileFilter to use with the file browser. | AbstractFileReadHandler | ||
| filename : String [read-only]
The filename of the last selected file. | AbstractFileReadHandler | ||
| inputIOHandler : GraphMLIOHandler
The GraphMLIOHandler instance that will be used for graph deserialization. | AbstractFileReadHandler | ||
| roundtripHandler : RoundtripHandler
The RoundtripHandler instance that will be used for the server roundtrip. | AbstractFileReadHandler | ||
| Property | Defined By | ||
|---|---|---|---|
| fileReference : FileReference
The FileReference which handles the file operations. | AbstractFileReadHandler | ||
| Method | Defined By | ||
|---|---|---|---|
AbstractFileReadHandler(roundtripHandler:RoundtripHandler = null)
Create a new instance. | AbstractFileReadHandler | ||
| Method | Defined By | ||
|---|---|---|---|
Create the GraphMLIOHandler instance that will be used for graph deserialization. | AbstractFileReadHandler | ||
dispatchXMLResult(result:XML):void
Dispatches a XMLResultEvent containing the received XML data. | AbstractFileReadHandler | ||
handleResult(result:XML):void
Updates the graph with the new GraphML
Has to be called after the upload is complete and the response is received. | AbstractFileReadHandler | ||
onCancel(event:Event):void
Called when the user chose the cancel button of the upload dialog. | AbstractFileReadHandler | ||
onComplete(event:Event):void
Called when the data is sent or loaded. | AbstractFileReadHandler | ||
onHTTPStatus(evt:HTTPStatusEvent):void
Called when the server sends a HTTP status. | AbstractFileReadHandler | ||
onIOError(evt:IOErrorEvent):void
Called when an IO error occurs while executing the file download. | AbstractFileReadHandler | ||
onSecurityError(evt:SecurityErrorEvent):void
Called when a security error occurs while executing the file download. | AbstractFileReadHandler | ||
onSelected(event:Event):void
Called when a file is chosen for upload from the FileChooser. | AbstractFileReadHandler | ||
onUploadComplete(event:DataEvent):void
Called after the upload is complete and the response is received. | AbstractFileReadHandler | ||
openDialog(graph:IGraph = null, defaultFileName:String = null):void
Opens the file dialog. | AbstractFileReadHandler | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a valid result is received. | AbstractFileReadHandler | |||
| fileFilter | property |
fileFilter:Array
An array of flash.net.FileFilter to use with the file browser.
Implement a custom set of FileFilter like:
fileFilter = new Array(
new FileFilter("GraphML files (graphml)", "graphml"),
new FileFilter("all files (", ")
);
The default value is new Array( new FileFilter("GraphML files (graphml)", "graphml"), new FileFilter("all files (", ") );.
public function get fileFilter():Array public function set fileFilter(value:Array):void| filename | property |
filename:String [read-only] The filename of the last selected file.
public function get filename():String| fileReference | property |
fileReference:FileReference
The FileReference which handles the file operations.
By default the current FileReference instance is created in
openDialog(). Thus, it should never be set explicitly except
in an overridden openDialog() method.
protected function get fileReference():FileReference protected function set fileReference(value:FileReference):void| inputIOHandler | property |
inputIOHandler:GraphMLIOHandler
The GraphMLIOHandler instance that will be used for graph deserialization.
By default, the IO handler is created by createInputIOHandler.
public function get inputIOHandler():GraphMLIOHandler public function set inputIOHandler(value:GraphMLIOHandler):voidSee also
| roundtripHandler | property |
roundtripHandler:RoundtripHandler
The RoundtripHandler instance that will be used for the server roundtrip.
If no IO handler is set to the inputIOHandler property,
this RoundtripHandler instance will be used to create one.
If the upload method is used without the graph parameter,
a fully configured RoundtripHandler has to be passed to this instance,
either by setting this property or by passing it to the constructor's
roundtripHandler parameter.
public function get roundtripHandler():RoundtripHandler public function set roundtripHandler(value:RoundtripHandler):void| AbstractFileReadHandler | () | Constructor |
public function AbstractFileReadHandler(roundtripHandler:RoundtripHandler = null)Create a new instance.
ParametersroundtripHandler:RoundtripHandler (default = null) — The roundtrip handler to receive the inputIOHandler from.
If none is provided a new DefaultGraphMLIOHandler will manage the
GraphML parsing.
|
See also
| createInputIOHandler | () | method |
protected function createInputIOHandler():GraphMLIOHandler
Create the GraphMLIOHandler instance that will be used for graph deserialization.
This implementation uses the RoundtripHandler that has been passed to the constructor and
returns its input io handler. If none was provided a new DefaultGraphMLIOHandler
will be created.
GraphMLIOHandler — the GraphMLIOHandler instance created.
|
See also
| dispatchXMLResult | () | method |
protected function dispatchXMLResult(result:XML):void
Dispatches a XMLResultEvent containing the received XML data.
Parameters
result:XML |
See also
| handleResult | () | method |
protected function handleResult(result:XML):voidUpdates the graph with the new GraphML Has to be called after the upload is complete and the response is received.
If a graph parameter was passed to the upload() method,
the result will be written to that graph using the inputIOHandler.
Otherwise, the roundtripHandler will be used.
This method will call dispatchXMLResult to dispatch
a XMLResultEvent containing the received XML data.
Parameters
result:XML — A DataEvent which holds the GraphML data in its
text property.
|
| onCancel | () | method |
protected function onCancel(event:Event):voidCalled when the user chose the cancel button of the upload dialog.
Parameters
event:Event |
| onComplete | () | method |
protected function onComplete(event:Event):voidCalled when the data is sent or loaded.
Upload: Called when the data is completely sent to the server. The result will be returned
in onUploadComplete.
Load: Called when the data is read. Subclasses have to override this method to retrieve
the XML from the FileReference and call handleResult.
Parameters
event:Event |
| onHTTPStatus | () | method |
protected function onHTTPStatus(evt:HTTPStatusEvent):voidCalled when the server sends a HTTP status.
This implementation is empty.
Parameters
evt:HTTPStatusEvent |
| onIOError | () | method |
protected function onIOError(evt:IOErrorEvent):voidCalled when an IO error occurs while executing the file download.
This implementation shows an alert message, traces the event and removes the busy cursor.
Parameters
evt:IOErrorEvent |
| onSecurityError | () | method |
protected function onSecurityError(evt:SecurityErrorEvent):voidCalled when a security error occurs while executing the file download.
This implementation shows an alert message, traces the event and removes the busy cursor.
Parameters
evt:SecurityErrorEvent |
| onSelected | () | method |
protected function onSelected(event:Event):voidCalled when a file is chosen for upload from the FileChooser.
Creates the URLRequest and start the upload process.
Parameters
event:Event |
| onUploadComplete | () | method |
protected function onUploadComplete(event:DataEvent):voidCalled after the upload is complete and the response is received.
This method has to be overridden for upload operations to retrieve the XML from the response
or FileReference and call handleResult.
This method will not be called after load operations.
Parameters
event:DataEvent — A DataEvent which holds the GraphML data in its
text property.
|
| openDialog | () | method |
protected function openDialog(graph:IGraph = null, defaultFileName:String = null):voidOpens the file dialog.
Subclasses have to override onSelected to start the actual load or upload.
Event handling can be customized by overriding the various protected event handler functions.
Parameters
graph:IGraph (default = null) — The graph instance in which the file contents will be stored. If no graph is passed,
the roundtripHandler will be used to store the graph to. Note, that in this
case, the roundtripHandler has to be properly initialized.
| |
defaultFileName:String (default = null) — The default file name to be shown in the browser's download dialog.
|
See also
| complete | Event |
com.yworks.remote.XMLResultEventcom.yworks.remote.XMLResultEvent.COMPLETEDispatched when a valid result is received.
The event is dispatched before doUpdate is called.
XML was received from the server.
The received XML is stored in the xmlResult property.