public class NetworkEvent extends ActionEvent
ActionEvent.Type
Modifier and Type | Field and Description |
---|---|
static int |
PROGRESS_TYPE_COMPLETED
Indicates that the connection request has completed
|
static int |
PROGRESS_TYPE_INITIALIZING
Indicates that a new request is initializing its connection
|
static int |
PROGRESS_TYPE_INPUT
Indicates the value for the current input stream reading
|
static int |
PROGRESS_TYPE_OUTPUT
Indicates the value for the current output stream writing
|
Constructor and Description |
---|
NetworkEvent(ConnectionRequest source,
Exception error)
Constructs an event for an error message
|
NetworkEvent(ConnectionRequest request,
int progressType)
Constructs a network status update event used to update progress indicators
and application logic of the current state in the NetworkManager
|
NetworkEvent(ConnectionRequest request,
int responseCode,
String message)
Constructs a response code even
|
NetworkEvent(ConnectionRequest request,
Object metaData)
Constructs a callback event from a connection request with some arbitrary associated meta data
|
Modifier and Type | Method and Description |
---|---|
ConnectionRequest |
getConnectionRequest()
Equivalent to getSource() casted to connection request
|
Exception |
getError() |
int |
getLength()
Returns the length of the download event or the upload event in case it is known.
|
String |
getMessage() |
Object |
getMetaData() |
int |
getProgressPercentage()
Returns the percentage of progress for a download operation assuming length is known
|
int |
getProgressType()
Indicates the type of progres indication for this event
|
int |
getResponseCode()
Indicates the response code sent by the response code listener
|
int |
getSentReceived()
Returns the amount of data received up to this event or sent up to this event (depending on the
event type).
|
void |
setError(Exception error) |
consume, getActualComponent, getCommand, getComponent, getDraggedComponent, getDropTarget, getEventType, getKeyEvent, getProgress, getSource, getX, getY, isConsumed, isLongEvent, isPointerPressedDuringDrag, setPointerPressedDuringDrag
public static final int PROGRESS_TYPE_INITIALIZING
public static final int PROGRESS_TYPE_OUTPUT
public static final int PROGRESS_TYPE_INPUT
public static final int PROGRESS_TYPE_COMPLETED
public NetworkEvent(ConnectionRequest source, Exception error)
source
- source of the error messageerror
- the exceptionpublic NetworkEvent(ConnectionRequest request, int responseCode, String message)
request
- the connection request indicating progressresponseCode
- the codemessage
- the error messagepublic NetworkEvent(ConnectionRequest request, int progressType)
request
- the connection request indicating progressprogressType
- public NetworkEvent(ConnectionRequest request, Object metaData)
request
- the connection requestmetaData
- the data associated with the eventpublic ConnectionRequest getConnectionRequest()
public Exception getError()
public void setError(Exception error)
error
- the error to setpublic int getProgressType()
public int getResponseCode()
public int getLength()
public int getSentReceived()
public int getProgressPercentage()
public Object getMetaData()
public String getMessage()