SK.gnome.twain
Class TwainManager

java.lang.Object
  extended by SK.gnome.morena.MorenaBase
      extended by SK.gnome.twain.TwainManager
All Implemented Interfaces:
MorenaConstants, TwainConstants

public class TwainManager
extends MorenaBase
implements TwainConstants

Java wrapper for TWAIN DSM.


Nested Class Summary
static class TwainManager.CloseHook
           
 
Field Summary
 
Fields inherited from interface SK.gnome.twain.TwainConstants
BW, CENTIMETERS, CIEXYZ, CMY, CMYK, CONDITION_CODE_STRING, DS_ENABLED, DS_OPEN, DSM_LOADED, DSM_OPEN, GRAY, INCHES, INVALID, LANDSCAPE, PALETTE, PICAS, PIXELS, POINTS, PORTRAIT, PRESESSION, RESULT_CODE_STRING, RGB, ROT0, ROT180, ROT270, ROT90, STATE_STRING, TRANSFER_READY, TRANSFERRING, TWAF_AIFF, TWAF_AU, TWAF_SND, TWAF_WAV, TWAL_ALARM, TWAL_BARCODE, TWAL_DOUBLEFEED, TWAL_FEEDERERROR, TWAL_FEEDERWARNING, TWAL_JAM, TWAL_PATCHCODE, TWAL_POWER, TWAL_SKEW, TWBD_HORZ, TWBD_HORZVERT, TWBD_VERT, TWBD_VERTHORZ, TWBO_LSBFIRST, TWBO_MSBFIRST, TWBR_CUSTHALFTONE, TWBR_DIFFUSION, TWBR_HALFTONES, TWBR_THRESHOLD, TWBT_2OF5DATALOGIC, TWBT_2OF5IATA, TWBT_2OF5INDUSTRIAL, TWBT_2OF5INTERLEAVED, TWBT_2OF5MATRIX, TWBT_2OF5NONINTERLEAVED, TWBT_3OF9, TWBT_3OF9FULLASCII, TWBT_CODABAR, TWBT_CODABARWITHSTARTSTOP, TWBT_CODE128, TWBT_CODE93, TWBT_EAN13, TWBT_EAN8, TWBT_MAXICODE, TWBT_PDF417, TWBT_POSTNET, TWBT_UCC128, TWBT_UPCA, TWBT_UPCE, TWCB_AUTO, TWCB_CLEAR, TWCB_NOCLEAR, TWCP_BITFIELDS, TWCP_GROUP31D, TWCP_GROUP31DEOL, TWCP_GROUP32D, TWCP_GROUP4, TWCP_JBIG, TWCP_JPEG, TWCP_LZW, TWCP_NONE, TWCP_PACKBITS, TWCP_PNG, TWCP_RLE4, TWCP_RLE8, TWDE_CHECKAUTOMATICCAPTURE, TWDE_CHECKBATTERY, TWDE_CHECKFLASH, TWDE_CHECKPOWERSUPPLY, TWDE_CHECKRESOLUTION, TWDE_CUSTOMEVENTS, TWDE_DEVICEADDED, TWDE_DEVICEOFFLINE, TWDE_DEVICEREADY, TWDE_DEVICEREMOVED, TWDE_IMAGECAPTURED, TWDE_IMAGEDELETED, TWDE_LAMPFAILURE, TWDE_PAPERDOUBLEFEED, TWDE_PAPERJAM, TWDE_POWERDOWNNOTIFY, TWDX_1PASSDUPLEX, TWDX_2PASSDUPLEX, TWDX_NONE, TWFA_CENTER, TWFA_LEFT, TWFA_NONE, TWFA_RIGHT, TWFF_BMP, TWFF_EXIF, TWFF_FPX, TWFF_JFIF, TWFF_PICT, TWFF_PNG, TWFF_SPIFF, TWFF_TIFF, TWFF_TIFFMULTI, TWFF_XBM, TWFL_AUTO, TWFL_NONE, TWFL_OFF, TWFL_ON, TWFL_REDEYE, TWFO_FIRSTPAGEFIRST, TWFO_LASTPAGEFIRST, TWFR_BOOK, TWFR_FANFOLD, TWFT_BLACK, TWFT_BLUE, TWFT_CYAN, TWFT_GREEN, TWFT_MAGENTA, TWFT_NONE, TWFT_RED, TWFT_WHITE, TWFT_YELLOW, TWIF_AUTO, TWIF_BANDPASS, TWIF_HIGHPASS, TWIF_LOWPASS, TWIF_NONE, TWIPS, TWJC_JSIC, TWJC_JSIS, TWJC_JSXC, TWJC_JSXS, TWJC_NONE, TWJQ_HIGH, TWJQ_LOW, TWJQ_MEDIUM, TWJQ_UNKNOWN, TWLG_AFRIKAANS, TWLG_ALBANIA, TWLG_ARABIC, TWLG_ARABIC_ALGERIA, TWLG_ARABIC_BAHRAIN, TWLG_ARABIC_EGYPT, TWLG_ARABIC_IRAQ, TWLG_ARABIC_JORDAN, TWLG_ARABIC_KUWAIT, TWLG_ARABIC_LEBANON, TWLG_ARABIC_LIBYA, TWLG_ARABIC_MOROCCO, TWLG_ARABIC_OMAN, TWLG_ARABIC_QATAR, TWLG_ARABIC_SAUDIARABIA, TWLG_ARABIC_SYRIA, TWLG_ARABIC_TUNISIA, TWLG_ARABIC_UAE, TWLG_ARABIC_YEMEN, TWLG_ASSAMESE, TWLG_BASQUE, TWLG_BENGALI, TWLG_BIHARI, TWLG_BODO, TWLG_BULGARIAN, TWLG_BYELORUSSIAN, TWLG_CATALAN, TWLG_CHINESE, TWLG_CHINESE_HONGKONG, TWLG_CHINESE_PRC, TWLG_CHINESE_SIMPLIFIED, TWLG_CHINESE_SINGAPORE, TWLG_CHINESE_TAIWAN, TWLG_CHINESE_TRADITIONAL, TWLG_CROATIA, TWLG_CZECH, TWLG_DAN, TWLG_DANISH, TWLG_DOGRI, TWLG_DUT, TWLG_DUTCH, TWLG_DUTCH_BELGIAN, TWLG_ENG, TWLG_ENGLISH, TWLG_ENGLISH_AUSTRALIAN, TWLG_ENGLISH_CANADIAN, TWLG_ENGLISH_IRELAND, TWLG_ENGLISH_NEWZEALAND, TWLG_ENGLISH_SOUTHAFRICA, TWLG_ENGLISH_UK, TWLG_ENGLISH_USA, TWLG_ESTONIAN, TWLG_FAEROESE, TWLG_FARSI, TWLG_FCF, TWLG_FIN, TWLG_FINNISH, TWLG_FRENCH, TWLG_FRENCH_BELGIAN, TWLG_FRENCH_CANADIAN, TWLG_FRENCH_LUXEMBOURG, TWLG_FRENCH_SWISS, TWLG_FRN, TWLG_GER, TWLG_GERMAN, TWLG_GERMAN_AUSTRIAN, TWLG_GERMAN_LIECHTENSTEIN, TWLG_GERMAN_LUXEMBOURG, TWLG_GERMAN_SWISS, TWLG_GREEK, TWLG_GUJARATI, TWLG_HARYANVI, TWLG_HEBREW, TWLG_HINDI, TWLG_HUNGARIAN, TWLG_ICE, TWLG_ICELANDIC, TWLG_INDONESIAN, TWLG_ITALIAN, TWLG_ITALIAN_SWISS, TWLG_ITN, TWLG_JAPANESE, TWLG_KANNADA, TWLG_KASHMIRI, TWLG_KOREAN, TWLG_KOREAN_JOHAB, TWLG_LATVIAN, TWLG_LITHUANIAN, TWLG_MALAYALAM, TWLG_MARATHI, TWLG_MARWARI, TWLG_MEGHALAYAN, TWLG_MIZO, TWLG_NAGA, TWLG_NOR, TWLG_NORWEGIAN, TWLG_NORWEGIAN_BOKMAL, TWLG_NORWEGIAN_NYNORSK, TWLG_ORISSI, TWLG_POLISH, TWLG_POR, TWLG_PORTUGUESE, TWLG_PORTUGUESE_BRAZIL, TWLG_PUNJABI, TWLG_PUSHTU, TWLG_ROMANIAN, TWLG_RUSSIAN, TWLG_SERBIAN_CYRILLIC, TWLG_SERBIAN_LATIN, TWLG_SIKKIMI, TWLG_SLOVAK, TWLG_SLOVENIAN, TWLG_SPA, TWLG_SPANISH, TWLG_SPANISH_MEXICAN, TWLG_SPANISH_MODERN, TWLG_SWE, TWLG_SWEDISH, TWLG_SWEDISH_FINLAND, TWLG_TAMIL, TWLG_TELUGU, TWLG_THAI, TWLG_TRIPURI, TWLG_TURKISH, TWLG_UKRANIAN, TWLG_URDU, TWLG_USA, TWLG_USERLOCALE, TWLG_VIETNAMESE, TWLP_REFLECTIVE, TWLP_TRANSMISSIVE, TWLS_BLUE, TWLS_GREEN, TWLS_IR, TWLS_NONE, TWLS_RED, TWLS_UV, TWLS_WHITE, TWNF_AUTO, TWNF_LONEPIXEL, TWNF_MAJORITYRULE, TWNF_NONE, TWOR_LANDSCAPE, TWOR_PORTRAIT, TWOR_ROT0, TWOR_ROT180, TWOR_ROT270, TWOR_ROT90, TWOV_ALL, TWOV_AUTO, TWOV_LEFTRIGHT, TWOV_NONE, TWOV_TOPBOTTOM, TWPC_CHUNKY, TWPC_PLANAR, TWPF_CHOCOLATE, TWPF_VANILLA, TWPR_ENDORSERBOTTOMAFTER, TWPR_ENDORSERBOTTOMBEFORE, TWPR_ENDORSERTOPAFTER, TWPR_ENDORSERTOPBEFORE, TWPR_IMPRINTERBOTTOMAFTER, TWPR_IMPRINTERBOTTOMBEFORE, TWPR_IMPRINTERTOPAFTER, TWPR_IMPRINTERTOPBEFORE, TWPT_BW, TWPT_CIEXYZ, TWPT_CMY, TWPT_CMYK, TWPT_GRAY, TWPT_PALETTE, TWPT_RGB, TWPT_YUV, TWPT_YUVK, TWSS_2A0, TWSS_4A0, TWSS_A0, TWSS_A1, TWSS_A10, TWSS_A2, TWSS_A3, TWSS_A4, TWSS_A4LETTER, TWSS_A5, TWSS_A6, TWSS_A7, TWSS_A8, TWSS_A9, TWSS_B3, TWSS_B4, TWSS_B5LETTER, TWSS_B6, TWSS_BUSINESSCARD, TWSS_C0, TWSS_C1, TWSS_C10, TWSS_C2, TWSS_C3, TWSS_C4, TWSS_C5, TWSS_C6, TWSS_C7, TWSS_C8, TWSS_C9, TWSS_ISOB0, TWSS_ISOB1, TWSS_ISOB10, TWSS_ISOB2, TWSS_ISOB3, TWSS_ISOB4, TWSS_ISOB5, TWSS_ISOB6, TWSS_ISOB7, TWSS_ISOB8, TWSS_ISOB9, TWSS_JISB0, TWSS_JISB1, TWSS_JISB10, TWSS_JISB2, TWSS_JISB3, TWSS_JISB4, TWSS_JISB5, TWSS_JISB6, TWSS_JISB7, TWSS_JISB8, TWSS_JISB9, TWSS_NONE, TWSS_USEXECUTIVE, TWSS_USLEDGER, TWSS_USLEGAL, TWSS_USLETTER, TWSS_USSTATEMENT, TWSX_FILE, TWSX_FILE2, TWSX_MEMORY, TWSX_NATIVE, TWTY_BOOL, TWTY_FIX32, TWTY_INT16, TWTY_INT32, TWTY_INT8, TWTY_STR1024, TWTY_STR128, TWTY_STR255, TWTY_STR32, TWTY_STR64, TWTY_UINT16, TWTY_UINT32, TWTY_UINT8, TWUN_CENTIMETERS, TWUN_INCHES, TWUN_PICAS, TWUN_PIXELS, TWUN_POINTS, TWUN_TWIPS, YUV, YUVK
 
Fields inherited from interface SK.gnome.morena.MorenaConstants
MORENA_MESSAGES, VERSION
 
Constructor Summary
TwainManager()
           
 
Method Summary
static void close()
          Close and unload DSM.
static int getConditionCode()
          Get last TWAIN operation condition code.
static TwainSource getDefaultSource()
          Get current TWAIN default source.
static int getIdentity()
          Get DSM TW_IDENTITY structure pointer for use in non-JavaTwain JNI code.
static int getResultCode()
          Get last TWAIN operation result code.
static int getState()
          Get TWAIN DSM state.
static boolean isAvailable()
          Check if TWAIN DSM is available.
static TwainSource[] listSources()
          Get available TWAIN sources.
static TwainSource selectSource(java.awt.Component parent, TwainSource defaultSource)
          Show Morena-like select source dialog to choose TWAIN source.
static TwainSource selectSource(TwainSource defaultSource)
          Open TWAIN select source dialog box.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwainManager

public TwainManager()
Method Detail

getState

public static int getState()
                    throws TwainException
Get TWAIN DSM state. Only values TwainConstants.INVALID, TwainConstants.DSM_LOADED and TwainConstants.DSM_OPEN are allowed as DSM state.

Throws:
TwainException

getResultCode

public static int getResultCode()
                         throws TwainException
Get last TWAIN operation result code.

Throws:
TwainException

getConditionCode

public static int getConditionCode()
                            throws TwainException
Get last TWAIN operation condition code.

Throws:
TwainException

getIdentity

public static int getIdentity()
Get DSM TW_IDENTITY structure pointer for use in non-JavaTwain JNI code.


isAvailable

public static boolean isAvailable()
                           throws TwainException
Check if TWAIN DSM is available.

Throws:
TwainException

selectSource

public static TwainSource selectSource(TwainSource defaultSource)
                                throws TwainException
Open TWAIN select source dialog box. If defaultSource is not null, use it as default source.

Throws:
TwainException

getDefaultSource

public static TwainSource getDefaultSource()
                                    throws TwainException
Get current TWAIN default source.

Throws:
TwainException

listSources

public static TwainSource[] listSources()
                                 throws TwainException
Get available TWAIN sources.

Throws:
TwainException

close

public static void close()
                  throws TwainException
Close and unload DSM.

Throws:
TwainException

selectSource

public static TwainSource selectSource(java.awt.Component parent,
                                       TwainSource defaultSource)
Show Morena-like select source dialog to choose TWAIN source.