Class PrintResult
java.lang.Object
com.codename1.printing.PrintResult
Outcome of a print request initiated through Printer or
Display.print(String, String, PrintResultListener).
Status semantics:
COMPLETED: the print flow finished and the job was handed to the printing system. Platforms generally can't observe the physical printer, so this means "queued/sent", not "paper came out".CANCELLED: the user dismissed the print dialog without printing.FAILED: the job could not be started or the printing system reported an error.getError()may carry a short, platform-supplied description.
Some platforms cannot distinguish cancellation from completion once the
native dialog takes over; those report COMPLETED on a best-effort
basis.
Instances are immutable. Construct through the static factories.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUser dismissed/cancelled the print dialog.static final intThe print job was handed to the platform printing system.static final intThe print job could not be completed. -
Method Summary
Modifier and TypeMethodDescriptionstatic PrintResultBuild aCANCELLEDresult.static PrintResultBuild aCOMPLETEDresult.static PrintResultBuild aFAILEDresult with an optional platform message.getError()Platform-supplied message whenisFailed()is true, otherwise null.intbooleanTrue iff status ==STATUS_CANCELLED.booleanTrue iff status ==STATUS_COMPLETED.booleanisFailed()True iff status ==STATUS_FAILED.toString()Returns a string representation of the object.
-
Field Details
-
STATUS_COMPLETED
public static final int STATUS_COMPLETEDThe print job was handed to the platform printing system.- See Also:
-
STATUS_CANCELLED
public static final int STATUS_CANCELLEDUser dismissed/cancelled the print dialog.- See Also:
-
STATUS_FAILED
public static final int STATUS_FAILEDThe print job could not be completed.- See Also:
-
-
Method Details
-
completed
Build aCOMPLETEDresult. -
cancelled
Build aCANCELLEDresult. -
failed
Build aFAILEDresult with an optional platform message. -
getStatus
public int getStatus() -
isCompleted
public boolean isCompleted()True iff status ==STATUS_COMPLETED. -
isCancelled
public boolean isCancelled()True iff status ==STATUS_CANCELLED. -
isFailed
public boolean isFailed()True iff status ==STATUS_FAILED. -
getError
Platform-supplied message whenisFailed()is true, otherwise null. -
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-