Class NetworkEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class ActionEvent
ActionEvent.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates that the connection request has completedstatic final intIndicates that a new request is initializing its connectionstatic final intIndicates the value for the current input stream readingstatic final intIndicates the value for the current output stream writing -
Constructor Summary
ConstructorsConstructorDescriptionNetworkEvent(ConnectionRequest request, int progressType) Constructs a network status update event used to update progress indicators and application logic of the current state in the NetworkManagerNetworkEvent(ConnectionRequest request, int responseCode, String message) Constructs a response code evenNetworkEvent(ConnectionRequest source, Exception error) Constructs an event for an error messageNetworkEvent(ConnectionRequest request, Object metaData) Constructs a callback event from a connection request with some arbitrary associated meta data -
Method Summary
Modifier and TypeMethodDescriptionEquivalent to getSource() casted to connection requestgetError()Returns
intReturns the length of the download event or the upload event in case it is known.Returns
Returns
intReturns the percentage of progress for a download operation assuming length is knownintIndicates the type of progres indication for this eventintIndicates the response code sent by the response code listenerintReturns the amount of data received up to this event or sent up to this event (depending on the event type).voidParameters
Methods inherited from class ActionEvent
consume, getActualComponent, getCommand, getComponent, getDraggedComponent, getDropTarget, getEventType, getKeyEvent, getProgress, getSource, getX, getY, isConsumed, isLongEvent, isPointerPressedDuringDrag, setPointerPressedDuringDrag
-
Field Details
-
PROGRESS_TYPE_INITIALIZING
public static final int PROGRESS_TYPE_INITIALIZINGIndicates that a new request is initializing its connection- See Also:
-
PROGRESS_TYPE_OUTPUT
public static final int PROGRESS_TYPE_OUTPUTIndicates the value for the current output stream writing- See Also:
-
PROGRESS_TYPE_INPUT
public static final int PROGRESS_TYPE_INPUTIndicates the value for the current input stream reading- See Also:
-
PROGRESS_TYPE_COMPLETED
public static final int PROGRESS_TYPE_COMPLETEDIndicates that the connection request has completed- See Also:
-
-
Constructor Details
-
NetworkEvent
Constructs an event for an error message
Parameters
-
source: source of the error message -
error: the exception
-
-
NetworkEvent
Constructs a response code even
Parameters
-
request: the connection request indicating progress -
responseCode: the code -
message: the error message
-
-
NetworkEvent
Constructs a network status update event used to update progress indicators and application logic of the current state in the NetworkManager
Parameters
-
request: the connection request indicating progress -
progressType
-
-
NetworkEvent
Constructs a callback event from a connection request with some arbitrary associated meta data
Parameters
-
request: the connection request -
metaData: the data associated with the event
-
-
-
Method Details
-
getConnectionRequest
Equivalent to getSource() casted to connection request
Returns
the source connection request
-
getError
Returns
the error
-
setError
Parameters
error: the error to set
-
getProgressType
public int getProgressType()Indicates the type of progres indication for this event
Returns
- Returns:
- One of PROGRESS_TYPE_COMPLETED, PROGRESS_TYPE_INITIALIZING, PROGRESS_TYPE_INPUT, PROGRESS_TYPE_OUTPUT
-
getResponseCode
public int getResponseCode()Indicates the response code sent by the response code listener
Returns
HTTP error code
-
getLength
public int getLength()Returns the length of the download event or the upload event in case it is known. -1 is returned when the value is unknown.
Returns
the length length in bytes or -1
-
getSentReceived
public int getSentReceived()Returns the amount of data received up to this event or sent up to this event (depending on the event type).
Returns
the receieved or sent value
-
getProgressPercentage
public int getProgressPercentage()Returns the percentage of progress for a download operation assuming length is known
Returns
the percentage of the download or -1
-
getMetaData
Returns
the metaData
-
getMessage
Returns
the message
-